diff options
author | Anton Schubert | 2016-12-30 13:09:39 +0100 |
---|---|---|
committer | Anton Schubert | 2016-12-30 13:09:45 +0100 |
commit | 638be570dcbfa88b696ded8e267f3a005c97ee92 (patch) | |
tree | e7a261fb7ec5cd5afcf47d436e25fd082f8574c2 /assets/clapprio/dash-shaka-playback.js | |
parent | 9bf48616a6d1584d5b9a1e568fb53d360aa2d777 (diff) |
replace dashjs player with clappr + shaka-plugin + level-plugin + audio-plugin
Diffstat (limited to '')
-rw-r--r-- | assets/clapprio/dash-shaka-playback.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/assets/clapprio/dash-shaka-playback.js b/assets/clapprio/dash-shaka-playback.js new file mode 100644 index 0000000..fc12904 --- /dev/null +++ b/assets/clapprio/dash-shaka-playback.js @@ -0,0 +1,5 @@ +!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)}(this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(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 a=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}}(),o=function(t,e,i){for(var n=!0;n;){var r=t,s=e,a=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,s);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(a)}var h=Object.getPrototypeOf(r);if(null===h)return;t=h,e=s,i=a,n=!0,o=h=void 0}},u=i(2),h=i(1),c=n(h),l=3e4,f=-1,d="shaka:ready",p=function(t){function e(t){r(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t),this._levels=[],t.autoPlay&&this.play()}return s(e,t),a(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c["default"].player.Player.version}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var i=this._currentLevelId===f;this._player.configure({abr:{enable:!i}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),i||this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)},get:function(){return this._currentLevelId||f}}]),a(e,[{key:"play",value:function(){return!this._player&&this._setup(),this.isReady?(this._src=this.el.src,void o(Object.getPrototypeOf(e.prototype),"play",this).call(this)):void this.once(d,this.play)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{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!!this.highDefinition}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._sendStats(),this._player.unload().then(function(){o(Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1})["catch"](function(){u.Log.error("shaka could not be unloaded")})}},{key:"getPlaybackType",value:function(){return(this._player&&this._player.isLive()?"live":"vod")||""}},{key:"selectTrack",value:function(t){this._player.selectTrack(t),this._onAdaptation()}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._destroy():this._player.destroy().then(function(){return t._destroy()})["catch"](function(){t._destroy(),u.Log.error("shaka could not be destroyed")})}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player);var e=this._player.load(this._options.src);e.then(function(){return t._loaded()})["catch"](function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=this,e=new c["default"].Player(this.el);return e.addEventListener("error",function(e,i){return t._error(e,i)}),e.addEventListener("adaptation",function(){return t._onAdaptation()}),e.addEventListener("buffering",function(e){return t._onBuffering(e)}),e}},{key:"_onBuffering",value:function(t){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}},{key:"_loaded",value:function(){this._isShakaReadyState=!0,this.trigger(d),this._shakaReady(),this._startToSendStats(),this._fillLevels()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.map(function(t){return{id:t.id,label:t.height+"p"}}).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this;this.sendStatsId=setInterval(function(){return t._sendStats()},l)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._error("error",{detail:t.detail})}},{key:"_error",value:function(t,i){u.Log.error("an error was raised support=",e.support),u.Log.error("an error was raised by shaka player",i.detail),this.trigger(u.Events.PLAYBACK_ERROR,i.detail,this.name)}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return t.active===!0})[0];this._fillLevels(),u.Log.debug("an adaptation has happened:",t),this.highDefinition=t.height>=720,this.trigger(u.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){o(Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"_shakaReady",value:function(){o(Object.getPrototypeOf(e.prototype),"_ready",this).call(this)}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this._player&&this._player.getTracks().filter(function(t){return"text"===t.type})}},{key:"audioTracks",get:function(){return this._player&&this._player.getTracks().filter(function(t){return"audio"===t.type})}},{key:"videoTracks",get:function(){return this._player&&this._player.getTracks().filter(function(t){return"video"===t.type})}}]),e}(u.HTML5Video);e["default"]=p,p.canPlay=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)},t.exports=e["default"]},function(t,e,i){var n;!function(){var r={};(function(t){function e(t,e){var i=t.split("."),n=Yr;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=je;e.prototype=i.prototype,t.md=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.fd=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 s(t){return t.a/(1-Math.pow(t.c,t.b))}function a(){this.c=new n(2),this.f=new n(5),this.a=0,this.b=5e5}function o(){}function u(){}function h(){this.g=null,this.f=!1,this.b=new a,this.h={},this.a={},this.i=!1,this.c=null}function c(t){return(t=t.h.audio)?(t=f(t),t[Math.floor(t.length/2)]):null}function l(t){var e=t.h.video;if(!e)return null;var e=f(e),i=t.a.audio,i=i&&i.bandwidth||0;t=t.b.getBandwidthEstimate();for(var n=e[0],r=0;r<e.length;++r){var s=e[r];if(s.bandwidth){var a=((r+1<e.length?e[r+1]:{bandwidth:1/0}).bandwidth+i)/.85;t>=(s.bandwidth+i)/.95&&t<=a&&(n=s)}}return n}function f(t){return t.streams.slice(0).filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function d(t){var e;t instanceof d?(p(this,t.R),this.ka=t.ka,this.T=t.T,m(this,t.wa),this.O=t.O,y(this,E(t.a)),this.ca=t.ca):t&&(e=String(t).match(Wr))?(p(this,e[1]||"",!0),this.ka=b(e[2]||""),this.T=b(e[3]||"",!0),m(this,e[4]),this.O=b(e[5]||"",!0),y(this,e[6]||"",!0),this.ca=b(e[7]||"")):this.a=new w(null)}function p(t,e,i){t.R=i?b(e,!0):e,t.R&&(t.R=t.R.replace(/:$/,""))}function m(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.wa=e}else t.wa=null}function y(t,e,i){e instanceof w?t.a=e:(i||(e=g(e,Qr)),t.a=new w(e))}function b(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function g(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 w(t){this.b=t||null}function E(t){var e=new w;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 S(t,e,i){this.category=t,this.code=e,this.data=Array.prototype.slice.call(arguments,2)}function T(t,e){return t.reduce(function(t,e,i){return e["catch"](t.bind(null,i))}.bind(null,e),Promise.reject())}function k(t,e){return t.concat(e)}function P(){}function A(t){return null!=t}function I(t){return function(e){return e!=t}}function _(){}function R(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function N(t){this.f=!1,this.a=[],this.b=[],this.c=[],this.g=t||null}function C(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}}function M(t,e){return{uris:t,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:e}}function x(t,e,i){for(var n=0;n<t.length;++n)if(i(t[n],e))return n;return-1}function D(){this.a={}}function O(){this.a=new D}function L(t,e,i,n){e=new U(e,i,n),t.a.push(i,e)}function j(t){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].ja();t.a.a={}}function U(t,e,i){this.target=t,this.type=e,this.a=i,this.target.addEventListener(e,i,!1)}function B(t){return!t||!Object.keys(t).length}function F(t){return Object.keys(t).map(function(e){return t[e]})}function K(t,e){return Object.keys(t).reduce(function(i,n){return i[n]=e(t[n],n),i},{})}function V(t,e){return Object.keys(t).every(function(i){return e(i,t[i])})}function q(t){if(!t)return"";t=new Uint8Array(t),239==t[0]&&187==t[1]&&191==t[2]&&(t=t.subarray(3)),t=escape($(t));try{return decodeURIComponent(t)}catch(e){throw new S(2,2004)}}function H(t,e){if(!t)return"";if(t.byteLength%2)throw new S(2,2004);var i;if(t instanceof ArrayBuffer)i=t;else{var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(t)),i=n.buffer}var n=t.byteLength/2,r=new Uint16Array(n);i=new DataView(i);for(var s=0;s<n;s++)r[s]=i.getUint16(2*s,e);return $(r)}function G(t){var e=new Uint8Array(t);if(239==e[0]&&187==e[1]&&191==e[2])return q(e);if(254==e[0]&&255==e[1])return H(e.subarray(2),!1);if(255==e[0]&&254==e[1])return H(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 H(t,!1);if(!e[1]&&!e[3])return H(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return q(t);throw new S(2,2003)}function z(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 $(t){for(var e="",i=0;i<t.length;i+=16e3)e+=String.fromCharCode.apply(null,t.subarray(i,i+16e3));return e}function Y(t){this.a=null,this.b=function(){this.a=null,t()}.bind(this)}function W(t){t.cancel(),t.a=setTimeout(t.b,100)}function X(e){return t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=*$/,"")}function J(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 Z(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 Q(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 tt(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 et(t,e,i){this.l=this.g=this.m=null,this.A=!1,this.b=null,this.f=new O,this.a=[],this.s=[],this.j=new R,this.G=t,this.i=null,this.h=function(t){this.j.reject(t),e(t)}.bind(this),this.w={},this.J=i,this.v=new Y(this.yc.bind(this)),this.C=this.c=!1,this.j["catch"](function(){})}function it(t,e){if(!t.g)return L(t.f,e,"encrypted",function(){this.f.ja(e,"encrypted"),this.h(new S(6,6010))}.bind(t)),Promise.resolve();t.l=e;var i=t.l.setMediaKeys(t.g),i=i["catch"](function(t){return Promise.reject(new S(6,6003,t.message))}),n=null;return t.b.serverCertificate&&(n=t.g.setServerCertificate(t.b.serverCertificate),n=n["catch"](function(t){return Promise.reject(new S(6,6004,t.message))})),Promise.all([i,n]).then(function(){return this.c?Promise.reject():(rt(this),void(this.b.initData.length||this.s.length||L(this.f,this.l,"encrypted",this.ec.bind(this))))}.bind(t))["catch"](function(t){return this.c?Promise.resolve():Promise.reject(t)}.bind(t))}function nt(t,e){return Promise.all(e.map(function(t){return ft(this,t).then(function(t){if(t)return t.remove()})}.bind(t)))}function rt(t){var e=t.b?t.b.initData:[];return e.forEach(function(t){dt(this,t.initDataType,t.initData)}.bind(t)),t.s.forEach(function(t){ft(this,t)}.bind(t)),e.length||t.s.length||t.j.resolve(),t.j}function st(t){return t.a.map(function(t){return t.ya.sessionId})}function at(t,e,i,n,r){var s=ht(t),a=0<=navigator.userAgent.indexOf("Edge/");e.periods.forEach(function(t){t.streamSets.forEach(function(t){"text"!=t.type&&(s&&(t.drmInfos=[s]),t.drmInfos.forEach(function(e){ut(this,e);var s=n[e.keySystem];s||(s={audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:i?"required":"optional",sessionTypes:[i?"persistent-license":"temporary"],label:e.keySystem,drmInfos:[]},n[e.keySystem]=s,r.push(e.keySystem)),s.drmInfos.push(e),e.distinctiveIdentifierRequired&&(s.distinctiveIdentifier="required"),e.persistentStateRequired&&(s.persistentState="required");var o="video"==t.type?s.videoCapabilities:s.audioCapabilities,u=("video"==t.type?e.videoRobustness:e.audioRobustness)||"";t.streams.forEach(function(t){var i=t.mimeType;t.codecs&&(i+='; codecs="'+t.codecs+'"'),t.keyId&&e.keyIds.push(t.keyId),a&&"com.microsoft.playready"==e.keySystem&&o.length||o.push({robustness:u,contentType:i})}.bind(this))}.bind(this)))}.bind(this))}.bind(t))}function ot(t,e,i){if(1==i.length&&""==i[0])return Promise.reject(new S(6,6e3));var n=new R,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 S(6,6001))}),r=r.then(function(t){if(this.c)return Promise.reject();var i=t.getConfiguration();return this.m=(i.audioCapabilities||[]).concat(i.videoCapabilities||[]).map(function(t){return t.contentType}),this.m.length||(this.m=null),i=e[t.keySystem],ct(this,t.keySystem,i,i.drmInfos),this.b.licenseServerUri?t.createMediaKeys():Promise.reject(new S(6,6012))}.bind(t)).then(function(t){return this.c?Promise.reject():(this.g=t,void(this.A=!0))}.bind(t))["catch"](function(t){return this.c?Promise.resolve():(this.m=this.b=null,t instanceof S?Promise.reject(t):Promise.reject(new S(6,6002,t.message)))}.bind(t)),n.reject(),r}function ut(t,e){var i=e.keySystem;if(i){if(!e.licenseServerUri){var n=t.i.servers[i];n&&(e.licenseServerUri=n)}e.keyIds||(e.keyIds=[]),(i=t.i.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 ht(e){if(B(e.i.clearKeys))return null;var i,n=[],r=[];for(i in e.i.clearKeys){var s=e.i.clearKeys[i],a=Z(i),s=Z(s),a={kty:"oct",kid:X(a),k:X(s)};n.push(a),r.push(a.kid)}return e=JSON.stringify({keys:n}),r=JSON.stringify({kids:r}),r=[{initData:new Uint8Array(z(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 ct(t,e,i,n){var r=[],s=[],a=[],o=[];lt(n,r,s,a,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:s[0],initData:a,keyIds:o}}function lt(t,e,i,n,r){function s(t,e){return t.initDataType==e.initDataType&&tt(t.initData,e.initData)}t.forEach(function(t){if(-1==e.indexOf(t.licenseServerUri)&&e.push(t.licenseServerUri),t.serverCertificate&&-1==x(i,t.serverCertificate,tt)&&i.push(t.serverCertificate),t.initData&&t.initData.forEach(function(t){-1==x(n,t,s)&&n.push(t)}),t.keyIds)for(var a=0;a<t.keyIds.length;++a)-1==r.indexOf(t.keyIds[a])&&r.push(t.keyIds[a])})}function ft(t,e){var i;try{i=t.g.createSession("persistent-license")}catch(n){var r=new S(6,6005,n.message);return t.h(r),Promise.reject(r)}L(t.f,i,"message",t.wb.bind(t)),L(t.f,i,"keystatuseschange",t.rb.bind(t));var s={initData:null,ya:i,loaded:!1};return t.a.push(s),i.load(e).then(function(t){if(!this.c){if(t)return s.loaded=!0,this.a.every(function(t){return t.loaded})&&this.j.resolve(),i;this.a.splice(this.a.indexOf(s),1),this.h(new S(6,6013))}}.bind(t),function(t){this.c||(this.a.splice(this.a.indexOf(s),1),this.h(new S(6,6005,t.message)))}.bind(t))}function dt(t,e,i){var n;try{n=t.C?t.g.createSession("persistent-license"):t.g.createSession()}catch(r){return void t.h(new S(6,6005,r.message))}L(t.f,n,"message",t.wb.bind(t)),L(t.f,n,"keystatuseschange",t.rb.bind(t)),t.a.push({initData:i,ya:n,loaded:!1}),n.generateRequest(e,i.buffer)["catch"](function(t){if(!this.c){for(var e=0;e<this.a.length;++e)if(this.a[e].ya==n){this.a.splice(e,1);break}this.h(new S(6,6006,t.message))}}.bind(t))}function pt(t){for(var e=H(t.body,!0),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=J(e.querySelector("Challenge").textContent).buffer}function mt(){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){return t.createMediaKeys()}).then(function(t){var i=!1;try{t.createSession("persistent-license"),i=!0}catch(r){}n[e]={persistentState:i}},function(){n[e]=null});t.push(r)}),Promise.all(t).then(function(){return n})}function yt(){var t,e={};for(t in is)e[t]=!0;for(t in ns)e[t]=!0;return["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"].forEach(function(t){e[t]=!!is[t]}),["mpd","m3u8","ism"].forEach(function(t){e[t]=!!ns[t]}),e}function bt(t,e,i,n){var r=n;return r||(n=new d(t).O.split("/").pop().split("."),1<n.length&&(n=n.pop().toLowerCase(),r=ns[n])),r?Promise.resolve(r):(i=M([t],i),i.method="HEAD",e.request(0,i).then(function(e){return(e=e.headers["content-type"])&&(e=e.toLowerCase()),(r=is[e])?r:Promise.reject(new S(4,4e3,t))},function(t){return Promise.reject(t)}))}function gt(t,e,i){this.h=rs[e],this.c=t,this.g=0,this.f=1/0,this.a=this.b=null,this.i=i}function vt(t,e,i){return t>=e?null:new ss(t,e,i)}function wt(t,e,i,n){var r=t.g;return Promise.resolve().then(function(){if(this.c){var t=this.h(e,r,i,n,this.i);if(null!=i&&null!=n){for(var s=0;s<t.length&&!(t[s].startTime>=this.f);++s)this.c.addCue(t[s]);null==this.b&&(this.b=i),this.a=Math.min(n,this.f)}}}.bind(t))}function Et(t,e){return null==t.a||t.a<e||e<t.b?0:t.a-e}function St(t,e){for(var i=t.c.cues,n=[],r=0;r<i.length;++r)e(i[r])&&n.push(i[r]);for(r=0;r<n.length;++r)t.c.removeCue(n[r])}function Tt(t){return!t||1==t.length&&1e-6>t.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function kt(t,e){var i=0;if(!t||1==t.length&&1e-6>t.end(0)-t.start(0))return i;var n=!1,r=1e-4;e||(r=.25);for(var s=0;s<t.length;++s)if(e+r>=t.start(s)&&e<t.end(s))i+=t.end(s)-e,n=!0;else if(n&&.04>=t.start(s)-t.end(s-1))i+=t.end(s)-t.start(s),i+=t.start(s)-t.end(s-1);else if(0<s&&e+r<t.start(s)&&e+r>=t.end(s-1)){if(!(.04>=t.start(s)-e))break;i+=t.end(s)-e,n=!0}else n=!1;return i}function Pt(t,e,i){this.f=t,this.h=e,this.j=i,this.c={},this.b=null,this.a={},this.g=new O,this.i=!1}function At(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hvc1.1.6.L93.90",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",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]=!!rs[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function It(t,e){var i;return"text"==e?i=t.b.b:(i=Rt(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),i}function _t(t,e,i){return"text"==e?(e=Et(t.b,i),e||(e=Et(t.b,i+.1))&&(e+=.1)):(t=Rt(t,e),e=kt(t,i),e||(e=kt(t,i+.1))&&(e+=.1)),e}function Rt(t,e){try{return t.c[e].buffered}catch(i){return null}}function Nt(t,e,i,n,r){return"text"==e?wt(t.b,i,n,r):Dt(t,e,t.Tc.bind(t,e,i))}function Ct(t,e){return"text"==e?t.b.remove(0,1/0):Dt(t,e,t.Bb.bind(t,e,0,t.h.duration))}function Mt(t,e,i){return"text"==e?(t.b.g=i,Promise.resolve()):Dt(t,e,t.Jc.bind(t,e,i))}function xt(t,e,i){return"text"==e?(t.b.f=i,Promise.resolve()):Promise.all([Dt(t,e,t.Lb.bind(t,e)),Dt(t,e,t.Hc.bind(t,e,i))])}function Dt(t,e,i){if(t.i)return Promise.reject();if(i={start:i,p:new R},t.a[e].push(i),1==t.a[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new S(3,3017,e)):i.p.reject(new S(3,3015,n)),Lt(t,e)}return i.p}function Ot(t,e){if(t.i)return Promise.reject();var i,n=[];for(i in t.c){var r=new R,s={start:function(t){t.resolve()}.bind(null,r),p:r};t.a[i].push(s),n.push(r),1==t.a[i].length&&s.start()}return Promise.all(n).then(function(){var t,i;try{e()}catch(n){i=Promise.reject(new S(3,3015,n))}for(t in this.c)Lt(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function Lt(t,e){t.a[e].shift();var i=t.a[e][0];if(i)try{i.start()}catch(n){i.p.reject(new S(3,3015,n)),Lt(t,e)}}function jt(t,e,i){this.a=t,this.L=e,this.D=i}function Ut(t,e,i,n,r,s){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.L=r,this.D=s}function Bt(t,e){this.j=t,this.i=e,this.c=this.a=1/0,this.b=1,this.g=this.f=0,this.h=!0}function Ft(t,e,i,n,r,s){this.a=t,this.c=e,this.j=i,this.s=n,this.l=r,this.m=s,this.b=new O,this.h=!1,this.g=1,this.i=this.f=null,0<t.readyState?this.sb():L(this.b,t,"loadedmetadata",this.sb.bind(this)),L(this.b,t,"ratechange",this.lc.bind(this)),Ht(this)}function Kt(t){return 0<t.a.readyState?Wt(t,t.a.currentTime):Vt(t)}function Vt(t){return t.s?Wt(t,t.s):1/0>t.c.da()?t.c.ra():Math.max(t.c.Ua(),t.c.ra())}function qt(t,e){e!=t.h&&(t.h=e,zt(t,t.g),t.l(e))}function Ht(e){Gt(e),e.i=t.setTimeout(e.pc.bind(e),250)}function Gt(e){e.i&&(t.clearTimeout(e.i),e.i=null)}function zt(e,i){null!=e.f&&(t.clearInterval(e.f),e.f=null),e.g=i,e.a.playbackRate=e.h||0>i?0:i,!e.h&&0>i&&(e.f=t.setInterval(function(){this.a.currentTime+=i/4}.bind(e),250))}function $t(t,e){var i=t.c,n=i.ra(),r=i.ea();return i.U()&&1/0!=i.c?(i=n+1,n=i+t.j,e>=n&&e<=r||kt(t.a.buffered,e)&&e>=i&&e<=r?e:e>r?r:r<n&&e>=i&&e<=r?e:Math.min(n+2,r)):e<n?n:e>r?r:e}function Yt(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 Wt(t,e){var i=t.c.ra();return e<i?i:(i=t.c.ea(),e>i?i:e)}function Xt(t,e,i){return i==e||t>=as&&i==e.split("-")[0]||t>=os&&i.split("-")[0]==e.split("-")[0]}function Jt(t){t=t.toLowerCase().split("-");var e=us[t[0]];return e&&(t[0]=e),t.join("-")}function Zt(t,e,i){var n=!1;return t.streamSets.forEach(function(t){t.streams.forEach(function(r){var s=r.allowedByApplication;r.allowedByApplication=!0,"video"==t.type?(r.width<e.minWidth||r.width>e.maxWidth||r.width>i.width||r.height<e.minHeight||r.height>e.maxHeight||r.height>i.height||r.width*r.height<e.minPixels||r.width*r.height>e.maxPixels||r.bandwidth<e.minVideoBandwidth||r.bandwidth>e.maxVideoBandwidth)&&(r.allowedByApplication=!1):"audio"==t.type&&(r.bandwidth<e.minAudioBandwidth||r.bandwidth>e.maxAudioBandwidth)&&(r.allowedByApplication=!1),s!=r.allowedByApplication&&(n=!0)})}),n}function Qt(t,e,i){var n="",r=null;for(t&&t.A&&(n=t.keySystem(),r=t.m),t=0;t<i.streamSets.length;++t){var s=i.streamSets[t];if(n&&s.drmInfos.length&&!s.drmInfos.some(function(t){return t.keySystem==n}))i.streamSets.splice(t,1),--t;else{for(var a=e[s.type],o=0;o<s.streams.length;++o){var u=s.streams[o],h=ae(u.mimeType,u.codecs);rs[h]||MediaSource.isTypeSupported(h)?r&&u.encrypted&&0>r.indexOf(h)?(s.streams.splice(o,1),--o):!a||u.mimeType==a.mimeType&&u.codecs.split(".")[0]==a.codecs.split(".")[0]||(s.streams.splice(o,1),--o):(s.streams.splice(o,1),--o)}s.streams.length||(i.streamSets.splice(t,1),--t)}}}function te(t,e){return t.streamSets.map(function(t){var i=e?e[t.type]:null;return t.streams.filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem}).map(function(e){return{id:e.id,active:i==e,type:t.type,bandwidth:e.bandwidth,language:t.language,kind:e.kind||null,width:e.width||null,height:e.height||null,frameRate:e.frameRate||void 0,codecs:e.codecs||null}})}).reduce(k,[])}function ee(t,e){for(var i=0;i<t.streamSets.length;i++)for(var n=t.streamSets[i],r=0;r<n.streams.length;r++){var s=n.streams[r];if(s.id==e.id)return{stream:s,Wc:n}}return null}function ie(t){return t.streams.some(function(t){return t.allowedByApplication&&t.allowedByKeySystem})}function ne(t,e,i){var n={};t.streamSets.forEach(function(t){!ie(t)||t.type in n||(n[t.type]=t)});var r=0;return t.streamSets.forEach(function(t){if(ie(t)&&"video"==t.type){var e=se(t);e>r?(r=e,n.video=t):e==r&&re(t)<re(n.video)&&(n.video=t)}}),t.streamSets.forEach(function(t){ie(t)&&t.primary&&(n[t.type].primary?re(t)<re(n[t.type])&&(n[t.type]=t):n[t.type]=t)}),[os,as,0].forEach(function(r){t.streamSets.forEach(function(t){if(ie(t)){var s;if("audio"==t.type?s=e.preferredAudioLanguage:"text"==t.type&&(s=e.preferredTextLanguage),s){s=Jt(s);var a=Jt(t.language);Xt(r,s,a)&&(t.language==n[t.type].language?re(t)<re(n[t.type])&&(n[t.type]=t):n[t.type]=t,i&&(i[t.type]=!0))}}})}),n}function re(t){var e=0;return!t||1>t.streams.length?e:(t.streams.forEach(function(t){e+=t.bandwidth}),e/t.streams.length)}function se(t){var e=0;return t?(t.streams.forEach(function(t){t.height>e&&(e=t.height)}),e):e}function ae(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function oe(t,e,i,n,r,s,a,o,u){this.m=t,this.c=e,this.S=i,this.a=n,this.G=r,this.v=s,this.j=a,this.w=o||null,this.A=u||null,this.h=null,this.i=1,this.C=Promise.resolve(),this.g=[],this.l={},this.b={},this.f=this.s=this.J=!1}function ue(t){return t.a.periods[Ie(t,Kt(t.m))]}function he(t){return K(t.b,function(t){return t.stream})}function ce(t,e){var i={};return i.text=e,fe(t,i)}function le(t,e,i,n){var r=t.b[e];!r&&"text"==e&&t.h.ignoreTextStreamFailures?ce(t,i):r&&(e=t.g[_e(t,i)])&&e.xa&&(e=t.l[i.id])&&e.xa&&r.stream!=i&&(r.stream=i,r.La=!0,n&&(r.aa?r.Pa=!0:r.ga?(r.la=!0,r.Pa=!0):(Me(r),Ne(t,r,!0))))}function fe(t,e){var i=Ie(t,Kt(t.m)),n=K(e,function(t){return ae(t.mimeType,t.codecs)});return t.c.init(n,t.h.useRelativeCueTimestamps),me(t),n=F(e),pe(t,n).then(function(){if(!this.f)for(var t in e){var n=e[t];this.b[t]||(this.b[t]={stream:n,type:t,ta:null,V:null,La:!0,Ma:i,endOfStream:!1,ga:!1,$:null,la:!1,Pa:!1,aa:!1,bb:!1},Ce(this,this.b[t],0))}}.bind(t))}function de(t,e){var i=t.g[e];if(i)return i.I;i={I:new R,xa:!1},t.g[e]=i;var n=t.a.periods[e].streamSets.map(function(t){return t.streams}).reduce(k,[]);return t.C=t.C.then(function(){if(!this.f)return pe(this,n)}.bind(t)).then(function(){this.f||(this.g[e].I.resolve(),this.g[e].xa=!0)}.bind(t))["catch"](function(t){this.f||(this.g[e].I.reject(),delete this.g[e],this.j(t))}.bind(t)),i.I}function pe(t,e){for(var i=[],n=0;n<e.length;++n){var r=e[n],s=t.l[r.id];s?i.push(s.I):(t.l[r.id]={I:new R,xa:!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.l[e[t].id];i.xa||(i.I.resolve(),i.xa=!0)}}.bind(t))["catch"](function(t){if(!this.f)return this.l[r.id].I.reject(),delete this.l[r.id],Promise.reject(t)}.bind(t))}function me(t){var e=t.a.presentationTimeline.da();1/0>e?t.c.za(e):t.c.za(Math.pow(2,32))}function ye(t,e){var i,n,r=Kt(t.m);n=t.c;var s=e.type;n="text"==s?n.b.a:Tt(Rt(n,s));var s=e.ta&&e.V?t.a.periods[_e(t,e.ta)].startTime+e.V.endTime:r,a=_e(t,e.stream),o=Ie(t,s),u=t.a.periods[o];return i=a!=o?null:be(t,e,r,n,o),(i?u.startTime+i.startTime-r:_t(t.c,e.type,r))>=Math.max(t.i*Math.max(t.a.minBufferTime||0,t.h.rebufferingGoal),t.i*t.h.bufferingGoal)?.5:s>=t.a.presentationTimeline.da()?(e.endOfStream=!0,null):(e.endOfStream=!1,o!=a?(e.Ma=o,null):(i=be(t,e,r,n,a))?(ve(t,e,r,a,i),null):1)}function be(t,e,i,n,r){if(e.V&&e.stream==e.ta)return i=e.V.position+1,ge(t,e,r,i);if(i=e.V?e.stream.findSegmentPosition(Math.max(0,t.a.periods[_e(t,e.ta)].startTime+e.V.endTime-t.a.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(n||i)-t.a.periods[r].startTime)),null==i)return null;var s=null;return null==n&&(s=ge(t,e,r,Math.max(0,i-1))),s||ge(t,e,r,i)}function ge(t,e,i,n){return i=t.a.periods[i],(e=e.stream.getSegmentReference(n))?(t=t.a.presentationTimeline,n=t.ea(),i.startTime+e.endTime<t.sa()||i.startTime+e.startTime>n?null:e):null}function ve(t,e,i,n,r){var s=t.a.periods[n],a=e.stream,o=t.a.periods[n+1],u=null,u=o?o.startTime:t.a.presentationTimeline.da();n=Ee(t,e,n,u),e.ga=!0,e.La=!1,o=Re(t,r),Promise.all([n,o]).then(function(t){if(!this.f&&!this.s)return Se(this,e,i,s,a,r,t[1])}.bind(t)).then(function(){this.f||this.s||(e.ga=!1,e.bb=!1,Ce(this,e,0),ke(this,a))}.bind(t))["catch"](function(t){this.f||this.s||(e.ga=!1,1001==t.code||1002==t.code||1003==t.code?"text"==e.type&&this.h.ignoreTextStreamFailures&&1001==t.code?delete this.b.text:(this.j(t),Ce(this,e,4)):3017==t.code?we(this,e,t):this.j(t))}.bind(t))}function we(t,e,i){if(!F(t.b).some(function(t){return t!=e&&t.bb})){var n=Math.round(100*t.i);if(20<n)t.i-=.2;else{if(!(4<n))return t.s=!0,void t.j(i);t.i-=.04}e.bb=!0}Ce(t,e,4)}function Ee(t,e,i,n){return e.La?(i=Mt(t.c,e.type,t.a.periods[i].startTime-e.stream.presentationTimeOffset),n=null!=n?xt(t.c,e.type,n):Promise.resolve(),e.stream.initSegmentReference?(t=Re(t,e.stream.initSegmentReference).then(function(t){if(!this.f)return Nt(this.c,e.type,t,null,null)}.bind(t))["catch"](function(t){ +return e.La=!0,Promise.reject(t)}),Promise.all([i,n,t])):Promise.all([i,n])):Promise.resolve()}function Se(t,e,i,n,r,s,a){return Te(t,e,i).then(function(){if(!this.f)return Nt(this.c,e.type,a,s.startTime+n.startTime,s.endTime+n.startTime)}.bind(t)).then(function(){if(!this.f)return e.ta=r,e.V=s,Promise.resolve()}.bind(t))}function Te(t,e,i){var n=It(t.c,e.type);return null==n?Promise.resolve():(i=i-n-t.h.bufferBehind,0>=i?Promise.resolve():t.c.remove(e.type,n,n+i).then(function(){}.bind(t)))}function ke(t,e){if(!t.J&&(t.J=F(t.b).every(function(t){return!t.la&&!t.aa&&t.V}),t.J)){var i=_e(t,e);for(t.g[i]||de(t,i).then(function(){this.v()}.bind(t))["catch"](P),i=0;i<t.a.periods.length;++i)de(t,i)["catch"](P);t.A&&t.A()}}function Pe(t,e){if(e.Ma!=_e(t,e.stream)){var i=e.Ma,n=F(t.b);n.every(function(t){return t.Ma==i})&&n.every(Ae)&&de(t,i).then(function(){if(!this.f){var t,e=this.G(this.a.periods[i]);for(t in this.b)if(!e[t])return void this.j(new S(5,5005));for(t in e)if(!(this.b[t]||"text"==t&&this.h.ignoreTextStreamFailures))return void this.j(new S(5,5005));for(t in this.b){le(this,t,e[t],!1);var n=this.b[t];Ae(n)&&Ce(this,n,0)}this.v()}}.bind(t))["catch"](P)}}function Ae(t){return!t.ga&&null==t.$&&!t.la&&!t.aa}function Ie(t,e){for(var i=t.a.periods.length-1;0<i;--i)if(e>=t.a.periods[i].startTime)return i;return 0}function _e(t,e){for(var i=0;i<t.a.periods.length;++i)for(var n=t.a.periods[i],r=0;r<n.streamSets.length;++r)if(0<=n.streamSets[r].streams.indexOf(e))return i;return-1}function Re(t,e){var i=M(e.a(),t.h.retryParameters);if(e.L||null!=e.D){var n="bytes="+e.L+"-";null!=e.D&&(n+=e.D),i.headers.Range=n}return t.S.request(1,i).then(function(t){return t.data})}function Ne(t,e,i){e.la=!1,e.Pa=!1,e.aa=!0,Ct(t.c,e.type).then(function(){if(i){var t=this.c,n=e.type;return"text"==n?Promise.resolve():Dt(t,n,t.Ub.bind(t,n))}}.bind(t)).then(function(){this.f||(e.ta=null,e.V=null,e.aa=!1,Ce(this,e,0))}.bind(t))}function Ce(e,i,n){i.$=t.setTimeout(e.X.bind(e,i),1e3*n)}function Me(e){null!=e.$&&(t.clearTimeout(e.$),e.$=null)}function xe(){this.a=Promise.resolve(),this.c=this.b=this.f=!1,this.h=new Promise(function(t){this.g=t}.bind(this))}function De(t){return t.f||(t.a=t.a.then(function(t){return this.b=!0,Promise.resolve(t)}.bind(t),function(t){return this.b=!0,Promise.reject(t)}.bind(t))),t.f=!0,t.a}function Oe(t,e,i,n,r){var s,a=r in n;for(s in e){var o=r+"."+s,u=a?n[r]:i[s],h=!!{".abr.manager":!0}[o];(a||s in t)&&(void 0===e[s]?void 0===u||a?delete t[s]:t[s]=u:h?t[s]=e[s]:"object"==typeof t[s]&&"object"==typeof e[s]?Oe(t[s],e[s],u,n,o):typeof e[s]==typeof u&&(t[s]=e[s]))}}function Le(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 je(){this.Aa=new D,this.S=this}function Ue(t,e){je.call(this),this.A=!1,this.f=t,this.s=null,this.w=new O,this.Ja=new h,this.na=this.c=this.m=this.b=this.j=this.oa=this.G=this.h=this.g=this.i=null,this.Qa=1e9,this.ma=[],this.Ca=!1,this.qa=!0,this.l=null,this.v={},this.a=qe(this),this.Ba={width:1/0,height:1/0},this.C=[],this.X=this.J=this.pa=0,e&&e(this),this.i=new N(this.Oc.bind(this)),this.oa=Be(this);for(var i=0;i<this.f.textTracks.length;++i){var n=this.f.textTracks[i];n.mode="disabled","Shaka Player TextTrack"==n.label&&(this.s=n)}this.s||(this.s=this.f.addTextTrack("subtitles","Shaka Player TextTrack")),this.s.mode="hidden",L(this.w,this.f,"error",this.oc.bind(this))}function Be(e){e.h=new MediaSource;var i=new R;return L(e.w,e.h,"sourceopen",i.resolve),e.f.src=t.URL.createObjectURL(e.h),i}function Fe(t){t.m&&t.m.configure(t.a.manifest),t.g&&t.g.configure(t.a.drm),t.b&&(t.b.configure(t.a.streaming),t.c.periods.forEach(t.Na.bind(t)),$e(t,ue(t.b))),t.a.abr.enabled&&!t.qa?t.a.abr.manager.enable():t.a.abr.manager.disable(),t.a.abr.manager.setDefaultEstimate(t.a.abr.defaultBandwidthEstimate)}function Ke(t){t.w&&t.w.ja(t.h,"sourceopen"),t.f&&(t.f.removeAttribute("src"),t.f.load());var e=Promise.all([t.a?t.a.abr.manager.stop():null,t.g?t.g.o():null,t.G?t.G.o():null,t.j?t.j.o():null,t.b?t.b.o():null,t.m?t.m.stop():null]);return t.g=null,t.G=null,t.j=null,t.b=null,t.m=null,t.c=null,t.na=null,t.oa=null,t.h=null,t.v={},t.C=[],t.pa=0,t.J=0,e}function Ve(){return{".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:null}}}function qe(t){return{drm:{retryParameters:C(),servers:{},clearKeys:{},advanced:{}},manifest:{retryParameters:C(),dash:{customScheme:function(t){if(t)return null},clockSyncUri:""}},streaming:{retryParameters:C(),rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,useRelativeCueTimestamps:!1},abr:{manager:t.Ja,enabled:!0,defaultBandwidthEstimate:5e5},preferredAudioLanguage:"",preferredTextLanguage:"",restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minAudioBandwidth:0,maxAudioBandwidth:1/0,minVideoBandwidth:0,maxVideoBandwidth:1/0}}}function He(t,e,i){for(var n in e){var r=e[n],s=i||!1;"text"==n&&(s=!0),t.qa?t.v[n]={stream:r,Rb:s}:le(t.b,n,r,s)}}function Ge(t){if(t.c){var e=Date.now()/1e3;t.Ca?t.J+=e-t.X:t.pa+=e-t.X,t.X=e}}function ze(t,e,i){if(!F(e).some(ie))return t.Z(new S(4,4012)),{};var n={};if(i)["video","audio","text"].forEach(function(t){t in e&&(n[t]=e[t])});else{i=he(t.b);for(var r in i){var s=i[r];s.allowedByApplication&&s.allowedByKeySystem&&e[r].language==s.language||(n[r]=e[r])}}if(B(n))return{};u(Object.keys(n));var a=t.a.abr.manager.chooseStreams(n);return V(n,function(t){return!!a[t]})?a:(t.Z(new S(4,4012)),{})}function $e(t,e){var i,n={audio:!1,text:!1},r=ne(e,t.a,n),s=ze(t,r);for(i in s)t.C.push({timestamp:Date.now()/1e3,id:s[i].id,type:i,fromAdaptation:!0});He(t,s,!0),Ye(t),r.text&&r.audio&&n.text&&r.text.language!=r.audio.language&&(t.s.mode="showing",Xe(t))}function Ye(t){Promise.resolve().then(function(){this.A||this.dispatchEvent(new Le("adaptation"))}.bind(t))}function We(t){Promise.resolve().then(function(){this.A||this.dispatchEvent(new Le("trackschanged"))}.bind(t))}function Xe(t){t.dispatchEvent(new Le("texttrackvisibility"))}function Je(t){return JSON.stringify(t,function(t,e){if("manager"!=t&&"function"!=typeof e){if(e instanceof Event||e instanceof Le){var i,n={};for(i in e){var r=e[i];r&&"object"==typeof 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 Ze(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__?Qe(e):e})}function Qe(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function ti(t,e,i,n,r){this.C=t,this.l=e,this.w=i,this.A=n,this.s=r,this.f=this.j=this.g=!1,this.v="",this.a=this.i=null,this.b={video:{},player:{}},this.m=0,this.c={},this.h=null}function ei(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new S(7,7e3))}}function ii(t,e){var i=Je(e);t.a.sendMessage("urn:x-cast:com.google.shaka.v2",i,function(){},o)}function ni(t,e,i){je.call(this),this.c=t,this.b=e,this.i=this.f=this.g=this.j=this.l=null,this.a=new ti(i,this.Pc.bind(this),this.Qc.bind(this),this.Rc.bind(this),this.mb.bind(this)),ri(this)}function ri(t){t.a.init(),t.i=new O,cs.forEach(function(t){L(this.i,this.c,t,this.cd.bind(this))}.bind(t)),ps.forEach(function(t){L(this.i,this.b,t,this.xc.bind(this))}.bind(t)),t.l={};for(var e in t.c)Object.defineProperty(t.l,e,{configurable:!1,enumerable:!0,get:t.bd.bind(t,e),set:t.dd.bind(t,e)});t.j={};for(e in t.b)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.wc.bind(t,e)});t.g=new je,t.g.S=t.l,t.f=new je,t.f.S=t.j}function si(t,e,i){je.call(this),this.b=t,this.a=e,this.j={video:t,player:e},this.l=i||function(){},this.i=!1,this.c=!0,this.f=this.g=null,ai(this)}function ai(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.vb.bind(e),i.onSenderDisconnected=e.vb.bind(e),i.onSystemVolumeChanged=e.Tb.bind(e),e.g=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.g.onMessage=e.hc.bind(e),i.start(),cs.forEach(function(t){this.b.addEventListener(t,this.yb.bind(this,"video"))}.bind(e)),ps.forEach(function(t){this.a.addEventListener(t,this.yb.bind(this,"player"))}.bind(e)),e.a.Gb(1920,1080),e.a.addEventListener("loading",function(){this.c=!1,oi(this)}.bind(e)),e.b.addEventListener("playing",function(){this.c=!1,oi(this)}.bind(e)),e.a.addEventListener("unloading",function(){this.c=!0,oi(this)}.bind(e)),e.b.addEventListener("ended",function(){t.setTimeout(function(){this.b&&this.b.ended&&(this.c=!0,oi(this))}.bind(this),5e3)}.bind(e))}function oi(t){Promise.resolve().then(function(){this.dispatchEvent(new Le("caststatuschanged"))}.bind(t))}function ui(t,e,i){for(var n in e.player)t.a[n](e.player[n]);t.l(i),i=Promise.resolve();var r=t.b.autoplay;e.manifest&&(t.b.autoplay=!1,i=t.a.load(e.manifest,e.startTime),i["catch"](function(t){this.a.dispatchEvent(new Le("error",{detail:t}))}.bind(t))),i.then(function(){for(var t in e.video){var i=e.video[t];this.b[t]=i}for(t in e.playerAfterLoad)i=e.playerAfterLoad[t],this.a[t](i);this.b.autoplay=r,e.manifest&&this.b.play()}.bind(t))}function hi(t,e,i){t.i&&(e=Je(e),i?t.g.getCastChannel(i).send(e):t.g.broadcast(e))}function ci(t,e){var i=li(t,e);return 1!=i.length?null:i[0]}function li(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return t.tagName==e})}function fi(t){var e=t.firstChild;return e&&e.nodeType==Node.TEXT_NODE?t.textContent.trim():null}function di(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 pi(t){return t?(t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function mi(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 yi(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 bi(t){return t=Number(t),t%1?null:t}function gi(t){return t=Number(t),!(t%1)&&0<t?t:null}function vi(t){return t=Number(t),!(t%1)&&0<=t?t:null}function wi(t){var e;return t=(e=t.match(/^(\d+)\/(\d+)$/))?Number(e[1]/e[2]):Number(t),isNaN(t)?null:t}function Ei(t,e){var i=Pi(t),n=null,r=i.filter(function(t){return"urn:mpeg:dash:mp4protection:2011"!=t.Db||(n=t.init||n,!1)}),s=i.map(function(t){return t.keyId}).filter(A),a=null;if(0<s.length&&(a=s[0],s.some(I(a))))throw new S(4,4010);return s=[],0<r.length?(s=ki(n,e,r),s.length||(s=[Ti("",n)])):0<i.length&&(s=F(ws).map(function(t){return Ti(t,n)})),{jb:a,gd:n,drmInfos:s,lb:!0}}function Si(t,e,i){var n=Ei(t,e);if(i.lb)t=1==i.drmInfos.length&&!i.drmInfos[0].keySystem,e=!n.drmInfos.length,(!i.drmInfos.length||t&&!e)&&(i.drmInfos=n.drmInfos),i.lb=!1;else if(0<n.drmInfos.length&&(i.drmInfos=i.drmInfos.filter(function(t){return n.drmInfos.some(function(e){return e.keySystem==t.keySystem})}),!i.drmInfos.length))throw new S(4,4008);return n.jb||i.jb}function Ti(t,e){return{keySystem:t,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:e||[],keyIds:[]}}function ki(t,e,i){return i.map(function(i){var n=ws[i.Db];return n?[Ti(n,i.init||t)]:e(i.node)||[]}).reduce(k,[])}function Pi(t){return t.map(function(t){var e=t.getAttribute("schemeIdUri"),i=t.getAttribute("cenc:default_KID"),n=li(t,"cenc:pssh").map(fi);if(!e)return null;if(e=e.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase(),0<=i.indexOf(" ")))throw new S(4,4009);var r=[];try{r=n.map(function(t){return{initDataType:"cenc",initData:J(t)}})}catch(s){throw new S(4,4007)}return{node:t,Db:e,keyId:i,init:0<r.length?r:null}}).filter(A)}function Ai(e,i,n,r,s){null!==s&&(s=Math.round(s));var a={RepresentationID:i,Number:n,Bandwidth:r,Time:s};return e.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(e,i,n){if("$$"==e)return"$";var r=a[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 Ii(t,e,i){if(i.length){var n=i[0];n.startTime<=Es&&(i[0]=new Ut(n.position,0,n.endTime,n.a,n.L,n.D)),t||(t=i[i.length-1],t.startTime>e||(i[i.length-1]=new Ut(t.position,t.startTime,e,t.a,t.L,t.D)))}}function _i(t,e){if(!e.length)return t;var i=e.map(function(t){return new d(t)});return t.map(function(t){return new d(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(k,[]).map(function(t){return t.toString()})}function Ri(t,e){var i=Ni(t,e,"timescale"),n=1;i&&(n=gi(i)||1),i=Ni(t,e,"duration"),(i=gi(i||""))&&(i/=n);var r=Ni(t,e,"startNumber"),s=Ni(t,e,"presentationTimeOffset"),a=vi(r||"");null!=r&&null!=a||(a=1);var o=Ci(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=Number(s),h=t.H.duration||1/0,o=li(o,"S"),c=[],l=0,f=0;f<o.length;++f){var d=o[f],p=di(d,"t",vi),m=di(d,"d",vi),d=di(d,"r",bi);if(null!=p&&(p-=u),!m)break;if(p=null!=p?p:l,d=d||0,0>d)if(f+1<o.length){if(d=di(o[f+1],"t",vi),null==d)break;if(p>=d)break;d=Math.ceil((d-p)/m)-1}else{if(1/0==h)break;if(p/r>=h)break;d=Math.ceil((h*r-p)/m)-1}0<c.length&&p!=l&&(c[c.length-1].end=p/r);for(var y=0;y<=d;++y)l=p+m,c.push({start:p/r,end:l/r}),p=l}r=c}return{Ia:n,F:i,ha:a,presentationTimeOffset:Number(s)/n||0,B:r}}function Ni(t,e,i){return[e(t.u),e(t.P),e(t.K)].filter(A).map(function(t){return t.getAttribute(i)}).reduce(function(t,e){return t||e})}function Ci(t,e,i){return[e(t.u),e(t.P),e(t.K)].filter(A).map(function(t){return ci(t,i)}).reduce(function(t,e){return t||e})}function Mi(t){this.b=t,this.c=0==Ss,this.a=0}function xi(t){return t.a<t.b.byteLength}function Di(t){try{var e=t.b.getUint8(t.a)}catch(i){Ki()}return t.a+=1,e}function Oi(t){try{var e=t.b.getUint16(t.a,t.c)}catch(i){Ki()}return t.a+=2,e}function Li(t){try{var e=t.b.getUint32(t.a,t.c)}catch(i){Ki()}return t.a+=4,e}function ji(t){var e,i;try{t.c?(e=t.b.getUint32(t.a,!0),i=t.b.getUint32(t.a+4,!0)):(i=t.b.getUint32(t.a,!1),e=t.b.getUint32(t.a+4,!1))}catch(n){Ki()}if(2097151<i)throw new S(3,3001);return t.a+=8,i*Math.pow(2,32)+e}function Ui(t,e){t.a+e>t.b.byteLength&&Ki();var i=t.b.buffer.slice(t.a,t.a+e);return t.a+=e,new Uint8Array(i)}function Bi(t,e){t.a+e>t.b.byteLength&&Ki(),t.a+=e}function Fi(t){var e=t.a;try{for(;xi(t)&&t.b.getUint8(t.a);)t.a+=1}catch(i){Ki()}return e=t.b.buffer.slice(e,t.a),t.a+=1,q(e)}function Ki(){throw new S(3,3e3)}function Vi(t,e){for(;xi(e);){var i=e.a,n=Li(e),r=Li(e);if(1==n?n=ji(e):n||(n=e.b.byteLength-i),r==t)return n;Bi(e,n-(e.a-i))}return-1}function qi(t,e){for(var i=new Mi(new DataView(t)),n=[[1836019574,0],[1953653099,0],[1835297121,0],[1835626086,0],[1937007212,0],[1937011556,8],[e,0]],r=-1,s=0;s<n.length;s++){var a=n[s][1],r=Vi(n[s][0],i);if(-1==r)return-1;Bi(i,a)}return r}function Hi(t,e,i,n){var r=[];t=new Mi(new DataView(t));var s=Vi(1936286840,t);if(-1==s)throw new S(3,3004);var a=Di(t);Bi(t,3),Bi(t,4);var o=Li(t);if(!o)throw new S(3,3005);var u,h;for(a?(u=ji(t),h=ji(t)):(u=Li(t),h=Li(t)),Bi(t,2),a=Oi(t),n=u-n,e=e+s+h,s=0;s<a;s++){u=Li(t),h=(2147483648&u)>>>31,u&=2147483647;var c=Li(t);if(Bi(t,4),1==h)throw new S(3,3006);r.push(new Ut(r.length,n/o,(n+c)/o,function(){return i},e,e+u-1)),n+=c,e+=u}return r}function Gi(t){this.a=t}function zi(t){this.b=t,this.a=new Mi(t),Ts||(Ts=[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 $i(t){var e;if(e=Yi(t),7<e.length)throw new S(3,3002);for(var i=0,n=0;n<e.length;n++)i=256*i+e[n];e=i,i=Yi(t);t:{for(n=0;n<Ts.length;n++)if(tt(i,Ts[n])){n=!0;break t}n=!1}if(n)i=t.b.byteLength-t.a.a;else{if(8==i.length&&224&i[1])throw new S(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.a+i<=t.b.byteLength?i:t.b.byteLength-t.a.a,n=new DataView(t.b.buffer,t.b.byteOffset+t.a.a,i),Bi(t.a,i),new Wi(e,n)}function Yi(t){var e,i=Di(t.a);for(e=1;8>=e&&!(i&1<<8-e);e++);if(8<e)throw new S(3,3002);var n=new Uint8Array(e);for(n[0]=i,i=1;i<e;i++)n[i]=Di(t.a);return n}function Wi(t,e){this.id=t,this.a=e}function Xi(t){if(8<t.a.byteLength)throw new S(3,3002);if(8==t.a.byteLength&&224&t.a.getUint8(0))throw new S(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 Ji(t,e,i,n,r,s){function a(){return r}var o=[];t=new zi(t.a);for(var u=-1,h=-1;xi(t.a);){var c=$i(t);if(187==c.id){var l=Zi(c);l&&(c=i*(l.ad-s),l=e+l.Ac,0<=u&&o.push(new Ut(o.length,u,c,a,h,l-1)),u=c,h=l)}}return 0<=u&&o.push(new Ut(o.length,u,n,a,h,null)),o}function Zi(t){var e=new zi(t.a);if(t=$i(e),179!=t.id)throw new S(3,3013);if(t=Xi(t),e=$i(e),183!=e.id)throw new S(3,3012);for(var e=new zi(e.a),i=0;xi(e.a);){var n=$i(e);if(241==n.id){i=Xi(n);break}}return{ad:t,Ac:i}}function Qi(t,e){var i=Ci(t,e,"Initialization");if(!i)return null;var n=t.u.M,r=i.getAttribute("sourceURL");r&&(n=_i(t.u.M,[r]));var r=0,s=null;return(i=di(i,"range",yi))&&(r=i.start,s=i.end),new jt(function(){return n},r,s)}function tn(t,e){var i,n=Ni(t,nn,"presentationTimeOffset"),r=Qi(t,nn);i=Number(n);var s=t.u.contentType,a=t.u.mimeType.split("/")[1];if("text"!=s&&"mp4"!=a&&"webm"!=a)throw new S(4,4006);if("webm"==a&&!r)throw new S(4,4005);var s=Ci(t,nn,"RepresentationIndex"),o=Ni(t,nn,"indexRange"),u=t.u.M,o=yi(o||"");if(s){var h=s.getAttribute("sourceURL");h&&(u=_i(t.u.M,[h])),o=di(s,"range",yi,o)}if(!o)throw new S(4,4002);return i=en(t,e,r,u,o.start,o.end,a,i),{createSegmentIndex:i.createSegmentIndex,findSegmentPosition:i.findSegmentPosition,getSegmentReference:i.getSegmentReference,initSegmentReference:r,presentationTimeOffset:Number(n)||0}}function en(t,e,i,n,r,s,a,o){var u=t.presentationTimeline,h=t.H.start,c=t.H.duration,l=e,f=null;return{createSegmentIndex:function(){var e=[l(n,r,s),"webm"==a?l(i.a(),i.L,i.D):null];return l=null,Promise.all(e).then(function(e){var i,s,l=e[0];if(e=e[1]||null,"mp4"==a)l=Hi(l,r,n,o);else{if(e=new zi(new DataView(e)),440786851!=$i(e).id)throw new S(3,3008);if(s=$i(e),408125543!=s.id)throw new S(3,3009);for(e=s.a.byteOffset,s=new zi(s.a),i=null;xi(s.a);){var d=$i(s);if(357149030==d.id){i=d;break}}if(!i)throw new S(3,3010);for(i=new zi(i.a),d=1e6,s=null;xi(i.a);){var p=$i(i);if(2807729==p.id)d=Xi(p);else if(17545==p.id)if(s=p,4==s.a.byteLength)s=s.a.getFloat32(0);else{if(8!=s.a.byteLength)throw new S(3,3003);s=s.a.getFloat64(0)}}if(null==s)throw new S(3,3011);if(i=d/=1e9,s*=d,l=$i(new zi(new DataView(l))),475249515!=l.id)throw new S(3,3007);l=Ji(l,e,i,s,n,o)}Ii(t.Ra,c,l),u.Fa(h,l),f=new Gi(l)})},findSegmentPosition:function(t){return f.find(t)},getSegmentReference:function(t){return f.get(t)}}}function nn(t){return t.Ga}function rn(t,e){var i,n=Qi(t,sn);i=on(t);var r=Ri(t,sn),s=r.ha;s||(s=1);var a=0;if(r.F?a=r.F*(s-1)-r.presentationTimeOffset:r.B&&0<r.B.length&&(a=r.B[0].start),i={F:r.F,startTime:a,ha:s,presentationTimeOffset:r.presentationTimeOffset,B:r.B,ua:i},!i.F&&!i.B&&1<i.ua.length)throw new S(4,4002);if(!i.F&&!t.H.duration&&!i.B&&1==i.ua.length)throw new S(4,4002);if(i.B&&!i.B.length)throw new S(4,4002);return s=r=null,t.K.id&&t.u.id&&(s=t.K.id+","+t.u.id,r=e[s]),a=an(t.H.duration,i.ha,t.u.M,i),Ii(t.Ra,t.H.duration,a),r?(r.Xa(a),r.Sa(t.presentationTimeline.sa()-t.H.start)):(t.presentationTimeline.Fa(t.H.start,a),r=new Gi(a),s&&(e[s]=r)),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:n,presentationTimeOffset:i.presentationTimeOffset}}function sn(t){return t.Y}function an(t,e,i,n){var r=n.ua.length;n.B&&n.B.length!=n.ua.length&&(r=Math.min(n.B.length,n.ua.length));for(var s=[],a=n.startTime,o=0;o<r;o++){var u,h=n.ua[o],c=_i(i,[h.dc]);u=null!=n.F?a+n.F:n.B?n.B[o].end:a+t,s.push(new Ut(o+e,a,u,function(t){return t}.bind(null,c),h.start,h.end)),a=u}return s}function on(t){return[t.u.Y,t.P.Y,t.K.Y].filter(A).map(function(t){return li(t,"SegmentURL")}).reduce(function(t,e){return 0<t.length?t:e}).map(function(t){var e=t.getAttribute("media");return t=di(t,"mediaRange",yi,{start:0,end:null}),{dc:e,start:t.start,end:t.end}})}function un(t,e,i,n){var r,s=fn(t);r=Ri(t,hn);var a=Ni(t,hn,"media"),o=Ni(t,hn,"index");if(r={F:r.F,Ia:r.Ia,ha:r.ha,presentationTimeOffset:r.presentationTimeOffset,B:r.B,Wa:a,Ea:o},a=0+(r.Ea?1:0),a+=r.B?1:0,a+=r.F?1:0,!a)throw new S(4,4002);if(1!=a&&(r.Ea&&(r.B=null),r.F=null),!r.Ea&&!r.Wa)throw new S(4,4002);if(r.Ea){if(i=t.u.mimeType.split("/")[1],"mp4"!=i&&"webm"!=i)throw new S(4,4006);if("webm"==i&&!s)throw new S(4,4005);n=Ai(r.Ea,t.u.id,null,t.bandwidth||null,null),n=_i(t.u.M,[n]),t=en(t,e,s,n,0,null,i,r.presentationTimeOffset)}else r.F?(n||t.presentationTimeline.Ya(r.F),t=cn(t,r)):(n=e=null,t.K.id&&t.u.id&&(n=t.K.id+","+t.u.id,e=i[n]),a=ln(t,r),Ii(t.Ra,t.H.duration,a),e?(e.Xa(a),e.Sa(t.presentationTimeline.sa()-t.H.start)):(t.presentationTimeline.Fa(t.H.start,a),e=new Gi(a),n&&(i[n]=e)),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:s,presentationTimeOffset:r.presentationTimeOffset}}function hn(t){return t.Ha}function cn(t,e){var i=t.H.duration,n=e.F,r=e.ha,s=e.Ia,a=e.Wa,o=t.bandwidth||null,u=t.u.id,h=t.u.M;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 new Ut(t,e,e+n,function(){var i=Ai(a,u,t+r,o,e*s);return _i(h,[i])},0,null)}}}function ln(t,e){for(var i=[],n=0;n<e.B.length;n++){var r=e.B[n].start,s=n+e.ha;i.push(new Ut(s,r,e.B[n].end,function(t,e,i,n,r,s){return t=Ai(t,e,r,i,s),_i(n,[t]).map(function(t){return t.toString()})}.bind(null,e.Wa,t.u.id,t.bandwidth||null,t.u.M,s,(r+e.presentationTimeOffset)*e.Ia),0,null))}return i}function fn(t){var e=Ni(t,hn,"initialization");if(!e)return null;var i=t.u.id,n=t.bandwidth||null,r=t.u.M;return new jt(function(){var t=Ai(e,i,null,n,null);return _i(r,[t])},0,null)}function dn(){this.m=this.l=this.j=this.c=this.a=null,this.h=[],this.b=null,this.g=[],this.v=1,this.i={},this.s=0,this.f=null,this.Ka=this.Ka.bind(this)}function pn(t){return t.a.request(0,M(t.h,t.c.retryParameters)).then(function(t){if(this.a)return mn(this,t.data,t.uri)}.bind(t))}function mn(t,e,i){var n=q(e),r=new DOMParser,s=null;e=null;try{s=r.parseFromString(n,"text/xml")}catch(a){}if(s&&"MPD"==s.documentElement.tagName&&(e=s.documentElement),!e)throw new S(4,4001);i=[i],n=li(e,"Location").map(fi).filter(A),0<n.length&&(i=t.h=n),n=li(e,"BaseURL").map(fi),i=_i(i,n);var o=di(e,"minBufferTime",mi);t.s=di(e,"minimumUpdatePeriod",mi,-1);var u,h=di(e,"availabilityStartTime",pi),n=di(e,"timeShiftBufferDepth",mi),c=di(e,"suggestedPresentationDelay",mi),r=di(e,"maxSegmentDuration",mi),s=e.getAttribute("type")||"static";if(t.b)u=t.b.presentationTimeline;else{var l=Math.max(10,1.5*o);u=new Bt(h,null!=c?c:l)}var h=yn(t,{Ra:"static"!=s,presentationTimeline:u,K:null,H:null,P:null,u:null,bandwidth:void 0},i,e),c=h.duration,f=h.periods;return u.Ib("static"==s),u.za(c||1/0),u.Hb(null!=n?n:1/0),u.Ya(r||1),t.b?Promise.resolve():(e=li(e,"UTCTiming"),n=u.U(),h.ba&&t.a.zb(t.Ka),Sn(t,i,e,n).then(function(t){this.a&&(u.Fb(t),this.b={presentationTimeline:u,periods:f,offlineSessionIds:[],minBufferTime:o||0})}.bind(t)))}function yn(t,e,i,n){var r=di(n,"mediaPresentationDuration",mi),s=!1,a=[],o=0;n=li(n,"Period");for(var u=0;u<n.length;u++){var h=n[u],o=di(h,"start",mi,o),c=di(h,"duration",mi);if(null==c)if(u+1!=n.length){var l=di(n[u+1],"start",mi);null!=l&&(c=l-o)}else null!=r&&(c=r-o);var h={start:o,duration:c,node:h,ba:!1},f=t,d=e,l=h;if(d.K=gn(l.node,null,i),d.H=l,d.K.id||(d.K.id="__shaka_period_"+l.start),f=li(l.node,"AdaptationSet").map(f.uc.bind(f,d)).filter(A),!f.length)throw new S(4,4004);for(d=0;d<f.length;d++)f[d].ba&&(l.ba=!0);if(f=vn(f),l={startTime:l.start,streamSets:f},a.push(l),s=s||h.ba,h=e.K.id,t.g.every(I(h))&&(t.j(l),t.g.push(h),t.b&&t.b.periods.push(l)),null==c){o=null;break}o+=c}return null!=r?{periods:a,duration:r,ba:s}:{periods:a,duration:o,ba:s}}function bn(e,i){0>e.s||(e.f=t.setTimeout(e.Sc.bind(e),1e3*Math.max(Math.max(3,e.s)-i,0)))}function gn(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",frameRate:void 0},i=i||e.M;var n=li(t,"BaseURL").map(fi),r=t.getAttribute("contentType")||e.contentType,s=t.getAttribute("mimeType")||e.mimeType,a=t.getAttribute("codecs")||e.codecs,o=di(t,"frameRate",wi)||e.frameRate;return r||(r=Tn(s,a)),{M:_i(i,n),Ga:ci(t,"SegmentBase")||e.Ga,Y:ci(t,"SegmentList")||e.Y,Ha:ci(t,"SegmentTemplate")||e.Ha,width:di(t,"width",vi)||e.width,height:di(t,"height",vi)||e.height,contentType:r,mimeType:s,codecs:a,frameRate:o,id:t.getAttribute("id")}}function vn(t){var e={};t.forEach(function(t){e[t.id]=[t]}),t.forEach(function(t){var i=e[t.id];t.Yc.forEach(function(t){(t=e[t])&&t!=i&&(i.push.apply(i,t),t.forEach(function(t){e[t.id]=i}))})});var i=[],n=[];return F(e).forEach(function(t){if(!(0<=n.indexOf(t))){n.push(t);var e=new D;t.forEach(function(t){e.push(t.contentType||"",t)}),e.keys().forEach(function(t){var n=new D;e.get(t).forEach(function(t){n.push(t.language,t)}),n.keys().forEach(function(e){var r=n.get(e);e={language:e,type:t,primary:r.some(function(t){return t.cc}),drmInfos:r.map(function(t){return t.drmInfos}).reduce(k,[]),streams:r.map(function(t){return t.streams}).reduce(k,[])},i.push(e)})})}}),i}function wn(t){var e;return e=0+(t.Ga?1:0),e+=t.Y?1:0,(e+=t.Ha?1:0)?(1!=e&&(t.Ga&&(t.Y=null),t.Ha=null),!0):"text"==t.contentType||"application"==t.contentType}function En(t,e,i,n){return e=_i(e,[i]),e=M(e,t.c.retryParameters),e.method=n,t.a.request(0,e).then(function(t){if("HEAD"==n){if(!t.headers||!t.headers.date)return 0;t=t.headers.date}else t=q(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function Sn(t,e,i,n){i=i.map(function(t){return{scheme:t.getAttribute("schemeIdUri"),value:t.getAttribute("value")}});var r=t.c.dash.clockSyncUri;return n&&!i.length&&r&&i.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),T(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 En(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 En(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":return Promise.reject();default:return Promise.reject()}}.bind(t))["catch"](function(){return 0})}function Tn(t,e){return rs[ae(t,e)]?"text":t.split("/")[0]}function kn(t,e){var i=q(t),n=[],r=new DOMParser,s=null;try{s=r.parseFromString(i,"text/xml")}catch(a){throw new S(2,2005)}if(s){var o,u;if(!(i=s.getElementsByTagName("tt")[0]))throw new S(2,2006);for(r=i.getAttribute("ttp:frameRate"),s=i.getAttribute("ttp:subFrameRate"),o=i.getAttribute("ttp:frameRateMultiplier"),u=i.getAttribute("ttp:tickRate"),r=new Pn(r,s,o,u),s=kn.b(i.getElementsByTagName("styling")[0]),o=kn.b(i.getElementsByTagName("layout")[0]),i=kn.b(i.getElementsByTagName("body")[0]),u=0;u<i.length;u++){var h=kn.c(i[u],e,r,s,o);h&&n.push(h)}}return n}function Pn(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 An(t,e){var i=new Mi(new DataView(t)),n=Vi(1835295092,i);if(-1!=n)return kn(Ui(i,n-8).buffer,e);if(-1!=qi(t,An.S))return[];throw new S(2,2007)}function In(t){this.b=t,this.a=0}function _n(t,e){var i;return e.lastIndex=t.a,i=(i=e.exec(t.b))?{position:i.index,length:i[0].length,Ec:i}:null,t.a!=t.b.length&&i&&i.position==t.a?(t.a+=i.length,i.Ec):null}function Rn(t){return t.a==t.b.length?null:(t=_n(t,/[^ \t\n]*/gm))?t[0]:null}function Nn(t,e,i,n,r){if(t=q(t),t=t.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n"),t=t.split(/\n{2,}/m),!/^WEBVTT($|[ \t\n])/m.test(t[0]))throw new S(2,2e3);n=[];for(var s=1;s<t.length;s++){var a=t[s].split("\n");(a=Nn.c(a,e,i,r))&&n.push(a)}return n}function Cn(t,e,i,n){var r=new Mi(new DataView(t)),s=Vi(1835295092,r);if(-1!=s)return Cn.Aa(Ui(r,s-8).buffer,e,i,n);if(-1!=qi(t,Cn.na))return[];throw new S(2,2008)}function Mn(e){return new Promise(function(i){var n=e.split(":");if(2>n.length||"data"!=n[0])throw new S(1,1004,e);if(n=n.slice(1).join(":").split(","),2>n.length)throw new S(1,1004,e);var r=n[0],n=t.decodeURIComponent(n.slice(1).join(",")),r=r.split(";"),s=null;if(1<r.length&&(s=r[1]),"base64"==s)n=J(n).buffer;else{if(s)throw new S(1,1005,e);n=z(n)}i({uri:e,data:n,headers:{"content-type":r[0]}})})}function xn(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){if(e=e.target,200<=e.status&&299>=e.status){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},{});e.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r})}else{r=null;try{r=G(e.response)}catch(s){}n(new S(1,1001,t,e.status,r))}},r.onerror=function(){n(new S(1,1002,t))},r.ontimeout=function(){n(new S(1,1003,t))};for(var s in e.headers)r.setRequestHeader(s,e.headers[s]);r.send(e.body)})}function Dn(){this.a=null,this.c=[],this.b={}}function On(t,e,i){return Un(t,e,"readwrite",function(t){return t.put(i)})}function Ln(t,e){var i=[];return Un(t,"segment","readwrite",function(t){return t.openCursor()},function(t){if(t){if(e(t.value)){var n=t["delete"](),r=new R;n.onsuccess=r.resolve,n.onerror=Bn.bind(null,n,r),i.push(r)}t["continue"]()}}).then(function(){return Promise.all(i)}).then(function(){return i.length})}function jn(t,e){var i=0;return Un(t,e,"readonly",function(t){return t.openCursor(null,"prev")},function(t){t&&(i=t.key+1)}).then(function(){return i})}function Un(t,e,i,n,r){i=t.a.transaction([e],i);var s=n(i.objectStore(e)),a=new R;r&&(s.onsuccess=function(t){r(t.target.result)}),s.onerror=Bn.bind(null,s,a);var o={transaction:i,I:a};t.c.push(o);var u=function(){this.c.splice(this.c.indexOf(o),1)}.bind(t);return i.oncomplete=function(){u(),a.resolve(s.result)},i.onerror=function(t){u(),Bn(s,a,t)},a}function Bn(t,e,i){"AbortError"==t.error.name?e.reject(new S(9,9002)):e.reject(new S(9,9001,t.error)),i.preventDefault()}function Fn(t){return{offlineUri:"offline:"+t.key,originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,tracks:t.periods[0].streams.map(function(t){return{id:t.id,active:!1,type:t.contentType,bandwidth:0,language:t.language,kind:t.kind||null,width:t.width,height:t.height,frameRate:t.frameRate,codecs:t.codecs}}),appMetadata:t.appMetadata}}function Kn(){}function Vn(t){var e=new Bt(null,0);e.za(t.duration);var i=t.drmInfo?[t.drmInfo]:[];return{presentationTimeline:e,minBufferTime:10,offlineSessionIds:t.sessionIds,periods:t.periods.map(function(t){return{startTime:t.startTime,streamSets:t.streams.map(function(n){var r=n.segments.map(function(t,e){return new Ut(e,t.startTime,t.endTime,function(){ +return[t.uri]},0,null)});return e.Fa(t.startTime,r),r=new Gi(r),{language:n.language,type:n.contentType,primary:n.primary,drmInfos:i,streams:[{id:n.id,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:n.initSegmentUri?new jt(function(){return[n.initSegmentUri]},0,null):null,presentationTimeOffset:n.presentationTimeOffset,mimeType:n.mimeType,codecs:n.codecs,bandwidth:0,width:n.width||void 0,height:n.height||void 0,kind:n.kind,encrypted:n.encrypted,keyId:n.keyId,allowedByApplication:!0,allowedByKeySystem:!0}]}})}})}}function qn(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=new Dn;return n.init(ks).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new S(9,9003,i);return{uri:t,data:e.data,headers:{}}})})}return Promise.reject(new S(1,9004,t))}function Hn(t,e,i){this.b={},this.i=i,this.m=t,this.l=e,this.j=this.a=null,this.f=this.h=this.g=this.c=0}function Gn(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),L:i.L,D:i.D,ib:n,Da:r})}function zn(t,e){t.c=0,t.g=0,t.h=0,t.f=0,F(t.b).forEach(function(t){t.forEach(function(t){null!=t.D?this.c+=t.D-t.L+1:this.h+=t.ib}.bind(this))}.bind(t)),t.a=e,t.a.size=t.c;var i=F(t.b).map(function(t){var e=0,i=function(){if(!this.i)return Promise.reject(new S(9,9002));if(e>=t.length)return Promise.resolve();var n=t[e++];return $n(this,n).then(i)}.bind(this);return i()}.bind(t));return t.b={},t.j=Promise.all(i)}function $n(t,e){var i=M(e.uris,t.l);(e.L||null!=e.D)&&(i.headers.Range="bytes="+e.L+"-"+(null==e.D?"":e.D));var n;return t.m.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,e.Da(t.data)):Promise.reject(new S(9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new S(9,9002));null==e.D?(this.a.size+=n,this.f+=e.ib):this.g+=n;var t=(this.g+this.f)/(this.c+this.h),i=Fn(this.a);this.i.progressCallback(i,t)}.bind(t))}function Yn(t){this.a=new Dn,this.c=t,this.j=Jn(this),this.h=null,this.v=!1,this.i=null,this.l=[],this.f=-1,this.m=0,this.b=null,this.g=new Hn(t.i,t.getConfiguration().streaming.retryParameters,this.j)}function Wn(){return!!t.indexedDB}function Xn(t,e,i,n){function r(){}var s,a,o,u=t.c.i,h=t.c.getConfiguration();return bt(e,u,h.manifest.retryParameters,n).then(function(t){return ir(this),o=new t,o.configure(h.manifest),o.start(e,u,this.s.bind(this),i)}.bind(t)).then(function(t){return ir(this),s=t,a=new et(u,i,r),a.configure(h.drm),a.init(s,!0)}.bind(t)).then(function(){return ir(this),tr(s)}.bind(t)).then(function(){return ir(this),rt(a)}.bind(t)).then(function(){return ir(this),o.stop()}.bind(t)).then(function(){return ir(this),{manifest:s,Sb:a}}.bind(t))["catch"](function(t){if(o)return o.stop().then(function(){throw t});throw t})}function Jn(t){return{trackSelectionCallback:t.A.bind(t),progressCallback:function(t,e){if(t||e)return null}}}function Zn(t){return t.a.a?Promise.resolve():t.a.init(ks)}function Qn(t){var e=t.h?t.h.o():Promise.resolve();return t.h=null,t.b=null,t.v=!1,t.i=null,t.l=[],t.f=-1,e}function tr(t){return t=t.periods.map(function(t){return t.streamSets}).reduce(k,[]).map(function(t){return t.streams}).reduce(k,[]),Promise.all(t.map(function(t){return t.createSegmentIndex()}))}function er(t,e,i,n){for(var r=[],s=t.b.presentationTimeline.ra(),a=s,o=n.findSegmentPosition(s),u=null!=o?n.getSegmentReference(o):null;u;){var h=t.a.b.segment++;Gn(t.g,i.type,u,(u.endTime-u.startTime)*n.bandwidth/8,function(t,e,i,n){return e={key:t,data:n,manifestKey:this.f,streamNumber:i,segmentNumber:e},this.l.push(t),On(this.a,"segment",e)}.bind(t,h,u.position,n.id)),r.push({startTime:u.startTime,endTime:u.endTime,uri:"offline:"+t.f+"/"+n.id+"/"+h}),a=u.endTime+e.startTime,u=n.getSegmentReference(++o)}return t.m=Math.max(t.m,a-s),e=null,n.initSegmentReference&&(h=t.a.b.segment++,e="offline:"+t.f+"/"+n.id+"/"+h,Gn(t.g,i.type,n.initSegmentReference,0,function(t,e){var i={key:h,data:e,manifestKey:this.f,streamNumber:t,segmentNumber:-1};return this.l.push(h),On(this.a,"segment",i)}.bind(t,n.id))),{id:n.id,primary:i.primary,presentationTimeOffset:n.presentationTimeOffset||0,contentType:i.type,mimeType:n.mimeType,codecs:n.codecs,frameRate:n.frameRate,kind:n.kind,language:i.language,width:n.width||null,height:n.height||null,initSegmentUri:e,encrypted:n.encrypted,keyId:n.keyId,segments:r}}function ir(t){if(!t.c)throw new S(9,9002)}function nr(t){Ps.push(t)}function rr(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase(),e=new Event(e,t);t.target.dispatchEvent(e)}function sr(t){for(this.c=[],this.b=[],this.a=[],t=new Mi(new DataView(t.buffer));xi(t);){var e=Vi(1886614376,t);if(-1==e)break;var i=t.a-8,n=Di(t);if(1<n)Bi(t,e-(t.a-i));else{Bi(t,3);var r=Q(Ui(t,16)),s=[];if(0<n)for(var n=Li(t),a=0;a<n;++a){var o=Q(Ui(t,16));s.push(o)}n=Li(t),Bi(t,n),this.b.push.apply(this.b,s),this.c.push(r),this.a.push({start:i,end:t.a-1}),t.a!=i+e&&Bi(t,e-(t.a-i))}}}function ar(t,e){try{var i=new or(t,e);return Promise.resolve(i)}catch(n){return Promise.reject(n)}}function or(t,e){this.keySystem=t;for(var i=!1,n=0;n<e.length;++n){var r=e[n],s={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},a=!1;if(r.audioCapabilities)for(var o=0;o<r.audioCapabilities.length;++o){var u=r.audioCapabilities[o];if(u.contentType){var a=!0,h=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,h)&&(s.audioCapabilities.push(u),i=!0)}}if(r.videoCapabilities)for(o=0;o<r.videoCapabilities.length;++o)u=r.videoCapabilities[o],u.contentType&&(a=!0,h=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,h)&&(s.videoCapabilities.push(u),i=!0));if(a||(i=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==r.persistentState&&(s.persistentState="required",s.sessionTypes=["persistent-license"]),i)return void(this.a=s)}throw i=Error("Unsupported keySystem"),i.name="NotSupportedError",i.code=DOMException.NOT_SUPPORTED_ERR,i}function ur(t){var e=this.mediaKeys;return e&&e!=t&&cr(e,null),delete this.mediaKeys,(this.mediaKeys=t)?cr(t,this):Promise.resolve()}function hr(t){this.a=new MSMediaKeys(t),this.b=new O}function cr(t,e){function i(){e.msSetMediaKeys(n.a),e.removeEventListener("loadedmetadata",i)}if(j(t.b),!e)return Promise.resolve();L(t.b,e,"msneedkey",fr);var n=t;try{return 1<=e.readyState?e.msSetMediaKeys(t.a):e.addEventListener("loadedmetadata",i),Promise.resolve()}catch(r){return Promise.reject(r)}}function lr(t){je.call(this),this.c=null,this.g=t,this.b=this.a=null,this.f=new O,this.sessionId="",this.expiration=NaN,this.closed=new R,this.keyStatuses=new mr}function fr(t){var e=document.createEvent("CustomEvent");if(e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="cenc",t=t.initData){var i=new sr(t);if(!(1>=i.a.length)){for(var n=[],r=0;r<i.a.length;r++)n.push(t.subarray(i.a[r].start,i.a[r].end+1));for(r=dr,t=[],i=0;i<n.length;++i){for(var s=!1,a=0;a<t.length&&!(s=r?r(n[i],t[a]):n[i]===t[a]);++a);s||t.push(n[i])}for(r=n=0;r<t.length;r++)n+=t[r].length;for(n=new Uint8Array(n),r=i=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;t=n}}e.initData=t,this.dispatchEvent(e)}function dr(t,e){return tt(t,e)}function pr(t,e){t.keyStatuses.eb(e),t.dispatchEvent(new Le("keystatuseschange"))}function mr(){this.size=0,this.a=void 0}function yr(){return Promise.reject(Error("The key system specified is not supported."))}function br(t){return t?Promise.reject(Error("MediaKeys not supported.")):Promise.resolve()}function gr(){throw new TypeError("Illegal constructor.")}function vr(){throw new TypeError("Illegal constructor.")}function wr(e){Is=e,_s=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Sr,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Tr,t.MediaKeys=Pr,t.MediaKeySystemAccess=kr}function Er(t){var e=Is;return e?e+t.charAt(0).toUpperCase()+t.slice(1):t}function Sr(t,e){try{var i=new kr(t,e);return Promise.resolve(i)}catch(n){return Promise.reject(n)}}function Tr(t){var e=this.mediaKeys;return e&&e!=t&&Ar(e,null),delete this.mediaKeys,(this.mediaKeys=t)&&Ar(t,this),Promise.resolve()}function kr(t,e){this.a=this.keySystem=t;var i=!0;"org.w3.clearkey"==t&&(this.a="webkit-org.w3.clearkey",i=!1);var n,r=!1;n=document.getElementsByTagName("video"),n=n.length?n[0]:document.createElement("video");for(var s=0;s<e.length;++s){var a=e[s],o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:a.initDataTypes,sessionTypes:["temporary"],label:a.label},u=!1;if(a.audioCapabilities)for(var h=0;h<a.audioCapabilities.length;++h){var c=a.audioCapabilities[h];if(c.contentType){var u=!0,l=c.contentType.split(";")[0];n.canPlayType(l,this.a)&&(o.audioCapabilities.push(c),r=!0)}}if(a.videoCapabilities)for(h=0;h<a.videoCapabilities.length;++h)c=a.videoCapabilities[h],c.contentType&&(u=!0,n.canPlayType(c.contentType,this.a)&&(o.videoCapabilities.push(c),r=!0));if(u||(r=n.canPlayType("video/mp4",this.a)||n.canPlayType("video/webm",this.a)),"required"==a.persistentState&&(i?(o.persistentState="required",o.sessionTypes=["persistent-license"]):r=!1),r)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 Pr(t){this.h=t,this.b=null,this.a=new O,this.c=[],this.f={}}function Ar(t,e){t.b=e,j(t.a);var i=Is;e&&(L(t.a,e,i+"needkey",t.tc.bind(t)),L(t.a,e,i+"keymessage",t.sc.bind(t)),L(t.a,e,i+"keyadded",t.qc.bind(t)),L(t.a,e,i+"keyerror",t.rc.bind(t)))}function Ir(t,e){var i=t.f[e];return i?i:(i=t.c.shift())?(i.sessionId=e,t.f[e]=i):null}function _r(t,e,i){je.call(this),this.f=t,this.i=!1,this.a=this.b=null,this.c=e,this.g=i,this.sessionId="",this.expiration=NaN,this.closed=new R,this.keyStatuses=new Cr}function Rr(t,e,i){if(t.i)return Promise.reject(Error("The session is already initialized."));t.i=!0;var n;try{if("persistent-license"==t.g)if(i)n=new Uint8Array(z("LOAD_SESSION|"+i));else{var r=z("PERSISTENT|"),s=new Uint8Array(r.byteLength+e.byteLength);s.set(new Uint8Array(r),0),s.set(new Uint8Array(e),r.byteLength),n=s}else n=new Uint8Array(e)}catch(a){return Promise.reject(a)}t.b=new R;var o=Er("generateKeyRequest");try{t.f[o](t.c,n)}catch(a){if("InvalidStateError"!=a.name)return t.b=null,Promise.reject(a);setTimeout(function(){try{this.f[o](this.c,n)}catch(t){this.b.reject(t),this.b=null}}.bind(t),10)}return t.b}function Nr(t,e){t.keyStatuses.eb(e),t.dispatchEvent(new Le("keystatuseschange"))}function Cr(){this.size=0,this.a=void 0}function Mr(){var t=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var e=t.apply(this,arguments);return e.abort=function(){},e}}function xr(){var t=MediaSource.prototype.endOfStream;MediaSource.prototype.endOfStream=function(){for(var e=0,i=0;i<this.sourceBuffers.length;++i)var n=this.sourceBuffers[i],n=n.buffered.end(n.buffered.length-1),e=Math.max(e,n);if(!isNaN(this.duration)&&e<this.duration)for(this.ob=!0,i=0;i<this.sourceBuffers.length;++i)n=this.sourceBuffers[i],n.kb=!1;return t.apply(this,arguments)};var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=e.apply(this,arguments);return t.h=this,t.addEventListener("updateend",Dr,!1),this.a||(this.addEventListener("sourceclose",Or,!1),this.a=!0),t}}function Dr(t){var e=t.target,i=e.h;if(i.ob){for(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.kb=!0,t=0;t<i.sourceBuffers.length;++t)if(0==i.sourceBuffers[t].kb)return;i.ob=!1}}function Or(t){t=t.target;for(var e=0;e<t.sourceBuffers.length;++e)t.sourceBuffers[e].removeEventListener("updateend",Dr,!1);t.removeEventListener("sourceclose",Or,!1)}function Lr(t){if(this.c=[],this.b=[],this.ia=Rs,t)try{t(this.W.bind(this),this.a.bind(this))}catch(e){this.a(e)}}function jr(t){var e=new Lr;return e.W(t),e}function Ur(t){var e=new Lr;return e.a(t),e}function Br(t){function e(t,e,i){t.ia==Rs&&(r[e]=i,n++,n==r.length&&t.W(r))}var i=new Lr;if(!t.length)return i.W([]),i;for(var n=0,r=Array(t.length),s=i.a.bind(i),a=0;a<t.length;++a)t[a]&&t[a].then?t[a].then(e.bind(null,i,a),s):e(i,a,t[a]);return i}function Fr(t){for(var e=new Lr,i=e.W.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 Kr(t,e,i){Cs.push(function(){if(i&&"function"==typeof i){try{var t=i(this.Oa)}catch(n){return void e.a(n)}var r;try{r=t&&t.then}catch(n){return void e.a(n)}t instanceof Lr?t==e?e.a(new TypeError("Chaining cycle detected")):t.then(e.W.bind(e),e.a.bind(e)):r?Vr(t,r,e):e.W(t)}else 1==this.ia?e.W(this.Oa):e.a(this.Oa)}.bind(t)),null==Ns&&(Ns=Hr(qr))}function Vr(t,e,i){try{var n=!1;e.call(t,function(t){if(!n){n=!0;var e;try{e=t&&t.then}catch(r){return void i.a(r)}e?Vr(t,e,i):i.W(t)}},i.a.bind(i))}catch(r){i.a(r)}}function qr(){for(;Cs.length;){null!=Ns&&(Gr(Ns),Ns=null);var t=Cs;Cs=[];for(var e=0;e<t.length;++e)t[e]()}}function Hr(){return 0}function Gr(){}function zr(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}var $r,Yr=this;Yr.ed=!0,a.prototype.setDefaultEstimate=function(t){this.b=t},a.prototype.getBandwidthEstimate=function(){return 128e3>this.a?this.b:Math.min(s(this.c),s(this.f))},e("shaka.abr.SimpleAbrManager",h),h.prototype.stop=function(){this.g=null,this.f=!1,this.h={},this.a={},this.c=null},h.prototype.stop=h.prototype.stop,h.prototype.init=function(t){this.g=t},h.prototype.init=h.prototype.init,h.prototype.chooseStreams=function(t){for(var e in t)this.h[e]=t[e];if(e={},"audio"in t){var i=c(this);i?(e.audio=i,this.a.audio=i):delete this.a.audio}return"video"in t&&((i=l(this))?(e.video=i,this.a.video=i):delete this.a.video),"text"in t&&(e.text=t.text.streams[0]),this.c=Date.now(),e},h.prototype.chooseStreams=h.prototype.chooseStreams,h.prototype.enable=function(){this.f=!0},h.prototype.enable=h.prototype.enable,h.prototype.disable=function(){this.f=!1},h.prototype.disable=h.prototype.disable,h.prototype.segmentDownloaded=function(t,e,i){var n=this.b;if(e-=t,16e3>i||(t=8e3*i/e,e/=1e3,n.a+=i,r(n.c,e,t),r(n.f,e,t)),null!=this.c&&this.f)t:{if(this.i){if(8e3>Date.now()-this.c)break t}else{if(!(128e3<=this.b.a))break t;this.i=!0}i={},(n=c(this))&&(i.audio=n,this.a.audio=n),(n=l(this))&&(i.video=n,this.a.video=n),this.c=Date.now(),this.b.getBandwidthEstimate(),this.g(i)}},h.prototype.segmentDownloaded=h.prototype.segmentDownloaded,h.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate()},h.prototype.getBandwidthEstimate=h.prototype.getBandwidthEstimate,h.prototype.setDefaultEstimate=function(t){this.b.setDefaultEstimate(t)},h.prototype.setDefaultEstimate=h.prototype.setDefaultEstimate;var Wr=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;$r=d.prototype,$r.R="",$r.ka="",$r.T="",$r.wa=null,$r.O="",$r.ca="",$r.toString=function(){var t=[],e=this.R;if(e&&t.push(g(e,Xr,!0),":"),e=this.T){t.push("//");var i=this.ka;i&&t.push(g(i,Xr,!0),"@"),t.push(encodeURIComponent(e).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e=this.wa,null!=e&&t.push(":",String(e))}return(e=this.O)&&(this.T&&"/"!=e.charAt(0)&&t.push("/"),t.push(g(e,"/"==e.charAt(0)?Zr:Jr,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ca)&&t.push("#",g(e,ts)),t.join("")},$r.resolve=function(t){var e=new d(this);"data"===e.R&&(e=new d);var i=!!t.R;i?p(e,t.R):i=!!t.ka,i?e.ka=t.ka:i=!!t.T,i?e.T=t.T:i=null!=t.wa;var n=t.O;if(i)m(e,t.wa);else if(i=!!t.O){if("/"!=n.charAt(0))if(this.T&&!this.O)n="/"+n;else{var r=e.O.lastIndexOf("/");-1!=r&&(n=e.O.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("/"),s=[],a=0;a<n.length;){var o=n[a++];"."==o?r&&a==n.length&&s.push(""):".."==o?((1<s.length||1==s.length&&""!=s[0])&&s.pop(),r&&a==n.length&&s.push("")):(s.push(o),r=!0)}n=s.join("/")}}return i?e.O=n:i=""!==t.a.toString(),i?y(e,E(t.a)):i=!!t.ca,i&&(e.ca=t.ca),e};var Xr=/[#\/\?@]/g,Jr=/[\#\?:]/g,Zr=/[\#\?]/g,Qr=/[\#\?@]/g,ts=/#/g;w.prototype.a=null,w.prototype.c=null,w.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 s=i;""!==n[r]&&(s+="="+encodeURIComponent(n[r])),e.push(s)}return this.b=e.join("&")},e("shaka.util.Error",S),S.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},S.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},S.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_TTML:2006,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,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,INDEXED_DB_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},e("shaka.util.IDestroyable",_),_.prototype.o=function(){},_.prototype.destroy=_.prototype.o,e("shaka.net.NetworkingEngine",N),N.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2};var es={};N.registerScheme=function(t,e){es[t]=e},N.unregisterScheme=function(t){delete es[t]},N.prototype.zc=function(t){this.b.push(t)},N.prototype.registerRequestFilter=N.prototype.zc,N.prototype.$c=function(t){var e=this.b;t=e.indexOf(t),0<=t&&e.splice(t,1)},N.prototype.unregisterRequestFilter=N.prototype.$c,N.prototype.Pb=function(){this.b=[]},N.prototype.clearAllRequestFilters=N.prototype.Pb,N.prototype.zb=function(t){this.c.push(t)},N.prototype.registerResponseFilter=N.prototype.zb,N.prototype.Kb=function(t){var e=this.c;t=e.indexOf(t),0<=t&&e.splice(t,1)},N.prototype.unregisterResponseFilter=N.prototype.Kb,N.prototype.Qb=function(){this.c=[]},N.prototype.clearAllResponseFilters=N.prototype.Qb,N.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"](P));return Promise.all(t)},N.prototype.destroy=N.prototype.o,N.prototype.request=function(t,e){if(this.f)return Promise.reject();for(var i=Date.now(),n=this.b,r=0;r<n.length;r++)try{n[r](t,e)}catch(s){return Promise.reject(s)}for(var r=e.retryParameters||{},n=r.maxAttempts||1,a=r.backoffFactor||2,o=null==r.baseDelay?1e3:r.baseDelay,u=this.h(t,e,0),r=1;r<n;r++)u=u["catch"](this.i.bind(this,t,e,o,r%e.uris.length)),o*=a;return this.a.push(u),u.then(function(e){this.a.splice(this.a.indexOf(u),1);var n=Date.now();return this.g&&1==t&&this.g(i,n,e.data.byteLength),e}.bind(this))["catch"](function(t){return this.a.splice(this.a.indexOf(u),1),Promise.reject(t)}.bind(this))},N.prototype.request=N.prototype.request,N.prototype.h=function(t,e,i){if(this.f)return Promise.reject();var n=new d(e.uris[i]),r=n.R;return r||(r=location.protocol,r=r.slice(0,-1),p(n,r),e.uris[i]=n.toString()),(r=es[r])?r(e.uris[i],e).then(function(e){for(var i=this.c,n=0;n<i.length;n++)i[n](t,e);return e}.bind(this)):Promise.reject(new S(1,1e3,n))},N.prototype.i=function(e,i,n,r){var s=new R,a=i.retryParameters||{};return t.setTimeout(s.resolve,n*(1+(2*Math.random()-1)*(null==a.fuzzFactor?.5:a.fuzzFactor))),s.then(this.h.bind(this,e,i,r))},$r=D.prototype,$r.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},$r.set=function(t,e){this.a[t]=e},$r.has=function(t){return this.a.hasOwnProperty(t)},$r.get=function(t){return(t=this.a[t])?t.slice():null},$r.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)},$r.keys=function(){var t,e=[];for(t in this.a)e.push(t);return e},O.prototype.o=function(){return j(this),this.a=null,Promise.resolve()},O.prototype.ja=function(t,e){for(var i=this.a.get(e)||[],n=0;n<i.length;++n){var r=i[n];r.target==t&&(r.ja(),this.a.remove(e,r))}},U.prototype.ja=function(){this.target&&(this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null)},Y.prototype.cancel=function(){null!=this.a&&(clearTimeout(this.a),this.a=null)},$r=et.prototype,$r.o=function(){this.c=!0;var t=this.a.map(function(t){return t.ya.close()["catch"](P),t.ya.closed});return this.j.reject(),this.f&&t.push(this.f.o()),this.l&&t.push(this.l.setMediaKeys(null)["catch"](P)),this.v&&this.v.cancel(),this.f=this.l=this.g=this.m=this.b=this.v=null,this.a=[],this.s=[],this.h=this.i=this.G=null,Promise.all(t)},$r.configure=function(t){this.i=t},$r.init=function(t,e){var i={},n=[];return this.C=e,this.s=t.offlineSessionIds,at(this,t,e||0<t.offlineSessionIds.length,i,n),n.length?ot(this,i,n):(this.A=!0,Promise.resolve())},$r.keySystem=function(){return this.b?this.b.keySystem:""},$r.ec=function(t){for(var e=new Uint8Array(t.initData),i=0;i<this.a.length;++i)if(tt(e,this.a[i].initData))return;dt(this,t.initDataType,e)},$r.wb=function(t){var e=t.target,i=M([this.b.licenseServerUri],this.i.retryParameters);i.body=t.message,i.method="POST","com.microsoft.playready"==this.b.keySystem&&pt(i),this.G.request(2,i).then(function(t){return this.c?Promise.reject():e.update(t.data)}.bind(this),function(t){return this.c?Promise.resolve():void this.h(new S(6,6007,t))}.bind(this))["catch"](function(t){return this.c?Promise.resolve():void this.h(new S(6,6008,t.message))}.bind(this))},$r.rb=function(t){t=t.target;var e;for(e=0;e<this.a.length&&this.a[e].ya!=t;++e);if(e!=this.a.length){var i=t.keyStatuses,n=!1;i.forEach||(i=[]),i.forEach(function(t,i){if("string"==typeof i){var r=i;i=t,t=r}if("com.microsoft.playready"==this.b.keySystem&&16==i.byteLength){var r=new DataView(i),s=r.getUint32(0,!0),a=r.getUint16(4,!0),o=r.getUint16(6,!0);r.setUint32(0,s,!1),r.setUint16(4,a,!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.j.resolve()),"expired"==t&&(n=!0),r=Q(new Uint8Array(i)),this.w[r]=t}.bind(this)),i=t.expiration-Date.now(),(0>i||n&&1e3>i)&&(this.a.splice(e,1),t.close()),W(this.v)}},$r.yc=function(){V(this.w,function(t,e){return"expired"==e})&&this.h(new S(6,6014)),this.J(this.w)};var is={},ns={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){ns[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){is[t]=e});var rs={};e("shaka.media.TextEngine.registerParser",function(t,e){rs[t]=e}),e("shaka.media.TextEngine.unregisterParser",function(t){delete rs[t]}),e("shaka.media.TextEngine.makeCue",vt);var ss=t.VTTCue||t.TextTrackCue;gt.prototype.o=function(){return this.c&&St(this,function(){return!0}),this.c=this.h=null,Promise.resolve()},gt.prototype.remove=function(t,e){return Promise.resolve().then(function(){this.c&&(St(this,function(i){return!(i.startTime>=e||i.endTime<=t)}),null==this.b||e<=this.b||t>=this.a||(t<=this.b&&e>=this.a?this.b=this.a=null:t<=this.b&&e<this.a?this.b=e:t>this.b&&e>=this.a&&(this.a=t)))}.bind(this))},$r=Pt.prototype,$r.o=function(){this.i=!0;var t,e=[];for(t in this.a){var i=this.a[t],n=i[0];for(this.a[t]=i.slice(0,1),n&&e.push(n.p["catch"](P)),n=1;n<i.length;++n)i[n].p["catch"](P),i[n].p.reject()}return this.b&&e.push(this.b.o()),Promise.all(e).then(function(){this.g.o(),this.b=this.j=this.h=this.f=this.g=null,this.c={},this.a={}}.bind(this))},$r.init=function(t,e){for(var i in t){var n=t[i];"text"==i?this.b=new gt(this.j,n,e):(n=this.h.addSourceBuffer(n),L(this.g,n,"error",this.Uc.bind(this,i)),L(this.g,n,"updateend",this.va.bind(this,i)),this.c[i]=n,this.a[i]=[])}},$r.remove=function(t,e,i){return"text"==t?this.b.remove(e,i):Dt(this,t,this.Bb.bind(this,t,e,i))},$r.endOfStream=function(t){return Ot(this,function(){t?this.h.endOfStream(t):this.h.endOfStream()}.bind(this))},$r.za=function(t){return Ot(this,function(){this.h.duration=t}.bind(this))},$r.da=function(){return this.h.duration},$r.Tc=function(t,e){this.c[t].appendBuffer(e)},$r.Bb=function(t,e,i){i<=e?this.va(t):this.c[t].remove(e,i)},$r.Lb=function(t){var e=this.c[t].appendWindowEnd;this.c[t].abort(),this.c[t].appendWindowEnd=e,this.va(t)},$r.Ub=function(t){this.f.currentTime-=.001,this.va(t)},$r.Jc=function(t,e){this.c[t].timestampOffset=e,this.va(t)},$r.Hc=function(t,e){this.c[t].appendWindowEnd=e+.04,this.va(t)},$r.Uc=function(t){this.a[t][0].p.reject(new S(3,3014,this.f.error?this.f.error.code:0))},$r.va=function(t){var e=this.a[t][0];e&&(e.p.resolve(),Lt(this,t))},e("shaka.media.InitSegmentReference",jt),e("shaka.media.SegmentReference",Ut),e("shaka.media.PresentationTimeline",Bt),Bt.prototype.da=function(){return this.a},Bt.prototype.getDuration=Bt.prototype.da,Bt.prototype.za=function(t){this.a=t},Bt.prototype.setDuration=Bt.prototype.za,Bt.prototype.Fb=function(t){this.g=t},Bt.prototype.setClockOffset=Bt.prototype.Fb,Bt.prototype.Ib=function(t){this.h=t},Bt.prototype.setStatic=Bt.prototype.Ib,Bt.prototype.Xb=function(){return this.c},Bt.prototype.getSegmentAvailabilityDuration=Bt.prototype.Xb,Bt.prototype.Hb=function(t){this.c=t},Bt.prototype.setSegmentAvailabilityDuration=Bt.prototype.Hb,Bt.prototype.Fa=function(t,e){e.length&&(this.b=e.reduce(function(t,e){return Math.max(t,e.endTime-e.startTime)},this.b),t||(this.f=Math.max(this.f,e[0].startTime)))},Bt.prototype.notifySegments=Bt.prototype.Fa,Bt.prototype.Ya=function(t){this.b=Math.max(this.b,t)},Bt.prototype.notifyMaxSegmentDuration=Bt.prototype.Ya,Bt.prototype.U=function(){return 1/0==this.a&&!this.h},Bt.prototype.isLive=Bt.prototype.U,Bt.prototype.fa=function(){return 1/0!=this.a&&!this.h},Bt.prototype.isInProgress=Bt.prototype.fa,Bt.prototype.ra=function(){return Math.max(Math.min(this.f,this.ea()),this.sa())},Bt.prototype.getEarliestStart=Bt.prototype.ra,Bt.prototype.sa=function(){return 1/0==this.c?0:Math.max(0,this.ea()-this.c-this.i)},Bt.prototype.getSegmentAvailabilityStart=Bt.prototype.sa,Bt.prototype.ea=function(){return this.U()||this.fa()?Math.min(Math.max(0,(Date.now()+this.g)/1e3-this.b-this.j),this.a):this.a},Bt.prototype.getSegmentAvailabilityEnd=Bt.prototype.ea,Bt.prototype.Ua=function(){return Math.max(0,this.ea()-(this.U()||this.fa()?this.i:0))},Bt.prototype.getSeekRangeEnd=Bt.prototype.Ua,$r=Ft.prototype,$r.o=function(){var e=this.b.o();return this.b=null,Gt(this),null!=this.f&&(t.clearInterval(this.f),this.f=null),this.m=this.l=this.c=this.a=null,e},$r.pc=function(){this.i=null,Ht(this);var t=kt(this.a.buffered,this.a.currentTime),e=Tt(this.a.buffered)>=this.a.duration-.05||this.a.ended;this.h?(e||t>=this.j)&&qt(this,!1):!e&&.5>t&&qt(this,!0)},$r.Ta=function(){return this.g},$r.lc=function(){this.a.playbackRate!=(this.h||0>this.g?0:this.g)&&zt(this,this.a.playbackRate)},$r.sb=function(){this.b.ja(this.a,"loadedmetadata");var t=Vt(this);.001>Math.abs(this.a.currentTime-t)?(L(this.b,this.a,"seeking",this.ub.bind(this)),L(this.b,this.a,"playing",this.tb.bind(this))):(L(this.b,this.a,"seeking",this.nc.bind(this)),this.a.currentTime=t)},$r.nc=function(){this.b.ja(this.a,"seeking"),L(this.b,this.a,"seeking",this.ub.bind(this)),L(this.b,this.a,"playing",this.tb.bind(this))},$r.ub=function(){var t=this.a.currentTime,e=$t(this,t);.001<Math.abs(e-t)?Yt(this,t,e):this.m()},$r.tb=function(){var t=this.a.currentTime,e=$t(this,t);.001<Math.abs(e-t)&&Yt(this,t,e)};var as=1,os=2,us={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"};oe.prototype.o=function(){for(var t in this.b)Me(this.b[t]);return this.h=this.b=this.l=this.g=this.A=this.w=this.j=this.v=this.G=this.C=this.a=this.S=this.c=this.m=null,this.f=!0,Promise.resolve()},oe.prototype.configure=function(t){this.h=t,this.m.j=this.i*Math.max(this.a.minBufferTime||0,this.h.rebufferingGoal)},oe.prototype.init=function(){var t=this.G(this.a.periods[Ie(this,Kt(this.m))]);return B(t)?Promise.reject(new S(5,5005)):fe(this,t).then(function(){this.w&&this.w()}.bind(this))},oe.prototype.X=function(t){if(!this.f&&!t.ga&&null!=t.$&&!t.aa)if(t.$=null,t.la)Ne(this,t,t.Pa);else{try{var e=ye(this,t);null!=e&&Ce(this,t,e)}catch(i){return void this.j(i)}e=F(this.b),Pe(this,t),e.every(function(t){return t.endOfStream})&&this.c.endOfStream()}},xe.prototype.then=function(t){ +return this.a=this.a.then(t).then(function(t){return this.c?(this.g(),Promise.reject(this.i)):Promise.resolve(t)}.bind(this)),this},xe.prototype.cancel=function(t){return this.b?Promise.resolve():(this.c=!0,this.i=t,this.h)},Le.prototype.preventDefault=function(){},Le.prototype.stopImmediatePropagation=function(){this.a=!0},Le.prototype.stopPropagation=function(){},e("shaka.util.FakeEventTarget",je),je.prototype.addEventListener=function(t,e){this.Aa.push(t,e)},je.prototype.addEventListener=je.prototype.addEventListener,je.prototype.removeEventListener=function(t,e){this.Aa.remove(t,e)},je.prototype.removeEventListener=je.prototype.removeEventListener,je.prototype.dispatchEvent=function(t){for(var e=this.Aa.get(t.type)||[],i=0;i<e.length;++i){t.target=this.S,t.currentTarget=this.S;var n=e[i];try{n.handleEvent?n.handleEvent(t):n.call(this,t)}catch(r){}if(t.a)break}return t.defaultPrevented},je.prototype.dispatchEvent=je.prototype.dispatchEvent,i(Ue),e("shaka.Player",Ue),Ue.prototype.o=function(){this.A=!0;var t=Promise.resolve();return this.l&&(t=this.l.cancel(new S(7,7e3))),t.then(function(){var t=Promise.all([Ke(this),this.w?this.w.o():null,this.i?this.i.o():null]);return this.a=this.i=this.Ja=this.w=this.s=this.f=null,t}.bind(this))},Ue.prototype.destroy=Ue.prototype.o,Ue.version="v2.0.2";var hs={};Ue.registerSupportPlugin=function(t,e){hs[t]=e},Ue.isBrowserSupported=function(){return!!(t.Promise&&t.Uint8Array&&Array.prototype.forEach&&t.MediaSource&&t.MediaKeys&&t.navigator&&t.navigator.requestMediaKeySystemAccess&&t.MediaKeySystemAccess&&t.MediaKeySystemAccess.prototype.getConfiguration)},Ue.probeSupport=function(){return mt().then(function(t){var e=yt(),i=At();t={manifest:e,media:i,drm:t};for(var n in hs)t[n]=hs[n]();return t})},Ue.prototype.load=function(t,e,i){var n=this.hb(),r=new xe;return this.l=r,this.dispatchEvent(new Le("loading")),De(r.then(function(){return n}).then(function(){return bt(t,this.i,this.a.manifest.retryParameters,i)}.bind(this)).then(function(e){return this.m=new e,this.m.configure(this.a.manifest),this.m.start(t,this.i,this.Na.bind(this),this.Z.bind(this),this.Lc.bind(this))}.bind(this)).then(function(e){if(0==e.periods.length)throw new S(4,4014);return this.c=e,this.na=t,this.g=new et(this.i,this.Z.bind(this),this.Mc.bind(this)),this.g.configure(this.a.drm),this.g.init(e,!1)}.bind(this)).then(function(){return this.c.periods.forEach(this.Na.bind(this)),this.X=Date.now()/1e3,Promise.all([it(this.g,this.f),this.oa])}.bind(this)).then(function(){return this.j=new Ft(this.f,this.c.presentationTimeline,1*Math.max(this.c.minBufferTime||0,this.a.streaming.rebufferingGoal),e||null,this.Jb.bind(this),this.Nc.bind(this)),this.G=new Pt(this.f,this.h,this.s),this.b=new oe(this.j,this.G,this.i,this.c,this.Kc.bind(this),this.Nb.bind(this),this.Z.bind(this)),this.b.configure(this.a.streaming),this.b.init()}.bind(this)).then(function(){this.c.periods.forEach(this.Na.bind(this)),We(this),Ye(this),this.a.abr.manager.init(this.fb.bind(this)),this.l=null}.bind(this)))["catch"](function(t){return this.l==r&&(this.l=null,this.dispatchEvent(new Le("unloading"))),Promise.reject(t)}.bind(this))},Ue.prototype.load=Ue.prototype.load,Ue.prototype.configure=function(t){t.abr&&t.abr.manager&&t.abr.manager!=this.a.abr.manager&&(this.a.abr.manager.stop(),t.abr.manager.init(this.fb.bind(this))),Oe(this.a,t,qe(this),Ve(),""),Fe(this)},Ue.prototype.configure=Ue.prototype.configure,Ue.prototype.getConfiguration=function(){var t=qe(this);return Oe(t,this.a,qe(this),Ve(),""),t},Ue.prototype.getConfiguration=Ue.prototype.getConfiguration,Ue.prototype.Dc=function(){var t=qe(this);t.abr&&t.abr.manager&&t.abr.manager!=this.a.abr.manager&&(this.a.abr.manager.stop(),t.abr.manager.init(this.fb.bind(this))),this.a=qe(this),Fe(this)},Ue.prototype.resetConfiguration=Ue.prototype.Dc,Ue.prototype.nb=function(){return this.i},Ue.prototype.getNetworkingEngine=Ue.prototype.nb,Ue.prototype.Vb=function(){return this.na},Ue.prototype.getManifestUri=Ue.prototype.Vb,Ue.prototype.U=function(){return!!this.c&&this.c.presentationTimeline.U()},Ue.prototype.isLive=Ue.prototype.U,Ue.prototype.fa=function(){return!!this.c&&this.c.presentationTimeline.fa()},Ue.prototype.isInProgress=Ue.prototype.fa,Ue.prototype.Fc=function(){var t=0,e=0;return this.c&&(e=this.c.presentationTimeline,t=e.sa(),e=e.Ua()),{start:t,end:e}},Ue.prototype.seekRange=Ue.prototype.Fc,Ue.prototype.keySystem=function(){return this.g?this.g.keySystem():""},Ue.prototype.keySystem=Ue.prototype.keySystem,Ue.prototype.drmInfo=function(){return this.g?this.g.b:null},Ue.prototype.drmInfo=Ue.prototype.drmInfo,Ue.prototype.Zb=function(){return this.Ca},Ue.prototype.isBuffering=Ue.prototype.Zb,Ue.prototype.hb=function(){if(this.A)return Promise.resolve();if(this.dispatchEvent(new Le("unloading")),this.l){var t=new S(7,7e3);return this.l.cancel(t).then(this.Cb.bind(this))}return this.Cb()},Ue.prototype.unload=Ue.prototype.hb,Ue.prototype.Ta=function(){return this.j?this.j.Ta():0},Ue.prototype.getPlaybackRate=Ue.prototype.Ta,Ue.prototype.Zc=function(t){this.j&&zt(this.j,t)},Ue.prototype.trickPlay=Ue.prototype.Zc,Ue.prototype.Ob=function(){this.j&&zt(this.j,1)},Ue.prototype.cancelTrickPlay=Ue.prototype.Ob,Ue.prototype.getTracks=function(){if(!this.b)return[];var t=he(this.b);return te(ue(this.b),t).filter(function(t){return 0>this.ma.indexOf(t.id)}.bind(this))},Ue.prototype.getTracks=Ue.prototype.getTracks,Ue.prototype.Gc=function(t,e){if(this.b){var i=ee(ue(this.b),t);if(i){var n=i.stream;n.allowedByApplication&&n.allowedByKeySystem&&(this.C.push({timestamp:Date.now()/1e3,id:n.id,type:t.type,fromAdaptation:!1}),i={},i[t.type]=n,"text"!=t.type&&(n=he(this.b).text,this.configure({abr:{enabled:!1}}),i.text=n),He(this,i,e))}}},Ue.prototype.selectTrack=Ue.prototype.Gc,Ue.prototype.bc=function(){return"showing"==this.s.mode},Ue.prototype.isTextTrackVisible=Ue.prototype.bc,Ue.prototype.Ic=function(t){this.s.mode=t?"showing":"hidden",Xe(this)},Ue.prototype.setTextTrackVisibility=Ue.prototype.Ic,Ue.prototype.getStats=function(){Ge(this);var t={},e={},i=this.f&&this.f.getVideoPlaybackQuality?this.f.getVideoPlaybackQuality():{};return this.b&&(e=he(this.b),t=e.video||{},e=e.audio||{}),{width:t.width||0,height:t.height||0,streamBandwidth:t.bandwidth+e.bandwidth||0,decodedFrames:Number(i.totalVideoFrames),droppedFrames:Number(i.droppedVideoFrames),estimatedBandwidth:this.a.abr.manager.getBandwidthEstimate(),playTime:this.pa,bufferingTime:this.J,switchHistory:this.C.slice(0)}},Ue.prototype.getStats=Ue.prototype.getStats,Ue.prototype.addTextTrack=function(t,e,i,n,r){if(!this.b)return Promise.reject();for(var s,a=ue(this.b),o=0;o<this.c.periods.length;o++)if(this.c.periods[o]==a){if(o==this.c.periods.length-1){if(s=this.c.presentationTimeline.da()-a.startTime,1/0==s)return Promise.reject()}else s=this.c.periods[o+1].startTime-a.startTime;break}var u={id:this.Qa++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1!=e?null:new Ut(1,0,s,function(){return[t]},0,null)},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:r||"",bandwidth:0,kind:i,encrypted:!1,keyId:null,language:e,allowedByApplication:!0,allowedByKeySystem:!0};return n={language:e,type:"text",primary:!1,drmInfos:[],streams:[u]},this.ma.push(u.id),a.streamSets.push(n),ce(this.b,u).then(function(){if(!this.A)return this.ma.splice(this.ma.indexOf(u.id),1),$e(this,a),We(this),{id:u.id,active:!1,type:"text",bandwidth:0,language:e,kind:i,width:null,height:null}}.bind(this))},Ue.prototype.addTextTrack=Ue.prototype.addTextTrack,Ue.prototype.Gb=function(t,e){this.Ba.width=t,this.Ba.height=e},Ue.prototype.setMaxHardwareResolution=Ue.prototype.Gb,$r=Ue.prototype,$r.Cb=function(){return this.m?Ke(this).then(function(){this.A||(this.Jb(!1),this.oa=Be(this))}.bind(this)):Promise.resolve()},$r.Na=function(t){var e=this.b?he(this.b):{};Qt(this.g,e,t),e=t.streamSets.some(ie),Zt(t,this.a.restrictions,this.Ba)&&!this.l&&We(this),t=!t.streamSets.some(ie),e?t&&this.Z(new S(4,4012)):this.Z(new S(4,4011))},$r.Oc=function(t,e,i){this.a.abr.manager.segmentDownloaded(t,e,i)},$r.Jb=function(t){Ge(this),this.Ca=t,this.dispatchEvent(new Le("buffering",{buffering:t}))},$r.Nc=function(){if(this.b){var t,e=this.b;for(t in e.b){var i=e.b[t];i.aa||0<_t(e.c,t,Kt(e.m))||i.la||(i.ga?i.la=!0:null==It(e.c,t)?null==i.$&&Ce(e,i,0):(Me(i),Ne(e,i,!1)))}}},$r.Kc=function(t){this.qa=!0,this.a.abr.manager.disable(),t=ne(t,this.a),t=ze(this,t,!0);for(var e in this.v)t[e]=this.v[e].stream;this.v={};for(e in t)this.C.push({timestamp:Date.now()/1e3,id:t[e].id,type:e,fromAdaptation:!0});return this.l||We(this),t},$r.Nb=function(){this.qa=!1,this.a.abr.enabled&&this.a.abr.manager.enable();for(var t in this.v){var e=this.v[t];le(this.b,t,e.stream,e.Rb)}this.v={}},$r.fb=function(t,e){var i,n=he(this.b);for(i in t){var r=t[i];n[i]!=r?this.C.push({timestamp:Date.now()/1e3,id:r.id,type:i,fromAdaptation:!0}):delete t[i]}if(!B(t)&&this.b){for(i in t)le(this.b,i,t[i],e||!1);Ye(this)}},$r.Z=function(t){this.dispatchEvent(new Le("error",{detail:t}))},$r.Lc=function(t){this.dispatchEvent(t)},$r.oc=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.Z(new S(3,3016,t,e))}}},$r.Mc=function(t){var e=["output-restricted","internal-error"],i=ue(this.b),n=!1;i.streamSets.forEach(function(i){i.streams.forEach(function(i){var r=i.allowedByKeySystem;i.keyId&&i.keyId in t&&(i.allowedByKeySystem=0>e.indexOf(t[i.keyId])),r!=i.allowedByKeySystem&&(n=!0)})}),$e(this,i),n&&We(this)};var cs="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),ls="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),fs=["loop","playbackRate"],ds=["pause","play"],ps=["adaptation","buffering","error","texttrackvisibility","trackschanged"],ms="getConfiguration getManifestUri getPlaybackRate getTracks getStats isBuffering isLive isTextTrackVisible seekRange".split(" "),ys=[["getConfiguration","configure"]],bs=[["isTextTrackVisible","setTextTrackVisibility"]],gs="configure resetConfiguration trickPlay cancelTrickPlay selectTrack setTextTrackVisibility addTextTrack".split(" "),vs=["load","unload"];$r=ti.prototype,$r.o=function(){return ei(this),this.a&&(this.a.stop(function(){},function(){}),this.a=null),this.A=this.w=this.l=null,this.f=this.j=this.g=!1,this.h=this.c=this.b=this.a=this.i=null,Promise.resolve()},$r.N=function(){return this.f},$r.ab=function(){return this.v},$r.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.g=!0,this.l();var e=new chrome.cast.SessionRequest(this.C),e=new chrome.cast.ApiConfig(e,this.fc.bind(this),this.mc.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){})}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},$r.cb=function(t){this.i=t,this.f&&ii(this,{type:"appData",appData:this.i})},$r.cast=function(t){return this.g?this.j?this.f?Promise.reject(new S(8,8002)):(this.h=new R,chrome.cast.requestSession(this.Za.bind(this,t),this.pb.bind(this)),this.h):Promise.reject(new S(8,8001)):Promise.reject(new S(8,8e3))},$r.get=function(t,e){if("video"==t){if(0<=ds.indexOf(e))return this.Ab.bind(this,t,e)}else if("player"==t){if(0<=gs.indexOf(e))return this.Ab.bind(this,t,e);if(0<=vs.indexOf(e))return this.Bc.bind(this,t,e);if(0<=ms.indexOf(e))return this.xb.bind(this,t,e)}return this.xb(t,e)},$r.set=function(t,e,i){this.b[t][e]=i,ii(this,{type:"set",targetName:t,property:e,value:i})},$r.Za=function(t,e){this.a=e,this.a.addUpdateListener(this.qb.bind(this)),this.a.addMessageListener("urn:x-cast:com.google.shaka.v2",this.gc.bind(this)),this.qb(),ii(this,{type:"init",initState:t,appData:this.i}),this.h.resolve()},$r.pb=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.h.reject(new S(8,e,t))},$r.xb=function(t,e){return this.b[t][e]},$r.Ab=function(t,e){ii(this,{type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},$r.Bc=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new R,r=this.m.toString();return this.m++,this.c[r]=n,ii(this,{type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},$r.fc=function(t){var e=this.s();this.h=new R,this.Za(e,t)},$r.mc=function(t){this.j="available"==t,this.l()},$r.qb=function(){var t=!!this.a&&"connected"==this.a.status;if(this.f&&!t){this.A();for(var e in this.b)this.b[e]={};ei(this)}this.v=(this.f=t)?this.a.receiver.friendlyName:"",this.l()},$r.gc=function(t,e){var i=Ze(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.w(n,new Le(r.type,r));break;case"update":r=i.update;for(n in r){var s,i=this.b[n]||{};for(s in r[n])i[s]=r[n][s]}break;case"asyncComplete":if(n=i.id,s=i.error,i=this.c[n],delete this.c[n],i)if(s){n=new S(s.category,s.code);for(r in s)n[r]=s[r];i.reject(n)}else i.resolve()}},i(ni),e("shaka.cast.CastProxy",ni),ni.prototype.o=function(){var t=[this.i?this.i.o():null,this.b?this.b.o():null,this.a?this.a.o():null];return this.a=this.i=this.j=this.l=this.b=this.c=null,Promise.all(t)},ni.prototype.destroy=ni.prototype.o,ni.prototype.Yb=function(){return this.l},ni.prototype.getVideo=ni.prototype.Yb,ni.prototype.Wb=function(){return this.j},ni.prototype.getPlayer=ni.prototype.Wb,ni.prototype.Mb=function(){return!!this.a&&(this.a.g&&this.a.j)},ni.prototype.canCast=ni.prototype.Mb,ni.prototype.N=function(){return!!this.a&&this.a.N()},ni.prototype.isCasting=ni.prototype.N,ni.prototype.ab=function(){return this.a?this.a.ab():""},ni.prototype.receiverName=ni.prototype.ab,ni.prototype.cast=function(){var t=this.mb();return this.a.cast(t).then(function(){return this.b.hb()}.bind(this))},ni.prototype.cast=ni.prototype.cast,ni.prototype.cb=function(t){this.a.cb(t)},ni.prototype.setAppData=ni.prototype.cb,ni.prototype.Xc=function(){var t=this.a;if(t.f){var e=t.s();chrome.cast.requestSession(t.Za.bind(t,e),t.pb.bind(t))}},ni.prototype.suggestDisconnect=ni.prototype.Xc,$r=ni.prototype,$r.mb=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.na,startTime:null};return this.c.pause(),fs.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),ys.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),bs.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},$r.Pc=function(){this.dispatchEvent(new Le("caststatuschanged"))},$r.Rc=function(){ys.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 Le("error",{detail:t}))}.bind(this)));var s={};fs.forEach(function(t){s[t]=this.a.get("video",t)}.bind(this)),i.then(function(){fs.forEach(function(t){this.c[t]=s[t]}.bind(this)),bs.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))},$r.bd=function(t){if("addEventListener"==t)return this.g.addEventListener.bind(this.g);if("removeEventListener"==t)return this.g.removeEventListener.bind(this.g);if(this.a.N()&&!Object.keys(this.a.b.video).length){var e=this.c[t];if("function"!=typeof e)return e}return this.a.N()?this.a.get("video",t):(e=this.c[t],"function"==typeof e&&(e=e.bind(this.c)),e)},$r.dd=function(t,e){this.a.N()?this.a.set("video",t,e):this.c[t]=e},$r.cd=function(t){this.a.N()||this.g.dispatchEvent(new Le(t.type,t))},$r.wc=function(t){return"addEventListener"==t?this.f.addEventListener.bind(this.f):"removeEventListener"==t?this.f.removeEventListener.bind(this.f):"getNetworkingEngine"==t?this.b.nb.bind(this.b):this.a.N()&&!Object.keys(this.a.b.video).length&&0<=ms.indexOf(t)||!this.a.N()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},$r.xc=function(t){this.a.N()||this.f.dispatchEvent(t)},$r.Qc=function(t,e){this.a.N()&&("video"==t?this.g.dispatchEvent(e):"player"==t&&this.f.dispatchEvent(e))},i(si),e("shaka.cast.CastReceiver",si),si.prototype.$b=function(){return this.i},si.prototype.isConnected=si.prototype.$b,si.prototype.ac=function(){return this.c},si.prototype.isIdle=si.prototype.ac,si.prototype.o=function(){var e=this.a?this.a.o():Promise.resolve();return null!=this.f&&t.clearTimeout(this.f),this.l=this.j=this.a=this.b=null,this.i=!1,this.c=!0,this.f=this.g=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},si.prototype.destroy=si.prototype.o,$r=si.prototype,$r.vb=function(){this.i=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,oi(this)},$r.yb=function(t,e){this.$a(),hi(this,{type:"event",targetName:t,event:e})},$r.$a=function(){null!=this.f&&t.clearTimeout(this.f),this.f=t.setTimeout(this.$a.bind(this),500);var e={video:{},player:{}};ls.forEach(function(t){e.video[t]=this.b[t]}.bind(this)),ms.forEach(function(t){e.player[t]=this.a[t]()}.bind(this));var i=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();i&&(e.video.volume=i.level,e.video.muted=i.muted),hi(this,{type:"update",update:e})},$r.Tb=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&hi(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}}),hi(this,{type:"event",targetName:"video",event:{type:"volumechange"}})},$r.hc=function(t){var e=Ze(t.data);switch(e.type){case"init":ui(this,e.initState,e.appData),this.$a();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.Eb.bind(this,t,e,null),this.Eb.bind(this,t,e))}},$r.Eb=function(t,e,i){hi(this,{type:"asyncComplete",id:e,error:i},t)};var ws={"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"},Es=1/15,Ss=1;e("shaka.media.SegmentIndex",Gi),Gi.prototype.o=function(){return this.a=null,Promise.resolve()},Gi.prototype.destroy=Gi.prototype.o,Gi.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 null},Gi.prototype.find=Gi.prototype.find,Gi.prototype.get=function(t){return this.a.length?(t-=this.a[0].position,0>t||t>=this.a.length?null:this.a[t]):null},Gi.prototype.get=Gi.prototype.get,Gi.prototype.Xa=function(t){for(var e=[],i=0,n=0;i<this.a.length&&n<t.length;){var r=this.a[i],s=t[n];r.startTime<s.startTime?(e.push(r),i++):(r.startTime>s.startTime||(.1<Math.abs(r.endTime-s.endTime)?e.push(s):e.push(r),i++),n++)}for(;i<this.a.length;)e.push(this.a[i++]);if(e.length)for(i=e[e.length-1].position+1;n<t.length;)s=t[n++],s=new Ut((i++),s.startTime,s.endTime,s.a,s.L,s.D),e.push(s);else e=t;this.a=e},Gi.prototype.merge=Gi.prototype.Xa,Gi.prototype.Sa=function(t){for(var e=0;e<this.a.length&&!(this.a[e].endTime>t);++e);this.a.splice(0,e)},Gi.prototype.evict=Gi.prototype.Sa;var Ts;e("shaka.dash.DashParser",dn),$r=dn.prototype,$r.configure=function(t){this.c=t},$r.start=function(t,e,i,n,r){return this.h=[t],this.a=e,this.j=i,this.l=n,this.m=r,pn(this).then(function(){return this.a&&bn(this,0),this.b}.bind(this))},$r.stop=function(){return this.a&&this.a.Kb(this.Ka),this.c=this.m=this.l=this.j=this.a=null,this.h=[],this.b=null,this.g=[],this.i={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},$r.uc=function(t,e){t.P=gn(e,t.K,null);var i=!1,n=li(e,"Role"),r=void 0;"text"==t.P.contentType&&(r="subtitle");for(var s=0;s<n.length;s++){var a=n[s].getAttribute("schemeIdUri");if(null==a||"urn:mpeg:dash:role:2011"==a)switch(a=n[s].getAttribute("value")){case"main":i=!0;break;case"caption":case"subtitle":r=a}}var n=!!ci(e,"InbandEventStream"),o=[];li(e,"SupplementalProperty").forEach(function(t){var e=t.getAttribute("schemeIdUri");("urn:mpeg:dash:adaptation-set-switching:2016"==e||"http://dashif.org/guidelines/AdaptationSetSwitching"==e||"http://dashif.org/descriptor/AdaptationSetSwitching"==e)&&(t=t.getAttribute("value"))&&o.push.apply(o,t.split(","))});var u=null;if(li(e,"EssentialProperty").forEach(function(t){"http://dashif.org/guidelines/trickmode"==t.getAttribute("schemeIdUri")&&(u=t.getAttribute("value"))}),null!=u)return null;if(s=li(e,"ContentProtection"),s=Ei(s,this.c.dash.customScheme),a=Jt(e.getAttribute("lang")||"und"),r=li(e,"Representation").map(this.vc.bind(this,t,s,r,a)).filter(function(t){return!!t}),!r.length)throw new S(4,4003);return t.P.contentType||(t.P.contentType=Tn(r[0].mimeType,r[0].codecs)),{id:t.P.id||"__fake__"+this.v++,contentType:t.P.contentType,language:a,cc:i,streams:r,drmInfos:s.drmInfos,Yc:o,ba:n}},$r.vc=function(t,e,i,n,r){if(t.u=gn(r,t.P,null),!wn(t.u))return null;t.bandwidth=di(r,"bandwidth",gi)||void 0;var s;if(s=this.Cc.bind(this),t.u.Ga)s=tn(t,s);else if(t.u.Y)s=rn(t,this.i);else if(t.u.Ha)s=un(t,s,this.i,!!this.b);else{var a=t.u.M,o=t.H.duration||0;s={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0<=t&&t<o?1:null},getSegmentReference:function(t){return 1!=t?null:new Ut(1,0,o,function(){return a},0,null)},initSegmentReference:null,presentationTimeOffset:0}}return r=li(r,"ContentProtection"),r=Si(r,this.c.dash.customScheme,e),{id:this.v++,createSegmentIndex:s.createSegmentIndex,findSegmentPosition:s.findSegmentPosition,getSegmentReference:s.getSegmentReference,initSegmentReference:s.initSegmentReference,presentationTimeOffset:s.presentationTimeOffset,mimeType:t.u.mimeType,codecs:t.u.codecs,frameRate:t.u.frameRate,bandwidth:t.bandwidth,width:t.u.width,height:t.u.height,kind:i,encrypted:0<e.drmInfos.length,keyId:r,language:n,allowedByApplication:!0,allowedByKeySystem:!0}},$r.Sc=function(){this.f=null;var t=Date.now();pn(this).then(function(){this.a&&bn(this,(Date.now()-t)/1e3)}.bind(this))["catch"](function(t){this.l(t),this.a&&bn(this,0)}.bind(this))},$r.Cc=function(t,e,i){return t=M(t,this.c.retryParameters),null!=e&&(t.headers.Range="bytes="+e+"-"+(null!=i?i:"")),this.a.request(1,t).then(function(t){return t.data})},$r.Ka=function(t,e){if(1==t){var i=new Mi(new DataView(e.data)),n=Vi(1701671783,i);if(-1!=n){var r=i.a-8+n;if(Bi(i,4),n=Fi(i),"urn:mpeg:dash:event:2012"==n)pn(this);else{var s=Fi(i),a=Li(i),o=Li(i),u=Li(i),h=Li(i),i=Ui(i,r-i.a);this.m(new Le("emsg",{detail:{ld:n,value:s,Ia:a,kd:o,hd:u,id:h,jd:i}}))}}}},ns.mpd=dn,is["application/dash+xml"]=dn,e("shaka.media.TtmlTextParser",kn),kn.m=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,kn.v=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,kn.s=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,kn.w=/^(\d*\.?\d*)f$/,kn.C=/^(\d*\.?\d*)t$/,kn.A=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,kn.l=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,kn.Ja={left:"start",center:"center",right:"end",start:"start",end:"end"},kn.Qa={left:"line-left",center:"center",right:"line-right"},kn.b=function(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=kn.b(i[n]),e=e.concat(r))}return e.length||e.push(t),e},kn.g=function(t){t=t.childNodes;for(var e=0;e<t.length;e++)"br"==t[e].nodeName&&0<e?t[e-1].textContent+="\n":0<t[e].childNodes.length&&kn.g(t[e])},kn.c=function(t,e,i,n,r){if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&""==t.textContent)return null;kn.g(t);var s=kn.a(t.getAttribute("begin"),i),a=kn.a(t.getAttribute("end"),i);i=kn.a(t.getAttribute("dur"),i);var o=t.textContent;if(null==a&&null!=i&&(a=s+i),null==s||null==a)throw new S(2,2001);return(e=vt(s+e,a+e,o))?(r=kn.i(t,"region",r),kn.oa(e,t,r,n),e):null},kn.oa=function(t,e,i,n){var r,s=kn.f(e,i,n,"tts:extent");s&&(r=kn.l.exec(s))&&(t.size=Number(r[1])),r=kn.f(e,i,n,"tts:writingMode"),s=!0,"tb"==r||"tblr"==r?t.vertical="lr":"tbrl"==r?t.vertical="rl":s=!1,(r=kn.f(e,i,n,"tts:origin"))&&(r=kn.l.exec(r))&&(s?(t.position=Number(r[2]),t.line=Number(r[1])):(t.position=Number(r[1]),t.line=Number(r[2])),t.snapToLines=!1),(e=kn.f(e,i,n,"tts:textAlign"))&&(t.align=e,"center"==e&&("center"!=t.align&&(t.align="middle"),t.position="auto"),t.positionAlign=kn.Qa[e],t.lineAlign=kn.Ja[e])},kn.f=function(t,e,i,n){for(var r=kn.b(e),s=0;s<r.length;s++){var a=r[s].getAttribute(n);if(a)return a}return r=kn.i,(t=r(e,"style",i)||r(t,"style",i))?t.getAttribute(n):null},kn.i=function(t,e,i){if(!t||1>i.length)return null;var n=null;if(t=kn.pa(t,e))for(e=0;e<i.length;e++)if(i[e].getAttribute("xml:id")==t){n=i[e];break}return n},kn.pa=function(t,e){for(var i=null;t&&!(i=t.getAttribute(e));){var n=t.parentNode;if(!(n instanceof Element))break;t=n}return i},kn.a=function(t,e){var i=null;return kn.m.test(t)?i=kn.qa(e,t):kn.v.test(t)?i=kn.h(kn.v,t):kn.s.test(t)?i=kn.h(kn.s,t):kn.w.test(t)?i=kn.Ba(e,t):kn.C.test(t)?i=kn.Ca(e,t):kn.A.test(t)&&(i=kn.h(kn.A,t)),i},kn.Ba=function(t,e){var i=kn.w.exec(e);return Number(i[1])/t.frameRate},kn.Ca=function(t,e){var i=kn.C.exec(e);return Number(i[1])/t.a},kn.qa=function(t,e){var i=kn.m.exec(e),n=Number(i[1]),r=Number(i[2]),s=Number(i[3]),a=Number(i[4]),a=a+(Number(i[5])||0)/t.b,s=s+a/t.frameRate;return s+60*r+3600*n},kn.h=function(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},rs["application/ttml+xml"]=kn,e("shaka.media.Mp4TtmlParser",An),An.S=1937010800,rs['application/mp4; codecs="stpp"']=An,e("shaka.media.VttTextParser",Nn),Nn.c=function(t,e,i,n){if(1==t.length&&!t[0]||/^NOTE($|[ \t])/.test(t[0]))return null;var r=null;0>t[0].indexOf("-->")&&(r=t[0],t.splice(0,1));var s=new In(t[0]),a=Nn.a(s),o=_n(s,/[ \t]+--\x3e[ \t]+/g),u=Nn.a(s);if(null==a||!o||null==u)throw new S(2,2001);if(a+=e,u+=e,n&&(a+=i,u+=i),t=vt(a,u,t.slice(1).join("\n").trim()),!t)return null;for(_n(s,/[ \t]+/gm),e=Rn(s);e;)Nn.j(t,e),_n(s,/[ \t]+/gm),e=Rn(s);return null!=r&&(t.id=r),t},Nn.j=function(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(t.align=i[1],"center"==i[1]&&"center"!=t.align&&(t.position="auto",t.align="middle")):(i=/^vertical:(lr|rl)$/.exec(e))?t.vertical=i[1]:(i=/^size:(\d{1,2}|100)%$/.exec(e))?t.size=Number(i[1]):(i=/^position:(\d{1,2}|100)%(?:,(line-left|line-right|center|start|end))?$/.exec(e))?(t.position=Number(i[1]),i[2]&&(t.positionAlign=i[2])):(i=/^line:(\d{1,2}|100)%(?:,(start|end|center))?$/.exec(e))?(t.snapToLines=!1,t.line=Number(i[1]),i[2]&&(t.lineAlign=i[2])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.snapToLines=!0,t.line=Number(i[1]),i[2]&&(t.lineAlign=i[2]))},Nn.a=function(t){if(t=_n(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g),!t)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)},rs["text/vtt"]=Nn,rs['text/vtt; codecs="vtt"']=Nn,e("shaka.media.Mp4VttParser",Cn),Cn.Aa=function(t,e,i,n){for(t=new Mi(new DataView(t)),i+=e,n+=e,e=[];xi(t);){var r=Vi(Cn.ma,t);if(-1==r)break;(r=Cn.c(Ui(t,r-8).buffer,i,n))&&e.push(r)}return e},Cn.c=function(t,e,i){t=new Mi(new DataView(t));for(var n,r,s;xi(t);){var a=Li(t),o=Li(t),u=q(Ui(t,a-8).buffer);switch(1==a&&ji(t),o){case Cn.J:n=u;break;case Cn.G:s=u;break;case Cn.X:r=u}}if(!n)throw new S(2,2008);if(e=vt(e,i,n),!e)return null;if(s&&(e.id=s),r)for(r=new In(r),s=Rn(r);s;)Nn.j(e,s),_n(r,/[ \t]+/gm),s=Rn(r);return e},Cn.na=2004251764,Cn.ma=1987343459,Cn.J=1885436268,Cn.G=1768187247,Cn.X=1937011815,rs['application/mp4; codecs="wvtt"']=Cn,e("shaka.net.DataUriPlugin",Mn),es.data=Mn,e("shaka.net.HttpPlugin",xn),es.http=xn,es.https=xn,$r=Dn.prototype,$r.init=function(e){if(!t.indexedDB)return Promise.reject(new S(9,9e3));var i=t.indexedDB.open("shaka_offline_db",1),n=new R;return i.onupgradeneeded=function(t){t=t.target.result;for(var i in e)t.createObjectStore(i,{keyPath:e[i]})},i.onsuccess=function(t){this.a=t.target.result,n.resolve()}.bind(this),i.onerror=Bn.bind(null,i,n),n.then(function(){var t=Object.keys(e);return Promise.all(t.map(function(t){return jn(this,t).then(function(e){this.b[t]=e}.bind(this))}.bind(this)))}.bind(this))},$r.o=function(){return Promise.all(this.c.map(function(t){try{t.transaction.abort()}catch(e){}return t.I["catch"](P)})).then(function(){this.a&&(this.a.close(),this.a=null)}.bind(this))},$r.get=function(t,e){return Un(this,t,"readonly",function(t){return t.get(e)})},$r.forEach=function(t,e){return Un(this,t,"readonly",function(t){return t.openCursor()},function(t){t&&(e(t.value),t["continue"]())})},$r.remove=function(t,e){return Un(this,t,"readwrite",function(t){return t["delete"](e)})};var ks={manifest:"key",segment:"key"};e("shaka.offline.OfflineManifestParser",Kn),Kn.prototype.configure=function(){},Kn.prototype.start=function(t){var e=/^offline:([0-9]+)$/.exec(t);if(!e)return Promise.reject(new S(1,9004,t));var i=Number(e[1]),n=new Dn;return n.init(ks).then(function(){return n.get("manifest",i)}).then(function(t){if(!t)throw new S(9,9003,i);return Vn(t)}).then(function(t){return n.o().then(function(){return t})},function(t){return n.o().then(function(){throw t})})},Kn.prototype.stop=function(){return Promise.resolve()},is["application/x-offline-manifest"]=Kn,e("shaka.offline.OfflineScheme",qn),es.offline=qn,Hn.prototype.o=function(){var t=this.j||Promise.resolve();return this.b={},this.j=this.a=this.l=this.m=this.i=null,t},e("shaka.offline.Storage",Yn),Yn.support=Wn,Yn.prototype.o=function(){var t=this.l,e=this.a,i=this.g?this.g.o()["catch"](function(){}).then(function(){return Promise.all(t.map(function(t){return e.remove("segment",t)}))}).then(function(){return e.o()}):Promise.resolve();return this.j=this.c=this.g=this.a=null,i},Yn.prototype.destroy=Yn.prototype.o,Yn.prototype.configure=function(t){Oe(this.j,t,Jn(this),{},"")},Yn.prototype.configure=Yn.prototype.configure,Yn.prototype.Vc=function(t,e,i){function n(t){s=t}if(this.v)return Promise.reject(new S(9,9006));this.v=!0;var r,s=null;return Zn(this).then(function(){return ir(this),Xn(this,t,n,i)}.bind(this)).then(function(i){if(ir(this),this.b=i.manifest,this.h=i.Sb,this.b.presentationTimeline.U()||this.b.presentationTimeline.fa())throw new S(9,9005,t);this.b.periods.forEach(this.s.bind(this)),this.f=this.a.b.manifest++,this.m=0,i=this.b.periods.map(this.w.bind(this));var n=this.h.b,s=st(this.h);if(n){if(!s.length)throw new S(9,9007,t);n.initData=[]}return r={key:this.f,originalManifestUri:t,duration:this.m,size:0,periods:i,sessionIds:s,drmInfo:n,appMetadata:e},zn(this.g,r)}.bind(this)).then(function(){if(ir(this),s)throw s;return On(this.a,"manifest",r)}.bind(this)).then(function(){return Qn(this)}.bind(this)).then(function(){return Fn(r)}.bind(this))["catch"](function(t){return Qn(this)["catch"](P).then(function(){throw t})}.bind(this))},Yn.prototype.store=Yn.prototype.Vc,Yn.prototype.remove=function(t){function e(t){6013!=t.code&&(a=t)}var i=t.offlineUri,n=/^offline:([0-9]+)$/.exec(i);if(!n)return Promise.reject(new S(9,9004,i));var r,s,a=null,o=Number(n[1]);return Zn(this).then(function(){return ir(this),this.a.get("manifest",o)}.bind(this)).then(function(t){if(ir(this),!t)throw new S(9,9003,i);return r=t,t=Vn(r),s=new et(this.c.i,e,function(){}),s.configure(this.c.getConfiguration().drm),s.init(t,!0)}.bind(this)).then(function(){return nt(s,r.sessionIds)}.bind(this)).then(function(){return s.o()}.bind(this)).then(function(){ +if(ir(this),a)throw a;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(k,[])}).reduce(k,[]),i=0,n=e.length,s=this.j.progressCallback;return Ln(this.a,function(r){return r=e.indexOf(r.key),0<=r&&(s(t,i/n),i++),0<=r}.bind(this))}.bind(this)).then(function(){return ir(this),this.j.progressCallback(t,1),this.a.remove("manifest",o)}.bind(this))},Yn.prototype.remove=Yn.prototype.remove,Yn.prototype.list=function(){var t=[];return Zn(this).then(function(){return ir(this),this.a.forEach("manifest",function(e){t.push(Fn(e))})}.bind(this)).then(function(){return t})},Yn.prototype.list=Yn.prototype.list,Yn.prototype.A=function(t){var e=[],i=t.filter(function(t){return"video"==t.type&&480>=t.height});i.sort(function(t,e){return e.bandwidth-t.bandwidth}),i.length&&e.push(i[0]);for(var n=Jt(this.c.getConfiguration().preferredAudioLanguage),i=[0,as,os],r=t.filter(function(t){return"audio"==t.type}),i=i.map(function(t){return r.filter(function(e){return e=Jt(e.language),Xt(t,n,e)})}),s=r,a=0;a<i.length;a++)i[a].length&&(s=i[a]);s.sort(function(t,e){return t.bandwidth-e.bandwidth}),s.length&&e.push(s[Math.floor(s.length/2)]);var i=Jt(this.c.getConfiguration().preferredTextLanguage),o=Xt.bind(null,os,i);return e.push.apply(e,t.filter(function(t){var e=Jt(t.language);return"text"==t.type&&o(e)})),e},Yn.prototype.s=function(t){function e(t,e,i){return e=e.filter(function(t){return t.type==i}),0==e.length?null:ee(t,e[0]).stream}var i={};this.i&&(i={video:e(this.b.periods[0],this.i,"video"),audio:e(this.b.periods[0],this.i,"audio")}),Qt(this.h,i,t),Zt(t,this.c.getConfiguration().restrictions,{width:1/0,height:1/0})},Yn.prototype.w=function(t){var e=te(t,null),e=this.j.trackSelectionCallback(e);this.i||(this.i=e,this.b.periods.forEach(this.s.bind(this)));for(var i=e.length-1;0<i;--i){for(var n=!1,r=i-1;0<=r;--r)if(e[i].type==e[r].type&&e[i].kind==e[r].kind&&e[i].language==e[r].language){n=!0;break}if(n)break}return e=e.map(function(e){return e=ee(t,e),er(this,t,e.Wc,e.stream)}.bind(this)),{startTime:t.startTime,streams:e}},hs.offline=Wn,e("shaka.polyfill.installAll",function(){for(var t=0;t<Ps.length;++t)Ps[t]()});var Ps=[];e("shaka.polyfill.register",nr),nr(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}}),document.addEventListener("webkitfullscreenchange",rr),document.addEventListener("webkitfullscreenerror",rr),document.addEventListener("mozfullscreenchange",rr),document.addEventListener("mozfullscreenerror",rr),document.addEventListener("MSFullscreenChange",rr),document.addEventListener("MSFullscreenError",rr)}}),or.prototype.createMediaKeys=function(){var t=new hr(this.keySystem);return Promise.resolve(t)},or.prototype.getConfiguration=function(){return this.a},hr.prototype.createSession=function(t){if("temporary"!=(t||"temporary"))throw new TypeError("Session type "+t+" is unsupported on this platform.");return new lr(this.a)},hr.prototype.setServerCertificate=function(){return Promise.reject(Error("setServerCertificate not supported on this platform."))},i(lr),$r=lr.prototype,$r.generateRequest=function(t,e){this.a=new R;try{this.c=this.g.createSession("video/mp4",new Uint8Array(e),null),L(this.f,this.c,"mskeymessage",this.kc.bind(this)),L(this.f,this.c,"mskeyadded",this.ic.bind(this)),L(this.f,this.c,"mskeyerror",this.jc.bind(this)),pr(this,"status-pending")}catch(i){this.a.reject(i)}return this.a},$r.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},$r.update=function(t){this.b=new R;try{this.c.update(new Uint8Array(t))}catch(e){this.b.reject(e)}return this.b},$r.close=function(){try{this.c.close(),this.closed.resolve(),j(this.f)}catch(t){this.closed.reject(t)}return this.closed},$r.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},$r.kc=function(t){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new Le("message",{messageType:void 0==this.keyStatuses.Va()?"licenserequest":"licenserenewal",message:t.message.buffer}))},$r.ic=function(){this.a?(pr(this,"usable"),this.a.resolve(),this.a=null):this.b&&(pr(this,"usable"),this.b.resolve(),this.b=null)},$r.jc=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:pr(this,"output-not-allowed");default:pr(this,"internal-error")}};var As;$r=mr.prototype,$r.eb=function(t){this.size=void 0==t?0:1,this.a=t},$r.Va=function(){return this.a},$r.forEach=function(t){this.a&&t(this.a,As)},$r.get=function(t){if(this.has(t))return this.a},$r.has=function(t){var e=As;return!(!this.a||!tt(new Uint8Array(t),new Uint8Array(e)))},$r.keys=function(){},gr.prototype.createSession=function(){},gr.prototype.setServerCertificate=function(){},vr.prototype.getConfiguration=function(){},vr.prototype.createMediaKeys=function(){};var Is="";kr.prototype.createMediaKeys=function(){var t=new Pr(this.a);return Promise.resolve(t)},kr.prototype.getConfiguration=function(){return this.b},$r=Pr.prototype,$r.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 _r(t,this.h,e),this.c.push(e),e},$r.setServerCertificate=function(){return Promise.reject(Error("setServerCertificate not supported on this platform."))},$r.tc=function(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="webm",e.initData=t.initData,this.b.dispatchEvent(e)},$r.sc=function(t){var e=Ir(this,t.sessionId);e&&(t=new Le("message",{messageType:void 0==e.keyStatuses.Va()?"licenserequest":"licenserenewal",message:t.message}),e.b&&(e.b.resolve(),e.b=null),e.dispatchEvent(t))},$r.qc=function(t){(t=Ir(this,t.sessionId))&&(Nr(t,"usable"),t.a&&t.a.resolve(),t.a=null)},$r.rc=function(t){var e=Ir(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?Nr(e,"output-restricted"):1==i?Nr(e,"expired"):Nr(e,"internal-error"))}},i(_r),$r=_r.prototype,$r.gb=function(t,e){if(this.a)this.a.then(this.gb.bind(this,t,e))["catch"](this.gb.bind(this,t,e));else{this.a=t;var i,n;"webkit-org.w3.clearkey"==this.c?(i=q(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=J(n.keys[0].k),n=J(n.keys[0].kid)):(i=new Uint8Array(e),n=null);var r=Er("addKey");try{this.f[r](this.c,i,n,this.sessionId)}catch(s){this.a.reject(s),this.a=null}}},$r.generateRequest=function(t,e){return Rr(this,e,null)},$r.load=function(t){return"persistent-license"==this.g?Rr(this,null,t):Promise.reject(Error("Not a persistent session."))},$r.update=function(t){var e=new R;return this.gb(e,t),e},$r.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var t=Er("cancelKeyRequest");try{this.f[t](this.c,this.sessionId)}catch(e){}}return this.closed.resolve(),this.closed},$r.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()};var _s;$r=Cr.prototype,$r.eb=function(t){this.size=void 0==t?0:1,this.a=t},$r.Va=function(){return this.a},$r.forEach=function(t){this.a&&t(this.a,_s)},$r.get=function(t){if(this.has(t))return this.a},$r.has=function(t){var e=_s;return!(!this.a||!tt(new Uint8Array(t),new Uint8Array(e)))},$r.keys=function(){},nr(function(){!t.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(HTMLMediaElement.prototype.webkitGenerateKeyRequest?wr("webkit"):HTMLMediaElement.prototype.generateKeyRequest?wr(""):t.MSMediaKeys?(As=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ur,t.MediaKeys=hr,t.MediaKeySystemAccess=or,navigator.requestMediaKeySystemAccess=ar):(navigator.requestMediaKeySystemAccess=yr,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=br,t.MediaKeys=gr,t.MediaKeySystemAccess=vr))}),nr(function(){if(t.MediaSource){var e=navigator.vendor,i=navigator.appVersion;!e||!i||0>e.indexOf("Apple")||(0<=i.indexOf("Version/8")?t.MediaSource=null:0<=i.indexOf("Version/9")?Mr():0<=i.indexOf("Version/10")&&(Mr(),xr()))}});var Rs=0;Lr.prototype.then=function(t,e){var i=new Lr;switch(this.ia){case 1:Kr(this,i,t);break;case 2:Kr(this,i,e);break;case Rs:this.c.push({I:i,Da:t}),this.b.push({I:i,Da:e})}return i},Lr.prototype["catch"]=function(t){return this.then(void 0,t)},Lr.prototype.W=function(t){if(this.ia==Rs){for(this.Oa=t,this.ia=1,t=0;t<this.c.length;++t)Kr(this,this.c[t].I,this.c[t].Da);this.c=[],this.b=[]}},Lr.prototype.a=function(t){if(this.ia==Rs){for(this.Oa=t,this.ia=2,t=0;t<this.b.length;++t)Kr(this,this.b[t].I,this.b[t].Da);this.c=[],this.b=[]}};var Ns=null,Cs=[];nr(function(e){t.setImmediate?(Hr=function(e){return t.setImmediate(e)},Gr=function(e){return t.clearImmediate(e)}):(Hr=function(e){return t.setTimeout(e,0)},Gr=function(e){return t.clearTimeout(e)}),t.Promise&&!e||(t.Promise=Lr,t.Promise.resolve=jr,t.Promise.reject=Ur,t.Promise.all=Br,t.Promise.race=Fr,t.Promise.prototype.then=Lr.prototype.then,t.Promise.prototype["catch"]=Lr.prototype["catch"])}),nr(function(){if(t.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in e&&(e.getVideoPlaybackQuality=zr)}})}).call(r,this),"undefined"!=typeof t&&t.exports?t.exports=r.shaka:(n=function(){return r.shaka}.call(e,i,e,t),!(void 0!==n&&(t.exports=n)))}()},function(e,i){e.exports=t}])});
\ No newline at end of file |