if (self.CavalryLogger) { CavalryLogger.start_js(["+4sWy"]); }

/**
 * @providesModule Shaka
 * @preserve-whitespace
 * @nopackage
 * @generated
 */
__d("Shaka",["Promise","VideoPlayerShakaPerformanceLogger","VideoPushParametersHelper","TimeSlice","Map","VideoPlayerLocalBandwidthEstimator","VideoPlayerResourceTimer","ShakaSegmentReferenceHelper","SegmentRequestManager","concatArrayBuffer","BufferReplacementHelper","logLongAkamaiRequest","throttle","ViewportPriorityAdjuster","VideoPriorityCalculator","VideoStreamingManager","MultipleSegmentsProvider","LocalBitrateHelper","UnitConstants","VideoPlayerShakaGlobalConfig","getSeekRangeGapsFromShakaReferences","mergeSeekRangeGaps","NetworkStatusDetector","setTimeoutAcrossTransitions","setTimeout","setIntervalAcrossTransitions","setInterval","setImmediateAcrossTransitions","setImmediate","clearTimeout","clearInterval","clearImmediate","extractCEA608","performanceNow","canUseFetchStream","SubscriptionsHandler"],(function $module_Shaka(global,require,requireDynamic,requireLazy,module,exports){

var Promise = require('Promise');
var VideoPlayerShakaPerformanceLogger = require('VideoPlayerShakaPerformanceLogger');
var VideoPushParametersHelper = require('VideoPushParametersHelper');
var TimeSlice = require('TimeSlice');
var Map = require('Map');
var VideoPlayerLocalBandwidthEstimator = require('VideoPlayerLocalBandwidthEstimator');
var VideoPlayerResourceTimer = require('VideoPlayerResourceTimer');
var ShakaSegmentReferenceHelper = require('ShakaSegmentReferenceHelper');
var SegmentRequestManager = require('SegmentRequestManager');
var concatArrayBuffer = require('concatArrayBuffer');
var BufferReplacementHelper = require('BufferReplacementHelper');
var logLongAkamaiRequest = require('logLongAkamaiRequest');
var throttle = require('throttle');
var ViewportPriorityAdjuster = require('ViewportPriorityAdjuster');
var VideoPriorityCalculator = require('VideoPriorityCalculator');
var VideoStreamingManager = require('VideoStreamingManager');
var MultipleSegmentsProvider = require('MultipleSegmentsProvider');
var LocalBitrateHelper = require('LocalBitrateHelper');
var UnitConstants = require('UnitConstants');
var VideoPlayerShakaGlobalConfig = require('VideoPlayerShakaGlobalConfig');
var getSeekRangeGapsFromShakaReferences = require('getSeekRangeGapsFromShakaReferences');
var mergeSeekRangeGaps = require('mergeSeekRangeGaps');
var NetworkStatusDetector = require('NetworkStatusDetector');

var setTimeout = VideoPlayerShakaGlobalConfig.getBool(
    'timeouts_persist_on_page_transition',
    true
  ) ?
  require('setTimeoutAcrossTransitions') :
  require('setTimeout');
var setInterval = VideoPlayerShakaGlobalConfig.getBool(
    'timeouts_persist_on_page_transition',
    true
  ) ?
  require('setIntervalAcrossTransitions') :
  require('setInterval');
var setImmediate = VideoPlayerShakaGlobalConfig.getBool(
    'timeouts_persist_on_page_transition',
    true
  ) ?
  require('setImmediateAcrossTransitions') :
  require('setImmediate');

var clearTimeout = require('clearTimeout');
var clearInterval = require('clearInterval');
var clearImmediate = require('clearImmediate');

var extractCEA608 = require('extractCEA608');
var performanceNow = require('performanceNow');

var canUseFetchStream = require('canUseFetchStream');
var SubscriptionsHandler = require('SubscriptionsHandler');

function setEventProperty(obj, name, handler) {
  obj[name] = TimeSlice.guard(handler, 'shaka ' + name);
};

if (
  VideoPlayerShakaGlobalConfig.getBool('shaka_native_promise', false) &&
  VideoPlayerShakaGlobalConfig.getBool('use_native_promise', true)
) {
  Promise = window.Promise;
}

var g = {};

(function(window){var n,ba=this;function q(a,b){var c=a.split("."),d=ba;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)c.length||void 0===b?d[e]?d=d[e]:d=d[e]={}:d[e]=b}function r(a,b){function c(){}c.prototype=b.prototype;a.ad=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Zc=function(a,c,f){return b.prototype[c].apply(a,Array.prototype.slice.call(arguments,2))}};/*

 Copyright 2015 Google Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/
function ca(){};function da(){}function fa(a){var b=console[a];b?b.bind||(console[a]=function(){b.apply(console,arguments)}):console[a]=function(){}}fa("error");fa("warn");fa("info");fa("log");fa("debug");function ga(a){ha[a]={xa:ja(),end:NaN}}function ka(a){if(a=ha[a])a.end=ja()}function la(){var a=ha.buffering;return a&&a.end?a.end-a.xa:NaN}var ja=window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now,ha={};function ma(a,b,c,d){this.id=a;this.bandwidth=b||0;this.lang=c||"unknown";this.streamInfoID=d;this.active=!1}q("shaka.player.AudioTrack.compare",function(a,b){return a.lang<b.lang?-1:a.lang>b.lang?1:a.bandwidth<b.bandwidth?-1:a.bandwidth>b.bandwidth?1:0});var na=VideoPlayerShakaGlobalConfig.getNumber("shaka_default_ajax_request_timeout",0),oa=VideoPlayerShakaGlobalConfig.getNumber("shaka_default_ajax_request_timeout",0),pa=VideoPlayerShakaGlobalConfig.getNumber("shaka_default_ajax_request_timeout",0);function qa(){this.minBandwidth=this.maxBandwidth=this.maxWidth=this.minHeight=this.maxHeight=null}qa.prototype.clone=function(){var a=new qa;a.maxHeight=this.maxHeight;a.minHeight=this.minHeight;a.maxWidth=this.maxWidth;a.maxBandwidth=this.maxBandwidth;a.minBandwidth=this.minBandwidth;return a};function ra(){this.fontSize="100%";this.fontColor=sa;this.fontOpacity=ta;this.backgroundColor=ua;this.backgroundOpacity=ta;this.fontEdge=va}q("shaka.player.TextStyle",ra);
function wa(a){var b=[];b.push("font-size: "+a.fontSize);b.push("color: "+xa(a.fontColor,a.fontOpacity));b.push("background-color: "+xa(a.backgroundColor,a.backgroundOpacity));for(var c=[],d=0;d<a.fontEdge.length;++d){var e=a.fontEdge[d].slice(3,6);c.push(xa(a.fontEdge[d].slice(0,3),a.fontOpacity)+" "+e.join("px ")+"px")}b.push("text-shadow: "+c.join(","));return b.join("; ")}function xa(a,b){return"rgba("+a.concat(b).join(",")+")"}var sa=[255,255,255],ua=[0,0,0];
ra.StandardColors={WHITE:sa,BLACK:ua,RED:[255,0,0],GREEN:[0,255,0],BLUE:[0,0,255],YELLOW:[255,255,0],MAGENTA:[255,0,255],CYAN:[0,255,255]};var ta=1;ra.StandardOpacities={OPAQUE:ta,SEMI_HIGH:.75,SEMI_LOW:.25,TRANSPARENT:0};var va=[];
ra.EdgeStyles={NONE:va,RAISED:[[34,34,34,1,1,0],[34,34,34,2,2,0],[34,34,34,3,3,0]],DEPRESSED:[[204,204,204,1,1,0],[204,204,204,0,1,0],[34,34,34,-1,-1,0],[34,34,34,0,-1,0]],UNIFORM:[[34,34,34,0,0,4],[34,34,34,0,0,4],[34,34,34,0,0,4],[34,34,34,0,0,4]],DROP:[[34,34,34,2,2,3],[34,34,34,2,2,4],[34,34,34,2,2,5]]};function ya(a,b){this.id=a;this.lang=b||"unknown";this.enabled=this.active=!1}q("shaka.player.TextTrack.compare",function(a,b){return a.lang<b.lang?-1:a.lang>b.lang?1:0});function za(a,b,c,d,e,f,g,h){this.id=a;this.bandwidth=b||0;this.width=c||0;this.height=d||0;this.streamInfoID=e;this.fbQualityLabel=f;this.fbQualityClass=g;a=[];h&&(a=h.split(","));this.isHVQ=-1<a.indexOf("hvq");this.isInlineHVQ=-1<a.indexOf("hvq_www_inline");this.active=!1}function Aa(a,b){var c=a.width*a.height,d=b.width*b.height;return c<d?-1:c>d?1:a.bandwidth<b.bandwidth?-1:a.bandwidth>b.bandwidth?1:0}q("shaka.player.VideoTrack.compare",Aa);function Ba(a){for(var b=Ca,c=[],d=0;d<a.length;++d){for(var e=!1,f=0;f<c.length&&!(e=b?b(a[d],c[f]):a[d]===c[f]);++f);e||c.push(a[d])}return c};var Da=0;function Ea(a){this.b=a;this.c=0==Fa;this.a=0}var Fa=1;function Ga(a){return a.a<a.b.byteLength}function Ha(a){var b=a.b.getUint8(a.a);a.a+=1;return b}function t(a){var b=a.b.getUint32(a.a,a.c);a.a+=4;return b}function Ja(a){var b,c;a.c?(b=a.b.getUint32(a.a,!0),c=a.b.getUint32(a.a+4,!0)):(c=a.b.getUint32(a.a,!1),b=a.b.getUint32(a.a+4,!1));if(2097151<c)throw new RangeError("DataViewReader: Overflow reading 64-bit value.");a.a+=8;return c*Math.pow(2,32)+b}
function Ka(a){if(a.a+16>a.b.byteLength)throw new RangeError("DataViewReader: Read past end of DataView.");var b=new Uint8Array(a.b.buffer,a.a,16);a.a+=16;return b}function La(a,b){if(a.a+b>a.b.byteLength)throw new RangeError("DataViewReader: Skip past end of DataView.");a.a+=b};function Ma(a){this.b=a;this.a=new Ea(a);Na||(Na=[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])])}var Na;
function Oa(a){var b;b=Pa(a);if(7<b.length)throw new RangeError("EbmlParser: EBML ID must be at most 7 bytes.");for(var c=0,d=0;d<b.length;d++)c=256*c+b[d];b=c;c=Pa(a);a:{for(d=0;d<Na.length;d++)if(Qa(c,Na[d])){d=!0;break a}d=!1}if(d)c=a.b.byteLength-a.a.a;else{if(8==c.length&&c[1]&224)throw new RangeError("EbmlParser: Variable sized integer value must be at most 53 bits.");for(var d=c[0]&(1<<8-c.length)-1,e=1;e<c.length;e++)d=256*d+c[e];c=d}c=a.a.a+c<=a.b.byteLength?c:a.b.byteLength-a.a.a;d=new DataView(a.b.buffer,
a.b.byteOffset+a.a.a,c);La(a.a,c);return new Ra(b,d)}function Pa(a){var b=Ha(a.a),c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new RangeError("EbmlParser: Variable sized integer must fit within 8 bytes.");var d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=Ha(a.a);return d}function Ra(a,b){this.id=a;this.a=b}
function Sa(a){if(8<a.a.byteLength)throw new RangeError("EbmlElement: Unsigned integer has too many bytes.");if(8==a.a.byteLength&&a.a.getUint8(0)&224)throw new RangeError("EbmlParser: Unsigned integer must be at most 53 bits.");for(var b=0,c=0;c<a.a.byteLength;c++)var d=a.a.getUint8(c),b=256*b+d;return b};var Ta={"output-restricted":"The required output protection is not available.","output-not-allowed":"The required output protection is not available.",expired:"The decryption key has expired.","internal-error":"The key system has encountered an unspecified error."};function Ua(a){this.b=Math.exp(Math.log(.5)/a);this.rb=this.Wa=this.a=0}Ua.prototype.sample=function(a,b){var c=Math.pow(this.b,a);this.a=b*(1-c)+c*this.a;this.Wa+=a;this.rb+=1};function Va(a){return a.a/(1-Math.pow(a.b,a.Wa))};var Wa=window.CustomEvent;"function"!==typeof Wa&&(Wa=function(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail);return c},Wa.prototype=window.Event.prototype);function u(a){var b=new Wa(a.type,{detail:a.detail,bubbles:!!a.bubbles}),c;for(c in a)c in b||(b[c]=a[c]);return b}function w(a){return new Wa("error",{detail:a,bubbles:!0})};function Xa(a,b,c){Ya(b);Ya(c);return c==b||a>=Za&&c==b.split("-")[0]||a>=$a&&c.split("-")[0]==b.split("-")[0]?!0:!1}var Za=1,$a=2;function Ya(a){a=a.toLowerCase().split("-");var b=ab[a[0]];b&&(a[0]=b);return a.join("-")}
var ab={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"};function bb(a){return Object.keys(a).map(function(b){return a[b]})}function x(a,b){return cb(a,b,"boolean")}function z(a,b,c){a=cb(a,b,"number");if(null==a)return null;if(isNaN(a)||a==Number.NEGATIVE_INFINITY||a==Number.POSITIVE_INFINITY)throw new RangeError("'"+b+"' must be finite.");if(null!=c&&a<c)throw new RangeError("'"+b+"' must be >= "+c);return a}function db(a,b){return cb(a,b,"string")}
function cb(a,b,c){a=a[b];if(null==a)return null;if(typeof a!=c)throw new TypeError("'"+b+"' must be a "+c+".");return a}function eb(a,b,c){a=a[b];if(null==a)return null;if(!(a instanceof c))throw new TypeError("'"+b+"' must be an instance of "+c.name+".");return a};function A(){this.a={}}A.prototype.push=function(a,b){this.a.hasOwnProperty(a)?this.a[a].push(b):this.a[a]=[b]};A.prototype.set=function(a,b){this.a[a]=b};A.prototype.get=function(a){return(a=this.a[a])?a.slice():null};function fb(a){var b=[],c;for(c in a.a)b.push.apply(b,a.a[c]);return b}function gb(a,b,c){if(a=a.a[b])for(b=0;b<a.length;++b)a[b]==c&&(a.splice(b,1),--b)}function hb(a){var b=[],c;for(c in a.a)b.push(c);return b};function ib(){this.a=new A}ib.prototype.destroy=function(){jb(this);this.a=null};function B(a,b,c,d){b=new kb(b,c,d);a.a.push(c,b)}ib.prototype.Oa=function(a,b){for(var c=this.a.get(b)||[],d=0;d<c.length;++d){var e=c[d];e.target==a&&(e.Oa(),gb(this.a,b,e))}};function jb(a){for(var b=fb(a.a),c=0;c<b.length;++c)b[c].Oa();a.a.a={}}function kb(a,b,c){this.target=a;this.type=b;this.a=c;this.target.addEventListener(b,c,!1)}
kb.prototype.Oa=function(){this.target&&(this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null)};function C(a){this.bb=new A;this.na=a}q("shaka.util.FakeEventTarget",C);n=C.prototype;n.addEventListener=function(a,b){this.bb.push(a,b)};n.removeEventListener=function(a,b){gb(this.bb,a,b)};
n.dispatchEvent=function(a){a.hasOwnProperty("srcElement")||(delete a.srcElement,Object.defineProperty(a,"srcElement",{get:function(){return null}}));if(a.hasOwnProperty("target"))a.target=this;else{delete a.target;var b=this;Object.defineProperty(a,"target",{get:function(){return b},set:function(a){b=a}})}if(a.hasOwnProperty("currentTarget"))a.currentTarget=null;else{delete a.currentTarget;var c=null;Object.defineProperty(a,"currentTarget",{get:function(){return c},set:function(a){c=a}})}return lb(this,
a)};n.Mb=!1;n.sa=function(a,b){return this.dispatchEvent(u({type:"debug/shakaEvent",bubbles:!0,detail:{type:a,event:b}}))};function lb(a,b){b.currentTarget=a;for(var c=a.bb.get(b.type)||[],d=0;d<c.length;++d){var e=c[d];try{e.handleEvent?e.handleEvent(b):e.call(a,b)}catch(f){}}a.na&&b.bubbles&&lb(a.na,b);return b.defaultPrevented};function D(a){C.call(this,null);this.a={Qa:{Ca:new Ua(VideoPlayerShakaGlobalConfig.getNumber("fast_moving_average_half_life",3)),Va:new Ua(VideoPlayerShakaGlobalConfig.getNumber("slow_moving_average_half_life",10))},Ja:{Ca:new Ua(VideoPlayerShakaGlobalConfig.getNumber("aggressive_fast_moving_average_half_life",.72127310931683)),Va:new Ua(VideoPlayerShakaGlobalConfig.getNumber("aggressive_slow_moving_average_half_life",9.2335087917745))}};this.g=a||5E5;this.h=VideoPlayerShakaGlobalConfig.getNumber("min_sample_count",
1E4);this.b=0}r(D,C);q("shaka.util.EWMABandwidthEstimator",D);
D.prototype.sample=function(a,b,c,d,e,f){if(VideoPlayerShakaGlobalConfig.getBool("change_abr_audio_exclusion_logic",!0)?!c:65536>b)e&&e.setEvent("unsampled").setReason("audio").log();else{if(VideoPlayerShakaGlobalConfig.getBool("use_resource_timing_entry_for_bandwidth",!0)){if(!d){e&&e.setEvent("unsampled").setReason("resource_timing_entry_missing").log();return}a=d.timeToLastByte;if(0>a){e&&e.setEvent("unsampled").setReason("resource_timing_entry_invalid").log();return}}a=Math.max(a,50);c=1E3*UnitConstants.BITS_IN_BYTE*
b/a;var g=a/1E3;this.a.Ja.Ca.sample(g,c,d);this.a.Ja.Va.sample(g,c,d);this.a.Qa.Ca.sample(g,c,d);this.a.Qa.Va.sample(g,c,d);this.dispatchEvent(u({type:"bandwidth"}));this.b=Date.now();d=parseInt(a,10);e&&e.setEvent("sampled").setBytes(b).setDelayMs(d).log();f&&f.getEventLogger("bandwidth_sampled").setLength(b).setClientTimeBegin(this.b-d).setClientTimeEnd(this.b).log()}};
D.prototype.getBandwidth=function(a){a="aggressive"===a?this.a.Ja:this.a.Qa;return this.canTrustEstimate()?Math.min(Va(a.Ca),Va(a.Va)):this.g};D.prototype.getFastMovingBandwidth=function(a){a="aggressive"===a?this.a.Ja:this.a.Qa;return this.canTrustEstimate()?Va(a.Ca):this.g};D.prototype.getDataAge=function(){return(Date.now()-this.b)/1E3};D.prototype.canTrustEstimate=function(a){var b=this.a.Ja.Ca;return b.Wa>=(void 0===a?.5:a)||b.rb>=this.h};D.prototype.supportsCaching=function(){return!1};
D.prototype.setRepresentationID=function(){};D.prototype.flushABREvaluationSet=function(){return[]};/*

 Copyright 2015 Facebook Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/
function mb(a,b,c){D.call(this,c);this.f=a||0;this.c=void 0===b?Infinity:b}r(mb,D);q("shaka.util.EWMACacheBandwidthEstimator",mb);mb.prototype.sample=function(a,b,c,d,e,f){var g=8E3*b/a;e&&e.setBytes(b).setDelayMs(parseInt(a,10));a<=this.f&&g>this.c?e&&e.setEvent("unsampled").setReason("cached").log():D.prototype.sample.call(this,a,b,c,d,e,f)};mb.prototype.supportsCaching=function(){return Infinity!==this.c&&!!this.f};mb.prototype.setRepresentationID=function(){};
mb.prototype.flushABREvaluationSet=function(){return[]};function nb(){D.call(this)}r(nb,D);q("shaka.util.EWMASignedURLBandwidthEstimator",nb);nb.prototype.supportsCaching=function(){return!0};function F(){var a,b,c=new Promise(function(c,e){a=c;b=e});c.resolve=a;c.reject=b;c.destroy=F.prototype.destroy;return c}F.prototype.destroy=function(){this.catch(function(){});var a=Error("Destroyed!");a.type="destroy";this.reject(a)};function ob(a){a.split("").reduce(function(a,c,d){return a+(d&&0==d%4?" "+c:c)})};function pb(){this.Na=new F;this.c=!1;this.ka=null;this.a=[];this.b=null}function qb(a,b){if(a.c)throw Error("Cannot append to a running task!");a.a.push(b)}pb.prototype.start=function(){if(this.c)throw Error("Task already started!");this.c=!0;this.a.unshift(function(){});rb(this,void 0)};pb.prototype.end=function(){this.a.splice(1)};
function rb(a,b){var c=a.a[0](b),d;c?(d=c[0],a.b=c[1]):(d=Promise.resolve(),a.b=null);d.then(G(a,function(a){this.ka?(this.a=[],this.b=null,sb(this)):(this.a.shift(),this.a.length?rb(this,a):(this.Na.resolve(a),this.b=null))})).catch(G(a,function(a){this.a=[];this.b=null;this.ka?sb(this):this.Na.reject(a)}))}
function sb(a){function b(){var a=Error("Task aborted.");a.type="aborted";this.Na.reject(a);setTimeout(function(){this.ka.resolve();this.ka=null}.bind(this),5)}a.f?a.f.then(function(){this.f=null;b.call(this)}.bind(a)):b.call(a)};function G(a,b){return b.bind(a)};function tb(a,b,c,d,e,f){MediaSource.isTypeSupported(c);C.call(this,e);e=b.addSourceBuffer(c);this.g=a;this.w=b;this.b=e;this.G=d;this.B=new ib;this.F=this.o=this.T=null;this.L=!1;this.K=this.H=this.I=0;this.D=null;this.R=this.C=!1;this.W=f;this.a=[];this.P=0;this.l=this.c=this.f=null;this.O=pa;this.m=this.s=0;this.v=this.N=!1;this.h=c&&c.charAt(0);B(this.B,this.b,"updateend",this.V.bind(this));this.g.getBool("listen_for_async_append_buffer_errors",!0)&&B(this.B,this.b,"error",this.U.bind(this));
this.j=null}r(tb,C);tb.prototype.la=function(){return{SourceBuffer:this.b}};function ub(a,b,c){a.Mb&&a.sa(b,{type:a.h.charAt(0),segment:c,sourceBuffer:a.b})}var vb=1/60;tb.prototype.destroy=function(){wb(this).catch(function(){});this.c&&this.c.destroy();this.a=this.f=this.c=null;this.B.destroy();this.w=this.b=this.B=null};function xb(a,b){for(var c=a.b.buffered,d=0;d<c.length;++d){var e=c.start(d)-vb,f=c.end(d)+vb;if(b>=e&&b<=f)return c.end(d)-b}return 0}
function yb(a,b,c){b=b.endTime?b.endTime-b.startTime:1;var d=new zb;d.b=3;d.l=1E3*b;d.f=1E3*a.O;d.w=a.T;d.m=c;d.Y=a.W;d.g=a.h;return d}
tb.prototype.fetch=function(a,b,c,d,e,f,g,h){var k,l=f?"replacing_lower_quality_buffer":null;if(this.o){var m=this.a[this.a.length-1],p=null;m&&(p=1E3*(a.startTime-m.endTime));k=this.o.getOperationLogger("fetch").setReason(l).setResource(Ab(a.url)).setType(Bb(this)).setLength(Math.round(1E3*(a.endTime-a.startTime))).setSegmentStartTime(1E3*a.startTime).setSegmentEndTime(1E3*a.endTime).setSegmentTimeGap(p).start()}this.j=k;if(this.f){if(this.g.getBool("sbm_enable_concurrent_fetch_requests",!1)){var v=
[].slice.call(arguments);return this.f.Na.then(G(this,function(){return this.fetch.apply(this,v)}),function(a){throw a;})}m=Error("Cannot fetch ("+this.h+"): previous operation not complete.");this.s>=this.I?(m.type="stream",k&&k.setError(m).log(),this.s=0):(this.s++,m.type="aborted");return Promise.reject(m)}this.f=new pb;c!=this.b.timestampOffset&&(this.b.timestampOffset=c);var m=yb(this,a,e),p=this.g.getBool("enable_streaming_code_path",!1),y;y=p?a.url.stream(m,this.G,this.o,this.j,this.F,Bb(this),
l,g,h):a.url.fetch(m,this.G,this.o,this.j,this.F,Bb(this),l,g);ub(this,"SegmentFetching",a);var E=H.prototype.Ia.bind(a.url);this.D&&this.C&&(d=this.D);var N=0;d&&(this.D=d,this.C=!1,qb(this.f,function(){return[d.then(function(a){a.Ha>N&&(N=a.Ha);return Cb(this,a,null)}.bind(this)),this.i.bind(this)]}.bind(this)));var aa=function(a){a.Ha>N&&(N=a.Ha);da((this.G.getBandwidth()/1E6).toFixed(2));if(this.N){var c;this.o&&(c=this.o.getOperationLogger("cea608_extraction").start());extractCEA608(a,b).then(function(a){c&&
c.setLength(a.length).log();a.length&&this.dispatchEvent(u({type:"cea608-captions",bubbles:!0,detail:{captions:a}}))}.bind(this)).catch(function(a){console.error(a)})}}.bind(this);p?qb(this.f,G(this,function(){var b=null,c=Math.max(0,(a.url.endByte||0)-a.url.startByte),d=this.g.getNumber("streaming_append_per_segment",3),e=0===d?0:c/d;return[y.then(function(c){b=c;this.v=!1;return Db(this,c,a,e)}.bind(this)).then(function(a){b=null;return a}).then(aa).catch(function(a){this.g.getBool("abort_fetch_on_net_error",
!1)&&h&&(this.b.abort(),this.v=!0);return Promise.reject(a)}.bind(this)),function(){ub(this,"SegmentFailed",a);b&&(b.cancel("abort"),b=null,h&&(this.b.abort(),this.v=!0));E();return this.i()}.bind(this)]})):qb(this.f,G(this,function(){return[y.then(function(b){ub(this,"SegmentFetched",a);aa(b);return Cb(this,b,a,l)}.bind(this)),function(){ub(this,"SegmentFailed",a);E();return this.i()}.bind(this)]}));var ea=0==this.b.buffered.length&&0==this.a.length,ia=null;qb(this.f,function(){if(0==this.b.buffered.length&&
!this.R){var b=Error("Failed to buffer segment ("+this.h+").");b.type="stream";return[Promise.reject(b)]}this.b.buffered.length&&ea&&(b=a.startTime,ia=this.b.buffered.start(0)-b);if(this.g.getBool("enable_segment_reference_epsilon",!1)){var b=ShakaSegmentReferenceHelper.insertReference(this.a,a),c=this.g.getBool("remove_trailing_inserted_references",!1)?this.a.length-b:0;this.a.splice(b,c)}else b=Eb(this.a,a.startTime),0<=b?this.a.splice(b+1,0,a):this.a.push(a)}.bind(this));this.s=0;return Fb(this).then(function(){k&&
k.log();return Promise.resolve({ja:ia,zc:N})}.bind(this),function(a){k&&k.setError(a).log();a=Gb(a,"task","An unknown task error occurred.");return Promise.reject(a)}.bind(this))};
function Db(a,b,c,d){var e=new ArrayBuffer(0),f=new ArrayBuffer(0),g=function(){return b.read().then(function(a){var b=a.value;a=a.done;if(this.v||a&&0===f.byteLength)return e;if(!a&&!b)return g();b&&(b instanceof Uint8Array&&(b=b.buffer),f=concatArrayBuffer(f,b));return f.byteLength>=d||a?(ub(this,"SegmentFetched",c),e=concatArrayBuffer(e,f),b=f,f=new ArrayBuffer(0),Cb(this,b,c).then(g)):g()}.bind(this))}.bind(a);return g()}
function Hb(a){if(a.f){var b=Error("Cannot clear ("+a.h+"): previous operation not complete.");a.m>=a.H?(b.type="stream",a.m=0):(a.m++,b.type="aborted");return Promise.reject(b)}a.f=new pb;qb(a.f,function(){var a;a:if(0==this.b.buffered.length)a=Promise.resolve();else{try{this.b.remove(0,this.w.duration)}catch(b){b=Gb(b,"clear_buffer","An error occured when clearing the buffer.");a=Promise.reject(b);break a}this.a=[];a=this.c=new F}return[a,this.i.bind(this)]}.bind(a));a.m=0;return Fb(a)}
function Ib(a,b){if(a.f){var c=Error("Cannot clearAfter ("+a.h+"): previous operation not complete.");c.type="stream";return Promise.reject(c)}a.f=new pb;qb(a.f,function(){return[Jb(this,b),this.i.bind(this)]}.bind(a));return Fb(a)}function Kb(a,b){a.c=new F;var c=b-5;if(0<c){try{a.b.remove(0,c)}catch(d){return d=Gb(d,"clear_buffer","An error occured when clearing the buffer."),Promise.reject(d)}c=Eb(a.a,c);0<c&&(a.a=a.a.slice(c,a.a.length))}else a.c.resolve();return a.c}
function wb(a){a.f?(a=a.f,a.ka?a=a.ka:a.c?(a.b&&(a.f=a.b()),a.ka=new F,a=a.ka):(a.c=!0,a=Promise.resolve())):a=Promise.resolve();return a}function Lb(a){for(var b=a.currentTime,c=b,d=0;d<a.buffered.length;d++)if(b<=a.buffered.start(d)){c=a.buffered.start(d);break}return c}function Mb(a,b){for(var c=b.currentTime,d=0;d<b.buffered.length;d++)if(c>=b.buffered.start(d)&&c<=b.buffered.end(d)-a.K)return!1;return!0}
function Fb(a){a.f.start();return a.f.Na.then(G(a,function(){this.f=null})).catch(G(a,function(a){this.f=null;a=Gb(a,"task","An unknown task error occurred.");return Promise.reject(a)}))}
function Cb(a,b,c,d){var e;if(a.o){var f=c?Ab(c.url):"init";e=a.o.getOperationLogger("append").setReason(d).setResource(f).setType(Bb(a)).setLength(b.byteLength).start();null!==c&&(e=e.setSegmentStartTime(1E3*c.startTime).setSegmentEndTime(1E3*c.endTime));a.j&&(e=e.setParentLogger(a.j))}try{a.b.appendBuffer(b)}catch(g){return a.g.getBool("nuke_source_buffer_on_quota_exceeded_err",!1)&&g instanceof DOMException&&g.code===DOMException.QUOTA_EXCEEDED_ERR&&g.message.match(/^.*SourceBuffer.*full.*free\sspace.*$/)&&
(g.type="sourcebuffer_full"),e&&e.setError(g).log(),Promise.reject(g)}a.c=new F;a.l=c;return a.c.then(function(){e&&e.log()},function(a){e&&e.setError(a).log();return Promise.reject(a)})}tb.prototype.U=function(a){a=a.error||Error("Call to appendBuffer failed to append the segment.");a=Gb(a,"stream","Call to appendBuffer failed to append the segment.");this.c&&this.c.reject(a)};
function Jb(a,b){if(0==a.b.buffered.length)return Promise.resolve();var c=Eb(a.a,b);if(-1==c||c==a.a.length-1)return Promise.resolve();try{a.b.remove(a.a[c+1].startTime,a.w.duration)}catch(d){return Promise.reject(d)}a.a=a.a.slice(0,c+1);a.c=new F;return a.c}tb.prototype.i=function(){if(this.c){if("open"==this.w.readyState){var a=Error("Previous operation aborted.");a.type="aborted";this.c.reject(a);this.b.abort();this.L&&(this.C=!0);this.c=new F}return this.c}return Promise.resolve()};
tb.prototype.V=function(){this.c&&(this.l&&(ub(this,"SegmentAppended",this.l),this.l=null),this.c.resolve(),this.c=null)};function Bb(a){return"v"===a.h.charAt(0)?"video":"a"===a.h.charAt(0)?"audio":null}function Gb(a,b,c){a||(a=Error(c));a.type||(a.type=b);a.message||(a.message=c);return a};function Nb(a){return String.fromCharCode.apply(null,a)}q("shaka.util.Uint8ArrayUtils.toString",Nb);function Ob(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b}q("shaka.util.Uint8ArrayUtils.fromString",Ob);q("shaka.util.Uint8ArrayUtils.toBase64",function(a,b){var c=void 0==b?!0:b,d=window.btoa(Nb(a)).replace(/\+/g,"-").replace(/\//g,"_");return c?d:d.replace(/=*$/,"")});function Pb(a){return Ob(window.atob(a.replace(/-/g,"+").replace(/_/g,"/")))}
q("shaka.util.Uint8ArrayUtils.fromBase64",Pb);q("shaka.util.Uint8ArrayUtils.fromHex",function(a){for(var b=new Uint8Array(a.length/2),c=0;c<a.length;c+=2)b[c/2]=window.parseInt(a.substr(c,2),16);return b});function Qb(a){for(var b="",c=0;c<a.length;++c){var d=a[c].toString(16);1==d.length&&(d="0"+d);b+=d}return b}q("shaka.util.Uint8ArrayUtils.toHex",Qb);function Qa(a,b){if(!a&&!b)return!0;if(!a||!b||a.length!=b.length)return!1;for(var c=0;c<a.length;++c)if(a[c]!=b[c])return!1;return!0};function Rb(){this.h=this.a="";this.l=!1;this.s=this.m=null;this.i=this.g=!1;this.j=this.f="";this.c=null;this.b=[]}function Sb(a,b){var c=new Rb;c.a=a.a;c.h=a.h;c.l=a.l;c.m=a.m;c.s=a.s;c.g=a.g;c.i=a.i;c.f=a.f;c.j=a.j;c.c=a.c?new Uint8Array(a.c.buffer):null;Tb(c,a.b);Tb(c,b.b);return c}function Tb(a,b){var c=a.b.concat(b.map(function(a){return{initData:new Uint8Array(a.initData.buffer),initDataType:a.initDataType}}));a.b=Ba(c)}
function Ca(a,b){return a.initDataType==b.initDataType&&Qa(a.initData,b.initData)};function Ub(a,b,c,d){this.a=[];d&&this.a.push(d)}q("shaka.player.DrmSchemeInfo",Ub);Ub.DistinctiveIdentifier={OPTIONAL:0,REQUIRED:1};Ub.PersistentState={OPTIONAL:0,REQUIRED:1};Ub.createUnencrypted=function(){return new Ub(0,0,0,null)};function Vb(a){this.systemIds=[];this.cencKeyIds=[];this.a=[];a=new Ea(new DataView(a.buffer));try{for(;Ga(a);){var b=a.a,c=t(a),d=t(a);1==c?c=Ja(a):0==c&&(c=a.b.byteLength-b);if(1886614376!=d)La(a,c-(a.a-b));else{var e=Ha(a);if(1<e)La(a,c-(a.a-b));else{La(a,3);var f=Qb(Ka(a)),g=[];if(0<e)for(var h=t(a),k=0;k<h;++k){var l=Qb(Ka(a));g.push(l)}var m=t(a);La(a,m);this.cencKeyIds.push.apply(this.cencKeyIds,g);this.systemIds.push(f);this.a.push({start:b,end:a.a-1});a.a!=b+c&&La(a,c-(a.a-b))}}}}catch(p){}}
;var Wb=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;function I(a){var b;a instanceof I?(Xb(this,a.ia),this.wa=a.wa,this.da=a.da,Yb(this,a.Ga),this.ea=a.ea,Zb(this,a.a.clone()),this.ta=a.ta):a&&(b=String(a).match(Wb))?(Xb(this,b[1]||"",!0),this.wa=$b(b[2]||""),this.da=$b(b[3]||"",!0),Yb(this,b[4]),this.ea=$b(b[5]||"",!0),Zb(this,b[6]||"",!0),this.ta=$b(b[7]||"")):this.a=new ac(null)}n=I.prototype;n.ia="";n.wa="";n.da="";n.Ga=null;n.ea="";n.ta="";
n.toString=function(){var a=[],b=this.ia;b&&a.push(bc(b,cc,!0),":");if(b=this.da){a.push("//");var c=this.wa;c&&a.push(bc(c,cc,!0),"@");a.push(encodeURIComponent(b).replace(/%25([0-9a-fA-F]{2})/g,"%$1"));b=this.Ga;null!=b&&a.push(":",String(b))}if(b=this.ea)this.da&&"/"!=b.charAt(0)&&a.push("/"),a.push(bc(b,"/"==b.charAt(0)?dc:ec,!0));(b=this.a.toString())&&a.push("?",b);(b=this.ta)&&a.push("#",bc(b,fc));return a.join("")};
n.resolve=function(a){var b=this.clone();"data"===b.ia&&(b=new I);var c=!!a.ia;c?Xb(b,a.ia):c=!!a.wa;c?b.wa=a.wa:c=!!a.da;c?b.da=a.da:c=null!=a.Ga;var d=a.ea;if(c)Yb(b,a.Ga);else if(c=!!a.ea){if("/"!=d.charAt(0))if(this.da&&!this.ea)d="/"+d;else{var e=b.ea.lastIndexOf("/");-1!=e&&(d=b.ea.substr(0,e+1)+d)}if(".."==d||"."==d)d="";else if(-1!=d.indexOf("./")||-1!=d.indexOf("/.")){for(var e=0==d.lastIndexOf("/",0),d=d.split("/"),f=[],g=0;g<d.length;){var h=d[g++];"."==h?e&&g==d.length&&f.push(""):".."==
h?((1<f.length||1==f.length&&""!=f[0])&&f.pop(),e&&g==d.length&&f.push("")):(f.push(h),e=!0)}d=f.join("/")}}c?b.ea=d:c=""!==a.a.toString();c?Zb(b,a.a.clone()):c=!!a.ta;c&&(b.ta=a.ta);return b};n.clone=function(){return new I(this)};function Xb(a,b,c){a.ia=c?$b(b,!0):b;a.ia&&(a.ia=a.ia.replace(/:$/,""))}function Yb(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.Ga=b}else a.Ga=null}function Zb(a,b,c){b instanceof ac?a.a=b:(c||(b=bc(b,gc)),a.a=new ac(b))}
function $b(a,b){return a?b?decodeURI(a):decodeURIComponent(a):""}function bc(a,b,c){return"string"==typeof a?(a=encodeURI(a).replace(b,hc),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function hc(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var cc=/[#\/\?@]/g,ec=/[\#\?:]/g,dc=/[\#\?]/g,gc=/[\#\?@]/g,fc=/#/g;function ac(a){this.b=a||null}ac.prototype.a=null;ac.prototype.c=null;
function ic(a,b,c){if(!a.a&&(a.a={},a.c=0,a.b))for(var d=a.b.split("&"),e=0;e<d.length;e++){var f=d[e].indexOf("="),g=null,h=null;0<=f?(g=d[e].substring(0,f),h=d[e].substring(f+1)):g=d[e];g=decodeURIComponent(g.replace(/\+/g," "));h=h||"";ic(a,g,decodeURIComponent(h.replace(/\+/g," ")))}a.b=null;(d=a.a.hasOwnProperty(b)&&a.a[b])||(a.a[b]=d=[]);d.push(c);a.c++}
ac.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";var a=[],b;for(b in this.a)for(var c=encodeURIComponent(b),d=this.a[b],e=0;e<d.length;e++){var f=c;""!==d[e]&&(f+="="+encodeURIComponent(d[e]));a.push(f)}return this.b=a.join("&")};ac.prototype.clone=function(){var a=new ac;a.b=this.b;if(this.a){var b={},c;for(c in this.a)b[c]=this.a[c].concat();a.a=b;a.c=this.c}return a};function jc(a,b,c){var d=a.indexOf("<?xml");0<=d&&(a=a.substr(d));a=(new DOMParser).parseFromString(a,"text/xml");if(!a)return null;"string"===typeof b&&(b=[new I(b)]);b=b||[new I("")];c=c||[new I("")];return J({Wb:b,baseUrl:c},a,kc)}q("shaka.dash.mpd.parseMpd",jc);function kc(){this.id=this.url=null;this.type="static";this.b=this.j=this.baseUrl=this.Wb=null;this.h=5;this.f=this.c=this.g=null;this.i=1;this.a=[]}
function lc(){this.f=this.c=this.b=this.baseUrl=this.duration=this.start=this.id=null;this.a=[]}function mc(){this.f=this.l=this.b=this.height=this.width=this.contentType=this.lang=this.group=this.id=null;this.g=!1;this.j=this.i=this.h=this.baseUrl=null;this.m=[];this.a=[];this.c=null}function nc(){this.value=null}function oc(){this.lang=this.a=null}function pc(){this.contentType=this.lang=this.id=null}function qc(){this.data=null}function rc(){this.data=null}
function sc(){this.a=this.b=this.g=this.j=this.baseUrl=this.m=this.fbQualityClass=this.fbQualityLabel=this.i=this.h=this.l=this.f=this.height=this.width=this.bandwidth=this.lang=this.id=null;this.c=[]}function tc(){this.value=this.a=null}tc.prototype.clone=function(){var a=new tc;a.a=this.a;a.value=this.value;return a};tc.prototype.parse=function(a,b){this.a=K(b,"schemeIdUri",L,this.a);this.value=K(b,"value",L,this.value)};function uc(){this.b=this.a=this.f=this.c=null}
function vc(){this.parsedPssh=this.psshBox=null}function wc(){this.url=null}function xc(){this.url=null}function yc(){this.baseUrl=null;this.b=1;this.f=this.c=this.g=this.a=this.h=null}yc.prototype.clone=function(){var a=new yc;a.baseUrl=Ac(this.baseUrl);a.b=this.b;a.h=this.h;a.a=M(this.a);a.g=M(this.g);a.c=M(this.c);a.f=M(this.f);return a};function Bc(){this.a=this.url=null}Bc.prototype.clone=function(){var a=new Bc;a.url=Ac(this.url);a.a=M(this.a);return a};function Cc(){this.a=this.url=null}
Cc.prototype.clone=function(){var a=new Cc;a.url=Ac(this.url);a.a=M(this.a);return a};function Dc(){this.baseUrl=null;this.b=1;this.f=this.g=null;this.i=0;this.h=null;this.c=[];this.a=null}Dc.prototype.clone=function(){var a=new Dc;a.baseUrl=Ac(this.baseUrl);a.b=this.b;a.g=this.g;a.f=this.f;a.i=this.i;a.h=M(this.h);a.c=Ac(this.c)||[];a.a=M(this.a);return a};function Ec(){this.a=this.b=null}Ec.prototype.clone=function(){var a=new Ec;a.b=Ac(this.b);a.a=M(this.a);return a};
function Fc(){this.b=1;this.a=this.i=null;this.j=0;this.c=this.g=this.f=this.h=null}Fc.prototype.clone=function(){var a=new Fc;a.b=this.b;a.i=this.i;a.a=this.a;a.j=this.j;a.h=this.h;a.f=this.f;a.g=this.g;a.c=M(this.c);return a};function Gc(){this.a=[]}Gc.prototype.clone=function(){var a=new Gc;a.a=Ac(this.a)||[];return a};function Hc(){this.a=this.duration=this.startTime=null}Hc.prototype.clone=function(){var a=new Hc;a.startTime=this.startTime;a.duration=this.duration;a.a=this.a;return a};
function Ic(a,b){this.xa=a;this.end=b}Ic.prototype.clone=function(){return new Ic(this.xa,this.end)};kc.TAG_NAME="MPD";lc.TAG_NAME="Period";mc.TAG_NAME="AdaptationSet";nc.TAG_NAME="Role";oc.TAG_NAME="Accessibility";pc.TAG_NAME="ContentComponent";sc.TAG_NAME="Representation";uc.TAG_NAME="ContentProtection";vc.TAG_NAME="cenc:pssh";wc.TAG_NAME="BaseURL";tc.TAG_NAME="AudioChannelConfiguration";xc.TAG_NAME="Location";yc.TAG_NAME="SegmentBase";Bc.TAG_NAME="RepresentationIndex";qc.TAG_NAME="FBInitializationBinary";
rc.TAG_NAME="FBSegmentIndexBinary";Cc.TAG_NAME="Initialization";Dc.TAG_NAME="SegmentList";Ec.TAG_NAME="SegmentURL";Fc.TAG_NAME="SegmentTemplate";Gc.TAG_NAME="SegmentTimeline";Hc.TAG_NAME="S";
kc.prototype.parse=function(a,b){this.url=a.Wb;this.id=K(b,"id",L);this.type=K(b,"type",L)||"static";this.b=K(b,"mediaPresentationDuration",Jc);this.h=K(b,"minBufferTime",Jc,this.h);this.g=K(b,"minimumUpdatePeriod",Jc,this.g);this.c=K(b,"availabilityStartTime",Kc,this.c);this.f=K(b,"timeShiftBufferDepth",Jc,this.f);this.f=null;this.i=K(b,"suggestedPresentationDelay",Jc,this.i);var c=a.baseUrl,d=O(this,b,wc);this.baseUrl=Lc(c,d);if(d=J(this,b,xc))this.j=Mc(c,d.url);this.a=O(this,b,lc)};
function Nc(a,b,c,d){if(0!==a.a.length){var e=new mc;e.contentType="text";e.lang=c||"en";e.g=!0;c=new sc;c.bandwidth=0;c.f=d||"text/vtt";c.baseUrl=[new I(b)];e.a.push(c);a.a[0].a.push(e);Oc(a.a[0])}}lc.prototype.parse=function(a,b){this.id=K(b,"id",L);this.start=K(b,"start",Jc);this.duration=K(b,"duration",Jc);var c=O(this,b,wc);this.baseUrl=Lc(a.baseUrl,c);this.b=J(this,b,yc);this.c=J(this,b,Dc);this.f=J(this,b,Fc);this.a=O(this,b,mc);Oc(this)};
function Oc(a){for(var b=[],c=0;c<a.a.length;++c){var d=a.a[c];null!=d.group&&(b[d.group]=!0)}for(c=0;c<a.a.length;++c)if(d=a.a[c],null==d.group){for(var e=1;1==b[e];)++e;b[e]=!0;d.group=e}}
mc.prototype.parse=function(a,b){var c=J(this,b,pc)||{},d=J(this,b,nc);this.id=K(b,"id",L);this.group=K(b,"group",P);this.lang=K(b,"lang",L,c.lang);this.contentType=K(b,"contentType",L,c.contentType);this.width=K(b,"width",Q);this.height=K(b,"height",Q);this.b=K(b,"mimeType",L);this.l=K(b,"codecs",L);this.f=K(b,"FBProjection",L);this.g=d&&"main"==d.value;this.lang&&(this.lang=Ya(this.lang));c=O(this,b,wc);this.baseUrl=Lc(a.baseUrl,c);this.m=O(this,b,uc);!this.contentType&&this.b&&(this.contentType=
this.b.split("/")[0]);this.h=a.b?Pc(this,b,a.b):J(this,b,yc);this.i=a.c?Pc(this,b,a.c):J(this,b,Dc);this.j=a.f?Pc(this,b,a.f):J(this,b,Fc);this.a=O(this,b,sc);this.c=J(this,b,oc);!this.b&&this.a.length&&(this.b=this.a[0].f,!this.contentType&&this.b&&(this.contentType=this.b.split("/")[0]))};nc.prototype.parse=function(a,b){this.value=K(b,"value",L)};oc.prototype.parse=function(a,b){this.a=K(b,"schemeIdUri",L);this.lang=K(b,"lang",L)};
pc.prototype.parse=function(a,b){this.id=K(b,"id",L);this.lang=K(b,"lang",L);this.contentType=K(b,"contentType",L);this.lang&&(this.lang=Ya(this.lang))};
sc.prototype.parse=function(a,b){this.id=K(b,"id",L);this.bandwidth=K(b,"bandwidth",Q);this.width=K(b,"width",Q,a.width);this.height=K(b,"height",Q,a.height);this.f=K(b,"mimeType",L,a.b);this.l=K(b,"codecs",L,a.l);this.fbQualityLabel=K(b,"FBQualityLabel",L);this.fbQualityClass=K(b,"FBQualityClass",L);this.m=K(b,"FBAbrPolicyTags",L);this.lang=a.lang;var c=O(this,b,wc);this.baseUrl=Lc(a.baseUrl,c);VideoPlayerShakaGlobalConfig.getBool("add_inline_initialization_resources",!1)&&(this.h=J(this,b,qc),this.i=
J(this,b,rc));this.c=O(this,b,uc);this.j=J(this,b,tc);this.g=a.h?Pc(this,b,a.h):J(this,b,yc);this.b=a.i?Pc(this,b,a.i):J(this,b,Dc);this.a=a.j?Pc(this,b,a.j):J(this,b,Fc);this.c=this.c.concat(a.m)};qc.prototype.parse=rc.prototype.parse=function(a,b){if(b&&b.firstChild){var c=Qc(b);null!=c&&(this.data=Pb(c).buffer)}};uc.prototype.parse=function(a,b){this.c=b;this.f=K(b,"schemeIdUri",L);var c=K(b,"cenc:default_KID",L);c&&(this.b=c.replace(/[-]/g,""));this.a=J(this,b,vc)};
vc.prototype.parse=function(a,b){var c=Qc(b);if(c){this.psshBox=Pb(c);try{this.parsedPssh=new Vb(this.psshBox)}catch(d){if(!(d instanceof RangeError))throw d;}}};wc.prototype.parse=function(a,b){var c=b.childNodes,d="";if(1==c.length)d=Qc(b);else for(var e=0;e<c.length;e++)c[e].nodeType==Node.TEXT_NODE&&(d+=c[e].nodeValue);this.url=d};xc.prototype.parse=function(a,b){this.url=Qc(b)};
yc.prototype.parse=function(a,b){this.baseUrl=a.baseUrl||this.baseUrl;this.b=K(b,"timescale",Q,this.b);this.h=K(b,"presentationTimeOffset",P,this.h);this.a=K(b,"indexRange",Rc,this.a);this.g=K(b,"FBFirstSegmentRange",Rc,this.g);this.c=J(this,b,Bc)||this.c;this.f=J(this,b,Cc)||this.f};Bc.prototype.parse=function(a,b){var c=K(b,"sourceURL",L);this.url=Mc(a.baseUrl,c);this.a=K(b,"range",Rc,M(a.a))};
Cc.prototype.parse=function(a,b){var c=K(b,"sourceURL",L);this.url=Mc(a.baseUrl,c);this.a=K(b,"range",Rc)};
Dc.prototype.parse=function(a,b){this.baseUrl=a.baseUrl||this.baseUrl;this.b=K(b,"timescale",Q,this.b);this.g=K(b,"presentationTimeOffset",P,this.g);this.f=K(b,"duration",Q,this.f);var c=K(b,"startNumber",Q);null!=c&&(this.i=c);this.h=J(this,b,Cc)||this.h;this.c=(c=O(this,b,Ec))&&0<c.length?c:this.c;this.a=J(this,b,Gc)||this.a;VideoPlayerShakaGlobalConfig.getBool("calculate_quick_dash_presentation_time_offset_from_timeline",!1)&&(c=VideoPlayerShakaGlobalConfig.getNumber("calculate_quick_dash_presentation_time_offset_epsilon_ms",
250),this.a&&this.a.a[0]&&(this.g=1E3<this.a.a[0].startTime?this.a.a[0].startTime-c:this.g))};Ec.prototype.parse=function(a,b){var c=K(b,"media",L);this.b=Mc(a.baseUrl,c);this.a=K(b,"mediaRange",Rc)};
Fc.prototype.parse=function(a,b){this.b=K(b,"timescale",Q,this.b);this.i=K(b,"presentationTimeOffset",P,this.i);this.a=K(b,"duration",Q,this.a);var c=K(b,"startNumber",P);null!=c&&(this.j=c);this.h=K(b,"media",L,this.h);this.f=K(b,"index",L,this.f);this.g=K(b,"initialization",L,this.g);this.c=J(this,b,Gc)||this.c};Gc.prototype.parse=function(a,b){this.a=O(this,b,Hc)};Hc.prototype.parse=function(a,b){this.startTime=K(b,"t",P);this.duration=K(b,"d",P);this.a=K(b,"r",Sc)};
function Lc(a,b){if(!b||0===b.length)return a;for(var c=[],d=0;d<b.length;d++){var e=b[d].url;null==a||0===a.length?c.push(new I(e)):(e=Mc(a.slice(0,1),e),c.push(e[0]))}return c}function Mc(a,b){if(!b)return a;var c=new I(b);return a?a.map(function(a){return a.resolve(c)}):[c]}function Pc(a,b,c){var d=M(c);(b=Tc(b,c.constructor.TAG_NAME))&&d.parse(a,b);return d}function J(a,b,c){var d=null;if(b=Tc(b,c.TAG_NAME))d=new c,d.parse(a,b);return d}
function Tc(a,b){for(var c=null,d=0;d<a.childNodes.length;d++)if(a.childNodes[d].tagName==b){if(c)return null;c=a.childNodes[d]}return c}function O(a,b,c){for(var d=[],e=0;e<b.childNodes.length;e++)if(b.childNodes[e].tagName==c.TAG_NAME){var f=new c;f.parse.call(f,a,b.childNodes[e]);d.push(f)}return d}function Qc(a){a=a.firstChild;return a.nodeType!=Node.TEXT_NODE?null:a.nodeValue}function Ac(a){return a?a.map(function(a){return a.clone()}):null}function M(a){return a?a.clone():null}
function K(a,b,c,d){a=c(a.getAttribute(b));return null!=a?a:void 0!==d?d:null}function Kc(a){if(!a)return null;a=Date.parse(a);return isNaN(a)?null:Math.floor(a/1E3)}
function Jc(a){if(!a)return null;var b=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(a);if(!b)return null;a=0;var c=P(b[1]);c&&(a+=31536E3*c);(c=P(b[2]))&&(a+=2592E3*c);(c=P(b[3]))&&(a+=86400*c);(c=P(b[4]))&&(a+=3600*c);(c=P(b[5]))&&(a+=60*c);b=window.parseFloat(b[6]);(b=isNaN(b)?null:b)&&(a+=b);return a}
function Rc(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=P(b[1]);if(null==a)return null;b=P(b[2]);return null==b?null:new Ic(a,b)}function Sc(a){a=window.parseInt(a,10);return isNaN(a)?null:a}function Q(a){a=window.parseInt(a,10);return 0<a?a:null}function P(a){a=window.parseInt(a,10);return 0<=a?a:null}function L(a){return a};function Uc(a,b){this.url=a;this.b=b||new zb;this.j=0;this.g=-1;this.h=this.i=0;this.a=null;this.c=new F;this.f=null;this.m=this.b.j;this.o=this.b.s}q("shaka.util.AjaxRequest",Uc);function zb(){this.body=null;this.b=1;this.l=1E3;this.f=0;this.method="GET";this.h="arraybuffer";this.c={};this.i=this.v=!1;this.Y=this.a=this.w=null;this.m=!1;this.s=this.j=this.g=null}var Vc=!0;function Wc(a){Xc(a);Yc(a);a.b.body=null;a.c.destroy();a.c=null;a.f=null}
function Yc(a){a.a&&(a.a.onload=null,a.a.onreadystatechange=null,a.a.onerror=null,a.a.ontimeout=null);a.a=null}function Xc(a){-1!==a.g&&(clearTimeout(a.g),a.g=-1)}var Zc=/(.*)\.(xx|fna)\.fbcdn\.net/,$c=/livestream-lookaside\.facebook\.com$/;
Uc.prototype.l=function(){if(this.a)return this.c;if(0==this.url.lastIndexOf("data:",0)){var a=this.url.split(":")[1].split(";").pop().split(","),b=a.pop(),b="base64"==a.pop()?window.atob(b.replace(/-/g,"+").replace(/_/g,"/")):window.decodeURIComponent(b);"arraybuffer"==this.b.h&&(b=Ob(b).buffer);a=JSON.parse(JSON.stringify(new XMLHttpRequest));a.response=b;a.responseText=b.toString();b=this.c;b.resolve(a);Wc(this);return b}if(0==this.url.lastIndexOf("idb:",0))return this.s();this.j++;this.i=performanceNow();
this.h||(this.h=this.b.l);this.a=new XMLHttpRequest;var c=this.url,a=new I(c);Vc&&(this.f&&!this.f.supportsCaching()||this.b.i)&&ic(a.a,"_",Date.now());c=Zc.test(c);if(null!=this.b.a&&c){var d=this.b.a,e=a.a;null!=d.a&&(d.h=d.a.getSegmentsToPush(),d.f=d.a.getSegmentStartTime(),d.g=d.a.getSegmentOffset(),d.c=d.a.getPushVideoRepresentationID(),d.b=d.a.getPushAudioRepresentationID(),d.j=d.a.getUseLongCacheForManifest());null!=d.h&&ic(e,"_nc_p_n",d.h);null!=d.f?ic(e,"_nc_p_ts",d.f):null!=d.g&&ic(e,"_nc_p_o",
d.g);null!=d.c&&null!=d.b&&(ic(e,"_nc_p_rid",d.c),ic(e,"_nc_p_arid",d.b));d.i&&ic(e,"_nc_p_dbg","1");d.j&&ic(e,"_nc_nc","1")}1==this.b.m&&c&&ic(a.a,"_nc_playing",1);c=a.toString();a=$c.test(a.da);this.a.open(this.b.method,c,!0);this.a.responseType=this.b.h;this.a.timeout=this.b.f;this.a.withCredentials=this.b.v||a;setEventProperty(this.a,"onload",this.Gc.bind(this));setEventProperty(this.a,"onreadystatechange",this.Mc.bind(this));setEventProperty(this.a,"onerror",this.Ec.bind(this));setEventProperty(this.a,
"ontimeout",this.Qc.bind(this));setEventProperty(this.a,"onabort",this.Ac.bind(this));for(b in this.b.c)this.a.setRequestHeader(b,this.b.c[b]);this.a.send(this.b.body);return this.c};Uc.prototype.send=Uc.prototype.l;function ad(a,b,c){b=Error(b);b.type=c;b.status=a.a.status;b.url=a.url;b.method=a.b.method;b.body=a.b.body;return b}n=Uc.prototype;
n.Ac=function(){if(VideoPlayerShakaGlobalConfig.getBool("fix_shaka_util_ajax_request_abort",!1)){var a=ad(this,"Request aborted.","aborted");this.c.reject(a);Wc(this)}};
n.Gc=function(a){if(this.f){var b=VideoPlayerResourceTimer.getResourceTimingEntry(this.url,this.i,performanceNow());this.f.sample(performanceNow()-this.i,a.loaded||this.a.response&&this.a.response.byteLength||0,this.b.g?"v"===this.b.g.charAt(0):!1,b,this.m,this.o)}a=[403];200<=this.a.status&&299>=this.a.status?(this.c.resolve(this.a),Wc(this)):!VideoPlayerShakaGlobalConfig.getBool("remove_ajax_resend_internal",!1)&&this.j<this.b.b&&-1===a.indexOf(this.a.status)?bd(this):(a=ad(this,"HTTP error.","net"),
this.c.reject(a),Wc(this))};n.Mc=function(){if(this.a.readyState==XMLHttpRequest.HEADERS_RECEIVED&&(this.a.Ha=Date.now()-this.i,this.b.a&&this.b.Y&&cd(this.b.Y,this.a),this.b.i)){var a=Date.parse(this.a.getResponseHeader("Date"));a&&(Da=a-Date.now())}};n.Ec=function(){var a=ad(this,"Network failure.","net");this.c.reject(a);Wc(this)};
n.Qc=function(){if(!VideoPlayerShakaGlobalConfig.getBool("remove_ajax_resend_internal",!1)&&this.j<this.b.b)bd(this);else{var a=ad(this,"Request timed out.","net");this.c.reject(a);Wc(this)}};function bd(a){Yc(a);a.g=setTimeout(function(){this.g=-1;this.l()}.bind(a),a.h*(1+.5*(2*Math.random()-1)));a.h*=2}function dd(){this.a=new Map;this.b=!1}
function cd(a,b){var c=b.getResponseHeader("X-FB-Debug-Num-Pushed"),d=b.getResponseHeader("X-FB-Debug-List-Pushed");null!=d&&null!=c&&(c=parseInt(c,10),d=d.split(","),c!=d.length&&console.warn("Inconsistent push debug headers.",c,d),c&&(-1<d[0].indexOf("/")&&(a.b=!0),d.forEach(function(a){this.a.set(a,(this.a.get(a)||0)+1)}.bind(a))))}var ed=/\/([^\/]+)$/,fd=/\/([^\/]+\/[^\/]+)$/;function gd(a,b){var c;c=(new I(b)).ea;c=(a.b?fd:ed).exec(c);if(!c)return 0;c=c[1];return a.a.get(c)||0};function H(a,b,c,d){this.c=b;this.startByte=c||0;this.baseUrl=this.toString();this.endByte=null!=d?d:null;this.g=this.f=null;this.j=a;this.h=null;this.i=!1;this.b=this.a=null}var hd;q("shaka.util.FailoverUri",H);H.prototype.m=function(){return this.startByte};H.prototype.getStartByte=H.prototype.m;H.prototype.l=function(){return this.endByte};H.prototype.getEndByte=H.prototype.l;function id(a,b){return a&&0!==a.length?a.map(function(a){return a.resolve(b)}):[b]}
H.setPrefetchCacheValueGetter=function(a){hd=a};n=H.prototype;n.fetch=function(a,b,c,d,e,f,g,h){return this.f?this.f:this.f=md(this,0,a||new zb,b,c,d,e,f,g,h)};n.stream=function(a,b,c,d,e,f,g,h,k){return nd(this,0,a||new zb,b,c,d,e,f,g,h,k)};
function md(a,b,c,d,e,f,g,h,k,l){return nd(a,b,c,d,e,f,g,h,k,l).then(function(a){var b,c=function(){return a.read().then(function(a){var d=a.value;if(a.done)return b||new ArrayBuffer(0);d&&("string"===typeof d?b=(b||"")+d:b=concatArrayBuffer(b||new ArrayBuffer(0),d));return c()}.bind(this))}.bind(this);return c()})}
n.Ia=function(){if(this.g){this.a=this.f=null;var a=this.g;Xc(a);if(a.a&&a.a.readyState!=XMLHttpRequest.DONE&&(a.a.abort(),!VideoPlayerShakaGlobalConfig.getBool("fix_shaka_util_ajax_request_abort",!1))){var b=ad(a,"Request aborted.","aborted");a.c.reject(b);Wc(a)}this.h=this.g=null}this.b&&(this.b.abortRequest(od(this)),VideoPlayerShakaGlobalConfig.getBool("fixing_scheduler_disable_leaks",!0)&&(this.b=null))};
function nd(a,b,c,d,e,f,g,h,k,l,m){a.b=l||null;var p;e&&(c.a&&(c.a.i=!0),l=0,c.Y&&(l=gd(c.Y,a.c[b].toString())),(p=e.getOperationLogger("request"))&&p.setReason(k||null).setPushed(l).setType(h||null).setInitiator("shaka").start(),f&&(p=p.setParentLogger(f)));var v=performanceNow();a.a=null;g&&(c.j=g);e&&(c.s=e);var y=pd(a,a.c[b],c);g=null;a.i=!1;var E;hd&&(E=hd(y))&&(g=E,a.i=!0,p&&p.setInitiator("prefetch"));if(!E&&m)return m.getStream(od(a)).then(function(a){return a.getReader()}.bind(a));m=null;
if(a.b&&!a.b.isDisabled()&&!g)try{(g=m=a.b.getPromise(od(a)))?p=null:a.b.disable()}catch(N){e&&e.getEventLogger("request_info_not_found").setResource(y).log()}g||(a.g=new Uc(y,c),d&&(a.g.f=d),g=a.g.l());p&&p.setResource(y);f&&f.setResource(y);var aa=!1,ea=g.then(G(a,function(a){!this.b||this.b.isDisabled()||this.a?this.a||(this.a=VideoPlayerResourceTimer.getResourceTimingEntry(y,this.i?0:v,performanceNow())):this.a=this.b.getResourceTimingEntry(y);this.b=this.h=this.g=this.f=null;this.h=a.a?new I(a.a):
this.c[b];a.response.Ha=a.Ha;p&&(p=p.setLength(a.response.byteLength||a.response.length).setWasPrefetchCacheHit(this.i),null!=this.a&&(p=p.setTimeToLastByte(Math.round(this.a.timeToLastByte)).setTimeToFirstByte(Math.round(this.a.timeToFirstByte)).setTimeToRequestStart(Math.round(this.a.timeToRequestStart)),2E3<=this.a.timeToFirstByte&&-1<y.indexOf("akamaihd")&&logLongAkamaiRequest(a.getResponseHeader("Debug-Info")+", TTFB-> "+this.a.timeToFirstByte+", TTRS-> "+this.a.timeToRequestStart)),p.log());
return Promise.resolve({value:a.response,done:!1})})),ea=ea.catch(G(a,function(a){if(this.f&&b+1<this.c.length)return this.f=md(this,b+1,c,d);this.b=this.a=this.f=this.g=null;p&&p.setError(a).log();return Promise.reject(a)}));return Promise.resolve({cancel:function(){},read:function(){return aa?Promise.resolve({value:null,done:!0}):ea.then(function(a){aa=!0;return a})}.bind(a)})}function od(a){return{baseUrl:a.toString(),startByte:a.startByte,endByte:a.endByte}}
n.clone=function(){return new H(this.j,this.c.map(function(a){return a.clone()}),this.startByte,this.endByte)};n.getResourceTimingEntry=function(){return this.a};function pd(a,b,c){var d=b.toString();if(a.startByte||a.endByte)b=b.da,!b.endsWith("fbcdn.net")||b.startsWith("interncache")||b.endsWith("ak.fbcdn.net")?c&&(c.c.Range="bytes="+(a.startByte+"-"+(null!=a.endByte?a.endByte:""))):(d+="&bytestart="+a.startByte,d+=null!==a.endByte?"&byteend="+a.endByte:"");a.j&&c&&(d=a.j(d,c.c)||d);return d}
function Ab(a){return pd(a,a.c[0])}n.toString=function(){return this.c[0].toString()};function qd(a,b,c,d){this.a=new zb;b=null!=b?b:oa;this.a.h="text";this.a.b=3;this.a.f=1E3*b;c&&(this.a.a=c);d&&(this.a.Y=d);this.a.i=!0;this.b=a}function rd(a,b){var c=a.b;return c.fetch(a.a,null,b,null,null,"manifest").then(function(a){a instanceof ArrayBuffer&&(a=String.fromCharCode.apply(null,new Uint8Array(a)));if(a=jc(a,c.c,[c.h]))return Promise.resolve(a);a=Error("MPD parse failure.");a.type="dash";return Promise.reject(a)})}
function sd(a){this.a=null;this.h=a;this.c=this.g=this.f=null;this.i=!1;this.j=this.b=null};function td(a,b){this.a=a;this.b=b||null}td.prototype.destroy=function(){this.a&&(this.a.Ia(),this.a=null);this.b=null};td.prototype.create=function(a,b){var c=null;b&&(c=new zb,c.Y=b);return!this.b&&this.a?this.a.fetch(c,null,a,null,null,"init"):Promise.resolve(this.b)};td.prototype.c=function(){return this.a};td.prototype.getFailoverUri=td.prototype.c;function ud(a,b){this.segmentOriginalEndTime=a;this.gapDistance=b}function vd(a,b,c,d,e){this.startTime=a;this.endTime=b;this.url=c;this.unscaledStartTime=null!=d?d:null;this.debugInfo=(this.timescaledGapInfo=e||null)?{endTime:this.timescaledGapInfo.segmentOriginalEndTime,delta:this.timescaledGapInfo.gapDistance}:null}function wd(a,b,c){return new vd(b,c,a.url,null!=a.unscaledStartTime?a.unscaledStartTime:void 0,a.timescaledGapInfo)}
function Eb(a,b){for(var c=a.length-1;0<=c;--c){var d=a[c];if(b>=d.startTime&&(null==d.endTime||b<d.endTime))return c}return-1}function xd(a,b){return a.map(function(a){return wd(a,a.startTime+b,null!=a.endTime?a.endTime+b:null)})};function yd(a,b,c,d){for(var e=b.a,f=[],g=0;g<d;++g){var h=g+c,k=(h-1)*e.a,l=k/e.b,m=(k+e.a)/e.b,h=zd(a,b,e.j+h-1,k);if(!h)return null;f.push(new vd(l,m,h,k))}return f}function zd(a,b,c,d){if(!b.a)return null;var e=b.a.h;if(!e)return b.baseUrl?new H(a,b.baseUrl,0,null):null;c=Ad(e,b.id,c,b.bandwidth,d);if(!c)return null;b=id(b.baseUrl,c);return new H(a,b,0,null)}
function Ad(a,b,c,d,e){var f={RepresentationID:b,Number:c,Bandwidth:d,Time:e};a=a.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(a,b,c){if("$$"==a)return"$";var d=f[b];if(null==d)return a;"RepresentationID"==b&&c&&(c=void 0);a=d.toString();c=window.parseInt(c,10)||1;c=Math.max(0,c-a.length);return Array(c+1).join("0")+a});try{return new I(a)}catch(g){if(g instanceof URIError)return null;throw g;}}
function Bd(a,b,c){var d=0;c*=b;a=a.a;for(var e=[],f=0;f<a.length&&a[f].duration;++f){var g=a[f].startTime,g=null!=g?g:d,h=a[f].a||0;if(0>h)if(h=a[f].duration,f+1===a.length)var k=a[0].startTime+c-g,h=Math.ceil(k/h)-1;else h=Math.ceil((a[f+1].startTime-g)/h)-1;if(0<e.length&&g!=d){var k=g-d,l=e[e.length-1];l.timescaledGapInfo=new ud(d/b,k/b);l.end=g}for(k=0;k<=h;++k)d=g+a[f].duration,e.push({start:g,end:d}),g=d}return e};function Cd(){}
Cd.prototype.parse=function(a,b,c,d,e){var f=null;try{a:{var g=[],h=new Ea(a),k=t(h);if(1936286840!=t(h))f=null;else{1==k&&(k=Ja(h));var l=Ha(h);La(h,3);La(h,4);var m=t(h);if(0==m)f=null;else{var p,v;0==l?(p=t(h),v=t(h)):(p=Ja(h),v=Ja(h));La(h,2);var y=h.b.getUint16(h.a,h.c);h.a+=2;a=p;b=b+k+v;for(v=k=0;v<y;v++){var E=t(h);p=(E&2147483648)>>>31;var l=E&2147483647,N=t(h);t(h);if(1==p){f=null;break a}var aa;aa=0==v&&e?e:new H(d,c,b,b+l-1);p=a/m;var ea=(a+N)/m;0===v&&(k=p);g.push(new vd(p-k,ea-k,aa));
a+=N;b+=l}g.b=m;f=g}}}}catch(ia){if(!(ia instanceof RangeError))throw ia;}return f};function R(a,b){this.a=a;this.ja=0;this.b=b;this.h=[];this.Xa=!1;this.B=function(){}}R.prototype.I=function(){return!!this.h[this.h.length-1]};R.prototype.lastPollHadChanges=R.prototype.I;R.prototype.H=function(){var a=this.h,b=a.lastIndexOf(!0);if(1>b)return 0;a=a.lastIndexOf(!0,b-1);return 0>a?0:b-a-1};R.prototype.getFetchesBetweenRecentChanges=R.prototype.H;R.prototype.w=function(){return Math.floor((this.h.length-1-this.h.lastIndexOf(!0))/2)};R.prototype.getConsecutiveUpdatesWithoutChanges=R.prototype.w;
R.prototype.G=function(){return this.h.length-1-this.h.lastIndexOf(!1)};R.prototype.getConsecutiveUpdatesWithChanges=R.prototype.G;R.prototype.destroy=function(){this.a=null};R.prototype.length=function(){return this.a.length};R.prototype.l=function(){return(this.a||[]).slice()};R.prototype.getSegments=R.prototype.l;function S(a){if(0==a.a.length)throw new RangeError("SegmentIndex: There is no first SegmentReference.");return a.a[0]}
R.prototype.A=function(){if(0==this.a.length)throw new RangeError("SegmentIndex: There is no last SegmentReference.");return this.a[this.a.length-1]};R.prototype.last=R.prototype.A;n=R.prototype;n.get=function(a){if(0>a||a>=this.a.length)throw new RangeError("SegmentIndex: The specified index is out of range.");return this.a[a]};n.findIndexByStartTime=function(a){return ShakaSegmentReferenceHelper.findIndexByStartTime(this.a,a)};n.cb=function(a){Dd(this,a);return!0};
function Dd(a,b){a.ja!=b.ja&&(b=new R(xd(b.a,a.ja-b.ja),b.b));if(0==a.length())a.a=b.a.slice(0);else if(0!=b.length()&&null!=a.A().endTime)if(null!=b.A().endTime&&b.A().endTime<a.A().endTime)VideoPlayerShakaGlobalConfig.getBool("fix_manifest_wrapped",!0)?b.A().endTime<S(a).startTime&&(a.Xa=!0):a.Xa=!0;else{a.Xa=!1;if(a.A().endTime<=S(b).startTime)var c=wd(a.A(),a.A().startTime,S(b).startTime),c=a.a.slice(0,-1).concat([c]);else{var d;for(d=0;d<a.a.length&&!(a.a[d].endTime>=S(b).startTime);++d);a.a[d].startTime<
S(b).startTime?(c=wd(a.a[d],a.a[d].startTime,S(b).startTime),c=a.a.slice(0,d).concat([c])):(S(a).startTime>S(b).startTime||S(b),c=a.a.slice(0,d))}a.a=c.concat(b.a);a.B(b.a)}}n.va=function(a){var b=a-this.ja;if(0==b)return 0;this.a=xd(this.a,b);this.ja=a;return b};n.$a=function(){return 0<this.length()?{start:S(this).startTime,end:this.A().endTime}:{start:0,end:0}};n.Rb=function(){return getSeekRangeGapsFromShakaReferences(this.a,this.b)};R.prototype.getSeekRangeGaps=R.prototype.Rb;
function Ed(a,b){var c=[];if(null===b||void 0===b)c=a.a;else{for(var d=0;d<a.a.length;d++){var e=a.a[a.a.length-d-1];e.startTime>=b&&c.push(e)}c.reverse()}return c.map(function(a,b){return Fd(a,b)}.bind(a))}function Fd(a,b){return{startTime:a.startTime,endTime:null===a.endTime?Number.POSITIVE_INFINITY:a.endTime,segmentID:b,requestInfo:od(a.url)}}function Gd(a,b){a.B=b}function Hd(a){a.B=function(){}};function T(a,b,c,d,e){R.call(this,a,b);this.j=c;this.D=d;this.i=e;this.duration=this.j.b||this.j.a.reduce(function(a,b){return null==b.duration?NaN:a+b.duration},0)||0;this.c=this.v=this.g=null;Id(this)}r(T,R);T.prototype.destroy=function(){this.D=this.j=null;R.prototype.destroy.call(this)};T.prototype.cb=function(a){if(!(a instanceof T))return!1;Dd(this,a);this.duration=Math.max(this.duration,a.duration);null==this.g?(this.i=a.i,Id(this)):Jd(this);return!0};
function Id(a){Jd(a);if(0!=a.length()){a.length();var b=null!=a.A().endTime?a.A().endTime:a.A().startTime;if(a.j.c>a.i)a.g=b;else{var c=a.i-(a.j.c+a.D.start);0>c?a.g=b:c<Math.max(a.A().startTime,a.A().endTime||0)?(a.A(),a.g=b):a.g=c}a.v=a.A().startTime;a.c=S(a).startTime}}T.prototype.va=function(a){a=R.prototype.va.call(this,a);Math.min.apply(null,this.a.filter(function(a){return null!=a.endTime}).map(function(a){return a.endTime-a.startTime}));null!=this.g&&(this.v+=a,this.c+=a,this.g+=a);return a};
T.prototype.$a=function(){return Kd(this,(Date.now()+Da)/1E3)};
function Kd(a,b){Jd(a);if(null!=a.j.f)if(null==a.g)a.length();else{for(var c=a.g+(b-a.i),d=0,e=0;e<a.a.length;++e){var f=null;e<a.a.length-1?f=a.a[e+1].endTime:(f=a.a[e],f=null!=f.endTime?f.endTime+(f.endTime-f.startTime):null);if(null!=f&&f<c-a.j.f)++d;else break}0<d&&a.a.splice(0,d)}if(null==a.g||null==a.v||null==a.c)return{start:0,end:0};c=Number.POSITIVE_INFINITY;a.duration&&(c=a.duration);d=b-a.i;e=a.g+d;null!=a.j.f&&(e=e-a.c-a.j.f,0<e&&(a.c+=e));a.c=Math.min(a.c,c);d=a.v+d;if(d<a.c)return{start:a.c,
end:a.c};d=0<a.length()?null!=a.A().endTime?Math.min(d,a.A().endTime):d:a.c;d=Math.max(d,a.c);d=Math.min(d,c);return{start:a.c,end:d}}function Jd(a){if(a.duration){for(var b=0,c=a.a.length-1;0<=c;--c)if(a.a[c].startTime>a.duration)++b;else break;0<b&&a.a.splice(-b)}};function Ld(a,b,c,d,e){var f=1,g=0,h;if(a.c>d)h=null;else{var k=a.i||0,l=a.f||0;h=c.a;h=h.a/h.b;var m=d-(a.c+b.start);0>m?h=null:(l=m-2*h-l,0>l&&(l=0),l=Math.ceil(l/h)*h,m-=h,0>m?h=null:(k=Math.floor(m/h)*h-k,0>k&&(k=0),k=Math.floor(k/h)*h,h={Pb:l/h+1,current:(k>=l?k:l)/h+1}))}h&&(f=h.Pb,g=h.current-h.Pb+1);f=yd(e,c,f,g);if(null==f)throw a=Error("Failed to generate SegmentReferences."),a.type="stream",a;T.call(this,f,c.a.b||1,a,b,d);this.C=c;this.s=this.f=0<this.length()?a.c+b.start+this.A().endTime:
null;this.m=h?h.current+1:null;this.F=e}r(Ld,T);Ld.prototype.destroy=function(){this.F=this.C=null;T.prototype.destroy.call(this)};Ld.prototype.cb=function(a){if(null!=this.f||!(a instanceof Ld)||null==a.f)return!1;this.f=a.f;this.s=a.s;this.m=a.m;this.i=a.i;this.duration=a.duration;Dd(this,a);Md(this,(Date.now()+Da)/1E3);Id(this);return!0};Ld.prototype.va=function(a){a=T.prototype.va.call(this,a);null!=this.f&&(this.f+=a,this.s+=a);return a};
Ld.prototype.$a=function(){var a=(Date.now()+Da)/1E3;Md(this,a);return Kd(this,a)};function Md(a,b){if(null!=a.f&&null!=a.s&&null!=a.m){var c=a.C.a,c=c.a/c.b,d=Math.floor((a.s+(b-a.i)-a.f)/c);if(0!=d){var e=yd(a.F,a.C,a.m,d);Array.prototype.push.apply(a.a,xd(e,a.ja));a.f+=d*c;a.m+=d}}};function Nd(a,b,c,d,e){this.g=a;this.f=b;this.c=c;this.i=d;this.a=null;this.h=e}Nd.prototype.destroy=function(){this.h=this.c=this.f=this.g=null;this.a&&(this.a.destroy(),this.a=null)};
Nd.prototype.create=function(){if(this.a)return Promise.resolve(this.a);if("dynamic"==this.g.type)try{this.a=new Ld(this.g,this.f,this.c,this.i,this.h)}catch(a){return Promise.reject(a)}else{var b;b=this.c.a;if(b=yd(this.h,this.c,1,Math.ceil(this.f.duration/(b.a/b.b)))){if(0<b.length){var c=b[b.length-1];b[b.length-1]=wd(c,c.startTime,this.f.duration)}b=new R(b,this.c.a.b||1)}else b=null;this.a=b;if(!this.a)return b=Error("Failed to generate SegmentReferences"),b.type="stream",Promise.reject(b)}return Promise.resolve(this.a)};
Nd.prototype.b=function(){return this.a};function Od(a,b,c,d,e){this.f=a;this.c=b;this.h=c;this.a=null;this.i=d;this.g=e}Od.prototype.destroy=function(){this.g=this.h=this.c=this.f=null;this.a&&(this.a.destroy(),this.a=null)};
Od.prototype.create=function(){if(this.a)return Promise.resolve(this.a);var a=this.h.b,b=[];a.a&&(b=Bd(a.a,a.b||1,this.c.duration||0));var c=0;a.f&&a.i?c=(a.i-1)*a.f:0<b.length&&(c=b[0].start-(a.g||0));var d=c,e=a.c.length;0<b.length&&b.length!=a.c.length&&(e=Math.min(b.length,a.c.length));for(var f=[],g=0;g<e;++g){var h=a.c[g],k=c/a.b,l=null,m=null,p;a.f?(l=c+a.f,m=l/a.b):0<b.length?(p=b[g].timescaledGapInfo,l=b[g].end-(a.g||0),m=l/a.b):(m=k+this.c.duration,l=m*a.b);var c=l,l=0,v=null;h.a&&(l=h.a.xa,
v=h.a.end);m=Math.min(this.c.duration+d/a.b,m);f.push(new vd(k,m,new H(this.g,h.b,l,v),null,p||null))}"dynamic"==this.f.type?this.a=new T(f,a.b||1,this.f,this.c,this.i):this.a=new R(f,a.b||1);return Promise.resolve(this.a)};Od.prototype.b=function(){return this.a};function Pd(a,b,c,d,e){this.c=a;this.f=b;this.g=c;this.i=d;this.a=null;this.h=e}Pd.prototype.destroy=function(){this.h=this.g=this.f=this.c=null;this.a&&(this.a.destroy(),this.a=null)};
Pd.prototype.create=function(){if(this.a)return Promise.resolve(this.a);for(var a=this.g.a,b=Bd(a.c,a.b||1,this.f.duration||0),c=[],d=0;d<b.length;++d){var e=b[d].start,f=b[d].timescaledGapInfo,g=e/a.b,h=b[d].end/a.b,k=zd(this.h,this.g,d+a.j,e);if(!k)return a=Error("Failed to generate media URL."),a.type="dash",Promise.reject(a);var l=(a.i||0)/a.b;c.push(new vd(g-l,h-l,k,e,f||null))}"dynamic"==this.c.type?this.a=new T(c,a.b||1,this.c,this.f,this.i):this.a=new R(c,a.b||1);return Promise.resolve(this.a)};
Pd.prototype.b=function(){return this.a};function Qd(){this.M=Rd++;this.id=this.S=this.J=null;this.b=0;this.height=this.width=this.bandwidth=null;this.c=this.a="";this.switchReason=this.g=this.fbQualityClass=this.fbQualityLabel=null;this.f=[];this.ga=!1;this.X=!0}var Rd=0;Qd.prototype.destroy=function(){this.J&&(this.J.destroy(),this.J=null);this.S&&(this.S.destroy(),this.S=null)};function Yd(a){var b=a.a||"";a.c&&(b+='; codecs="'+a.c+'"');return b}
function Zd(){this.M=$d++;this.id=null;this.contentType=this.lang="";this.f=this.b=!1;this.c=null;this.u=[];this.a=[]}var $d=0;Zd.prototype.destroy=function(){for(var a=0;a<this.u.length;++a)this.u[a].destroy();this.a=this.u=null};function ae(a){for(var b=[],c=0;c<a.a.length;++c){var d=new be;d.id=a.M;d.a=a.a[c];d.contentType=a.contentType;d.b=a.u.length?Yd(a.u[0]):"";b.push(d)}return b}function ce(){this.id=null;this.start=0;this.duration=null;this.a=[]}
ce.prototype.destroy=function(){for(var a=0;a<this.a.length;++a)this.a[a].destroy();this.a=null};function de(){this.b=!1;this.i=this.g=this.f=null;this.c=0;this.a=[];this.h=!1;this.j="none"}de.prototype.destroy=function(){for(var a=0;a<this.a.length;++a)this.a[a].destroy();this.a=null};function be(){this.id=0;this.a=null;this.b=this.contentType=""};function U(a,b,c,d,e,f,g,h,k,l,m,p,v){C.call(this,a);this.a=b;this.b=c;this.c=new tb(c,d,e,f,this,h);this.Ka=h;this.m={};this.pa=f;this.qa=0;this.Z=this.f=this.g=null;this.fa=!1;this.s=this.P=null;this.G=!1;this.V=0;this.W=!1;this.w=null;this.L=this.R=this.j=!1;this.C=new F;this.B=this.U=this.v=!1;this.oa=this.F=0;this.T=15;this.Da=this.ha=this.I=!1;this.N=g;this.ma=!1;this.o=null;this.Fa=!1;this.ca=null;this.h=m||null;this.H=p||null;this.l=v||null;this.K=null;this.O=!1;this.ya={};this.Ba=k;this.i=
null;this.$=!1;this.za=0;this.ra=e?e.split(";")[0]:"";this.D=!1;this.ba=l}r(U,C);U.prototype.la=function(){return{SourceBufferManager:this.c}};U.prototype.getDebug=U.prototype.la;
U.prototype.aa=function(a){null!=a.initialStreamBufferSize&&(this.F=Number(a.initialStreamBufferSize));var b=this.b.getNumber("initial_stream_buffer_size_for_video_stream",0);0<b&&-1!==this.ra.indexOf("v")&&(this.F=b);null!=a.dynamicStreamBufferSize&&(this.V=Number(a.dynamicStreamBufferSize));null!=a.smartBufferAdjustmentParams&&(this.ya=a.smartBufferAdjustmentParams);null!=a.smartBufferAdjustmentEnabled&&(this.O=Boolean(a.smartBufferAdjustmentEnabled));null!=a.streamBufferSize&&(this.T=Number(a.streamBufferSize));
null!=a.fixBufferingGoalDetermination&&(this.I=Boolean(a.fixBufferingGoalDetermination));null!=a.addCdnDebugQueryParameters&&(this.ha=Boolean(a.addCdnDebugQueryParameters));null!=a.useInitialBufferSizeWhenPaused&&(this.Da=Boolean(a.useInitialBufferSizeWhenPaused));null!=a.segmentRequestTimeout&&(this.c.O=Number(a.segmentRequestTimeout));null!=a.resolveVideoTimeUpdateOnFragmentedTimeRanges&&(this.ma=Boolean(a.resolveVideoTimeUpdateOnFragmentedTimeRanges));null!=a.performanceLogger&&(this.o=this.m.performanceLogger=
a.performanceLogger);null!=a.abrLogger&&(this.m.abrLogger=a.abrLogger);null!=a.reappendInitSegmentAfterAbort&&(this.m.reappendInitSegmentAfterAbort=Boolean(a.reappendInitSegmentAfterAbort));null!=a.liveDataFetchMaxRetries&&(this.m.liveDataFetchMaxRetries=Number(a.liveDataFetchMaxRetries));null!=a.liveSourceBufferClearMaxRetries&&(this.m.liveSourceBufferClearMaxRetries=Number(a.liveSourceBufferClearMaxRetries));null!=a.skipEmptySegments&&(this.m.skipEmptySegments=Boolean(a.skipEmptySegments));null!=
a.playheadFragmentedGapDiffAllowance&&(this.m.playheadFragmentedGapDiffAllowance=Number(a.playheadFragmentedGapDiffAllowance));null!=a.useMicroTaskTimeouts&&(this.Fa=Boolean(a.useMicroTaskTimeouts));a=this.c;b=this.m;null!=b.reappendInitSegmentAfterAbort&&(a.L=Boolean(b.reappendInitSegmentAfterAbort));null!=b.performanceLogger&&(a.o=b.performanceLogger);null!=b.abrLogger&&(a.F=b.abrLogger);null!=b.liveDataFetchMaxRetries&&(a.I=b.liveDataFetchMaxRetries);null!=b.liveSourceBufferClearMaxRetries&&(a.H=
b.liveSourceBufferClearMaxRetries);null!=b.playheadFragmentedGapDiffAllowance&&(a.K=b.playheadFragmentedGapDiffAllowance);null!=b.skipEmptySegments&&(a.R=b.skipEmptySegments)};U.prototype.destroy=function(){ee(this);this.C.destroy();this.pa=this.g=this.C=null;this.c.destroy();this.a=this.c=null;this.b.getBool("fixing_scheduler_disable_leaks",!0)&&(this.h=null);this.na=null};n=U.prototype;n.Ea=function(){return this.g};n.ob=function(){return this.f};
n.bc=function(a){this.v||a.then(function(){this.v=!0;this.s||V(this,0)}.bind(this)).catch(function(){});return this.C};n.ab=function(){return this.B};
n.Ma=function(a,b,c,d){if(a!=this.g){var e=a.S;e&&(this.Z=e.create(this.o,this.Ka));this.L=!0;a.J.create().then(G(this,function(e){if(this.a){this.L=!1;var g=this.g;this.g=a;var h=this.f;this.f=e;h&&Hd(h);Gd(this.f,function(){this.l&&this.l.setSegments(this.f.l());this.h&&fe(this,this.g.id||"",this.f)}.bind(this));this.l&&this.l.setSegments(this.f.l());this.h&&fe(this,a.id||"",e);this.fa=!0;this.P=d?d:null;this.G||(this.b.getBool("make_early_track_selection",!1)&&this.j&&!this.D&&!this.s?V(this,0):
g?b&&ge(this,!0,c):V(this,0))}})).catch(G(this,function(a){this.L=!1;"aborted"!=a.type&&(this.v?(a=w(a),this.dispatchEvent(a)):this.C.reject(a))}))}};n.Xb=function(a){return ge(this,!!a)};n.Yb=function(){this.W=!0};n.$b=function(a){this.za=a};
function fe(a,b,c){if(a.b.getBool("use_update_segments_by_shaka_reference",!0))a.h.updateSegmentsByShakaReferences(b,c.l());else{var d;(d=0===c.a.length?null:Fd(c.A(),c.a.length-1))&&!a.h.hasSegment(d)&&(d=0<a.h.getSegments(b).length?a.a.currentTime-10:null,a.h.updateSegments(b,Ed(c,d)))}}
function ge(a,b,c){a.g&&!a.G&&(a.G=!0,ee(a),wb(a.c).then(G(a,function(){var a=this.a.currentTime;this.b.getBool("set_current_time_in_resync",!1)&&0==a&&(a=S(this.f).startTime);if(!b&&0<xb(this.c,a)&&0<=Eb(this.c.a,a))return Promise.resolve();if(c)return Ib(this.c,this.a.currentTime+c);this.$=!0;return Hb(this.c)})).then(G(a,function(){this.G=!1;V(this,0)})).catch(G(a,function(a){this.G=!1;"aborted"!=a.type&&(this.v?(a=w(a),this.dispatchEvent(a)):this.C.reject(a))})))}
n.Zb=function(a){return 0<xb(this.c,a)&&0<=Eb(this.c.a,a)};n.Ta=function(){};n.Za=function(){return!0};
function he(a){a.R=a.R||!a.a.paused;a.a.paused||a.O||(a.K=Date.now(),a.O=!0);var b=a.ya,c=null;if(b.inExperiment)if(b.useSmartBuffering){if(a.O&&a.K){var c=(Date.now()-a.K)/1E3,d=null;1>c?c=null:(d=3>c?b.bufferSize_00_to_03:10>c?b.bufferSize_03_to_10:30>c?b.bufferSize_10_to_30:60>c?b.bufferSize_30_to_60:b.bufferSize_above_60,c=Math.min(d,a.a.duration))}}else a.K&&(c=b.nonSmartBufferSize);c||(c=a.Da&&a.a.paused?a.F:a.T,a.V&&!a.a.paused&&(c=Math.max(Math.min(a.f.A().endTime-a.a.currentTime,a.V),a.T)));
c=(a.I?a.j&&a.R:a.j)?Math.max(a.F,c):a.F;0<a.b.getNumber("audio_video_buffer_diff_threshold",14400)&&(b=a.a.buffered.length?a.a.buffered.end(a.a.buffered.length-1):0,b=Math.max(0,b-a.a.currentTime),c=Math.min(c,b+a.b.getNumber("audio_video_buffer_diff_threshold",14400)));return c}function ie(a,b){return xb(a.c,a.j?b:b+(a.w||0))}
function je(a){if(a.j&&!a.v||a.b.getBool("make_early_track_selection",!1)&&a.L||a.b.getBool("prevent_fetch_while_fetching_in_stream",!1)&&a.D)return a.s=null,Promise.resolve();var b;if(b=a.v&&!a.B)b=1<a.c.b.buffered.length?!0:!1;if(b&&(a.W||Mb(a.c,a.a)))return a.ma&&(a.a.currentTime=Lb(a.a)),a.W=!1,ge(a,!0),Promise.resolve();a.b.getNumber("decouple_stream_on_update_loop_from_request_loop_int",0)||(a.s=null);b=a.g;var c=a.f,d=a.a.currentTime;a.b.getBool("use_pending_seek_position_for_reference",!1)&&
0===a.a.readyState&&!d&&a.ca&&(d=a.ca);if(a.I&&!a.j&&ie(a,d)>=a.b.getNumber("start_stream_buffer_size",1))return a.b.getBool("fix_chrome_mse_regression",!1)&&1===a.a.readyState&&0<a.a.buffered.length&&(a.a.currentTime=a.a.currentTime),ke(a),V(a,0),Promise.resolve();var e=null,f=[];if(ie(a,d)>=he(a))if(a.U=!0,a.I||ke(a),f=le(a)?me(a,d):[],0<f.length)e=f[0];else return V(a,1E3/(5*(Math.abs(a.a.playbackRate)||1))),Promise.resolve();else{e=1;a.l&&(e=a.l.getNumberOfSegments());var g=ne(a,d,c,e),e=g[0];
a.l&&(a.l.setFutureSegments(g),a.l.setBufferingGoal(he(a)-ie(a,d)));!e&&le(a)&&(f=me(a,d),0<f.length&&(e=f[0]))}if(!e)return ke(a),a.v&&!a.B&&(a.B=!0,oe(a)),V(a,200),Promise.resolve();if(a.h||a.H)g=a.j?d:d+(a.w||0),g={additionalSegmentsRequired:f,playhead:d,bufferStart:g,bufferEnd:ie(a,d)+g,bufferingGoal:he(a),isPlaying:!a.a.paused},a.h&&a.h.updatePlayerState(b.id||"",g),a.H&&a.H.getPriorityUpdater().updatePriorityWithNewPlayerState(g);a.b.getBool("refresh_segment_reference_failover_uri",!1)&&(e.url=
e.url.clone());a.D=!0;"video"===b.a.split("/")[0]&&a.pa.setRepresentationID(b.id);c=a.c.fetch(e,c.b,b.b+a.za,a.Z,a.ha&&!a.a.paused,0<f.length,a.h,a.H);c=c.then(G(a,function(a){this.ba.informNetworkResumed();return a}));a.N&&"video"===b.a.split("/")[0]&&a.N.add(e.startTime||0,e.endTime||0,{id:b.id,reason:a.P,performanceLogger:a.o?a.o.getOperationLogger("stream_switch"):null});a.Z=null;a.fa&&(a.fa=!1,e=a.P,a.P=null,pe(a,b,e));a.B=!1;return c.then(G(a,function(a){return this.b.getBool("clear_old_buffer",
!1)?Kb(this.c,this.a.currentTime).then(function(){return a}):a})).then(G(a,function(a){var b=a.ja;a=a.zc;this.j||(this.qa=a);this.D=!1;this.oa++;null==this.w&&(this.w=b);this.$&&0<xb(this.c,d)&&(this.$=!1,this.b.getBool("disable_nudge",!1)||(b=u({type:"should_nudge"}),this.dispatchEvent(b)));V(this,0)})).catch(G(a,function(a){this.D=!1;return Promise.reject(a)}))}
function qe(a,b,c){var d=null!==a.i&&-1<a.i&&a.i<c.length()-1?c.get(a.i):null,e=null;if(null===a.i||!d||d.startTime>b)return e=Eb(c.a,b),a.i=e;for(d=a.i;d<=a.i+1;d++)if(e=c.get(d),e.startTime<=b&&e.endTime>b)return a.i=d;e=Eb(c.a,b);return(a.i=e)||-1}function le(a){return a.b.getBool("replace_lower_quality_buffer",!1)&&null===a.H&&a.R&&null!==a.N&&"video"===a.g.a.split("/")[0]&&null!==a.f}
function me(a,b){if(!a.Ba||!a.g.id||!a.f)return[];var c=qe(a,b,a.f);return-1===c?[]:BufferReplacementHelper.getSegmentsToReplaceLowerQuality(a.f.l(),b,c,a.g.id,a.Ba,a.N,{thresholdBefore:a.b.getNumber("buffer_replacement_behind_threshold",5),thresholdAfter:a.b.getNumber("buffer_replacement_ahead_threshold",15),wrapReplacementPastEnd:a.b.getBool("wrap_replacement_past_end",!1)})}
n.Vb=function(){var a;this.b.getNumber("decouple_stream_on_update_loop_from_request_loop_int",0)&&V(this,this.b.getNumber("decouple_stream_on_update_loop_from_request_loop_int",0));this.b.getBool("catch_stream_update_sync_code_error",!1)?a=new Promise(function(a,c){try{je(this).then(a).catch(c)}catch(d){d.type="uncaught",c(d)}}.bind(this)):a=je(this);a.catch(G(this,function(a){if("aborted"!=a.type){if("sourcebuffer_full"===a.type)return Hb(this.c).then(G(this,function(){V(this,0)}));var c=-1===[0,
404,410,502,503,504].indexOf(a.status);if("net"===a.type&&!c&&this.g)if(this.b.getBool("allow_infinite_retry_on_net_err",!1))switch(a.status){case 404:V(this,2E3);break;case 410:this.B=!0;oe(this);break;default:V(this,1E3)}else V(this,1E3),c=!0;0===a.status?this.ba.informNetworkInterrupted():this.ba.informNetworkResumed();if(!this.b.getBool("allow_infinite_retry_on_net_err",!1)||c)c=w(a),this.dispatchEvent(c),this.o&&setTimeout(function(){var c=this.o.getEventLogger("stream_error_fallback").setError(a).setType(this.ra.split("/")[0]);
this.a?c.setResult("failed"):c.setResult("success");c.log()}.bind(this),0)}}))};function ne(a,b,c,d){var e,f=a.c;e=f.a.length;e=0<e?f.a[e-1]:null;f=-1;null!=e?f=a.b.getBool("enable_segment_reference_epsilon",!1)?null!=e.endTime?c.findIndexByStartTime(e.endTime):-1:null!=e.endTime?Eb(c.a,e.endTime):-1:(f=qe(a,b,c),0>f&&(f=c.length()?c.length()-1:-1));if(0>f)return[];a=[];for(b=f;b<f+d&&b<c.length();b++)a.push(c.get(b));return a}
function ke(a){if(!a.j&&null!=a.w){a.j=!0;var b=a.c,c=a.w,d=c-b.P;0!=d&&(b.a=xd(b.a,d),b.P=c);a.C.resolve(a.w)}}n.Wc=function(){return this.U};U.prototype.hasHitBufferingGoal=U.prototype.Wc;function pe(a,b,c){var d=b.a.split("/")[0];b=u({type:"adaptation",id:b.id,bubbles:!0,contentType:d,size:"video"!=d?null:{width:b.width,height:b.height},bandwidth:b.bandwidth,reason:c});a.dispatchEvent(b)}function oe(a){var b=u({type:"ended"});a.dispatchEvent(b)}
function V(a,b){ee(a);!b&&a.Fa?Promise.resolve().then(a.Vb.bind(a)):a.s=setTimeout(a.Vb.bind(a),b)}function ee(a){null!=a.s&&(clearTimeout(a.s),a.s=null)}U.prototype.Sa=function(){return this.qa};function re(a){this.c=a;this.a=null}re.prototype.destroy=function(){this.a&&(this.a.destroy(),this.a=null)};re.prototype.create=function(){if(this.a)return Promise.resolve(this.a);var a=new vd(0,null,this.c);this.a=new R([a],1);return Promise.resolve(this.a)};re.prototype.b=function(){return this.a};function se(a,b){C.call(this,a);this.b=b;this.h=!0;this.i=this.g=null;this.f=new F;this.a=null}r(se,C);se.prototype.aa=function(){};se.prototype.destroy=function(){this.a&&this.b.removeChild(this.a);this.f.destroy();this.na=this.b=this.g=this.i=this.a=this.f=null};n=se.prototype;n.Ea=function(){return this.g};n.ob=function(){return this.i};n.bc=function(){return this.f};n.ab=function(){return!0};
n.Ma=function(a){a.J.create().then(G(this,function(b){if(this.b){if(0==b.length())return Promise.reject(Error("No subtitles URL available."));var c=this.g;this.g=a;this.i=b;b=S(b).url.c[0].toString();var d=this.Za();this.a&&(this.Ta(!1),this.b.removeChild(this.a));this.a=document.createElement("track");this.b.appendChild(this.a);this.a.src=b;this.Ta(d);b=u({type:"adaptation",bubbles:!0,contentType:"text",size:null,bandwidth:a.bandwidth});this.dispatchEvent(b);c||this.f.resolve(0)}}))};n.Xb=function(){};
n.Yb=function(){};n.Zb=function(){return!0};n.Ta=function(a){this.h=a;this.a&&(this.a.track.mode=a?"showing":"disabled")};n.Za=function(){this.a&&(this.h="showing"==this.a.track.mode);return this.h};n.Sa=function(){return 0};n.$b=function(){};function te(){}
te.prototype.parse=function(a,b,c,d){var e=null;try{var f;var g=new Ma(b);if(440786851!=Oa(g).id)f=null;else{var h=Oa(g);if(408125543!=h.id)f=null;else{var k=h.a.byteOffset,l;var m=new Ma(h.a);for(b=null;Ga(m.a);){var p=Oa(m);if(357149030==p.id){b=p;break}}if(b){for(var v=new Ma(b.a),p=1E6,m=null;Ga(v.a);){var y=Oa(v);if(2807729==y.id)p=Sa(y);else if(17545==y.id)if(b=y,4==b.a.byteLength)m=b.a.getFloat32(0);else if(8==b.a.byteLength)m=b.a.getFloat64(0);else throw new RangeError("EbmlElement: floating point numbers must be 4 or 8 bytes.");}null==
m?l=null:(v=p/1E9,l={qb:v,duration:m*v})}else l=null;f=l?{Uc:k,qb:l.qb,duration:l.duration}:null}}if(f){var E=Oa(new Ma(a));if(475249515!=E.id)e=null;else{var N=f.Uc,aa=f.qb,ea=f.duration;a=[];var ia=new Ma(E.a);for(f=E=-1;Ga(ia.a);){var jd=Oa(ia);if(187==jd.id){var Ia;var kd=new Ma(jd.a),ld=Oa(kd);if(179!=ld.id)Ia=null;else{var Ge=Sa(ld),Sd=Oa(kd);if(183!=Sd.id)Ia=null;else{for(var Td=new Ma(Sd.a),k=0;Ga(Td.a);){var Ud=Oa(Td);if(241==Ud.id){k=Sa(Ud);break}}Ia={Yc:Ge,Tc:k}}}if(Ia){var Vd=aa*Ia.Yc,
Wd=N+Ia.Tc;if(0<=E){var zc=new H(d,c,f,Wd-1);a.push(new vd(E,Vd,zc))}E=Vd;f=Wd}}}0<=E&&(zc=new H(d,c,f,null),a.push(new vd(E,ea,zc)));e=a}}else e=null}catch(Xd){if(!(Xd instanceof RangeError))throw Xd;}return e};function ue(a,b,c,d,e,f,g,h,k,l,m){this.h=a;this.m=b;this.c=c;this.l=l||null;this.j=m||null;this.a=d;this.g=e;this.f=f;this.v=g;this.ua=null;this.i=h;this.o=k||null;this.s=null}ue.prototype.destroy=function(){this.i=this.m=this.h=null;this.a.Ia();this.a=null;this.f&&(this.f.Ia(),this.f=null);this.g&&(this.g.Ia(),this.g=null);this.ua=null};ue.prototype.yc=function(){return this.ua};ue.prototype.create=function(){return ve(this)};ue.prototype.Ra=function(){return ve(this)};
function ve(a){if(a.ua)return a.ua;var b=null;a.o&&(b=a.o.getOperationLogger("create_container_segment_index_source").start());if(null!==a.l&&(null!==a.j||"webm"!==a.c))return we(a,a.l,a.j,b);var c=[a.a.fetch(null,null,a.o,b)];"webm"==a.c&&c.push(a.g.fetch(null,null,a.o,b));a.ua=Promise.all(c).then(G(a,function(a){return we(this,a[0],a[1]||null,b)}));return a.ua}
function we(a,b,c,d){var e=null;"mp4"==a.c?(e=new Cd,e=e.parse(new DataView(b),a.a.startByte,a.a.c,a.i,a.f)):"webm"==a.c&&(e=new te,e=e.parse(new DataView(b),new DataView(c),a.a.c,a.i));if(!e)return a=Error("Failed to parse SegmentReferences from "+a.a.toString()+" (or one of its fallbacks)."),a.type="stream",Promise.reject(a);var f;"dynamic"==a.h.type?f=new T(e,e.b,a.h,a.m,a.v):f=new R(e,e.b);d&&d.log();a.s=f;return Promise.resolve(f)}ue.prototype.b=function(){return this.s};function xe(a,b){this.a=a;this.o=b||null}
function ye(a,b,c){for(var d=(Date.now()+Da)/1E3,e=0;e<b.a.length;++e)for(var f=b.a[e],g=0;g<f.a.length;++g){var h=f.a[g];if("text"!=h.contentType)for(var k=0;k<h.a.length;++k){var l=h.a[k],m=0,m=m+(l.g?1:0),m=m+(l.b?1:0),m=m+(l.a?1:0);0==m?(h.a.splice(k,1),--k):1!=m&&(l.g?(l.b=null,l.a=null):l.b&&(l.a=null))}}ze(b);for(e=0;e<b.a.length;++e)for(f=b.a[e],g=0;g<f.a.length;++g){k=h=f.a[g];l=null;for(m=0;m<k.a.length;++m){var p=k.a[m].f||"";l?p!=l&&(k.a.splice(m,1),--m):l=p}0==h.a.length&&(f.a.splice(g,
1),--g)}"dynamic"==b.type&&null==b.c&&(b.c=d);e=new de;"dynamic"==b.type&&(e.b=!0,e.f=b.g,e.g=new H(c,b.j||b.url),e.i=b.c);e.c=b.h||5;for(f=0;f<b.a.length;++f){g=b.a[f];if(null==g.start)break;g=Ae(a,b,g,d,c);e.a.push(g)}a="none";for(f=0;f<b.a.length;f++)for(g=b.a[f],c=0;c<g.a.length;c++)for(d=g.a[c],h=0;h<d.a.length;h++)k=d.a[h].j,null!=k&&null!=k.value&&(a=k.value,"urn:mpeg:dash:23003:3:audio_channel_configuration:2011"===k.a&&("1"===a?a="mono":"2"===a&&(a="stereo")));e.j=a;return e}
function ze(a){if(a.a.length){null==a.a[0].start&&(a.a[0].start=0);var b=function(a){return 0==a||!!a};"dynamic"==a.type&&(a.b=null);b(a.b)&&1==a.a.length&&!b(a.a[0].duration)&&(a.a[0].duration=a.b);for(var c=0,d=!0,e=0;e<a.a.length;++e){var f=a.a[e-1],g=a.a[e],h=a.a[e+1]||{start:a.b};!b(g.start)&&f&&b(f.start)&&b(f.duration)&&(g.start=f.start+f.duration);!b(g.duration)&&b(h.start)&&(g.duration=h.start-g.start);null!=g.start&&null!=g.duration?c+=g.duration:d=!1}b(a.b)||(e=a.a[a.a.length-1],d?a.b=
c:b(e.start)&&b(e.duration)?a.b=e.start+e.duration:"dynamic"!=a.type&&(a.b=c))}}
function Ae(a,b,c,d,e){var f=new ce;f.id=c.id;f.start=c.start;f.duration=c.duration;var g=new A;c.a.forEach(function(a){g.push(a.contentType||"",a)});for(var h=hb(g),k=0;k<h.length;++k){var l=new A;g.get(h[k]).forEach(function(a){l.push(a.group,a)});for(var m=hb(l),p=0;p<m.length;++p){var v=new A;l.get(m[p]).forEach(function(a){v.push(a.lang,a)});for(var y=hb(v),E=0;E<y.length;++E){var N=v.get(y[E]),N=Be(a,b,c,N,d,e);f.a.push(N)}}}return f}
function Be(a,b,c,d,e,f){ca(d.every(function(a){return a.group==d[0].group&&(a.lang||"")==(d[0].lang||"")&&(a.contentType||"")==(d[0].contentType||"")}));var g=new Zd,h=d.filter(function(a){return null!=a.id});h.length==d.length&&(g.id=h.map(function(a){return a.id}).sort().reduce(function(a,b){return a+","+b}));g.b=!(!d[0].c||"urn:scte:dash:cc:cea-608:2015"!==d[0].c.a);g.lang=d[0].lang||"";g.contentType=d[0].contentType||"";g.f=d.some(function(a){return a.g});for(var h={},k=0;k<d.length;++k){var l=
d[k];l.f&&(g.c=l.f);for(var m=0;m<l.a.length;++m){var p=l.a[m],v=Ce(a,p),y=g.a.slice(0);De(v,y);0==y.length&&0<g.a.length||!(p=Ee(a,b,c,p,e,f))||(g.u.push(p),g.a=y,h[p.M]=l)}}if(g.a.some(function(a){return""==a.a}))return g.u.forEach(function(a){a.ga=!0}),g;a=Fe(d);for(k=0;k<g.u.length;++k)p=g.u[k],l=h[p.M],l==a&&(p.ga=!0);return g}
function Fe(a){for(var b=null,c=null,d=0;d<a.length;++d)for(var e=a[d],f=0;f<e.a.length;++f){var g=e.a[f],g=(g.width||1)*(g.height||1)*(g.bandwidth||1);if(null==b||g<b)b=g,c=e}return c}function De(a,b){if(0==b.length)Array.prototype.push.apply(b,a);else for(var c=0;c<b.length;++c){for(var d=!1,e=0;e<a.length;++e){var f=b[c],g=a[e];if(f.a==g.a&&f.h==g.h&&f.l==g.l&&f.g==g.g&&f.i==g.i&&f.f==g.f&&f.j==g.j&&Qa(f.c,g.c)){d=!0;Tb(b[c],a[e].b);break}}d||(b.splice(c,1),--c)}}
function Ce(a,b){var c=[];if(0==b.c.length)c.push(new Rb);else if(a.a)for(var d=0;d<b.c.length;++d)c.push.apply(c,He(a,b.c[d]));return c}
function He(a,b){var c=[];if(2!=a.a.length)return[];var d=a.a(b.f||"",b.c);if(!(d&&d instanceof Array))return[];for(var e=0;e<d.length;++e){var f;var g=d[e];f=new Rb;if(g){var h=db(g,"keySystem");if(null!=h)f.a=h;else throw Error("'keySystem' cannot be null.");var k=db(g,"licenseServerUrl");if(null!=k)f.h=k;else if(h)throw Error("For encrypted streaming content, 'licenseServerUrl' cannot be null or empty.");h=x(g,"withCredentials");null!=h&&(f.l=h);h=eb(g,"licensePostProcessor",Function);null!=h&&
(f.m=h);h=eb(g,"licensePreProcessor",Function);null!=h&&(f.s=h);h=x(g,"distinctiveIdentifierRequired");null!=h&&(f.g=h);h=x(g,"persistentStateRequired");null!=h&&(f.i=h);h=db(g,"audioRobustness");null!=h&&(f.f=h);h=db(g,"videoRobustness");null!=h&&(f.j=h);h=eb(g,"serverCertificate",Uint8Array);null!=h&&(f.c=h);if(h=eb(g,"initData",Object)){g=eb(h,"initData",Uint8Array);if(null==g)throw Error("'initData.initData' cannot be null.");h=db(h,"initDataType");if(null==h)throw Error("'initData.initDataType' cannot be null.");
f.b.push({initData:new Uint8Array(g.buffer),initDataType:h})}}0==f.b.length&&b.a&&b.a.psshBox&&Tb(f,[{initData:b.a.psshBox,initDataType:"cenc"}]);c.push(f)}return c}
function Ee(a,b,c,d,e,f){if(!d.baseUrl||0===d.baseUrl.length)return null;var g=null,h=1,k=0;if(d.g){g=d.f.split("/")[1];if("mp4"!=g&&"webm"!=g)g=null;else{var l=d.g;if("webm"!=g||l.f)if(l.a||l.c&&l.c.a){h=l.c;h||(h=new Bc,h.url=d.baseUrl,h.a=l.a?l.a.clone():null);k=Ie(h,f);h=l.f?Ie(l.f,f):null;l.g?(l=l.g,l=new H(f,d.baseUrl,l.xa,l.end)):l=null;var m=l,p=VideoPlayerShakaGlobalConfig.getBool("add_inline_initialization_resources",!1)&&d.i&&d.i.data?d.i.data:null,l=VideoPlayerShakaGlobalConfig.getBool("add_inline_initialization_resources",
!1)&&d.h&&d.h.data?d.h.data:null;b=new ue(b,c,g,k,h,m,e,f,a.o,p,l);c=new td(h,l);e=new Qd;e.J=b;e.S=c;g=e}else g=null;else g=null}h=d.g.b;k=d.g.h}else if(d.b)a=d.b,!a.f&&!a.a&&1<a.c.length?g=null:a.f||c.duration||a.a||1!=a.c.length?a.a&&0===a.a.a.length?g=null:(a=a.h?Ie(a.h,f):null,b=new Od(b,c,d,e,f),c=new td(a),e=new Qd,e.J=b,e.S=c,g=e):g=null,h=d.b.b,k=d.b.g;else if(d.a){a:if(g=d.a,h=0+(g.f?1:0),h+=g.c?1:0,h+=g.a?1:0,0==h?h=!1:(1!=h&&(g.f?(g.c=null,g.a=null):g.c&&(g.a=null)),h=!0),h){h=null;if(g.g&&
(h=(g=d.a.g)?Je(d,g,Cc):null,!h)){g=null;break a}g=h?Ie(h,f):null;h=d.a;h.f?(h=d.f.split("/")[1],"mp4"!=h&&"webm"!=h?b=null:"webm"!=h||g?zd(f,d,1,0)?(k=(k=d.a.f)?Je(d,k,Bc):null)?(k=Ie(k,f),b=new ue(b,c,h,k,g,null,e,f,a.o)):b=null:b=null:b=null):b=h.h?h.c?new Pd(b,c,d,e,f):h.a?"dynamic"!=b.type&&null==c.duration?null:new Nd(b,c,d,e,f):null:null;b?(c=new td(g),e=new Qd,e.J=b,e.S=c,g=e):g=null}else g=null;h=d.a.b;k=d.a.i}else"text"==d.f.split("/")[0]&&(g=new Qd,g.J=new re(new H(f,d.baseUrl)));if(!g)return null;
g.id=d.id;k&&(g.b=-1*k/h);g.bandwidth=d.bandwidth;g.width=d.width;g.height=d.height;g.a=d.f||"";g.c=d.l||"";g.fbQualityLabel=d.fbQualityLabel||null;g.fbQualityClass=d.fbQualityClass||null;g.g=d.m||null;for(b=0;b<d.c.length;++b)c=d.c[b],c.b&&g.f.push(c.b);return g}function Je(a,b,c){b=Ad(b,a.id,null,a.bandwidth,null);if(!b)return null;c=new c;c.url=id(a.baseUrl,b);return c}function Ie(a,b){var c=a.url,d=0,e=null;a.a&&(d=a.a.xa,e=a.a.end);return new H(b,c,d,e)};function Ke(a,b,c,d,e,f){this.b=new H(null,[new I(a)]);this.a=new zb;this.a.body=b;this.a.method=c;this.a.b=3;this.a.v=d;this.a.f=1E3*(null!=f?f:na);a=e||{};for(var g in a)this.a.c[g]=a[g]}function Le(a){return a.b.fetch(a.a).then(function(a){return Promise.resolve(new Uint8Array(a))})};function Me(a,b,c){C.call(this,a);this.c=b;this.j=c;this.a=this.h=null;this.i=new ib;this.b=[];this.f=[];this.m=0;this.g=new F;this.l=null;this.w=na}r(Me,C);Me.prototype.destroy=function(){this.na=null;for(var a=0;a<this.f.length;++a)this.f[a].close().catch(function(){});this.f=[];this.b=this.a=this.h=null;this.g.destroy();this.g=null;this.i.destroy();this.i=null;this.l&&(clearTimeout(this.l),this.l=null);this.c=this.j=null};
Me.prototype.initialize=function(){for(var a=new A,b=Ne(this.j),c=0;c<b.length;++c){var d=b[c];d.a.a||d.b&&!Oe(d.b)||a.push(d.contentType,d)}for(var c={},d=!1,e=0;e<b.length;++e){var f=b[e];if(f.a.a&&!a.a.hasOwnProperty(f.contentType)){var g=f.a.a,h=c[g];h||(h=f.a,h={audioCapabilities:void 0,videoCapabilities:void 0,initDataTypes:void 0,distinctiveIdentifier:h.g?"required":"optional",persistentState:h.i?"required":"optional",sessionTypes:["temporary"]},c[g]=h);if(f.b&&(g=f.contentType+"Capabilities",
g in h)){d=!0;h[g]||(h[g]=[]);var k;"audio"==f.contentType?k=f.a.f:"video"==f.contentType&&(k=f.a.j);h[g].push({contentType:f.b,robustness:k})}}}if(!d)if(b.length)this.a=b[0].a;else throw a=Error("No DrmInfo exists!"),a.type="drm",a;if(0==Object.keys(c).length)return Pe(this.j,a),this.g.resolve(),Promise.resolve();k=new F;c=Qe(c,k);c=c.then(this.v.bind(this,b,a));k.reject(null);return c};
function Qe(a,b){for(var c in a)b=b.catch(function(a,b){return navigator.requestMediaKeySystemAccess(a,[b])}.bind(null,c,a[c]));return b}
Me.prototype.v=function(a,b,c){if(!this.c)return Re();for(var d=c.keySystem,e=c.getConfiguration(),f=["audio","video"],g=0;g<f.length;++g){var h=f[g];if(!b.a.hasOwnProperty(h)){var k=e[h+"Capabilities"];if(k){for(var k=k[0],l=[],m={},p=0;p<a.length;++p){var v=a[p],y=k?v.b==k.contentType:v.contentType==h;v.a.a!=d||!y||v.id in m||(l.push(v),m[v.id]=!0,this.a=this.a?Sb(this.a,v.a):v.a)}b.set(h,l)}}}Pe(this.j,b);return c.createMediaKeys().then(function(a){this.h=a}.bind(this))};
function Se(a){return a.c?a.h?a.c.setMediaKeys(a.h).then(G(a,function(){return this.c?this.a.c?this.h.setServerCertificate(this.a.c):Promise.resolve():Re()})).then(G(a,function(){if(!this.c)return Re();for(var a=0;a<this.a.b.length;++a){var c=this.a.b[a];this.s({type:"encrypted",initDataType:c.initDataType,initData:c.initData})}0==this.a.b.length&&B(this.i,this.c,"encrypted",this.s.bind(this))})):Promise.resolve():Re()}
function Re(){var a=Error("EmeManager destroyed");a.type="destroy";return Promise.reject(a)}
Me.prototype.s=function(a){for(var b=new Uint8Array(a.initData),c=0;c<this.b.length;++c)if(Qa(b,this.b[c].data))return;try{var d=Te(this)}catch(e){b=w(e);this.dispatchEvent(b);this.g.reject(e);return}a=d.generateRequest(a.initDataType,a.initData);this.b.push({data:b,nb:d});a.catch(G(this,function(a){if(this.c){for(var b=0;b<this.b.length;++b)if(this.b[b].nb==d){this.b.splice(b,1);break}b=w(a);this.dispatchEvent(b);this.g.reject(a)}}));this.f.push(d)};
function Te(a){var b=null,b=a.h.createSession();B(a.i,b,"message",a.C.bind(a));B(a.i,b,"keystatuseschange",a.B.bind(a));return b}Me.prototype.C=function(a){Ue(this,a.target,this.a,a.message)};
Me.prototype.B=function(a){a=a.target;var b={};a.keyStatuses.forEach(function(a,c){if("string"==typeof a){var f=a;a=c;c=f}if("com.microsoft.playready"==this.a.a&&16==a.byteLength){var f=new DataView(a),g=f.getUint32(0,!0),h=f.getUint16(4,!0),k=f.getUint16(6,!0);f.setUint32(0,g,!1);f.setUint16(4,h,!1);f.setUint16(6,k,!1)}f=Qb(new Uint8Array(a));b[f]=c}.bind(this));if(a.expiration<Date.now()){for(var c=0;c<this.b.length;++c)if(this.b[c].nb==a){this.b.splice(c,1);break}a.close();this.f.splice(this.f.indexOf(a),
1)}Ve(this.j,b)};function Ue(a,b,c,d){d=We(c,d);Le(new Ke(d.url,d.body,d.method,c.l,d.headers,a.w)).then(G(a,function(a){c.m&&(a=c.m(a));return b.update(a)})).then(G(a,function(){var a=u({type:"sessionReady",detail:b});this.dispatchEvent(a);this.m++;this.m>=this.f.length&&this.g.resolve()})).catch(G(a,function(a){a.nb=b;a=w(a);this.dispatchEvent(a)}))}
function We(a,b){var c={url:a.h,body:b.slice(0),method:"POST",headers:{}};if("com.microsoft.playready"===a.a){for(var d=String.fromCharCode.apply(null,new Uint16Array(c.body)),d=(new DOMParser).parseFromString(d,"application/xml"),e=d.getElementsByTagName("name"),f=d.getElementsByTagName("value"),g=0;g<e.length;g++)c.headers[e[g].childNodes[0].nodeValue]=f[g].childNodes[0].nodeValue;c.body=window.atob(d.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue)}if(!a.s)return c;a.s(c);c.url=db(c,
"url");if(null==c.url)throw Error("'url' cannot be null.");if(!(c.body instanceof ArrayBuffer||"string"==typeof c.body||null==c.body))throw new TypeError("'body' must be an ArrayBuffer, a string, or null.");c.method=db(c,"method");if("GET"!=c.method&&"POST"!=c.method)throw Error("'method' must be either 'GET' or 'POST'.");c.headers=eb(c,"headers",Object);if(null==c.headers)throw Error("'headers' cannot be null.");return c};function W(a,b,c,d,e){C.call(this,null);this.b=a;this.s=b;this.c=null;this.f=new ib;this.j=this.i=null;this.D=0;this.B=null;this.h=!1;this.I=this.K=!0;this.g=!1;this.a={enableAdaptation:!0,streamBufferSize:15,liveStreamEndTimeout:15,licenseRequestTimeout:na,mpdRequestTimeout:oa,segmentRequestTimeout:pa,preferredLanguage:"en",restrictions:new qa};this.o=c;this.w=d;this.L=e;this.l=null;this.m=1;this.F=null;this.v=!1}r(W,C);q("shaka.player.Player",W);W.version="v1.6.4-fb";
W.isBrowserSupported=function(){return!!window.MediaSource&&!!window.Uint8Array};
W.prototype.la=function(){var a={},b=this.c;if(b){var c=b.ub();a.BandwidthEstimator=c.BandwidthEstimator;var d=c.VideoSourceStream;d&&(a.VideoSourceStream=d,(d=a.VideoBufferManager=d.la().SourceBufferManager)&&(a.VideoSourceBuffer=d.la().SourceBuffer));(d=a.AudioSourceStream=c.AudioSourceStream)&&(d=a.AudioBufferManager=d.la().SourceBufferManager)&&(a.AudioSourceBuffer=d.la().SourceBuffer);a.TextSourceStream=c.TextSourceStream;a.getManifest=b.hc.bind(b)}else a.getManifest=function(){};a.$c=!0;return a};
W.prototype.getDebug=W.prototype.la;W.prototype.T=function(a){this.K=a};W.prototype.setResumeAfterBuffering=W.prototype.T;function Oe(a){return"text/vtt"==a?!!window.VTTCue:MediaSource.isTypeSupported(a)}W.isTypeSupported=Oe;W.setTextStyle=function(a){var b=document.getElementById("ShakaPlayerTextStyle");b||(b=document.createElement("style"),b.id="ShakaPlayerTextStyle",document.head.appendChild(b));for(b=b.sheet;b.cssRules.length;)b.deleteRule(0);b.insertRule("::cue { "+wa(a)+" }",0)};
W.prototype.destroy=function(){return this.H().then(G(this,function(){this.f.destroy();this.b=this.f=null})).catch(function(){})};W.prototype.destroy=W.prototype.destroy;W.prototype.H=function(){this.g=!0;return Xe(this)};W.prototype.unload=W.prototype.H;
function Xe(a){var b;a.o&&(b=a.o.getOperationLogger("unload").start());if(!a.c)return b&&b.log(),Promise.resolve();a.h&&Ye(a);a.b.pause();jb(a.f);Ze(a);$e(a);a.i&&(a.i.destroy(),a.i=null);a.c&&(a.c.destroy(),a.c=null);a.b.src="";var c=Promise.resolve().then(function(){b&&b.log()});a.h=!1;return c}function af(a,b){for(var c=0;c<a.length;c++)b.push(a[c].contentType,a[c])}W.prototype.ba=function(a){return bf(this,a)};W.prototype.load=W.prototype.ba;
function bf(a,b){var c;a.o&&(c=a.o.getOperationLogger("load").setState("loading").start(),b.o=b.h.performanceLogger=a.o);a.w&&(b.mb=b.h.abrLogger=a.w);a.L&&(b.G=a.L);cf(b,a.b);var d=null;a.g=!1;a.c&&(d=Xe(a).then(G(a,function(){return b.Ua()})));a.b.autoplay&&(ga("load"),B(a.f,a.b,"timeupdate",a.Fc.bind(a)));b.Gb(a.a);b.ba=a.F;a.F=null;d||(d=b.Ua());d.catch(G(a,function(a){b.destroy();return Promise.reject(a)}));return d.then(G(a,function(){if(!this.b||this.g)return df();this.c=b;B(this.f,this.c,
"seekrangechanged",this.Nc.bind(this));var a=new A;af(Ne(this.c),a);Pe(this.c,a);a=this.ac();c&&0<a.length&&(a=a.reduce(function(a,b){if(null===a||b.bandwidth<a.bandwidth)a=b;return a},null),c.setLowestQualityRepresentationID(a.streamInfoID));if(!this.a.enableContentProtection)return Promise.resolve();var d;this.o&&(d=this.o.getOperationLogger("eme_init"));this.i=new Me(this,this.b,this.c);return this.i.initialize().then(function(){d&&d.log()})})).then(G(a,function(){if(!this.b||this.g)return df();
B(this.f,this.b,"playing",this.Lc.bind(this));B(this.f,this.b,"pause",this.Jc.bind(this));B(this.f,this.b,"waiting",this.Sc.bind(this));return ef(this.c,this,this.b)})).then(G(a,function(){if(!this.b||this.g)return df();if(this.a.enableContentProtection){var a;this.o&&(a=this.o.getOperationLogger("eme_attach"));return Se(this.i).then(function(){a&&a.log()})}return Promise.resolve()})).then(G(a,function(){if(!this.b||this.g)return df();ff(this);c&&c.updateState("ready").log()})).catch(G(a,function(a){c&&
c.setError(JSON.stringify(a)).log();if(!this.b||this.g)return df();if("destroy"!=a.type){var b=w(a);this.dispatchEvent(b)}return this.H().then(function(){return Promise.reject(a)})}))}function df(){var a=Error("Player destroyed");a.type="destroy";return Promise.reject(a)}n=W.prototype;n.Fc=function(){ka("load");this.f.Oa(this.b,"timeupdate")};n.Sc=function(){gf(this)};
n.Lc=function(){ga("playing");this.o&&this.o.getEventLogger("playing").setState("playing").log();!this.j&&0>this.m&&(this.b.playbackRate=0,this.C(this.b.currentTime,Date.now(),this.m));this.h&&!this.I&&Ye(this)};n.Jc=function(){this.o&&this.o.getEventLogger("pause").setState("paused").log();ka("playing");$e(this)};n.Nc=function(a){this.D=a.start;gf(this)};n.ac=function(){return this.c?this.c.T():[]};W.prototype.getVideoTracks=W.prototype.ac;W.prototype.Z=function(){return this.c?this.c.pa():[]};
W.prototype.getAudioTracks=W.prototype.Z;W.prototype.aa=function(){return this.c?this.c.Hb():[]};W.prototype.getTextTracks=W.prototype.aa;W.prototype.selectVideoTrack=function(a,b){return this.c?this.c.selectVideoTrack(a,void 0==b?!0:b):!1};W.prototype.selectVideoTrack=W.prototype.selectVideoTrack;W.prototype.ca=function(a,b,c){return this.c?hf(this.c,"audio",a,void 0==b?!0:b,c):!1};W.prototype.selectAudioTrack=W.prototype.ca;W.prototype.fa=function(a){return this.c?hf(this.c,"text",a,!1):!1};
W.prototype.selectTextTrack=W.prototype.fa;W.prototype.W=function(a){this.c&&jf(this.c,a)};W.prototype.enableTextTrack=W.prototype.W;W.prototype.R=function(a){$e(this);this.v&&this.h||!(0<=a)?this.b.paused||(this.b.playbackRate=0,this.C(this.b.currentTime,Date.now(),a)):this.b.playbackRate=a;this.m=a};W.prototype.setPlaybackRate=W.prototype.R;W.prototype.N=function(){return this.m};W.prototype.getPlaybackRate=W.prototype.N;W.prototype.ha=function(a){this.F=a};W.prototype.setPlaybackStartTime=W.prototype.ha;
W.prototype.G=function(){return this.c?!!this.c.U():!1};W.prototype.isLive=W.prototype.G;
W.prototype.V=function(a){if(a){var b=x(a,"enableAdaptation");null!=b&&(this.a.enableAdaptation=b);b=x(a,"endBufferingOnPlaying");null!=b&&(this.I=b);b=x(a,"usePlaybackRateForBuffering");null!=b&&(this.v=b);b=z(a,"streamBufferSize",0);null!=b&&(this.a.streamBufferSize=b);b=z(a,"dynamicStreamBufferSize",0);null!=b&&(this.a.dynamicStreamBufferSize=b);null!=a.smartBufferAdjustmentParams&&(this.a.smartBufferAdjustmentParams=a.smartBufferAdjustmentParams);b=x(a,"addCdnDebugQueryParameters");null!=b&&(this.a.addCdnDebugQueryParameters=
b);b=z(a,"initialStreamBufferSize",0);null!=b&&(this.a.initialStreamBufferSize=b);b=x(a,"includeStreamBufferSizeInStartOffset");null!=b&&(this.a.includeStreamBufferSizeInStartOffset=b);b=z(a,"jumpToLiveThreshold");null!=b&&(this.a.jumpToLiveThreshold=b);b=z(a,"liveStreamEndTimeout",0);null!=b&&(this.a.liveStreamEndTimeout=b);b=z(a,"licenseRequestTimeout",0);null!=b&&(this.a.licenseRequestTimeout=b);b=z(a,"mpdRequestTimeout",0);null!=b&&(this.a.mpdRequestTimeout=b);b=z(a,"minMpdRefreshInterval",0);
null!=b&&(this.a.minMpdRefreshInterval=b);b=x(a,"enableLiveInterruptionDetection");null!=b&&(this.a.enableLiveInterruptionDetection=b);b=x(a,"enableManifestDebug");null!=b&&(this.a.enableManifestDebug=b,C.prototype.Mb=b,b||(C.prototype.sa=function(){}));b=x(a,"resolveVideoTimeUpdateOnFragmentedTimeRanges");null!=b&&(this.a.resolveVideoTimeUpdateOnFragmentedTimeRanges=b);b=z(a,"liveInterruptionConsecutiveUpdatesWithoutChange");null!=b&&(this.a.liveInterruptionConsecutiveUpdatesWithoutChange=b);b=z(a,
"liveInterruptionConsecutiveUpdatesWithChange");null!=b&&(this.a.liveInterruptionConsecutiveUpdatesWithChange=b);b=x(a,"reappendInitSegmentAfterAbort");null!=b&&(this.a.reappendInitSegmentAfterAbort=b);b=x(a,"liveSendPushHeaders");null!=b&&(this.a.liveSendPushHeaders=b);b=z(a,"liveMaxManifestFetchesWithPush");null!=b&&(this.a.liveMaxManifestFetchesWithPush=b);b=z(a,"liveMaxSegmentsToPush");null!=b&&(this.a.liveMaxSegmentsToPush=b);b=z(a,"segmentRequestTimeout",0);null!=b&&(this.a.segmentRequestTimeout=
b);b=db(a,"preferredLanguage");null!=b&&(this.a.preferredLanguage=b);b=eb(a,"restrictions",qa);null!=b&&(this.a.restrictions=b.clone());b=a.liveInitialPushRepresentation;null!=b&&(this.a.liveInitialPushRepresentation=b);b=a.liveAudioPushRepresentation;null!=b&&(this.a.liveAudioPushRepresentation=b);b=a.useInlineInitSegment;null!=b&&(this.a.useInlineInitSegment=b);b=x(a,"disableCacheBustingEvenThoughItMayAffectBandwidthEstimation");null!=b&&(Vc=!b);b=x(a,"currentTimeDuringReadyStateZeroThrows");null!=
b&&(this.a.currentTimeDuringReadyStateZeroThrows=b);b=z(a,"liveDataFetchMaxRetries");null!=b&&(this.a.liveDataFetchMaxRetries=b);b=z(a,"liveSourceBufferClearMaxRetries");null!=b&&(this.a.liveSourceBufferClearMaxRetries=b);b=x(a,"useLongCacheForManifest");null!=b&&(this.a.useLongCacheForManifest=b);b=x(a,"jumpToEarliestPositionInCurrentBlock");null!=b&&(this.a.jumpToEarliestPositionInCurrentBlock=b);b=x(a,"ignoreMinBufferTime");null!=b&&(this.a.ignoreMinBufferTime=b);b=z(a,"playheadFragmentedGapDiffAllowance");
null!=b&&(this.a.playheadFragmentedGapDiffAllowance=b);b=x(a,"fixBufferingGoalDetermination");null!=b&&(this.a.fixBufferingGoalDetermination=b);b=x(a,"skipEmptySegments");null!=b&&(this.a.skipEmptySegments=b);(b=x(a,"useMicroTaskTimeouts"))&&(this.a.useMicroTaskTimeouts=b);(b=x(a,"enableRequestPipelining"))&&(this.a.enableRequestPipelining=b);(b=x(a,"enableStreaming"))&&(this.a.enableStreaming=b);(a=x(a,"enableContentProtection"))&&(this.a.enableContentProtection=a);this.c&&this.c.Gb(this.a)}};
W.prototype.configure=W.prototype.V;function gf(a){if(a.s.getBool("skip_manifest_gap_based_on_stream_limits",!1)){var b=a.c?a.c.Ya():null;if(b)for(var c=a.s.getNumber("skip_manifest_gap_boundary_precision_ms",1E3)/1E3,d=b.La,e=a.b.playbackRate,f=a.b.currentTime,g=0;g<d.length;++g)f<=d[g].endTime+c&&f>=d[g].startTime-c&&(0<=e?b.end>d[g].endTime&&(a.b.currentTime=d[g].endTime):b.start<d[g].startTime&&(a.b.currentTime=d[g].startTime))}}
W.prototype.O=function(){var a=this.c&&this.c.Ya();return(a=a&&{start:a.start,end:a.end,last:a.A,seekRangeGaps:a.La})||null};W.prototype.getVideoSourceStreamLimits=W.prototype.O;W.prototype.$=function(){return this.a};W.prototype.getConfiguration=W.prototype.$;function $e(a){a.j&&(clearTimeout(a.j),a.j=null)}function ff(a){Ze(a);a.B=setTimeout(a.P.bind(a),100)}function Ze(a){a.B&&(clearTimeout(a.B),a.B=null)}
W.prototype.C=function(a,b,c){this.j=null;var d=(Date.now()-b)/1E3*c;this.b.currentTime<this.D+(this.G()?1:.05)?this.b.pause():(d=Math.max(this.D,a+d),this.b.currentTime=d,this.j=setTimeout(this.C.bind(this,a,b,c),250))};function Ye(a){ka("buffering");a.l&&(a.l.log(),a.l=null);if(a.w){var b=Date.now();a.w.setEvent("buffering").setClientTimeBegin(Math.round(b-la())).setClientTimeEnd(Math.round(b)).log()}a.v&&(a.b.playbackRate=a.m);a.h=!1;a.dispatchEvent(u({type:"bufferingEnd"}))}
W.prototype.P=function(){ff(this);if(!this.b.ended&&!this.b.seeking){var a=this.b.buffered,b=a.length?a.end(a.length-1):0,a=Math.max(b-this.b.currentTime,0),c=this.b.currentTime,d=this.G()?this.s.getNumber("live_buffering_underflow_threshold",.5):this.s.getNumber("buffering_underflow_threshold",.5),e=this.b.duration,e=isNaN(e)?0:Math.max(e-.05,0),b=b>=e||c>=e;if(this.h){if(d=kf(this.c),a>d||lf(this.c)||this.s.getBool("fix_buffering_at_the_end_of_playback",!0)&&b)Ye(this),this.K&&!this.v&&this.b.play()}else!this.b.paused&&
!b&&a<d&&(this.h=!0,this.v?this.b.playbackRate=0:this.b.pause(),this.o&&!this.l&&(a=this.b.buffered,a=a.length?a.end(a.length-1):0,a=Math.max(a-this.b.currentTime,0),a=1E3*(kf(this.c)-a),this.l=this.o.getOperationLogger("buffering").setLength(Math.round(a)).start()),ga("buffering"),this.dispatchEvent(u({type:"bufferingStart"})),gf(this)),lf(this.c)&&Ye(this)}};W.prototype.U=function(a){if(this.c){var b=this.c;b.f.video&&b.f.video.$b(a)}};W.prototype.setVideoStreamOffset=W.prototype.U;function mf(a){for(var b=0;b<a.length;++b)for(var c=a[b],d=0;d<c.a.length;++d){for(var e=c.a[d],f=e,g=0;g<f.u.length;++g)Oe(Yd(f.u[g]))||(f.u.splice(g,1),--g);0==e.u.length&&(c.a.splice(d,1),--d)}for(b=0;b<a.length;++b)for(c=a[b],d=0;d<c.a.length;++d)c.a[d].u.sort(nf)}function nf(a,b){var c=a.bandwidth||Number.MAX_VALUE,d=b.bandwidth||Number.MAX_VALUE;return c<d?-1:c>d?1:0};function of(a){this.a=a}of.prototype.destroy=function(){this.a.destroy();this.a=null};of.prototype.update=function(a){var b=pf(a),c=pf(this.a);return Promise.all([b,c]).then(G(this,function(b){var c=b[0];b=b[1];mf(this.a.a);a.b&&!this.a.b&&(a.h=!0);a.f=this.a.f;a.g=this.a.g?this.a.g.clone():null;a.c=this.a.c;var f=[];qf(a,this.a,c,b,f);mf(a.a);return Promise.resolve(f)}))};
function pf(a){function b(a,b){return a.concat(b)}var c=a.a.map(function(a){return a.a}).reduce(b,[]).map(function(a){return a.u}).reduce(b,[]);a=c.map(function(a){return a.J.create()});return Promise.all(a).then(function(a){for(var b={},f=0;f<c.length;++f)b[c[f].M]=a[f];return Promise.resolve(b)})}
function qf(a,b,c,d,e){var f=new A;a.a.forEach(function(a,b){f.push(a.id||""+b,a)});var g=new A;b.a.forEach(function(a,b){g.push(a.id||""+b,a)});a=hb(f);for(b=0;b<a.length;++b){var h=a[b],k=f.get(h);1<k.length||(h=g.get(h))&&0!=h.length&&1==h.length&&(rf(k[0],h[0],c,d,e),k[0].duration=h[0].duration)}}
function rf(a,b,c,d,e){var f=new A;a.a.forEach(function(a,b){f.push(a.id||""+b,a)});var g=new A;b.a.forEach(function(a,b){g.push(a.id||""+b,a)});a=hb(f);for(b=0;b<a.length;++b){var h=a[b],k=f.get(h);1<k.length||(h=g.get(h))&&0!=h.length&&1==h.length&&sf(k[0],h[0],c,d,e)}}
function sf(a,b,c,d,e){var f=new A;a.u.forEach(function(a,b){f.push(a.id||""+b,a)});var g=new A;b.u.forEach(function(a,b){g.push(a.id||""+b,a)});b={};for(var h=hb(f),k=0;k<h.length;++k){var l=h[k];b[l]=l;var m=f.get(l);1<m.length||((l=g.get(l))&&0!=l.length?1==l.length&&(tf(m[0],l[0],c,d),m[0].S=l[0].S,l[0].S=null,m[0].b=l[0].b,VideoPlayerShakaGlobalConfig.getBool("refresh_bandwidth_from_live_manifest",!1)&&(m[0].bandwidth=l[0].bandwidth)):(e.push(m[0]),a.u.splice(a.u.indexOf(m[0]),1)))}h=hb(g);for(k=
0;k<h.length;++k)l=h[k],b[l]||(b[l]=l,l=g.get(l),a.u.push(l[0]))}function tf(a,b,c,d){a=c[a.M];d=d[b.M];b=a.length();a.cb(d)&&(d=a.length(),a.h.push(b!==d),50<a.h.length&&a.h.shift())};function X(){this.a=this.b=null;this.f=new ib;this.c=Number.POSITIVE_INFINITY;this.i=!0;this.g=!1}q("shaka.media.SimpleAbrManager",X);X.prototype.destroy=function(){this.f.destroy();this.a=this.b=this.f=null};X.prototype.initialize=function(a,b){this.b||this.a||(this.b=a,this.a=b)};
X.prototype.start=function(){this.b&&this.a&&!this.g&&(this.c=Date.now()+4E3,B(this.f,this.b.getEstimator(),"bandwidth",this.l.bind(this)),B(this.f,this.a,"adaptation",this.j.bind(this)),B(this.f,this.a,"trackschanged",this.h.bind(this)),this.g=!0)};X.prototype.enable=function(a){this.i=a};X.prototype.getInitialVideoTrackId=function(){if(!this.b||!this.a)return null;var a=uf(this);return a?a.id:null};X.prototype.getInitialSwitchReason=function(){return null};X.prototype.getInitialAudioTrackId=function(){return null};
X.prototype.selectVideoTrack=function(a,b,c){this.g&&this.a.selectVideoTrack(a.id,b,c)};X.prototype.l=function(){Date.now()<this.c||this.h()};X.prototype.h=function(){if(this.i){var a=uf(this);if(a){if(a.active){this.c=Date.now()+3E3;return}this.selectVideoTrack(a,!1)}this.c=Number.POSITIVE_INFINITY}};X.prototype.j=function(){this.c==Number.POSITIVE_INFINITY&&(this.c=Date.now()+3E4)};
function uf(a){var b=a.a.T();if(0==b.length)return null;b.sort(Aa);var c;a:{c=a.a.pa();for(var d=0;d<c.length;++d)if(c[d].active){c=c[d];break a}c=null}c=c?c.bandwidth:0;a=a.b.getBandwidth();for(var d=b[0],e=0;e<b.length;++e){var f=b[e],g=e+1<b.length?b[e+1]:{bandwidth:Number.POSITIVE_INFINITY};if(f.bandwidth&&(g=(g.bandwidth+c)/.85,a>=(f.bandwidth+c)/.95&&a<=g&&(d=f,d.active)))break}return d};function Y(a,b,c,d){C.call(this,null);this.a=a;this.c=b;this.qa=c;this.hb=new VideoPlayerLocalBandwidthEstimator(this,c,b);this.i=new ib;this.l=new MediaSource;this.W=this.b=null;this.pb=0;this.Jb=this.vb=!1;this.kb=oa;this.mb=this.o=null;this.jb=3;this.fb=this.wb=this.Ba=!1;this.eb=0;this.Y=new dd;this.Z=null;this.Db=1;this.Bb=Infinity;this.ic=this.gc=!1;this.ha=this.Ka=null;this.tb=this.jc=this.Da=this.xb=this.ca=!1;this.g=new A;this.B=d;this.B.initialize(this.hb,this);this.K=!1;this.N="en";this.ra=
!1;this.H=new F;this.ib=new F;this.m=new qa;this.D=null;this.Fb=1;this.f={};this.oa=new F;this.$=0;this.gb=15E3;this.j=null;this.zb=!1;this.yb=0;this.ya=!1;this.C={};this.ba=this.aa=this.v=null;this.h={};this.V=!1;this.Ab=0;this.I=this.c.getNumber("buffering_overflow_threshold",0);this.Kb=null;this.s={};this.w={};this.O=this.G=this.L=null;this.F=new NetworkStatusDetector;this.fa=this.Cb=!1;this.Lb=new SubscriptionsHandler;this.c.getBool("allow_infinite_retry_on_net_err",!1)&&this.Lb.addSubscriptions(this.F.addListener("networkInterrupted",
this.pc,this),this.F.addListener("networkResumed",this.qc,this),this.F.addListener("systemWake",this.rc,this))}r(Y,C);q("shaka.player.StreamVideoSource",Y);Y.prototype.ub=function(){return{VideoSourceStream:this.f.video,AudioSourceStream:this.f.audio,TextSourceStream:this.f.text,BandwidthEstimator:this.qa}};Y.prototype.getStreamDebug=Y.prototype.ub;Y.prototype.nc=function(){return this.a?this.a.j:"none"};Y.prototype.getMpdAudioConfig=Y.prototype.nc;
Y.prototype.Gb=function(a){null!=a.streamBufferSize&&(this.h.streamBufferSize=a.streamBufferSize);null!=a.initialStreamBufferSize&&(this.h.initialStreamBufferSize=a.initialStreamBufferSize);null!=a.dynamicStreamBufferSize&&(this.h.dynamicStreamBufferSize=a.dynamicStreamBufferSize);null!=a.smartBufferAdjustmentParams&&(this.h.smartBufferAdjustmentParams=a.smartBufferAdjustmentParams);null!=a.addCdnDebugQueryParameters&&(this.h.addCdnDebugQueryParameters=a.addCdnDebugQueryParameters);null!=a.segmentRequestTimeout&&
(this.h.segmentRequestTimeout=a.segmentRequestTimeout);null!=a.resolveVideoTimeUpdateOnFragmentedTimeRanges&&(this.h.resolveVideoTimeUpdateOnFragmentedTimeRanges=a.resolveVideoTimeUpdateOnFragmentedTimeRanges);null!=a.reappendInitSegmentAfterAbort&&(this.h.reappendInitSegmentAfterAbort=a.reappendInitSegmentAfterAbort);null!=a.liveDataFetchMaxRetries&&(this.h.liveDataFetchMaxRetries=a.liveDataFetchMaxRetries);null!=a.liveSourceBufferClearMaxRetries&&(this.h.liveSourceBufferClearMaxRetries=a.liveSourceBufferClearMaxRetries);
null!=a.playheadFragmentedGapDiffAllowance&&(this.h.playheadFragmentedGapDiffAllowance=a.playheadFragmentedGapDiffAllowance);null!=a.fixBufferingGoalDetermination&&(this.h.fixBufferingGoalDetermination=a.fixBufferingGoalDetermination);null!=a.skipEmptySegments&&(this.h.skipEmptySegments=a.skipEmptySegments);null!=a.useMicroTaskTimeouts&&(this.h.useMicroTaskTimeouts=a.useMicroTaskTimeouts);vf(this);null!=a.includeStreamBufferSizeInStartOffset&&(this.vb=Boolean(a.includeStreamBufferSizeInStartOffset));
null!=a.liveAudioPushRepresentation&&(this.ha=String(a.liveAudioPushRepresentation));null!=a.liveInitialPushRepresentation&&(this.Ka=String(a.liveInitialPushRepresentation));null!=a.enableAdaptation&&this.B.enable(Boolean(a.enableAdaptation));null!=a.mpdRequestTimeout&&(this.kb=Number(a.mpdRequestTimeout));null!=a.minMpdRefreshInterval&&(this.jb=Number(a.minMpdRefreshInterval)/1E3);null!=a.enableManifestDebug&&(this.ic=!!a.enableManifestDebug);null!=a.liveStreamEndTimeout&&(this.gb=Number(a.liveStreamEndTimeout));
null!=a.preferredLanguage&&(this.N=Ya(String(a.preferredLanguage)));null!=a.liveSendPushHeaders&&(this.fb=Boolean(a.liveSendPushHeaders));null!=a.liveMaxManifestFetchesWithPush&&(this.eb=Number(a.liveMaxManifestFetchesWithPush));null!=a.currentTimeDuringReadyStateZeroThrows&&(this.gc=Boolean(a.currentTimeDuringReadyStateZeroThrows));null!=a.liveMaxSegmentsToPush&&(this.Bb=Number(a.liveMaxSegmentsToPush));null!=a.jumpToLiveThreshold&&(this.yb=Number(a.jumpToLiveThreshold));null!=a.restrictions&&(this.m=
a.restrictions,this.K&&wf(this));null!=a.useLongCacheForManifest&&(this.ca=Boolean(a.useLongCacheForManifest));null!=a.jumpToEarliestPositionInCurrentBlock&&(this.xb=Boolean(a.jumpToEarliestPositionInCurrentBlock));null!=a.ignoreMinBufferTime&&(this.Da=Boolean(a.ignoreMinBufferTime));null!==a.enableRequestPipelining&&(this.jc=Boolean(a.enableRequestPipelining));null!==a.enableStreaming&&(this.tb=Boolean(a.enableStreaming))};
Y.prototype.destroy=function(){this.H.destroy();this.oa.destroy();this.oa=this.H=null;this.aa&&(clearTimeout(this.aa),this.aa=null);this.v&&(clearTimeout(this.v),this.v=null);this.C=null;this.i.destroy();this.i=null;bb(this.f).forEach(function(a){a.destroy()});this.g=this.f=null;this.a&&(this.a.destroy(),this.a=null);this.B.destroy();this.na=this.m=this.b=this.l=this.qa=this.B=null;this.c.getBool("fixing_scheduler_disable_leaks",!0)&&(Object.keys(this.s).forEach(function(a){(a=this.s[a])&&a.disable()}.bind(this)),
this.s={});Object.keys(this.w).forEach(function(a){(a=this.w[a])&&a.destroy()}.bind(this));this.w={};this.G&&(this.G.disable(),this.G=null);this.L&&(this.L.cleanup(),this.L=null);this.Lb.release()};function cf(a,b){if(a.o){var c=a.o.getOperationLogger("media_source_open").start();a.ib.then(function(){c.log()})}B(a.i,a.l,"sourceopen",a.Ic.bind(a));b.src=window.URL.createObjectURL(a.l)}n=Y.prototype;n.Qb=function(){};
function ef(a,b,c){var d;a.o&&(d=a.o.getOperationLogger("source_attach").start());if(!a.K)return a=Error("Cannot call attach() right now."),a.type="app",d&&d.setError(a).log(),Promise.reject(a);a.na=b;a.b=c;a.W=null;a.c.getBool("enable_viewport_priority_adjustment",!1)&&(a.L=new ViewportPriorityAdjuster(a.b),a.L.setOnPriorityChanged(function(a){Object.keys(this.s).forEach(function(b){this.s[b].updatePriorityWithNewAdjustment(a)}.bind(this))}.bind(a)));B(a.i,a.b,"loadedmetadata",a.Hc.bind(a));B(a.i,
a.qa,"bandwidth",a.Xc.bind(a));if(a.a.b||a.c.getBool("back_off_buffering_overflow",!1))B(a.i,b,"bufferingStart",a.Dc.bind(a)),B(a.i,b,"bufferingEnd",a.Cc.bind(a));b=a.c.getBool("enable_content_protection",!1)?a.b.setMediaKeys(a.b.mediaKeys):Promise.resolve();xf(a).then(G(a,function(){d&&this.U()&&d.setLiveheadPosition(yf(zf(this)));this.H&&this.H.resolve();this.Qb()})).catch(G(a,function(a){this.H&&this.H.reject(a)}));return Promise.all([a.H,b]).then(function(){d&&d.log()})}
n.Ua=function(){if(this.K){var a=Error("Cannot call load() right now.");a.type="app";return Promise.reject(a)}if(!this.a||0==this.a.a.length)return a=Error("The manifest does not specify any content."),a.type="stream",Promise.reject(a);mf(this.a.a);if(0==this.a.a.length||0==this.a.a[0].a.length||!this.a.a[0].a.some(function(a){return"video"===a.contentType}))return a=Error("The manifest specifies content that cannot be displayed on this browser/platform."),a.type="stream",Promise.reject(a);this.K=
!0;this.Da||(this.h.initialStreamBufferSize=Math.max(this.h.initialStreamBufferSize||0,this.a.c));vf(this);wf(this);return Promise.resolve()};function Af(a){var b=u({type:"manifestwrapped",bubbles:!0});a.dispatchEvent(b)}function Bf(a,b){var c=u({type:"liveheadIdleAt",seconds:b,bubbles:!0});a.dispatchEvent(c)}function yf(a){return Math.min.apply(Math,a.map(function(a){return a.length()?a.A().endTime:null}).filter(function(a){return!!a}))}
n.sb=function(a,b){var c;this.c.getBool("decouple_mpd_update_loop_from_request_loop",!1)&&Cf(this,0);this.o&&(c=this.o.getOperationLogger("update_manifest").start());if(!b||this.K){var d=Date.now();this.c.getBool("decouple_mpd_update_loop_from_request_loop",!1)||(this.v=null);var e=null,f,g;if(this.fb&&(!this.eb||this.eb>this.Db)){f=Math.floor(Df(this))+1;f=Math.min(f,this.Bb);var h=this.f.video;if(h=h?h.ob():null)h=h.A(),null!=h.unscaledStartTime&&(g=h.unscaledStartTime);if(this.b.paused||this.V)f=
0}f&&this.Db++;h=this.a.g;h=this.c.getBool("enable_clean_failover_uri_on_mpd_requests",!1)?h.clone():h;c&&!a&&c.setResource(h.toString());(a?this.Tb():this.Ub(h,f,g)).then(G(this,function(b){a||this.F.informNetworkResumed();e=new of(b);return e.update(this.a)})).then(G(this,function(a){e.destroy();e=null;var f=zf(this);this.sa("SegmentIndexesUpdated",f);if(this.c.getBool("emit_live_playhead_idle_from_client",!0)){var g=this.c.getNumber("live_playhead_idle_all_stream_threshold",4),h=this.c.getNumber("live_playhead_idle_single_stream_threshold",
5);if(zf(this).every(function(a){return a.w()>=g})||zf(this).some(function(a){return a.w()>=h})){var v=yf(f);Bf(this,v)}}f.some(function(a){return a.Xa})&&Af(this);v=Ef(this,f);c&&this.U()&&c.setLiveheadPosition(yf(f));c&&c.setManifestType(this.a.b?"dynamic":"static");f=this.c.getBool("seek_over_unavailable_segments_on_manifest_update",!1)&&this.fa;v&&this.a.b&&(this.b.paused||f)&&v.end>this.b.currentTime+10&&(this.fa=!1,this.b.currentTime=v.end);this.c.getBool("skip_remaining_buffered_on_stream_end",
!1)&&v&&this.a.b&&this.a.h&&this.b.paused&&(this.b.currentTime=this.$-.1);if(lf(this))return c&&c.log(),this.Aa();for(f=0;f<a.length;++f)Ff(this,a[f]);this.Da||(this.h.initialStreamBufferSize=Math.max(this.h.initialStreamBufferSize||0,this.a.c));this.h.useInitialBufferSizeWhenPaused=this.a.b;vf(this);wf(this);0==Object.keys(this.f).length?xf(this):(a=Date.now(),b||Cf(this,(a-d)/1E3));c&&c.log()})).catch(G(this,function(a){c&&c.setError(a).log();e&&(e.destroy(),e=null);if(!b){var d=[0,410],d=this.c.getBool("fix_live_stream_gone_on_manifest_update",
!1)?-1===d.indexOf(a.status):0!==a.status;if(this.c.getBool("allow_infinite_retry_on_net_err",!1)&&"net"===a.type&&!d)switch(a.status){case 410:this.Cb=!0;this.j&&(clearTimeout(this.j),this.j=null);this.Aa();break;default:Gf(this)}0===a.status?this.F.informNetworkInterrupted():this.F.informNetworkResumed();if("delay"==a.type)return Gf(this);this.c.getBool("allow_infinite_retry_on_net_err",!1)&&!d||"aborted"==a.type||(a=w(a),this.dispatchEvent(a),this.a&&Gf(this))}}))}};n.Ub=function(){return Promise.reject("Cannot update manifest with this VideoSource implementation.")};
n.Tb=function(){return Promise.reject("Cannot update manifest with this VideoSource implementation.")};function Cf(a,b){if(null!=a.a.f){if(a.c.getBool("decouple_mpd_update_loop_from_request_loop",!1)&&(a.v&&(clearTimeout(a.v),a.v=null),lf(a)))return;var c=Math.max(a.a.f,a.jb),c=Math.max(c-b,0),d=a.sb.bind(a,!1);!c&&a.h.useMicroTaskTimeouts?Promise.resolve().then(d):a.v=setTimeout(d,1E3*c)}}
function Ff(a,b){var c=b.a.split("/")[0],d=a.f[c];if(d&&d.Ea()==b){var e=a.g.get(b.a.split("/")[0]).map(function(a){return a.u}).reduce(function(a,b){return a.concat(b)},[]).filter(function(a){return a.ga&&a.X});if(0==e.length){c=Error("All usable streams have been removed from the manifest.");c.type="app";c=w(c);a.dispatchEvent(c);return}a.C[c].cc==b&&delete a.C[c];d.Ma(e[0],!0);b.destroy()}b.destroy()}n.Vc=function(a){this.Kb=a};Y.prototype.setTaggedTimeRanges=Y.prototype.Vc;
Y.prototype.lc=function(){if(!this.g||!this.g.a.hasOwnProperty("video"))return 0;var a=this.f.video;return a?a.oa:0};Y.prototype.getFetchedVideoSegmentsCount=Y.prototype.lc;Y.prototype.wc=function(){return 0===Object.keys(this.f).length?!1:["audio","video"].every(G(this,function(a){return!this.f[a]||this.f[a].U}))};Y.prototype.hasHitBufferingGoal=Y.prototype.wc;
Y.prototype.T=function(a){if(!this.g||!this.g.a.hasOwnProperty("video"))return[];a=a&&a.useLocalBitrate||!1;for(var b=this.f.video,c=b?b.Ea():null,c=c?c.M:0,d=[],e=this.g.get("video"),f=0;f<e.length;++f)for(var g=e[f],h=0;h<g.u.length;++h){var k=g.u[h];if(k.ga&&k.X){var l=null;if(a&&null!==k.J){var m=k.J.b(),p=b;if(this.U()||null===m||null===p)l=null;else{var l=qe(p,this.b.currentTime,m),v=m.l();this.c.getBool("start_local_bitrate_at_buffer_end",!1)&&(p=LocalBitrateHelper.getBufferEndSegmentIndex(v,
l,this.b.currentTime+ie(p,this.b.currentTime)),null!==p&&(l=p));l=LocalBitrateHelper.getLocalBitrate(m.l(),l,this.c.getNumber("local_bitrate_segments_ahead",10))}}l=l||k.bandwidth;m=k.M;k=new za(m,l,k.width,k.height,k.id,k.fbQualityLabel,k.fbQualityClass,k.g);m==c&&(k.active=!0);d.push(k)}}return d};Y.prototype.getVideoTracks=Y.prototype.T;
Y.prototype.oc=function(){if(this.Z)return this.Z;if(!this.a)return null;for(var a=0;a<this.a.a.length;++a)for(var b=this.a.a[a],c=0;c<b.a.length;++c)if(this.Z=b.a[c].c)return this.Z;return null};Y.prototype.getVideoProjection=Y.prototype.oc;Y.prototype.mc=function(){return this.hb};Y.prototype.getLocalEstimator=Y.prototype.mc;function Hf(a){a=a.T();for(var b=0;b<a.length;b++)if(a[b].active)return a[b]}
Y.prototype.pa=function(){if(!this.g||!this.g.a.hasOwnProperty("audio"))return[];for(var a=this.f.audio,a=(a=a?a.Ea():null)?a.M:0,b=[],c=this.g.get("audio"),d=0;d<c.length;++d)for(var e=c[d],f=e.lang,g=0;g<e.u.length;++g){var h=e.u[g];if(h.ga&&h.X){var k=h.M,h=new ma(k,h.bandwidth,f,h.id);k==a&&(h.active=!0);b.push(h)}}return b};Y.prototype.getAudioTracks=Y.prototype.pa;
Y.prototype.Hb=function(){if(!this.g||!this.g.a.hasOwnProperty("text"))return[];for(var a=this.f.text,b=a?a.Ea():null,b=b?b.M:0,c=[],d=this.g.get("text"),e=0;e<d.length;++e)for(var f=d[e],g=f.lang,h=0;h<f.u.length;++h){var k=f.u[h].M,l=new ya(k,g);k==b&&(l.active=!0,l.enabled=a.Za());c.push(l)}return c};Y.prototype.getTextTracks=Y.prototype.Hb;
function kf(a){var b=Number(a.h.initialStreamBufferSize);a.h.fixBufferingGoalDetermination&&(b=1);if(a.c.getBool("back_off_buffering_overflow",!1))b=a.I;else{var c=a.c.getNumber("buffering_overflow_threshold",0);0<c&&(b=c)}return a.wb?Number(a.h.streamBufferSize):b}function Ne(a){if(a.K){a=a.a.a[0];for(var b=[],c=0;c<a.a.length;++c)b.push.apply(b,ae(a.a[c]));a=b}else a=[];return a}
function Pe(a,b){if(a.K){for(var c={},d=a.a.a[0],e=0;e<d.a.length;++e){var f=d.a[e];c[f.M]=f}a.g.a={};d=hb(b);for(e=0;e<d.length;++e){var f=d[e],g=b.get(f);if("video"==f){var h=g[0].id;a.g.push(f,c[h])}else if("audio"==f)for(var h=g[0].b.split(";")[0],k=0;k<g.length;++k){var l=g[k];l.b.split(";")[0]==h&&a.g.push(f,c[l.id])}else for(k=0;k<g.length;++k)h=g[k].id,a.g.push(f,c[h])}a.ra=!0;if(c=a.g.get("audio"))If(a,c),a.g.set("audio",c),c=c[0].lang||a.N,Xa(2,a.N,c)&&(a.ra=!1);if(c=a.g.get("text"))If(a,
c),a.g.set("text",c),c=c[0].lang||a.N,Xa(2,a.N,c)||(a.ra=!1)}}Y.prototype.kc=function(){this.Ba=!0};Y.prototype.setClearBufferAfterSeeking=Y.prototype.kc;Y.prototype.selectVideoTrack=function(a,b,c,d){return hf(this,"video",a,b,c,d)};function jf(a,b){var c=a.f.text;c&&c.Ta(b)}
function wf(a){if(a.m){for(var b=!1,c=0;c<a.a.a.length;++c)for(var d=a.a.a[c],e=0;e<d.a.length;++e){var f=d.a[e];if("video"==f.contentType)for(var g=0;g<f.u.length;++g){var h=f.u[g],k=h.X;h.X=!0;a.m.maxWidth&&h.width>a.m.maxWidth&&(h.X=!1);a.m.maxHeight&&h.height>a.m.maxHeight&&(h.X=!1);a.m.minHeight&&h.height<a.m.minHeight&&(h.X=!1);a.m.maxBandwidth&&h.bandwidth>a.m.maxBandwidth&&(h.X=!1);a.m.minBandwidth&&h.bandwidth<a.m.minBandwidth&&(h.X=!1);k!=h.X&&(b=!0)}}0!=fb(a.g).length&&b&&(Jf(a),0<a.T().length||
(b=Error("The application has restricted all video tracks!"),b.type="app",b=w(b),a.dispatchEvent(b)))}}Y.prototype.U=function(){return this.a?this.a.b:null};Y.prototype.isLive=Y.prototype.U;Y.prototype.sc=function(a){this.wb=a};Y.prototype.setIsLiveInterrupted=Y.prototype.sc;Y.prototype.vc=function(){for(var a in this.f)this.f[a].Yb()};Y.prototype.forceResyncVideoBuffer=Y.prototype.vc;
function Ve(a,b){for(var c,d=!1,e=new A,f=fb(a.g),g=0;g<f.length;++g)for(var h=f[g],k=0;k<h.u.length;++k){var l=h.u[k];l.f.forEach(function(a){e.push(a,l)})}for(c in b)if(f=Ta[b[c]]||null,h=e.get(c))for(g=0;g<h.length;++g)l=h[g],k=l.ga,l.ga=!f,k!=l.ga&&(d=!0);else ob(c);d&&(Jf(a),d=a.pa(),c=a.T(),d=a.g.a.hasOwnProperty("audio")&&0==d.length,c=a.g.a.hasOwnProperty("video")&&0==c.length,d||c)&&(c=Error("The key system has restricted all "+(d&&c?"audio and video tracks.":d?"audio tracks.":"video tracks.")),
c.type="drm",c=w(c),a.dispatchEvent(c))}function Jf(a){var b=u({type:"trackschanged",bubbles:!0});a.dispatchEvent(b)}function hf(a,b,c,d,e,f){if(!a.g.a.hasOwnProperty(b)||!a.f[b])return!1;for(var g=a.g.get(b),h=0;h<g.length;++h)for(var k=g[h],l=0;l<k.u.length;++l){var m=k.u[l];if(m.M==c){if(!m.ga||!m.X)return!1;if("text"!=b&&!a.ya)return c=a.C[b],a.C[b]={cc:m,Nb:null!=c&&c.Nb||d,Ob:null!=c&&c.Ob||e,switchReason:f},!0;a.f[b].Ma(m,d,e,f);return!0}}return!1}
function If(a,b){for(var c=0;2>=c;++c)for(var d=0;d<b.length;++d){var e=b[d];if(Xa(c,a.N,e.lang)){b.splice(d,1);b.splice(0,0,e);return}}for(d=0;d<b.length;++d)if(e=b[d],e.f){b.splice(d,1);b.splice(0,0,e);break}}n=Y.prototype;n.Ic=function(){this.i.Oa(this.l,"sourceopen");this.ib.resolve()};
function xf(a){var b;a.o&&(b=a.o.getOperationLogger("start_streams").start());for(var c=[],d=["audio","video","text"],e=0;e<d.length;++e){var f=d[e];a.g.a.hasOwnProperty(f)&&c.push(a.g.get(f)[0])}for(var g=Kf(a,c),e=0;e<d.length;++e)if(f=d[e],a.g.a.hasOwnProperty(f)&&!g[f])return a=Error("Unable to select an initial "+f+" stream: all "+f+" streams have been restricted (by the application or by the key system)."),a.type="stream",b&&b.setError(a).log(),Promise.reject(a);c=bb(g).map(function(a){return a.J.create()});
c.push(a.ib);return Promise.all(c).then(G(a,function(a){a.pop();if(!a.every(function(a){return a.length()}))return a=Error("Some streams are not available."),a.type="stream",Promise.reject(a);a=Ef(this,a);if(!a)return a=Error("Some streams are not available."),a.type="stream",Promise.reject(a);if(!Lf(this,g))return a=Error("Failed to create Stream objects."),a.type="stream",Promise.reject(a);this.B.start();Mf(this,g,a);return Promise.resolve()})).then(function(){b&&b.log()}).catch(G(a,function(a){if("aborted"==
a.type)b&&b.setError(a).log();else{Object.keys(this.f);if(this.a.b)return Date.now()+Da<this.a.i?(a=Math.max(this.a.i-Date.now()/1E3,this.jb),this.v=setTimeout(this.sb.bind(this,!0),1E3*a)):Cf(this,0),b&&b.log(),Promise.resolve();b&&b.setError(a).log();return Promise.reject(a)}}))}
function Kf(a,b){for(var c={},d=0;d<b.length;++d){var e=b[d],f=null;if("video"==e.contentType){var g=a.B.getInitialVideoTrackId();if(null==g)continue;f=e.u.filter(function(a){return a.M==g});if(0==f.length)continue;f=f[0]}else if("audio"==e.contentType)if(g=a.B.getInitialAudioTrackId(),f=e.u.filter(function(a){return a.M==g}),0==f.length){f=e.u.filter(function(a){return a.ga&&a.X});if(0==f.length)continue;f=e.u[Math.floor(f.length/2)]}else f=f[0];else 0<e.u.length&&(f=e.u[0]);c[e.contentType]=f}return c}
function Lf(a,b){var c={},d;for(d in b){var e=b[d],e="text"==d?new se(a,a.b):Nf(a,e);if(!e)return bb(c).forEach(function(a){a.destroy()}),!1;c[d]=e}a.Ib(a.Jb);a.f=c;return!0}
function Nf(a,b){var c=Yd(b),d=Of(c.split(";")[0]),e=null,f=a.c.getBool("use_local_estimator_for_abr_sampling",!0)?a.hb:a.qa,g=null,h=null;a.tb&&canUseFetchStream()?(h=new MultipleSegmentsProvider(a.c.getNumber("streaming_segment_size",1)),g=Pf(a,h,d,f)):a.jc&&(e=Qf(a,d,f));var k=null,l=a.g.get(d);"video"===d&&0<l.length&&(k=function(a,b){for(var c=null,d=null,e=0;e<l[0].u.length;e++)l[0].u[e].id===a?c=l[0].u[e]:l[0].u[e].id===b&&(d=l[0].u[e]);return null===c||null===d?0:c.bandwidth>d.bandwidth?1:
-1});c=new U(a,a.b,a.c,a.l,c,f,a.Kb,a.Y,k,a.F,e,g,h);c.aa(a.h);return c}function Pf(a,b,c,d){var e=a.w[c],f="audio"===c&&a.c.getBool("disable_audio_streaming",!1);if(!e&&!f){var e=new VideoStreamingManager(a.c,b,c,a.o),g="video"===c;g&&e.addListener("bandwidthUpdate",function(a){d.sample(a.timeTaken,a.bytesRead,g,{timeToLastByte:a.timeTaken},this.mb,this.o)}.bind(a))}e&&(a.w[c]=e);return e||null}
function Qf(a,b,c){if("video"===b||"audio"===b&&a.c.getBool("enable_request_pipelining_for_vod_audios",!1)){var d=a.s[b];d||(d=new SegmentRequestManager(a.c,b,a.U()?VideoPriorityCalculator.calculateLive:VideoPriorityCalculator.calculate,a.o,c,a.mb),a.L&&d.updatePriorityWithNewAdjustment(a.L.getPriorityAdjustment()),a.s[b]=d);return d}return null}function Rf(a,b){a.b.currentTime=b;a.D=b}
function Mf(a,b,c){a.Fb=a.b.playbackRate;a.b.playbackRate=0;Sf(a,c);var d;a.ba&&a.ba<=c.end&&a.ba>=c.start?d=a.ba:a.a.b?(d=c.end,a.zb=!0):d=c.start;B(a.i,a.b,"seeking",a.Oc.bind(a));a.G?(a.G.setOnPlaying(a.Pa.bind(a,!0)),a.G.setOnPaused(a.Pa.bind(a,!1)),a.G.enable()):(B(a.i,a.b,"playing",a.Pa.bind(a,!0)),a.c.getBool("update_priority_on_play_event",!0)&&B(a.i,a.b,"play",a.Pa.bind(a,!0)),B(a.i,a.b,"pause",a.Pa.bind(a,!1)));B(a.i,a.b,"seeking",a.ec.bind(a));B(a.i,a.b,"timeupdate",throttle(a.ec.bind(a),
a.c.getNumber("scheduler_priority_update_interval",1E3)));if(a.b.currentTime!=d)if(a.gc)0!==a.b.readyState?Rf(a,d):Tf(a,d);else try{Rf(a,d)}catch(e){Tf(a,d)}Uf(a,c.start,c.end,c.A,c.La);var f=[],g;for(g in a.f){c=a.f[g];G(a,function(a){f.push(a.bc(this.oa).then(G(this,function(b){var c=a.Sa();c>this.pb&&(this.pb=c);return b})))})(c);B(a.i,c,"ended",a.Pc.bind(a));B(a.i,c,"should_nudge",a.Kc.bind(a));d=b[g];var h=a.B.getInitialSwitchReason()||void 0;c.Ma(d,!1,void 0,h)}Promise.all(f).then(a.Bc.bind(a)).catch(G(a,
function(a){"destroy"!=a.type&&(a=w(a),this.dispatchEvent(a))}));jf(a,a.ra)}n.Pa=function(a){Object.keys(this.s).forEach(function(b){this.s[b].updatePriorityWithNewPlayingState(a)}.bind(this));Object.keys(this.w).forEach(function(b){this.w[b].getPriorityUpdater().updatePriorityWithNewPlayingState(a)}.bind(this))};n.ec=function(){this.b&&(Object.keys(this.s).forEach(function(a){this.s[a].updatePriorityWithNewPlayhead(this.b.currentTime)}.bind(this)),Object.keys(this.w).forEach(function(a){this.w[a].getPriorityUpdater().updatePriorityWithNewPlayhead(this.b.currentTime)}.bind(this)))};
function Tf(a,b){a.W=b;for(var c in a.f){var d=a.f[c];a.W&&(d.ca=a.W)}}
n.Bc=function(a){ca(a&&a.length==Object.keys(this.f).length);for(var b=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,d=0;d<a.length;++d)var e=a[d],b=Math.min(b,e),c=Math.max(c,e);a=zf(this);for(d=0;d<a.length;++d)a[d].va(c);this.c.getBool("process_deferred_switches_early",!1)&&Vf(this);Wf(this,a,c);var f=bb(this.f).map(function(a){return a.Ea().id});this.c.getBool("sequentially_load_streams",!1)?Xf(this,f,c):(d=fb(this.g).map(function(a){return a.u}).reduce(function(a,b){return a.concat(b)},
[]).filter(function(a){return!~f.indexOf(a.id)}).map(function(a){var b=[a.J.Ra?a.J.Ra():a.J.create()];a.S&&b.push(a.S.create(this.o,this.Y));return Promise.all(b)}),Promise.all(d).then(G(this,function(a){for(var b=0;b<a.length;++b)a[b][0].va(c);this.ya=!0;Vf(this)})).catch(G(this,function(a){"aborted"!=a.type&&(a=w(a),this.dispatchEvent(a))})))};
function Xf(a,b,c){var d=Promise.resolve();fb(a.g).map(function(a){return a.u}).reduce(function(a,b){return a.concat(b)},[]).filter(function(a){return!~b.indexOf(a.id)}).forEach(function(a){d=d.then(G(this,function(b){b&&b[0].va(c);b=[a.J.Ra?a.J.Ra():a.J.create()];a.S&&b.push(a.S.create(this.o,this.Y));return Promise.all(b)})).catch(function(a){throw a;})});d.then(G(a,function(){this.ya=!0;Vf(this)})).catch(G(a,function(a){"aborted"!=a.type&&(a=w(a),this.dispatchEvent(a))}))}
function Vf(a){for(var b in a.C){var c=a.C[b];a.f[b].Ma(c.cc,c.Nb,c.Ob,c.switchReason)}a.C={}}function Wf(a,b,c){if(b=Ef(a,b))Sf(a,b),Uf(a,b.start,b.end,b.A,b.La);if(0!=c)b=a.b.currentTime+c,a.b.currentTime=b,a.D=b;else if(a.zb&&b){c=b.end;if(a.xb){var d=a.b.currentTime;d>=b.start&&d<=b.end&&d<c&&(c=d)}b=c;Math.abs(b-a.b.currentTime)>=a.yb&&(a.b.currentTime=b)}a.b.playbackRate=a.Fb;a.a.b&&null!=a.a.f&&Cf(a,0);Yf(a);a.oa.resolve()}
function Sf(a,b){if(a.a.b)isNaN(a.l.duration)&&(a.l.duration=b.end+2592E3);else if(isNaN(a.l.duration)||b.end>a.l.duration){a.l.duration=b.end;for(var c=0;c<a.l.sourceBuffers.length;++c)a.l.sourceBuffers[c].appendWindowEnd=b.end}}n.Rc=function(){this.aa=null;Yf(this);var a=Ef(this,zf(this));a&&(this.a.b&&this.$!=a.A&&(this.$=a.A,null!=this.j&&(clearTimeout(this.j),this.j=null)),Uf(this,a.start,a.end,a.A,a.La),this.b.paused||Zf(this,this.b.currentTime,a.start,a.end))};
function Uf(a,b,c,d,e){b=u({type:"seekrangechanged",bubbles:!0,start:b,end:c,last:d,seekRangeGaps:e});a.dispatchEvent(b)}
n.Oc=function(){var a=this.b.currentTime;if(null!=this.D){if(a>=this.D-.01&&a<=this.D+.01){this.D=null;return}this.D=null}var b=Ef(this,zf(this));if(b){var c=b.start,b=b.end;this.c.getBool("skip_remaining_buffered_on_stream_end",!1)&&this.a.b&&this.a.h&&this.b.paused&&(b=this.$);(c=Zf(this,a,c,b))||(c=b,a<=c+.01||this.a.b&&!$f(this,c)?c=!1:(this.b.currentTime=c,c=!0));if(!c){for(var d in this.f)this.f[d].Xb(this.Ba);this.Ba=!1}}};
function Zf(a,b,c,d){if(b>=c-.01)return!1;b=0;a.a.b&&(b=.5,$f(a,c+b)||(b=a.a.c));a.b.currentTime=Math.min(c+b,d);return!0}function $f(a,b){for(var c in a.f)if(!a.f[c].Zb(b))return!1;return!0}n.Pc=function(){if(!this.a.b){for(var a in this.f)if(!this.f[a].ab())return;this.Aa()}};n.Kc=function(){this.c.getBool("ignore_seek_when_nudging",!0)&&(this.D=this.b.currentTime);this.b.currentTime+=.001};
n.Sb=function(){var a=this.a,b=null,c=null;a&&a.a&&a.a[0]&&(b=a.a[0]);b&&b.a&&b.a[0]&&(c=b.a[0]);return!!c&&c.b};Y.prototype.hasInlinedCea608Subtitles=Y.prototype.Sb;Y.prototype.Ib=function(a){this.Jb=a;var b=this.f;"video"in b&&(b.video.c.N=a&&this.Sb())};Y.prototype.setEnableCea608Parsing=Y.prototype.Ib;function lf(a){var b=a.c.getNumber("live_buffering_underflow_threshold",.5);return a.c.getBool("fix_live_stream_gone_on_manifest_update",!1)&&a.Cb||a.a.h&&a.b.currentTime+b>a.$}n=Y.prototype;
n.Dc=function(){this.V=!0;if(this.a.b){if(lf(this))return this.Aa();this.c.getBool("allow_infinite_retry_on_net_err",!1)&&this.F.isNetworkInterrupted()||!bb(this.f).every(function(a){return a.ab()})||(this.j=setTimeout(this.Aa.bind(this),this.gb))}this.c.getBool("back_off_buffering_overflow",!1)&&(null===this.I||Date.now()-this.Ab>this.c.getNumber("back_off_buffering_overflow_time_window",2E3)?this.I=this.c.getNumber("buffering_overflow_threshold",0):this.I*=this.c.getNumber("back_off_buffering_overflow_time_factor",
2),this.I=Math.min(this.I,this.c.getNumber("back_off_buffering_overflow_max",5)))};n.Cc=function(){this.V=!1;this.c.getBool("back_off_buffering_overflow",!1)&&(this.Ab=Date.now());null!=this.j&&(clearTimeout(this.j),this.j=null)};n.Hc=function(){null!==this.W&&(Rf(this,this.W),Tf(this,null))};n.Xc=function(){};n.Aa=function(){this.V=!1;this.j=null;this.l.endOfStream()};function zf(a){return bb(a.f).map(function(a){return a.ob()}).filter(function(a){return null!=a})}
function Df(a){return Math.max(a.a?a.a.c:1,a.vb?a.h.streamBufferSize||0:0)}
function Ef(a,b){for(var c=0,d=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,f=[],g=0;g<b.length;++g){var h=b[g].$a(),f=f.concat(b[g].Rb()),c=Math.max(c,h.start);null!=h.end&&(d=Math.min(d,h.end));b[g].length()&&(e=Math.min(e,b[g].A().endTime))}f=mergeSeekRangeGaps(f);if(d==Number.POSITIVE_INFINITY)if(d=a.a.a[0],d.duration)d=(d.start||0)+d.duration;else return null;a.a.b&&(g=Df(a),d=Math.max(d-g,c));if(c>d)return null;d=Math.floor(1E5*d)/1E5;return{start:c,end:d,A:e,La:f}}
n.Ya=function(){return Ef(this,zf(this))};Y.prototype.computeStreamLimits=Y.prototype.Ya;function Yf(a){a.a.b&&(a.aa=setTimeout(a.Rc.bind(a),1E3))}function vf(a){for(var b in a.f)a.f[b].aa(a.h)}Y.prototype.Sa=function(){return this.pb};Y.prototype.getLongestInitResponseTime=Y.prototype.Sa;function Of(a){return"v"===a.charAt(0)?"video":"a"===a.charAt(0)?"audio":null}
Y.prototype.pc=function(){var a=u({type:"networkinterrupted",bubbles:!0});this.dispatchEvent(a);this.O=this.O||Date.now();this.V&&this.j&&clearTimeout(this.j)};
Y.prototype.qc=function(){var a=u({type:"networkresumed",bubbles:!0});this.dispatchEvent(a);a=this.c.getNumber("max_network_interrupted_time_before_seek",1E4);null!==this.O&&Date.now()-this.O>=a&&(this.O=null,this.fa=!0);this.c.getBool("fix_network_interrupted_start_not_nulled",!1)&&(this.O=null);this.V&&(this.j=setTimeout(this.Aa.bind(this),this.gb))};Y.prototype.rc=function(){this.fa=!0};function Gf(a){a.c.getBool("decouple_mpd_update_loop_from_request_loop",!1)||Cf(a,0)};function Z(a,b,c,d,e){d||(d=new D);e||(e=new X);Y.call(this,null,b,d,e);"string"===typeof a?this.Eb=a:this.lb=a;this.P=null;this.ma=c;this.za=[];this.dc=[];this.fc=[];this.Fa=0;this.R=null}r(Z,Y);q("shaka.player.DashVideoSource",Z);Z.prototype.xc=function(a){this.P=a;this.sb(!0,!0)};Z.prototype.updateManifest=Z.prototype.xc;Z.prototype.hc=function(){return this.lb||this.P};Z.prototype.debugGetManifest=Z.prototype.hc;
Z.prototype.tc=function(a,b,c){this.za.push(a);this.dc.push(b||"");this.fc.push(c||"")};Z.prototype.addExternalCaptions=Z.prototype.tc;Z.prototype.uc=function(a){this.R=a};Z.prototype.setNetworkCallback=Z.prototype.uc;Z.prototype.destroy=function(){this.P=this.R=this.ma=null;Y.prototype.destroy.call(this)};
Z.prototype.Ua=function(){var a;this.o&&(a=this.o.getOperationLogger("source_load").start());var b,c=G(this,function(c){this.sa("MPDFetchDuration",(Date.now()-b)/1E3);this.P=c;for(var d=0;d<this.za.length;d++)Nc(c,this.za[d],this.dc[d],this.fc[d]);this.a=ye(new xe(this.ma,this.o),c,this.R);a&&a.setManifestType(this.a.b?"dynamic":"static");return Y.prototype.Ua.call(this).then(function(){a&&a.log()})});if(this.lb)return b=Date.now(),c(this.lb);var d=[new I(this.Eb)],e;if(this.fb){var f=new VideoPushParametersHelper(this.Eb);
f.setStreamEndOffset(Df(this));this.Ka&&f.setPushVideoRepresentationID(this.Ka);this.ha&&f.setPushAudioRepresentationID(this.ha);this.ca&&f.setUseLongCacheForManifest(this.ca);e=new sd(null);e.a=f}d=new H(this.R,d);e=new qd(d,this.kb,e,this.Y);b=Date.now();return rd(e,this.o).then(c)};
Z.prototype.Qb=function(){if(this.ic){var a=this.a;if(a=(a=a&&a.a)&&a[0]){var a=a.a.reduce(function(a,b){return a.concat(b.u)},[]),b=function(a){return null!=a};Promise.all(a.map(function(a){a=a.J;return a.yc?a.ua:a.create()})).then(function(a){a=a.filter(b);this.sa("InitialSegmentIndexes",a)}.bind(this));Promise.all(a.map(function(a){return a.S})).then(function(a){a=a.filter(b);this.sa("SegmentInitSources",a)}.bind(this))}}};
Z.prototype.Ub=function(a,b,c){if(this.b.paused&&this.Fa+1E4>Date.now()&&this.a)return Promise.reject({type:"delay"});var d;if(b&&void 0!=c)d=new sd(b),d.f=c,b=Hf(this),null!=b&&(d.c=b.streamInfoID,d.b=this.ha);else for(b=a.c,c=0;c<b.length;c++){var e=new VideoPushParametersHelper(b[c].toString());this.ca&&e.setUseLongCacheForManifest(this.ca);b[c]=new I(e.getURL())}a=new qd(a,this.kb,d,this.Y);var f=Date.now();return rd(a,this.o).then(G(this,function(a){this.Fa=Date.now();this.sa("MPDFetchDuration",
(this.Fa-f)/1E3);this.P=a;a=ye(new xe(this.ma,this.o),a,this.R);return Promise.resolve(a)}))};Z.prototype.Tb=function(){var a=ye(new xe(this.ma),this.P,this.R);return Promise.resolve(a)};}.bind(g, global))();

module.exports = g.shaka;


/* 3A4lhO4ztfS */}),null);