/*! For license information please see dash.all.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dashjs=t():e.dashjs=t()}(self,(function(){return function(){var e={4593:function(e,t){var n,r,i,o,u,l=function(e){for(var t=[],n=0;n>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},c=function(e){for(var t=[],n=0;n>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push(n.charAt(63&a))}return 2==e.length-t?(a=(e[t]<<16)+(e[t+1]<<8),r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push("=")):1==e.length-t&&(a=e[t]<<16,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push("==")),r.join("")},i=function(){for(var e=[],t=0;t=n&&console.log(this.time+" ["+e+"] "+t)}},f=function(e){for(var t=[],n=0;ni&&(c.log("ERROR","Too large cursor position "+this.pos),this.pos=i)},moveCursor:function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n=144&&this.backSpace();var t=n(e);this.pos>=i?c.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},clearFromPos:function(e){var t;for(t=e;t0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},getTextAndFormat:function(){return this.rows}};var m=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new p,this.nonDisplayedMemory=new p,this.lastOutputScreen=new p,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};m.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(e){this.outputFilter=e},setPAC:function(e){this.writeScreen.setPAC(e)},setBkgData:function(e){this.writeScreen.setBkgData(e)},setMode:function(e){e!==this.mode&&(this.mode=e,c.log("INFO","MODE="+e),"MODE_POP-ON"==this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},insertChars:function(e){for(var t=0;t=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}c.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=c.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var y=function(e,t,n){this.field=e||1,this.outputs=[t,n],this.channels=[new m(1,t),new m(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};y.prototype={getHandler:function(e){return this.channels[e].getHandler()},setHandler:function(e,t){this.channels[e].setHandler(t)},addData:function(e,t){var n,r,i,a=!1;this.lastTime=e,c.setTime(e);for(var o=0;o=16&&r<=31&&r===this.lastCmdA&&i===this.lastCmdB?(this.lastCmdA=null,this.lastCmdB=null,c.log("DEBUG","Repeated command ("+f([r,i])+") is dropped")):0!==r||0!==i?(c.log("DATA","["+f([t[o],t[o+1]])+"] -> ("+f([r,i])+")"),(n=this.parseCmd(r,i))||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i)),n||(a=this.parseChars(r,i))&&(this.currChNr&&this.currChNr>=0?this.channels[this.currChNr-1].insertChars(a):c.log("WARNING","No channel found yet. TEXT-MODE?")),n?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,c.log("WARNING","Couldn't parse cleaned data "+f([r,i])+" orig: "+f([t[o],t[o+1]])))):this.dataCounters.padding+=2},parseCmd:function(e,t){var n;if(!((20===e||21===e||28===e||29===e)&&32<=t&&t<=47||(23===e||31===e)&&33<=t&&t<=35))return!1;n=20===e||21===e||23===e?1:2;var r=this.channels[n-1];return 20===e||21===e||28===e||29===e?32===t?r.cc_RCL():33===t?r.cc_BS():34===t?r.cc_AOF():35===t?r.cc_AON():36===t?r.cc_DER():37===t?r.cc_RU(2):38===t?r.cc_RU(3):39===t?r.cc_RU(4):40===t?r.cc_FON():41===t?r.cc_RDC():42===t?r.cc_TR():43===t?r.cc_RTD():44===t?r.cc_EDM():45===t?r.cc_CR():46===t?r.cc_ENM():47===t&&r.cc_EOC():r.cc_TO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},parseMidrow:function(e,t){var n=null;if((17===e||25===e)&&32<=t&&t<=47){if((n=17===e?1:2)!==this.currChNr)return c.log("ERROR","Mismatch channel in midrow parsing"),!1;var r=this.channels[n-1];return r.insertChars([32]),r.cc_MIDROW(t),c.log("DEBUG","MIDROW ("+f([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var n,r;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127||(16===e||24===e)&&64<=t&&t<=95))return!1;n=e<=23?1:2,r=64<=t&&t<=95?1===n?a[e]:s[e]:1===n?o[e]:u[e];var i=this.interpretPAC(r,t);return this.channels[n-1].setPAC(i),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},interpretPAC:function(e,t){var n,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,r.underline=1==(1&n),n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((n-16)/2),r},parseChars:function(e,t){var r=null,i=null,a=null;if(e>=25?(r=2,a=e-8):(r=1,a=e),17<=a&&a<=19){var o;o=17===a?t+80:18===a?t+112:t+144,c.log("INFO","Special char '"+n(o)+"' in channel "+r),i=[o],this.lastCmdA=e,this.lastCmdB=t}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t],this.lastCmdA=null,this.lastCmdB=null);if(i){var s=f(i);c.log("DEBUG","Char codes = "+s.join(","))}return i},parseBackgroundAttributes:function(e,t){var n,r,i;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(n={},16===e||24===e?(r=Math.floor((t-32)/2),n.background=l[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),i=e<24?1:2,this.channels[i-1].setBkgData(n),this.lastCmdA=e,this.lastCmdB=t,!0)},reset:function(){for(var e=0;e0&&(r+=" ");for(var s=arguments.length,u=new Array(s>2?s-2:0),l=2;l=e&&p[e](r),h&&h.get().debug.dispatchEvent&&g.trigger(i.Z.LOG,{message:r,level:e})}return t={getLogger:function(e){return{fatal:y.bind(e),error:E.bind(e),warn:v.bind(e),info:_.bind(e),debug:T.bind(e)}},setLogTimestampVisible:function(e){n=e},setCalleeNameVisible:function(e){a=e}},n=!0,a=!0,f=(new Date).getTime(),"undefined"!=typeof window&&window.console&&(p[o]=m(window.console.error),p[s]=m(window.console.error),p[u]=m(window.console.warn),p[l]=m(window.console.info),p[c]=m(window.console.debug)),t}f.__dashjs_factory_name="Debug";var d=a.Z.getSingletonFactory(f);d.LOG_LEVEL_NONE=0,d.LOG_LEVEL_FATAL=o,d.LOG_LEVEL_ERROR=s,d.LOG_LEVEL_WARNING=u,d.LOG_LEVEL_INFO=l,d.LOG_LEVEL_DEBUG=c,a.Z.updateSingletonFactory(f.__dashjs_factory_name,d),t.Z=d},5595:function(e,t,n){"use strict";var r=n(5448),i=n(8825);function a(){var e={};function t(t,n,r){var i=-1;return e[t]?(e[t].some((function(e,t){if(e&&e.callback===n&&(!r||r===e.scope))return i=t,!0})),i):i}var n={on:function(n,r,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!n)throw new Error("event type cannot be null or undefined");if(!r||"function"!=typeof r)throw new Error("listener must be a function: "+r);var o=a.priority||0;if(!(t(n,r,i)>=0)){e[n]=e[n]||[];var s={callback:r,scope:i,priority:o};i&&i.getStreamId&&(s.streamId=i.getStreamId()),i&&i.getType&&(s.mediaType=i.getType()),a&&a.mode&&(s.mode=a.mode);var u=e[n].some((function(t,r){if(t&&o>t.priority)return e[n].splice(r,0,s),!0}));u||e[n].push(s)}},off:function(n,r,i){if(n&&r&&e[n]){var a=t(n,r,i);a<0||(e[n][a]=null)}},trigger:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t&&e[t]){if((n=n||{}).hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");n.type=t,r.streamId&&(n.streamId=r.streamId),r.mediaType&&(n.mediaType=r.mediaType),e[t].filter((function(e){return!(!e||r.streamId&&e.streamId&&e.streamId!==r.streamId||r.mediaType&&e.mediaType&&e.mediaType!==r.mediaType||r.mode&&e.mode&&e.mode!==r.mode||!e.mode&&r.mode&&r.mode===i.Z.EVENT_MODE_ON_RECEIVE)})).forEach((function(e){return e&&e.callback.call(e.scope,n)}))}},reset:function(){e={}}};return n}a.__dashjs_factory_name="EventBus";var o=r.Z.getSingletonFactory(a);o.EVENT_PRIORITY_LOW=0,o.EVENT_PRIORITY_HIGH=5e3,r.Z.updateSingletonFactory(a.__dashjs_factory_name,o),t.Z=o},5448:function(e,t){"use strict";var n=function(){var e,t=[],n={},r={};function i(e,n){for(var r in t){var i=t[r];if(i.context===e&&i.name===n)return i.instance}return null}function a(e,t){return t[e]}function o(e,t,n){e in n&&(n[e]=t)}function s(t,n,r){var i,a=t.__dashjs_factory_name,o=n[a];if(o){var s=o.instance;if(!o.override)return s.apply({context:n,factory:e},r);for(var u in i=t.apply({context:n},r),s=s.apply({context:n,factory:e,parent:i},r))i.hasOwnProperty(u)&&(i[u]=s[u])}else i=t.apply({context:n},r);return i.getClassName=function(){return a},i}return e={extend:function(e,t,n,r){!r[e]&&t&&(r[e]={instance:t,override:n})},getSingletonInstance:i,setSingletonInstance:function(e,n,r){for(var i in t){var a=t[i];if(a.context===e&&a.name===n)return void(t[i].instance=r)}t.push({name:n,context:e,instance:r})},deleteSingletonInstances:function(e){t=t.filter((function(t){return t.context!==e}))},getSingletonFactory:function(e){var r=a(e.__dashjs_factory_name,n);return r||(r=function(n){var r;return void 0===n&&(n={}),{getInstance:function(){return r||(r=i(n,e.__dashjs_factory_name)),r||(r=s(e,n,arguments),t.push({name:e.__dashjs_factory_name,context:n,instance:r})),r}}},n[e.__dashjs_factory_name]=r),r},getSingletonFactoryByName:function(e){return a(e,n)},updateSingletonFactory:function(e,t){o(e,t,n)},getClassFactory:function(e){var t=a(e.__dashjs_factory_name,r);return t||(t=function(t){return void 0===t&&(t={}),{create:function(){return s(e,t,arguments)}}},r[e.__dashjs_factory_name]=t),t},getClassFactoryByName:function(e){return a(e,r)},updateClassFactory:function(e,t){o(e,t,r)}},e}();t.Z=n},1264:function(e,t,n){"use strict";var r=n(5448),i=n(703),a=n(6398),o=n(3393),s=n(7855),u=n(5595),l=n(8512);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(){var e,t,n=this.context,r=(0,u.Z)(n).getInstance(),d={"streaming.delay.liveDelay":l.Z.SETTING_UPDATED_LIVE_DELAY,"streaming.delay.liveDelayFragmentCount":l.Z.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,"streaming.liveCatchup.enabled":l.Z.SETTING_UPDATED_CATCHUP_ENABLED,"streaming.liveCatchup.playbackRate.min":l.Z.SETTING_UPDATED_PLAYBACK_RATE_MIN,"streaming.liveCatchup.playbackRate.max":l.Z.SETTING_UPDATED_PLAYBACK_RATE_MAX},g={debug:{logLevel:a.Z.LOG_LEVEL_WARNING,dispatchEvent:!1},streaming:{abandonLoadTimeout:1e4,wallclockTimeUpdateInterval:100,manifestUpdateRetryInterval:100,liveUpdateTimeThresholdInMilliseconds:0,cacheInitSegments:!1,applyServiceDescription:!0,applyProducerReferenceTime:!0,applyContentSteering:!0,eventControllerRefreshDelay:100,enableManifestDurationMismatchFix:!0,parseInbandPrft:!1,enableManifestTimescaleMismatchFix:!1,capabilities:{filterUnsupportedEssentialProperties:!0,useMediaCapabilitiesApi:!1},timeShiftBuffer:{calcFromSegmentTimeline:!1,fallbackToSegmentTimeline:!0},metrics:{maxListDepth:100},delay:{liveDelayFragmentCount:NaN,liveDelay:NaN,useSuggestedPresentationDelay:!0},protection:{keepProtectionMediaKeys:!1,ignoreEmeEncryptedEvent:!1,detectPlayreadyMessageFormat:!0},buffer:{enableSeekDecorrelationFix:!1,fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!1,reuseExistingSourceBuffers:!0,bufferPruningInterval:10,bufferToKeep:20,bufferTimeAtTopQuality:30,bufferTimeAtTopQualityLongForm:60,initialBufferLevel:NaN,stableBufferTime:12,longFormContentDurationThreshold:600,stallThreshold:.3,useAppendWindow:!0,setStallState:!0,avoidCurrentTimeRangePruning:!1,useChangeTypeForTrackSwitch:!0,mediaSourceDurationInfinity:!0,resetSourceBuffersForTrackSwitch:!1},gaps:{jumpGaps:!0,jumpLargeGaps:!0,smallGapLimit:1.5,threshold:.3,enableSeekFix:!0,enableStallFix:!1,stallSeek:.1},utcSynchronization:{enabled:!0,useManifestDateHeaderTimeSource:!0,backgroundAttempts:2,timeBetweenSyncAttempts:30,maximumTimeBetweenSyncAttempts:600,minimumTimeBetweenSyncAttempts:2,timeBetweenSyncAttemptsAdjustmentFactor:2,maximumAllowedDrift:100,enableBackgroundSyncAfterSegmentDownloadError:!0,defaultTimingSource:{scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"https://time.akamai.com/?iso&ms"}},scheduling:{defaultTimeout:500,lowLatencyTimeout:0,scheduleWhilePaused:!0},text:{defaultEnabled:!0,dispatchForManualRendering:!1,extendSegmentedCues:!0,imsc:{displayForcedOnlyMode:!1,enableRollUp:!0},webvtt:{customRenderingEnabled:!1}},liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN},playbackBufferMin:.5,enabled:null,mode:o.Z.LIVE_CATCHUP_MODE_DEFAULT},lastBitrateCachingInfo:{enabled:!0,ttl:36e4},lastMediaSettingsCachingInfo:{enabled:!0,ttl:36e4},saveLastMediaSettingsForCurrentStreamingSession:!0,cacheLoadThresholds:{video:50,audio:5},trackSwitchMode:{audio:o.Z.TRACK_SWITCH_MODE_ALWAYS_REPLACE,video:o.Z.TRACK_SWITCH_MODE_NEVER_REPLACE},selectionModeForInitialTrack:o.Z.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY,fragmentRequestTimeout:2e4,fragmentRequestProgressTimeout:-1,manifestRequestTimeout:1e4,retryIntervals:(e={},f(e,s.w.MPD_TYPE,500),f(e,s.w.XLINK_EXPANSION_TYPE,500),f(e,s.w.MEDIA_SEGMENT_TYPE,1e3),f(e,s.w.INIT_SEGMENT_TYPE,1e3),f(e,s.w.BITSTREAM_SWITCHING_SEGMENT_TYPE,1e3),f(e,s.w.INDEX_SEGMENT_TYPE,1e3),f(e,s.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE,1e3),f(e,s.w.LICENSE,1e3),f(e,s.w.OTHER_TYPE,1e3),f(e,"lowLatencyReductionFactor",10),e),retryAttempts:(t={},f(t,s.w.MPD_TYPE,3),f(t,s.w.XLINK_EXPANSION_TYPE,1),f(t,s.w.MEDIA_SEGMENT_TYPE,3),f(t,s.w.INIT_SEGMENT_TYPE,3),f(t,s.w.BITSTREAM_SWITCHING_SEGMENT_TYPE,3),f(t,s.w.INDEX_SEGMENT_TYPE,3),f(t,s.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE,3),f(t,s.w.LICENSE,3),f(t,s.w.OTHER_TYPE,3),f(t,"lowLatencyMultiplyFactor",5),t),abr:{movingAverageMethod:o.Z.MOVING_AVERAGE_SLIDING_WINDOW,ABRStrategy:o.Z.ABR_STRATEGY_DYNAMIC,additionalAbrRules:{insufficientBufferRule:!0,switchHistoryRule:!0,droppedFramesRule:!0,abandonRequestsRule:!0},abrRulesParameters:{abandonRequestsRule:{graceTimeThreshold:500,abandonMultiplier:1.8,minLengthToAverage:5}},bandwidthSafetyFactor:.9,useDefaultABRRules:!0,useDeadTimeLatency:!0,limitBitrateByPortal:!1,usePixelRatioInLimitBitrateByPortal:!1,maxBitrate:{audio:-1,video:-1},minBitrate:{audio:-1,video:-1},maxRepresentationRatio:{audio:1,video:1},initialBitrate:{audio:-1,video:-1},initialRepresentationRatio:{audio:-1,video:-1},autoSwitchBitrate:{audio:!0,video:!0},fetchThroughputCalculationMode:o.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING},cmcd:{enabled:!1,sid:null,cid:null,rtp:null,rtpSafetyFactor:5,mode:o.Z.CMCD_MODE_QUERY,enabledKeys:["br","d","ot","tb","bl","dl","mtp","nor","nrr","su","bs","rtp","cid","pr","sf","sid","st","v"]},cmsd:{enabled:!1,abr:{applyMb:!1,etpWeightRatio:0}}},errors:{recoverAttempts:{mediaErrorDecode:5}}},h=i.Z.clone(g);function p(e,t,n){for(var a in e)e.hasOwnProperty(a)&&(t.hasOwnProperty(a)?"object"!==c(e[a])||e[a]instanceof Array||null===e[a]?(t[a]=i.Z.clone(e[a]),d[n+a]&&r.trigger(d[n+a])):p(e[a],t[a],n.slice()+a+"."):console.error("Settings parameter "+n+a+" is not supported"))}return{get:function(){return h},update:function(e){"object"===c(e)&&p(e,h,"")},reset:function(){h=i.Z.clone(g)}}}d.__dashjs_factory_name="Settings";var g=r.Z.getSingletonFactory(d);t.Z=g},703:function(e,t,n){"use strict";var r=n(3875),i=n.n(r),a=n(1067);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var n=0;n0&&(t[a.substring(0,o)]=a.substring(o+2))}return t}},{key:"generateUuid",value:function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))}},{key:"generateHashCode",value:function(e){var t=0;if(0===e.length)return t;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:null;try{var t=null===e&&"undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"";return(0,a.UAParser)(t)}catch(e){return{}}}},{key:"stringHasProtocol",value:function(e){return/(http(s?)):\/\//i.test(e)}}],null&&s(t.prototype,null),n&&s(t,n),e}();t.Z=u},2032:function(e,t,n){"use strict";function r(){return"4.7.4"}n.d(t,{e:function(){return r}})},2230:function(e,t){"use strict";function n(e,t){for(var n=0;ns.startTime&&l-e>r?e:!isNaN(s.startTime)&&es.startTime?s.startTime+.001:Math.min(l-r,o)}return o}catch(e){return NaN}},initialize:function(e){l=e,c=!1,m.initialize(e)},isLastSegmentRequested:function(e,t){if(!e||!a)return!1;if(c)return!0;if(!isFinite(e.adaptation.period.duration))return!1;if(a.presentationStartTime+a.duration>t)return!1;if(e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.numberOfSegments)&&!isNaN(a.index)&&a.index>=e.mediaFinishedInformation.numberOfSegments-1){if(!l||e.segmentInfoType===u.Z.SEGMENT_TEMPLATE)return!0;if(l&&e.segmentInfoType===u.Z.SEGMENT_LIST&&e.adaptation.period.nextPeriodId)return!0}return!!(l&&e.adaptation.period.nextPeriodId&&e.segmentInfoType===u.Z.SEGMENT_TIMELINE&&e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment)&&a&&!isNaN(a.mediaStartTime)&&!isNaN(a.duration)&&a.mediaStartTime+a.duration>=e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment-.05)},repeatSegmentRequest:function(e,t){return t&&t.segmentInfoType?A(e,t,a?a.index:0):null},reset:function(){_(),f.off(o.Z.DYNAMIC_TO_STATIC,I,t)}},n=d.getLogger(t),_(),f.on(o.Z.DYNAMIC_TO_STATIC,I,t),t}l.__dashjs_factory_name="DashHandler",t.Z=a.Z.getClassFactory(l)},1553:function(e,t){"use strict";function n(e,t){for(var n=0;n0)for(o=0;o=i&&t-nr&&o=a)}return!0}function c(e,t,n,r){var i,a,o;i=n.segmentDuration,isNaN(i)&&(i=n.adaptation.period.duration),a=parseFloat((n.adaptation.period.start+r*i).toFixed(5)),o=parseFloat((a+i).toFixed(5));var s=u(n,i,a,e.calcMediaTimeFromPresentationTime(a,n),e,o,t,r);return l(e,n,s,t)?s:null}function f(e,t,n,r,i,a,o,c,f,d){var g,h,p=r/a,m=i/a;return g=e.calcPresentationTimeFromMediaTime(p,n),l(e,n,h=u(n,m,g,p,e,g+m,t,f),t)?(h.replacementTime=d||r,o=s(o,"Number",h.replacementNumber),o=s(o,"Time",h.replacementTime),h.media=o,h.mediaRange=c,h):null}},3636:function(e,t,n){"use strict";var r=n(5448),i=n(3393),a=n(7387);function o(e,t){var n=(e=e||{}).timelineConverter;function r(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(i.Z.MISSING_CONFIG_ERROR)}function o(e,i){if(r(),!e)return null;var o=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate;i=Math.max(i,0);var s=(0,a.NF)(n,t,e,i);if(s){s.replacementTime=Math.round((i-1)*e.segmentDuration*e.timescale,10);var u=o.media;u=(0,a.vi)(u,"Number",s.replacementNumber),u=(0,a.vi)(u,"Time",s.replacementTime),s.media=u}return s}return{getSegmentByIndex:o,getSegmentByTime:function(e,t){if(r(),!e)return null;var i=e.segmentDuration;if(isNaN(i))return null;var a=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return o(e,Math.floor(a/i))},getMediaFinishedInformation:function(e){var t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!e)return t;var n=e.segmentDuration;return isNaN(n)?t.numberOfSegments=1:t.numberOfSegments=Math.ceil(e.adaptation.period.duration/n),t}}}o.__dashjs_factory_name="TemplateSegmentsGetter";var s=r.Z.getClassFactory(o);t.Z=s},1724:function(e,t,n){"use strict";var r=n(5448),i=n(3393),a=n(7387);function o(e,t){var n=(e=e||{}).timelineConverter,r=e.dashMetrics;function o(){if(!n)throw new Error(i.Z.MISSING_CONFIG_ERROR)}function s(e,t){var n,r,i,a,o,s,l,c=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,f=c.SegmentTimeline,d=c.SegmentURL_asArray,g=0,h=-1;l=e.timescale;var p=!1;for(i=0,a=(n=f.S_asArray).length;i=i*f-.5*c.d&&(l=!0),!1})),u},getSegmentByTime:function(e,r){if(o(),!e)return null;void 0===r&&(r=null);var i=null,u=n.calcMediaTimeFromPresentationTime(r,e);return s(e,(function(r,o,s,l,c,f,d){var g=parseFloat((u*c).toPrecision(15));if(g=r){var h=o.media,p=l.mediaRange;return s&&(h=s[d].media||"",p=s[d].mediaRange),i=(0,a.TJ)(n,t,e,r,l.d,c,h,p,f,l.tManifest),!0}return!1})),i},getMediaFinishedInformation:function(e){if(!e)return 0;var t,n,r,i,a,o,s,l=(e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList).SegmentTimeline,c=0,f=0,d=0;for(s=e.timescale,i=(t=l.S_asArray).length,r=0;r0&&void 0!==arguments[0]?arguments[0]:null;return parseFloat((F(e)-G()).toFixed(5))}function F(e){var t=e||y;return t.start+t.duration}function x(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];y&&c&&c.getElement()?(e&&E&&B(G()),c.play()):v=!0}function k(){y&&c&&c.pause()}function U(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(y&&c&&c.getElement()){var a=isNaN(I)?c.getTime():I;e!==a&&((R=!0===r)||(I=e),t.info("Requesting seek to time: "+e+(R?" (internal)":"")),E&&i&&B(e),c.setCurrentTime(e,n))}}function Z(){if(y&&c&&E){var e=n&&n.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,t=i.getCurrentDVRInfo(e);return t&&t.range?t.range.end:0}}function B(e){var t=new Date(g.getClientReferenceTime()),n=o.getRegularPeriods()[0],r=g.calcPresentationTimeFromWallTime(t,n);p=r-e}function G(){return y&&c?c.getTime():null}function q(){return y&&c?c.isPaused():null}function Y(){return y&&c?c.isSeeking():null}function j(){return y&&c?c.isStalled():null}function H(){return y&&c?c.getPlaybackRate():null}function V(){return y&&c?c.getEnded():null}function K(){return E}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!q()&&E&&0!==c.getReadyState()&&!Y()&&!N){e||(e=n.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO);var r=G(),i=W(r,e),o=!isNaN(i)&&i!==r;o&&!Y()&&(j()||w||1===c.getReadyState())&&(t.debug("UpdateCurrentTime: Seek to actual time: ".concat(i," from currentTime: ").concat(r)),U(i,!1,!1))}}function W(e,t){var n=i.getCurrentDVRInfo(t),r=n?n.range:null;return r?e>r.end?Math.max(r.end-p,r.start):e>0&&e+.25T+D.get().streaming.liveUpdateTimeThresholdInMilliseconds)&&(n.addDVRMetric(),q()?function(){var e=Date.now();(!_||e>_+500)&&(_=e,ue())}():z(),T=e)}}()}),D.get().streaming.wallclockTimeUpdateInterval))}function Q(){clearInterval(h),h=null}function J(e){var t=o.convertRepresentationToRepresentationInfo(e.currentRepresentation),n=t?t.mediaInfo.streamInfo:null;null!==n&&y.id===n.id&&(y=n)}function $(){M.trigger(l.Z.CAN_PLAY)}function ee(){M.trigger(l.Z.CAN_PLAY_THROUGH)}function te(e){e.streamId===n.getActiveStreamInfo().id&&(w=e.state===s.Z.BUFFER_EMPTY,D.get().streaming.buffer.setStallState&&c.setStallState(e.mediaType,e.state===s.Z.BUFFER_EMPTY))}function ne(){t.info("Native video element event: play"),z(),X(),M.trigger(l.Z.PLAYBACK_STARTED,{startTime:G()})}function re(){t.info("Native video element event: waiting"),M.trigger(l.Z.PLAYBACK_WAITING,{playingTime:G()})}function ie(){t.info("Native video element event: playing"),R=!1,M.trigger(l.Z.PLAYBACK_PLAYING,{playingTime:G()})}function ae(){t.info("Native video element event: pause"),M.trigger(l.Z.PLAYBACK_PAUSED,{ended:V()})}function oe(){if(!R){var e=G();isNaN(I)||I===e||(e=I),I=NaN,t.info("Seeking to: "+e),X(),M.trigger(l.Z.PLAYBACK_SEEKING,{seekTime:e,streamId:y.id})}}function se(){t.info("Native video element event: seeked"),R=!1,M.trigger(l.Z.PLAYBACK_SEEKED)}function ue(){y&&M.trigger(l.Z.PLAYBACK_TIME_UPDATED,{timeToEnd:L(),time:G(),streamId:y.id})}function le(){M.trigger(l.Z.PLAYBACK_PROGRESS,{streamId:y.id})}function ce(){var e=H();t.info("Native video element event: ratechange: ",e),M.trigger(l.Z.PLAYBACK_RATE_CHANGED,{playbackRate:e})}function fe(){t.info("Native video element event: loadedmetadata"),M.trigger(l.Z.PLAYBACK_METADATA_LOADED),X()}function de(){t.info("Native video element event: loadeddata"),M.trigger(l.Z.PLAYBACK_LOADED_DATA)}function ge(){t.info("Native video element event: ended"),k(),Q();var e=n?n.getActiveStreamInfo():null;e&&M.trigger(l.Z.PLAYBACK_ENDED,{isLast:e.isLast})}function he(){M.trigger(l.Z.PLAYBACK_VOLUME_CHANGED)}function pe(e){if(h&&e.isLast){t.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended");var n=e.seekTime?e.seekTime:F();c.setCurrentTime(n),k(),Q()}}function me(e){var t=e.target||e.srcElement;M.trigger(l.Z.PLAYBACK_ERROR,{error:t.error})}function ye(){E=!1}function Ee(e){if(!1===e.stream&&A&&!isNaN(e.request.duration)){var n=1.2*e.request.duration;n>p&&(t.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",n.toFixed(2)),p=n,m=n)}}function ve(e){M.trigger(l.Z.PLAYBACK_STALLED,{e:e})}function _e(e){var n;(n=e.mediaInfo)&&n.supplementalProperties&&n.supplementalProperties[a.Z.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME]&&"true"===n.supplementalProperties[a.Z.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME].value&&(t.debug("Low Latency critical SupplementalProperty set: Enabling low Latency"),A=!0)}function Te(e){var t=n.getActiveStreamInfo();e&&t&&e.currentRepresentation&&e.streamId&&e.streamId===t.id&&e.mediaType&&(e.mediaType===a.Z.VIDEO||e.mediaType===a.Z.AUDIO)&&(b=e.currentRepresentation.availabilityTimeComplete,(A=!b)&&!C&&(C=!0))}function Se(){N=!0}function be(){N=!1}return e={initialize:function(t,n){y=t,!0!==n&&(c.addEventListener("canplay",$),c.addEventListener("canplaythrough",ee),c.addEventListener("play",ne),c.addEventListener("waiting",re),c.addEventListener("playing",ie),c.addEventListener("pause",ae),c.addEventListener("error",me),c.addEventListener("seeking",oe),c.addEventListener("seeked",se),c.addEventListener("timeupdate",ue),c.addEventListener("progress",le),c.addEventListener("ratechange",ce),c.addEventListener("loadedmetadata",fe),c.addEventListener("loadeddata",de),c.addEventListener("stalled",ve),c.addEventListener("ended",ge),c.addEventListener("volumechange",he),E=y.manifestInfo.isDynamic,w=!1,R=!1,M.on(l.Z.DATA_UPDATE_COMPLETED,J,e),M.on(l.Z.LOADING_PROGRESS,Ee,e),M.on(l.Z.MANIFEST_UPDATED,Se,e),M.on(l.Z.STREAMS_COMPOSED,be,e),M.on(d.Z.PLAYBACK_ENDED,pe,e,{priority:u.Z.EVENT_PRIORITY_HIGH}),M.on(d.Z.STREAM_INITIALIZING,_e,e),M.on(d.Z.REPRESENTATION_SWITCH,Te,e),M.on(d.Z.BUFFER_LEVEL_STATE_CHANGED,te,e),M.on(d.Z.DYNAMIC_TO_STATIC,ye,e),v&&(v=!1,x()))},setConfig:function(e){e&&(e.streamController&&(n=e.streamController),e.serviceDescriptionController&&(r=e.serviceDescriptionController),e.dashMetrics&&(i=e.dashMetrics),e.adapter&&(o=e.adapter),e.videoModel&&(c=e.videoModel),e.timelineConverter&&(g=e.timelineConverter),e.settings&&(D=e.settings))},getTimeToStreamEnd:L,getBufferLevel:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=null;return n.getActiveStreamProcessors().forEach((function(n){if(!e||0===e.length||-1===e.indexOf(n.getType())){var r=n.getBufferLevel();t=null===t?r:Math.min(t,r)}})),t},getPlaybackStalled:function(){return w},getTime:G,getLowLatencyModeEnabled:function(){return A},getInitialCatchupModeActivated:function(){return C},getIsManifestUpdateInProgress:function(){return N},getPlaybackRate:H,getPlayedRanges:function(){return y&&c?c.getPlayedRanges():null},getEnded:V,getIsDynamic:K,getStreamController:function(){return n},computeAndSetLiveDelay:function(e,t){var n,i,a,s=!isNaN(e)&&isFinite(e)?e:NaN,u=o.getSuggestedPresentationDelay(),l=r.getServiceDescriptionSettings();return n=isNaN(D.get().streaming.delay.liveDelay)?null===D.get().streaming.delay.liveDelayFragmentCount||isNaN(D.get().streaming.delay.liveDelayFragmentCount)||isNaN(s)?l&&!isNaN(l.liveDelay)&&l.liveDelay>0?l.liveDelay:!0===D.get().streaming.delay.useSuggestedPresentationDelay&&null!==u&&!isNaN(u)&&u>0?u:isNaN(s)?t&&!isNaN(t.minBufferTime)?4*t.minBufferTime:4*y.manifestInfo.minBufferTime:4*s:s*D.get().streaming.delay.liveDelayFragmentCount:D.get().streaming.delay.liveDelay,null!==(a=o.getAvailabilityStartTime())&&(S=a),i=t&&t.dvrWindowSize>0?Math.min(n,t.dvrWindowSize):n,p=i,m=i,i},getLiveDelay:function(){return p},getOriginalLiveDelay:function(){return m},getCurrentLiveLatency:function(){if(!E||isNaN(S))return NaN;var e=G();if(isNaN(e)||0===e)return 0;var t=(new Date).getTime()+1e3*g.getClientTimeOffset();return Math.max(((t-S-1e3*e)/1e3).toFixed(3),0)},play:x,isPaused:q,isStalled:j,pause:k,isSeeking:Y,getStreamEndTime:F,seek:U,seekToOriginalLive:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Z();if(0!==r){var i=r-(p=m);U(i,e,t,n)}},seekToCurrentLive:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Z();if(0!==r){var i=r-p;U(i,e,t,n)}},reset:P,updateCurrentTime:z,getAvailabilityStartTime:function(){return S}},t=(0,f.Z)(O).getInstance().getLogger(e),P(),e}g.__dashjs_factory_name="PlaybackController";var h=c.Z.getSingletonFactory(g),p=n(3186),m="loading",y="executed",E="failed";function v(e){var t,n,r,i,a=(e=e||{}).eventBus,o=e.events,s=e.dashMetrics,u=e.fragmentLoader,l=e.debug,c=e.streamInfo,f=e.type;function d(e){var t;return!!e&&(t=!1,r.some((function(n){if(r=e,i=n,!isNaN(r.index)&&r.startTime===i.startTime&&r.adaptationIndex===i.adaptationIndex&&r.type===i.type||function(e,t){return isNaN(e.index)&&isNaN(t.index)&&e.quality===t.quality}(e,n)||function(e,t){return e.action===p.Z.ACTION_COMPLETE&&e.action===t.action}(e,n))return t=!0;var r,i})),t)}function g(e){return isNaN(e.duration)?.25:Math.min(e.duration/8,.5)}function h(e){r=r.filter((function(t){var n=g(t);return isNaN(t.startTime)||void 0!==e&&t.startTime>=e-n}))}function v(e,t){t<=e+.5||(r=r.filter((function(n){var r=g(n);return isNaN(n.startTime)||n.startTime>=t-r||isNaN(n.duration)||n.startTime+n.duration<=e+r})))}function _(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r],a=i.startTime,o=a+i.duration;if(n=isNaN(n)?g(i):n,!isNaN(a)&&!isNaN(o)&&t+n>=a&&t-n0&&v(n,t)}else h()},abortRequests:function(){n.debug("abort requests"),u.abort(),i=[]},executeRequest:function(e){e.action===p.Z.ACTION_DOWNLOAD?(T(e,m),i.push(e),function(e){a.trigger(o.FRAGMENT_LOADING_STARTED,{request:e},{streamId:c.id,mediaType:f}),u.load(e)}(e)):n.warn("Unknown request action.")},reset:function(){a.off(o.LOADING_COMPLETED,S,this),a.off(o.LOADING_DATA_PROGRESS,b,this),a.off(o.LOADING_ABANDONED,A,this),u&&u.reset(),I()},resetInitialSettings:I,addExecutedRequest:function(e){r.push(e)}},n=l.getLogger(t),I(),a.on(o.LOADING_COMPLETED,S,t),a.on(o.LOADING_DATA_PROGRESS,b,t),a.on(o.LOADING_ABANDONED,A,t),t}v.__dashjs_factory_name="FragmentModel";var _=c.Z.getClassFactory(v);_.FRAGMENT_MODEL_LOADING=m,_.FRAGMENT_MODEL_EXECUTED=y,_.FRAGMENT_MODEL_CANCELED="canceled",_.FRAGMENT_MODEL_FAILED=E,c.Z.updateClassFactory(v.__dashjs_factory_name,_);var T=_,S=n(5459);function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function I(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var w=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var i=R(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return I(this,e)});function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE=10,e.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE=11,e.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE=12,e.SEGMENT_BASE_LOADER_ERROR_CODE=15,e.TIME_SYNC_FAILED_ERROR_CODE=16,e.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE=17,e.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE=18,e.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=19,e.APPEND_ERROR_CODE=20,e.REMOVE_ERROR_CODE=21,e.DATA_UPDATE_FAILED_ERROR_CODE=22,e.CAPABILITY_MEDIASOURCE_ERROR_CODE=23,e.CAPABILITY_MEDIAKEYS_ERROR_CODE=24,e.DOWNLOAD_ERROR_ID_MANIFEST_CODE=25,e.DOWNLOAD_ERROR_ID_SIDX_CODE=26,e.DOWNLOAD_ERROR_ID_CONTENT_CODE=27,e.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE=28,e.DOWNLOAD_ERROR_ID_XLINK_CODE=29,e.MANIFEST_ERROR_ID_PARSE_CODE=31,e.MANIFEST_ERROR_ID_NOSTREAMS_CODE=32,e.TIMED_TEXT_ERROR_ID_PARSE_CODE=33,e.MANIFEST_ERROR_ID_MULTIPLEXED_CODE=34,e.MEDIASOURCE_TYPE_UNSUPPORTED_CODE=35,e.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE="parsing failed for ",e.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading manifest: ",e.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading Xlink element: ",e.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE="Segments update failed",e.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE="no segments are available yet",e.SEGMENT_BASE_LOADER_ERROR_MESSAGE="error loading segment ranges from sidx",e.TIME_SYNC_FAILED_ERROR_MESSAGE="Failed to synchronize client and server time",e.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE="request is null",e.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE="Failed to resolve a valid URL",e.APPEND_ERROR_MESSAGE="chunk is not defined",e.REMOVE_ERROR_MESSAGE="Removing data from the SourceBuffer",e.DATA_UPDATE_FAILED_ERROR_MESSAGE="Data update failed",e.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE="mediasource is not supported",e.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE="mediakeys is not supported",e.TIMED_TEXT_ERROR_MESSAGE_PARSE="parsing error :",e.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE="Error creating source buffer of type : ",e}return i}(n(2230).Z)),N=n(1264),C=n(7855);function D(e){var t,n,r,i,o,s,u=this.context,c=(0,N.Z)(u).getInstance(),d=e.textController,g=e.eventBus,h=[],p=[],m=!1,y=e.mediaSource,E=null;function v(e){return new Promise((function(t){M((function(){i.changeType&&i.changeType(e),t()}))}))}function _(e){return i=d.getTextSourceBuffer(e),Promise.resolve()}function T(){if("function"==typeof i.addEventListener)try{i.addEventListener("updateend",D,!1),i.addEventListener("error",O,!1),i.addEventListener("abort",O,!1)}catch(e){s=setInterval(D,50)}else s=setInterval(D,50)}function b(e){return new Promise((function(t){i&&c.get().streaming.buffer.useAppendWindow?M((function(){try{if(!i)return void t();var n=y.duration,a=0;e&&!isNaN(e.start)&&!isNaN(e.duration)&&isFinite(e.duration)&&(n=e.start+e.duration),e&&!isNaN(e.start)&&(a=e.start),i.appendWindowEnd===n&&i.appendWindowStart===a||(i.appendWindowStart=0,i.appendWindowEnd=n+.01,i.appendWindowStart=Math.max(a-.1,0),r.debug("Updated append window for ".concat(o.type,". Set start to ").concat(i.appendWindowStart," and end to ").concat(i.appendWindowEnd))),t()}catch(e){r.warn("Failed to set append window"),t()}})):t()}))}function A(e){return new Promise((function(t){i?M((function(){try{i.timestampOffset===e||isNaN(e)||(i.timestampOffset=e,r.debug("Set MSE timestamp offset to ".concat(e))),t()}catch(e){t()}})):t()}))}function I(){if(!m&&p.length>0){m=!0;var e=p[0];p.splice(0,1);var t=function(){m=!1,p.length>0&&I.call(this),e&&e.data&&e.data.segmentType&&e.data.segmentType!==C.w.INIT_SEGMENT_TYPE&&delete e.data.bytes,e.promise.resolve({chunk:e.data})};try{E=e.request,0===e.data.bytes.byteLength?t.call(this):(i.appendBuffer?i.appendBuffer(e.data.bytes):i.append(e.data.bytes,e.data),M(t.bind(this)))}catch(t){r.fatal('SourceBuffer append failed "'+t+'"'),p.length>0?I():m=!1,delete e.data.bytes,e.promise.reject({chunk:e.data,error:new S.Z(t.code,t.message)})}}}function R(){h.length>0&&(i.updating||(h.shift()(),R()))}function D(){i.updating||R()}function O(e){var t,r,i=e.target||{};t=l.Z.SOURCE_BUFFER_ERROR,r={error:i,lastRequestAppended:E}||{},g.trigger(t,r,{streamId:o.streamInfo.id,mediaType:n})}function M(e){h.push(e),i.updating||R()}return t={getType:function(){return n},getAllBufferRanges:function(){try{return i.buffered}catch(e){return r.error("getAllBufferRanges exception: "+e.message),null}},getBuffer:function(){return i},append:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new Promise((function(r,i){e?(p.push({data:e,promise:{resolve:r,reject:i},request:n}),M(I.bind(t))):i({chunk:e,error:new S.Z(w.APPEND_ERROR_CODE,w.APPEND_ERROR_MESSAGE)})}))},remove:function(e){return new Promise((function(t,n){var r=e.start,a=e.end;r>=0&&a>r?M((function(){try{i.remove(r,a),M((function(){t({from:r,to:a,unintended:!1}),e.resolve&&e.resolve()}))}catch(t){n({from:r,to:a,unintended:!1,error:new S.Z(w.REMOVE_ERROR_CODE,w.REMOVE_ERROR_MESSAGE)}),e.reject&&e.reject(t)}})):t()}))},abort:function(){return new Promise((function(e){try{p=[],"open"===y.readyState?M((function(){try{i&&i.abort(),e()}catch(t){e()}})):i&&i.setTextTrack&&"ended"===y.readyState?(i.abort(),e()):e()}catch(t){e()}}))},reset:function(){if(i){try{h=[],function(){try{"function"==typeof i.removeEventListener&&(i.removeEventListener("updateend",D,!1),i.removeEventListener("error",O,!1),i.removeEventListener("abort",O,!1)),clearInterval(s)}catch(e){r.error(e)}}(),m=!1,p=[],i.getClassName&&"TextSourceBuffer"===i.getClassName()||(r.debug("Removing sourcebuffer from media source"),y.removeSourceBuffer(i))}catch(e){}i=null}E=null},updateTimestampOffset:A,initializeForStreamSwitch:function(e,t,r){n=(o=e).type;var a=o.codec;!function(e){i=e.getBuffer()}(r),T();var s=[];return s.push(new Promise((function(e){M((function(){var t=i.appendWindowStart,n=i.appendWindowEnd;i&&(i.abort(),i.appendWindowStart=t,i.appendWindowEnd=n),e()}))}))),s.push(b(o.streamInfo)),c.get().streaming.buffer.useChangeTypeForTrackSwitch&&s.push(v(a)),t&&void 0!==t.MSETimeOffset&&s.push(A(t.MSETimeOffset)),Promise.all(s)},initializeForFirstUse:function(e,t,r){n=(o=t).type;var s=o.codec;try{if(s.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))return _(e);i=y.addSourceBuffer(s),T();var u=[];return u.push(b(o.streamInfo)),r&&void 0!==r.MSETimeOffset&&u.push(A(r.MSETimeOffset)),Promise.all(u)}catch(t){return o.type==a.Z.TEXT&&!o.isFragmented||-1!==s.indexOf('codecs="stpp')||-1!==s.indexOf('codecs="vtt')||-1!==s.indexOf("text/vtt")?_(e):Promise.reject(t)}},updateAppendWindow:b,changeType:v},r=(0,f.Z)(u).getInstance().getLogger(t),t}D.__dashjs_factory_name="SourceBufferSink";var O=c.Z.getClassFactory(D);function M(e){var t,n,r,i=this.context,a=[],o=e;function s(e,t){return a=a.filter((function(n){return!((isNaN(t)||n.starte))})),Promise.resolve()}return t={getAllBufferRanges:function(){for(var e=[],t=0;te[e.length-1].end?e.push({start:n.start,end:n.end}):e[e.length-1].end=n.end}var r={start:function(t){return e[t].start},end:function(t){return e[t].end}};return Object.defineProperty(r,"length",{get:function(){return e.length}}),r},append:function(e){return"InitializationSegment"!==e.segmentType?(a.push(e),a.sort((function(e,t){return e.start-t.start})),r=null):r=e,n.debug("PreBufferSink appended chunk s: "+e.start+"; e: "+e.end),o&&o({chunk:e}),Promise.resolve()},remove:s,abort:function(){return Promise.resolve()},discharge:function(e,t){var n=function(e,t){return a.filter((function(n){return(isNaN(t)||n.starte)}))}(e,t);return r&&(n.push(r),r=null),s(e,t),n},reset:function(){a=[],r=null,o=null},updateTimestampOffset:function(){return Promise.resolve()},waitForUpdateEnd:function(e){e()},getBuffer:function(){return this}},n=(0,f.Z)(i).getInstance().getLogger(t),t}M.__dashjs_factory_name="PreBufferSink";var P=c.Z.getClassFactory(M);function L(){var e={};return{save:function(t){var n=t.streamId,r=t.representationId;e[n]=e[n]||{},e[n][r]=t},extract:function(t,n){return e&&e[t]&&e[t][n]?e[t][n]:null},reset:function(){e={}}}}L.__dashjs_factory_name="InitCache";var F=c.Z.getSingletonFactory(L),x=.01,k="BufferController";function U(e){e=e||{};var t,n,r,i,o,c,g,h,p,m,y,E,v,_,b,A,I,R,N,D,M,L=this.context,U=(0,u.Z)(L).getInstance(),Z=e.errHandler,B=e.fragmentModel,G=e.representationController,q=e.adapter,Y=e.textController,j=e.abrController,H=e.playbackController,V=e.streamInfo,K=e.type,z=e.settings;function W(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new Promise((function(n,r){c=e,p&&t&&"function"==typeof p.discharge?(m=p,Q(t).then((function(){n()})).catch((function(e){r(e)}))):n()}))}function X(e){return q.convertRepresentationToRepresentationInfo(G.getRepresentationForQuality(e))}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new Promise((function(n,r){R&&e?c?(y=!1,$(e,t).then((function(e){n(e)})).catch((function(e){r(e)}))):(y=!0,J().then((function(e){n(e)})).catch((function(e){r(e)}))):n(null)}))}function J(){var e=this;return new Promise((function(t,n){var r=j.getQualityFor(K,V.id);p=P(L).create(ie.bind(e)),_e(X(r)).then((function(){t(p)})).catch((function(){n()}))}))}function $(e,t){return new Promise((function(r,i){var o=j.getQualityFor(K,V.id);p=O(L).create({mediaSource:c,textController:Y,eventBus:U}),function(e,t,n){var r=X(n);return t&&t[K]&&(K===a.Z.VIDEO||K===a.Z.AUDIO)?p.initializeForStreamSwitch(e,r,t[K]):p.initializeForFirstUse(V,e,r)}(e,t,o).then((function(){return _e(X(o))})).then((function(){r(p)})).catch((function(e){n.fatal("Caught error on create SourceBuffer: "+e),Z.error(new S.Z(w.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+K)),i(e)}))}))}function ee(e){z.get().streaming.cacheInitSegments&&(n.info("Init fragment finished loading saving to",K+"'s init cache"),R.save(e.chunk)),n.debug("Append Init fragment",K," with representationId:",e.chunk.representationId," and quality:",e.chunk.quality,", data size:",e.chunk.bytes.byteLength),ne(e.chunk)}function te(e){ne(e.chunk,e.request)}function ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;p&&(p.append(e,t).then((function(e){ie(e)})).catch((function(e){ie(e)})),e.mediaInfo.type===a.Z.VIDEO&&Ne(l.Z.VIDEO_CHUNK_RECEIVED,{chunk:e}))}function re(e){if(e&&e.length>0)for(var t=0,r=e.length;t0){var e=Math.max(.2*o,1),t=o-e,r=Math.min(z.get().streaming.buffer.bufferTimeAtTopQuality,.9*t),i=Math.min(z.get().streaming.buffer.bufferTimeAtTopQualityLongForm,.9*t),a={streaming:{buffer:{bufferToKeep:parseFloat(e.toFixed(5)),bufferTimeAtTopQuality:parseFloat(r.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(i.toFixed(5))}}};z.update(a)}}(),void(22!==e.error.code&&we()||(n.warn("Clearing playback buffer to overcome quota exceed situation"),Ne(l.Z.QUOTA_EXCEEDED,{criticalBufferLevel:o,quotaExceededTime:e.chunk.start}),ye(me())));if(p&&(fe(),I=!1,(_=e.chunk)&&_.endFragment)){_&&!isNaN(_.index)&&(g=Math.max(_.index,g),de());var t=p.getAllBufferRanges();_.segmentType===C.w.MEDIA_SEGMENT_TYPE&&(re(t),se(),function(){if(!isNaN(M)&&!y)if(K===a.Z.AUDIO||K===a.Z.VIDEO){var e=H.getTime(),t=ce(e,0),n=ce(M,0);if(t&&n&&t.start===n.start)M=NaN;else{var r=G.getCurrentRepresentation().segmentDuration,i=ce(M,r);i&&(z.get().streaming.buffer.enableSeekDecorrelationFix&&Math.abs(e-M)>r?M<=i.end&&H.seek(Math.max(M,i.start),!1,!0):e0&&(r=!0),E=null),_&&!r&&Ne(l.Z.BYTES_APPENDED_END_FRAGMENT,{quality:_.quality,startTime:_.start,index:_.index,bufferedRanges:t,segmentType:_.segmentType,mediaType:K})}}function ae(){return new Promise((function(e,t){var n=oe();if(!n||0===n.length)return se(),void e();ye(n).then((function(){e()})).catch((function(e){t(e)}))}))}function oe(e){var t=[],r=p.getAllBufferRanges();if(!r||0===r.length)return t;if(!e&&0!==e||isNaN(e))t.push({start:r.start(0),end:r.end(r.length-1)+.5});else{var i=function(e,t){var n=z.get().streaming.buffer.bufferToKeep,r=t.start(0);if(e-r>n){var i=Math.max(0,e-n),a=B.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:e,threshold:x})[0];if(a&&(i=Math.min(a.startTime,i)),i>0)return{start:r,end:i}}return null}(e,r),a=function(e,t){var r=t.end(t.length-1)+.5,i=Re(e),a=V.manifestInfo.duration>=z.get().streaming.buffer.longFormContentDurationThreshold?z.get().streaming.buffer.bufferTimeAtTopQualityLongForm:z.get().streaming.buffer.bufferTimeAtTopQuality,o=isNaN(i)?e:Math.min(i,e+a);if(o>=t.end(t.length-1))return null;var s=B.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:e,threshold:x})[0];if(s&&(o=Math.max(s.startTime+s.duration,o)),z.get().streaming.buffer.avoidCurrentTimeRangePruning)for(var u=0;u=a&&e=h-1,t=H.getTimeToStreamEnd(V)-i<1e-5;!e&&!t||r||(Ae(!0),n.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id ".concat(V.id," and type ").concat(K)))}function ge(){K!==a.Z.AUDIO&&K!==a.Z.VIDEO||((!H.getLowLatencyModeEnabled()&&i=z.get().streaming.buffer.stallThreshold||H.getLowLatencyModeEnabled()&&i>0)&&he(s.Z.BUFFER_LOADED))}function he(e){v===e||e===s.Z.BUFFER_EMPTY&&0===H.getTime()||K===a.Z.TEXT&&!Y.isTextEnabled()||(v=e,Ne(l.Z.BUFFER_LEVEL_STATE_CHANGED,{state:e}),Ne(e===s.Z.BUFFER_LOADED?l.Z.BUFFER_LOADED:l.Z.BUFFER_EMPTY),n.debug(e===s.Z.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function pe(){p&&K!==a.Z.TEXT&&(r||ye(me()))}function me(){var e=[],t=p.getAllBufferRanges();if(!t||0===t.length)return e;var n=H.getTime(),r=Math.max(0,n-z.get().streaming.buffer.bufferToKeep),i=B.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:n,threshold:x})[0];if(i)r=Math.min(i.startTime,r);else if(0===n&&H.getIsDynamic())return[];if(t.start(0)<=r){for(var a={start:0,end:r},o=0;o=z.get().streaming.buffer.bufferPruningInterval&&(b=0,pe())}function be(){ge()}function Ae(e){(r=e)?Ne(l.Z.BUFFERING_COMPLETED):h=Number.POSITIVE_INFINITY}function Ie(){try{var e,t,n=p.getAllBufferRanges(),r=0;if(!n)return r;for(t=0,e=n.length;t=i&&t<=a&&(t=a),r+=1}return t===e?NaN:t}catch(e){}}function we(){var e=Ie();return isNaN(e)||e0){for(var t="Beginning "+K+"PreBuffer discharge, adding buffer for:",r=0;r=i&&e<=a)return!0;r+=1}return!1}catch(e){return n.error(e),!1}},pruneBuffer:pe,setMediaSource:W,getMediaSource:function(){return c},appendInitSegmentFromCache:function(e){var t=R.extract(V.id,e);return!!t&&(n.info("Append Init fragment",K," with representationId:",t.representationId," and quality:",t.quality,", data size:",t.bytes.byteLength),ne(t),!0)},getIsBufferingCompleted:function(){return r},setIsBufferingCompleted:Ae,getIsPruningInProgress:function(){return A},reset:function(e,t){U.off(l.Z.INIT_FRAGMENT_LOADED,ee,this),U.off(l.Z.MEDIA_FRAGMENT_LOADED,te,this),U.off(l.Z.WALLCLOCK_TIME_UPDATED,Se,this),U.off(d.Z.PLAYBACK_PLAYING,le,this),U.off(d.Z.PLAYBACK_PROGRESS,se,this),U.off(d.Z.PLAYBACK_TIME_UPDATED,se,this),U.off(d.Z.PLAYBACK_RATE_CHANGED,be,this),U.off(d.Z.PLAYBACK_STALLED,ue,this),Ce(e,t)},prepareForPlaybackSeek:function(){return r&&Ae(!1),p.abort()},prepareForReplacementTrackSwitch:function(e){return new Promise((function(t,n){p.abort().then((function(){return Te()})).then((function(){return z.get().streaming.buffer.useChangeTypeForTrackSwitch?p.changeType(e):Promise.resolve()})).then((function(){return ae()})).then((function(){Ae(!1),t()})).catch((function(e){n(e)}))}))},prepareForNonReplacementTrackSwitch:function(e){return new Promise((function(t,n){Te().then((function(){return z.get().streaming.buffer.useChangeTypeForTrackSwitch?p.changeType(e):Promise.resolve()})).then((function(){t()})).catch((function(e){n(e)}))}))},prepareForForceReplacementQualitySwitch:function(e){return new Promise((function(t,n){p.abort().then((function(){return Te()})).then((function(){return ae()})).then((function(){return _e(e)})).then((function(){Ae(!1),t()})).catch((function(e){n(e)}))}))},updateAppendWindow:Te,getAllRangesWithSafetyFactor:oe,getContinuousBufferTimeForTargetTime:Re,clearBuffers:ye,pruneAllSafely:ae,updateBufferTimestampOffset:_e,setSeekTarget:function(e){M=e},segmentRequestingCompleted:function(e){isNaN(e)||(h=e,de())}},n=(0,f.Z)(L).getInstance().getLogger(t),R=F(L).getInstance(),Ce(),t}U.__dashjs_factory_name=k;var Z=c.Z.getClassFactory(U),B="NotFragmentedTextBufferController";function G(e){e=e||{};var t,n,r,i,a,o,s=this.context,c=(0,u.Z)(s).getInstance(),f=e.textController,d=e.errHandler,g=e.streamInfo,h=e.type;function p(e){i=e}function m(e){var t,r;n!==e&&(n=e)&&(t=l.Z.BUFFERING_COMPLETED,r={},c.trigger(t,r,{streamId:g.id,mediaType:h}))}function y(e){e.chunk.bytes&&!n&&(o.save(e.chunk),a.append(e.chunk),m(!0))}return t={initialize:function(e){p(e)},getStreamId:function(){return g.id},getType:function(){return h},getBufferControllerType:function(){return B},createBufferSink:function(e){return new Promise((function(t,n){try{(a=O(s).create({mediaSource:i,textController:f,eventBus:c})).initializeForFirstUse(g,e),r||(a.getBuffer()&&"function"==typeof a.getBuffer().initialize&&a.getBuffer().initialize(),r=!0),t(a)}catch(e){d.error(new S.Z(w.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+h)),n(e)}}))},dischargePreBuffer:function(){},getBuffer:function(){return a},getBufferLevel:function(){return 0},getRangeAt:function(){return null},pruneBuffer:function(){},hasBufferAtTime:function(){return!0},getAllRangesWithSafetyFactor:function(){return[]},getContinuousBufferTimeForTargetTime:function(){return Number.POSITIVE_INFINITY},setMediaSource:p,getMediaSource:function(){return i},appendInitSegmentFromCache:function(e){return null!==o.extract(g.id,e)},getIsBufferingCompleted:function(){return n},setIsBufferingCompleted:m,getIsPruningInProgress:function(){return!1},reset:function(e){c.off(l.Z.INIT_FRAGMENT_LOADED,y,t),!e&&a&&(a.abort(),a.reset(),a=null)},clearBuffers:function(){return Promise.resolve()},prepareForPlaybackSeek:function(){return Promise.resolve()},prepareForReplacementTrackSwitch:function(){return n=!1,Promise.resolve()},setSeekTarget:function(){},updateAppendWindow:function(){return Promise.resolve()},pruneAllSafely:function(){return Promise.resolve()},updateBufferTimestampOffset:function(){return Promise.resolve()},segmentRequestingCompleted:function(){}},r=!1,i=null,n=!1,o=F(s).getInstance(),c.on(l.Z.INIT_FRAGMENT_LOADED,y,t),t}G.__dashjs_factory_name=B;var q=c.Z.getClassFactory(G);function Y(e){e=e||{};var t,n,r,i,o,c,g,h,p,m,y,E,v,_=this.context,S=(0,u.Z)(_).getInstance(),b=e.dashMetrics,A=e.mediaPlayerModel,I=e.fragmentModel,R=e.abrController,w=e.playbackController,N=e.textController,C=e.type,D=e.bufferController,O=e.representationController,M=e.settings;function P(){E=!0}function L(){E=!1}function F(e){if(!D.getIsBufferingCompleted()){x();var t=isNaN(e)?0:e;o=setTimeout(k,t)}}function x(){o&&(clearTimeout(o),o=null)}function k(){try{if(function(){try{return C===a.Z.TEXT&&!N.isTextEnabled()||w.isPaused()&&(!w.getStreamController().getInitialPlayback()||!w.getStreamController().getAutoPlay())&&!M.get().streaming.scheduling.scheduleWhilePaused}catch(e){return!1}}())return void x();if(function(){try{return!!E&&O.getCurrentRepresentationInfo()&&(isNaN(p)||m||(e=n.id,t=R.getMaxAllowedIndexFor(C,e),!(!isNaN(h)&&h==t||(r.info("Top quality "+C+" index has changed from "+h+" to "+t),h=t,0)))||function(){var e=O.getCurrentRepresentationInfo();return!C||!e||b.getCurrentBufferLevel(C)=M.get().streaming.buffer.longFormContentDurationThreshold?M.get().streaming.buffer.bufferTimeAtTopQualityLongForm:M.get().streaming.buffer.bufferTimeAtTopQuality:A.getStableBufferTime()}catch(e){return A.getStableBufferTime()}}(),e):e}function Z(){B(!0)}function B(e){if(w&&I){var t=I.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:w.getTime(),threshold:0})[0];t&&w.getTime()>=t.startTime&&((!g.mediaInfo||t.mediaInfo.type===g.mediaInfo.type&&t.mediaInfo.index!==g.mediaInfo.index)&&e&&S.trigger(l.Z.TRACK_CHANGE_RENDERED,{mediaType:C,oldMediaInfo:g.mediaInfo,newMediaInfo:t.mediaInfo,streamId:n.id}),t.quality===g.quality&&t.adaptationIndex===g.adaptationIndex||!e||(r.debug("Quality change rendered for streamId ".concat(n.id," and type ").concat(C)),S.trigger(l.Z.QUALITY_CHANGE_RENDERED,{mediaType:C,oldQuality:g.quality,newQuality:t.quality,streamId:n.id})),g={mediaInfo:t.mediaInfo,quality:t.quality,adaptationIndex:t.adaptationIndex})}}function G(){I.abortRequests(),x()}function q(){M.get().streaming.scheduling.scheduleWhilePaused||F()}function Y(e){b.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function j(){v=!0,i=0,p=NaN,g={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},h=NaN,m=!1,y=!1,E=!0}return t={initialize:function(e){c=e,S.on(l.Z.URL_RESOLUTION_FAILED,G,t),S.on(d.Z.PLAYBACK_STARTED,q,t),S.on(d.Z.PLAYBACK_RATE_CHANGED,Y,t),S.on(d.Z.PLAYBACK_TIME_UPDATED,Z,t),S.on(d.Z.MANAGED_MEDIA_SOURCE_START_STREAMING,P,t),S.on(d.Z.MANAGED_MEDIA_SOURCE_END_STREAMING,L,t)},getType:function(){return C},getStreamId:function(){return n.id},setTimeToLoadDelay:function(e){i=e},getTimeToLoadDelay:function(){return i},setSwitchTrack:function(e){m=e},getSwitchTrack:function(){return m},startScheduleTimer:F,clearScheduleTimer:x,reset:function(){S.off(l.Z.URL_RESOLUTION_FAILED,G,t),S.off(d.Z.PLAYBACK_STARTED,q,t),S.off(d.Z.PLAYBACK_RATE_CHANGED,Y,t),S.off(d.Z.PLAYBACK_TIME_UPDATED,Z,t),S.off(d.Z.MANAGED_MEDIA_SOURCE_START_STREAMING,P,t),S.off(d.Z.MANAGED_MEDIA_SOURCE_END_STREAMING,L,t),x(),B(!1),j(),n=null},getBufferTarget:U,getPlaybackController:function(){return w},setCheckPlaybackQuality:function(e){v=e},setInitSegmentRequired:function(e){y=e},setLastInitializedQuality:function(e){p=e}},r=(0,f.Z)(_).getInstance().getLogger(t),j(),n=e.streamInfo,t}Y.__dashjs_factory_name="ScheduleController";var j=c.Z.getClassFactory(Y),H=n(7387);function V(e){var t,n,r,i,o,s,u=(e=e||{}).eventBus,l=e.events,c=e.abrController,f=e.dashMetrics,g=e.playbackController,h=e.timelineConverter,p=e.type,m=e.streamInfo,y=e.dashConstants,E=e.segmentsController,v=e.isDynamic,_=e.adapter;function T(){return p}function S(){return r}function b(){return s}function A(){n=null,r=!0,i=[],o=null}function I(e){return new Promise((function(t,n){var r=e.hasInitialization(),a=e.hasSegments(),o=[];o.push(E.updateInitData(e,r)),o.push(E.updateSegmentData(e,a)),Promise.all(o).then((function(n){var r;n[0]&&!n[0].error&&(e=function(e,t){return t&&!t.error&&t.representation?t.representation:e}(e,n[0])),n[1]&&!n[1].error&&(e=function(e,t){if(t&&!t.error){var n,r,i,a,o=t.segments,s=[],u=0;for(n=0,r=o?o.length:0;n0&&(e.segments=s),e}}(e,n[1])),(r=e).mediaFinishedInformation=E.getMediaFinishedInformation(r),function(e){if(S()){var t,n,r=f.getCurrentManifestUpdate(),a=!1;if(r){for(var o=0;o=i.length?null:i[e]}function N(e){r=!1,u.trigger(l.DATA_UPDATE_COMPLETED,{data:n,currentRepresentation:s,error:e},{streamId:m.id,mediaType:p})}function C(e){s=e,o=_.convertRepresentationToRepresentationInfo(s)}function D(e){if(e.newDuration){var t=b();t&&t.adaptation.period&&(t.adaptation.period.duration=e.newDuration)}}return t={getStreamId:function(){return m.id},getType:T,getData:function(){return n},isUpdating:S,updateData:function(e,t,o,s,u){return new Promise((function(l,c){if(r=!0,i=t,n=e,C(w(u)),o!==a.Z.VIDEO&&o!==a.Z.AUDIO&&(o!==a.Z.TEXT||!s))return N(),void l();for(var f=[],d=0,g=i.length;d=N.start+N.duration}function ue(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.sender)if(B.getIsManifestUpdateInProgress())ge();else if((!ae()||Y.isTextEnabled())&&g&&e.representationId&&!g.appendInitSegmentFromCache(e.representationId)){var n=p.getCurrentRepresentation();if(0===n.range)return void le();var r=v?v.getInitRequest(i,n):null;r?k.executeRequest(r):t&&(h.setInitSegmentRequired(!0),ge())}}function le(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(B.getIsManifestUpdateInProgress()||g.getIsPruningInProgress())ge();else{var n=de();n?(m=!1,y=!1,ce(n)):fe(t)}}function ce(e){isNaN(e.startTime+e.duration)||(b=e.startTime+e.duration),e.delayLoadingTime=(new Date).getTime()+h.getTimeToLoadDelay(),h.setTimeToLoadDelay(0),function(e){var t=e.url;return e.range&&(t=t.concat("_",e.range)),$.contains(t)}(e)?(n.warn("Fragment request url ".concat(e.url," for stream id ").concat(N.id," and media type ").concat(D," is on the ignore list and will be skipped")),ge()):(n.debug("Next fragment request url for stream id ".concat(N.id," and media type ").concat(D," is ").concat(e.url)),k.executeRequest(e))}function fe(e){var t,a=p.getCurrentRepresentation();if(!V.get().streaming.gaps.enableSeekFix||!m&&0!==B.getTime()||(r?r&&a.segmentInfoType===o.Z.SEGMENT_TIMELINE&&(t=v.getValidTimeAheadOfTargetTime(b,i,a,V.get().streaming.gaps.threshold)):t=v.getValidTimeAheadOfTargetTime(b,i,a,V.get().streaming.gaps.threshold),isNaN(t)||t===b)){if(v.isLastSegmentRequested(a,b)){var s=v.getCurrentIndex();return n.debug("Segment requesting for stream ".concat(N.id," has finished")),R.trigger(l.Z.STREAM_REQUESTING_COMPLETED,{segmentIndex:s},{streamId:N.id,mediaType:D}),g.segmentRequestingCompleted(s),void h.clearScheduleTimer()}e&&ge()}else B.isSeeking()||0===B.getTime()?(n.warn("Adjusting playback time ".concat(t," because of gap in the manifest. Seeking by ").concat(t-b)),B.seek(t,!1,!1)):(n.warn("Adjusting buffering time ".concat(t," because of gap in the manifest. Adjusting time by ").concat(t-b)),Fe(t),e&&ge())}function de(){var e,t=Ne();if(isNaN(b)||ie()===a.Z.TEXT&&!Y.isTextEnabled())return null;if(v){var n=p&&t?p.getRepresentationForQuality(t.quality):null;e=m?v.getSegmentRequestForTime(i,n,b):y?v.repeatSegmentRequest(i,n):v.getNextSegmentRequest(i,n)}return e}function ge(){h.startScheduleTimer(B.getLowLatencyModeEnabled()?V.get().streaming.scheduling.lowLatencyTimeout:V.get().streaming.scheduling.defaultTimeout)}function he(e){e.error||g.getIsBufferingCompleted()||g.updateBufferTimestampOffset(e.currentRepresentation)}function pe(e){H.addBufferState(D,e.state,h.getBufferTarget()),e.state!==s.Z.BUFFER_EMPTY||B.isSeeking()||(n.info("Buffer is empty! Stalling!"),H.pushPlayListTraceMetrics(new Date,ee.REBUFFERING_REASON))}function me(e){k.syncExecutedRequestsWithBufferedRange(g.getBuffer().getAllBufferRanges(),N.duration),e.quotaExceeded&&e.from>B.getTime()&&Fe(e.from),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&h.startScheduleTimer()}function ye(e){if(e&&e.lastRequestAppended&&e.lastRequestAppended.url){var t=e.lastRequestAppended.url;e.lastRequestAppended.range&&(t=t.concat("_",e.lastRequestAppended.range)),n.warn("Blacklisting segment with url ".concat(t)),$.add(t)}}function Ee(e){if(n.debug("Appended bytes for ".concat(e.mediaType," and stream id ").concat(e.streamId)),e.segmentType===C.w.INIT_SEGMENT_TYPE){var t=e.quality;h.setLastInitializedQuality(t),n.info("["+D+"] lastInitializedRepresentationInfo changed to "+e.quality)}A?ve(A):h.startScheduleTimer(0)}function ve(e){var t=k.getRequests({state:T.FRAGMENT_MODEL_LOADING});if(t&&t.length>0)return n.debug("Preparing for default quality switch: Waiting for ongoing segment request to be finished before applying switch."),void(A=e);g.updateBufferTimestampOffset(e).then((function(){h.setCheckPlaybackQuality(!1),i.segmentAlignment||i.subSegmentAlignment?h.startScheduleTimer():Pe(),A=null,E=!1})).catch((function(){A=null,E=!1}))}function _e(e){n.info("onFragmentLoadingAbandoned request: "+e.request.url+" has been aborted"),B.isSeeking()||h.getSwitchTrack()||E||(n.info("onFragmentLoadingAbandoned request: "+e.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),e.request&&e.request.isInitializationRequest()?h.setInitSegmentRequired(!0):Fe(e.request.startTime+e.request.duration/2),h.startScheduleTimer(0))}function Te(e){n.info("OnFragmentLoadingCompleted for stream id "+N.id+" and media type "+D+" - Url:",e.request?e.request.url:"undefined",e.request.range?", Range:"+e.request.range:""),ae()&&h.startScheduleTimer(0),e.error&&e.request.serviceLocation&&function(e){n.info("Fragment loading completed with an error"),e&&e.request&&e.request.type&&(e.request.type===C.w.INIT_SEGMENT_TYPE?ue({representationId:e.request.representationId,sender:{}},!1):e.request.type===C.w.MEDIA_SEGMENT_TYPE&&(Fe(e.request.startTime+e.request.duration/2),le({},!1)))}(e)}function Se(){Fe(B.getTime()),we().startScheduleTimer()}function be(e){var t=e.currentTrackInfo;if(t){var n=c.find((function(e){return e.index===t.index&&e.lang===t.lang}));n&&Re(n).then((function(){g.setIsBufferingCompleted(!1),Fe(B.getTime()),h.setInitSegmentRequired(!0),h.startScheduleTimer()}))}}function Ae(e){Fe(e.quotaExceededTime),h.clearScheduleTimer()}function Ie(){return g?g.getBuffer():null}function Re(e){e===i||e&&i&&e.type!==i.type||(i=e);var t=L.getRealAdaptation(N,i),n=L.getVoRepresentations(i);if(p){var o,s=p.getData(),u=U.getMaxAllowedIndexFor(D,N.id),l=U.getMinAllowedIndexFor(D,N.id),c=null;return null!==s&&s.id===t.id||D===a.Z.TEXT?o=U.getQualityFor(D,N.id):(c=U.getThroughputHistory().getAverageThroughput(D,r)||U.getInitialBitrateFor(D,N.id),o=U.getQualityForBitrate(i,c,N.id)),void 0!==l&&ou&&(o=u),p.updateData(t,n,D,i.isFragmented,o)}return Promise.resolve()}function we(){return h}function Ne(e){var t;return void 0!==e?((0,z.SE)(e),t=p?p.getRepresentationForQuality(e):null):t=p?p.getCurrentRepresentation():null,L.convertRepresentationToRepresentationInfo(t)}function Ce(){return!!g&&g.getIsBufferingCompleted()}function De(e){if(V.get().streaming.enableManifestTimescaleMismatchFix){var t=e.chunk,n=t.bytes,r=Ne(t.quality),i=p&&r?p.getRepresentationForQuality(r.quality):null;r&&i&&(i.timescale=J.getMediaTimescaleFromMoov(n))}}function Oe(e){var t=e.chunk,n=t.bytes,r=t.quality,i=Ne(r),a=p&&i?p.getRepresentationForQuality(i.quality):null;if(i&&a){var s;if(V.get().streaming.parseInbandPrft&&e.request.type===C.w.MEDIA_SEGMENT_TYPE){var u=function(e,t){var n=e.getBoxes("prft"),r=[];return n.forEach((function(e){r.push(function(e,t){var n="unknown";switch(e.flags){case 0:n=o.Z.PRODUCER_REFERENCE_TIME_TYPE.ENCODER;break;case 16:n=o.Z.PRODUCER_REFERENCE_TIME_TYPE.APPLICATION;break;case 24:n=o.Z.PRODUCER_REFERENCE_TIME_TYPE.CAPTURED}var r=1e3*e.ntp_timestamp_sec+e.ntp_timestamp_frac/Math.pow(2,32)*1e3;return{type:n,ntpTimestamp:r=re(I).getInstance().ntpToUTC(r),mediaTime:e.media_time/t}}(e,t))})),r}(s=s||J.parse(n),a.timescale);u&&u.length&&R.trigger(d.Z.INBAND_PRFT,{data:u},{streamId:N.id,mediaType:D})}var c=L.getEventsFor(i.mediaInfo,null,N),f=L.getEventsFor(i,a,N);if(c&&c.length>0||f&&f.length>0){var g=k.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,quality:r,index:t.index})[0],h=function(e,t,n,r){try{for(var i={},a=[],o=n.concat(r),s=0,u=o.length;sV.get().streaming.buffer.stallThreshold;if(g.getIsBufferingCompleted()&&!t)return g.prepareForNonReplacementTrackSwitch(i.codec).then((function(){R.trigger(l.Z.BUFFERING_COMPLETED,{},{streamId:N.id,mediaType:D})})).catch((function(){R.trigger(l.Z.BUFFERING_COMPLETED,{},{streamId:N.id,mediaType:D})})),void e();h.clearScheduleTimer(),h.setSwitchTrack(!0),t?(R.trigger(l.Z.BUFFER_REPLACEMENT_STARTED,{mediaType:D,streamId:N.id},{mediaType:D,streamId:N.id}),k.abortRequests(),g.prepareForReplacementTrackSwitch(i.codec).then((function(){var e=Ne();return g.updateBufferTimestampOffset(e)})).then((function(){Me(),e()})).catch((function(){Me(),e()}))):g.prepareForNonReplacementTrackSwitch(i.codec).then((function(){Pe(),e()})).catch((function(){Pe(),e()}))}))},prepareQualityChange:function(e){A&&n.warn("Canceling queued representation switch to ".concat(A.quality," for ").concat(D)),n.debug("Preparing quality switch for type ".concat(D));var t=e.newQuality;E=!0,h.clearScheduleTimer(),p.prepareQualityChange(t);var r=Ne(t);e.reason&&e.reason.forceReplace?function(e){k.abortRequests(),R.trigger(l.Z.BUFFER_REPLACEMENT_STARTED,{mediaType:D,streamId:N.id},{mediaType:D,streamId:N.id}),h.setCheckPlaybackQuality(!1),g.prepareForForceReplacementQualitySwitch(e).then((function(){Me(),A=null,E=!1})).catch((function(){Me(),A=null,E=!1}))}(r):e&&e.reason&&e.reason.forceAbandon?function(e){g.updateBufferTimestampOffset(e).then((function(){k.abortRequests(),y=!0,h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),E=!1,A=null})).catch((function(){A=null,E=!1}))}(r):V.get().streaming.buffer.fastSwitchEnabled?function(e){var t=B.getTime(),n=1.5*(isNaN(e.fragmentDuration)?1:e.fragmentDuration),r=k.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:t+n,threshold:0})[0];if(r&&!ae()){var i=g.getBufferLevel(),a=U.getAbandonmentStateFor(N.id,D);r.quality=n&&a!==s.Z.ABANDON_LOAD?g.updateBufferTimestampOffset(e).then((function(){k.abortRequests(),Fe(t+n),h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),E=!1})).catch((function(){E=!1})):ve(e)}else ve(e)}(r):ve(r),H.pushPlayListTraceMetrics(new Date,ee.REPRESENTATION_SWITCH_STOP_REASON),H.createPlaylistTraceMetrics(r.id,1e3*B.getTime(),B.getPlaybackRate())},getMediaInfo:function(){return i},getMediaSource:function(){return g.getMediaSource()},setMediaSource:function(e){return g.setMediaSource(e,i)},getBuffer:Ie,setExplicitBufferingTime:Fe,finalisePlayList:function(e,t){H.pushPlayListTraceMetrics(e,t)},probeNextRequest:function(){var e=Ne(),t=p&&e?p.getRepresentationForQuality(e.quality):null;return v.getNextSegmentRequestIdempotent(i,t)},prepareInnerPeriodPlaybackSeeking:function(e){return new Promise((function(t){if(g.hasBufferAtTime(e.seekTime))return g.pruneBuffer(),se(g.getContinuousBufferTimeForTargetTime(e.seekTime))&&g.setIsBufferingCompleted(!0),void t();h.clearScheduleTimer(),k.abortRequests(),g.prepareForPlaybackSeek().then((function(){var t=g.getAllRangesWithSafetyFactor(e.seekTime);return g.clearBuffers(t)})).then((function(){var n=g.getContinuousBufferTimeForTargetTime(e.seekTime);if(se(n))g.setIsBufferingCompleted(!0),t();else{var r=isNaN(n)?e.seekTime:n;Fe(r),g.setSeekTarget(r);var i=[];i.push(g.updateAppendWindow());var a=Ne();i.push(g.updateBufferTimestampOffset(a)),Promise.all(i).then((function(){h.setInitSegmentRequired(!0),h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),t()}))}})).catch((function(e){n.error(e)}))}))},prepareOuterPeriodPlaybackSeeking:function(){return new Promise((function(e,t){try{h.clearScheduleTimer(),k.abortRequests(),g.prepareForPlaybackSeek().then((function(){return g.pruneAllSafely()})).then((function(){e()}))}catch(e){t(e)}}))},reset:function(e,n){v&&v.reset(),g&&(g.reset(e,n),g=null),h&&(h.reset(),h=null),p&&(p.reset(),p=null),_&&(_=null),U&&U.unRegisterStreamType(ne(),D),R.off(l.Z.DATA_UPDATE_COMPLETED,he,t),R.off(l.Z.INIT_FRAGMENT_NEEDED,ue,t),R.off(l.Z.MEDIA_FRAGMENT_NEEDED,le,t),R.off(l.Z.INIT_FRAGMENT_LOADED,De,t),R.off(l.Z.MEDIA_FRAGMENT_LOADED,Oe,t),R.off(l.Z.BUFFER_LEVEL_STATE_CHANGED,pe,t),R.off(l.Z.BUFFER_CLEARED,me,t),R.off(l.Z.SEEK_TARGET,Le,t),R.off(l.Z.FRAGMENT_LOADING_ABANDONED,_e,t),R.off(l.Z.FRAGMENT_LOADING_COMPLETED,Te,t),R.off(l.Z.SET_FRAGMENTED_TEXT_AFTER_DISABLED,Se,t),R.off(l.Z.SET_NON_FRAGMENTED_TEXT,be,t),R.off(l.Z.QUOTA_EXCEEDED,Ae,t),R.off(l.Z.SOURCE_BUFFER_ERROR,ye,t),R.off(l.Z.BYTES_APPENDED_END_FRAGMENT,Ee,t),oe(),D=null,N=null}},n=(0,f.Z)(I).getInstance().getLogger(t),oe(),R.on(l.Z.DATA_UPDATE_COMPLETED,he,t,{priority:u.Z.EVENT_PRIORITY_HIGH}),R.on(l.Z.INIT_FRAGMENT_NEEDED,ue,t),R.on(l.Z.MEDIA_FRAGMENT_NEEDED,le,t),R.on(l.Z.INIT_FRAGMENT_LOADED,De,t),R.on(l.Z.MEDIA_FRAGMENT_LOADED,Oe,t),R.on(l.Z.BUFFER_LEVEL_STATE_CHANGED,pe,t),R.on(l.Z.BUFFER_CLEARED,me,t),R.on(l.Z.SEEK_TARGET,Le,t),R.on(l.Z.FRAGMENT_LOADING_ABANDONED,_e,t),R.on(l.Z.FRAGMENT_LOADING_COMPLETED,Te,t),R.on(l.Z.QUOTA_EXCEEDED,Ae,t),R.on(l.Z.SET_FRAGMENTED_TEXT_AFTER_DISABLED,Se,t),R.on(l.Z.SET_NON_FRAGMENTED_TEXT,be,t),R.on(l.Z.SOURCE_BUFFER_ERROR,ye,t),R.on(l.Z.BYTES_APPENDED_END_FRAGMENT,Ee,t),t}ie.__dashjs_factory_name="StreamProcessor";var ae=c.Z.getClassFactory(ie),oe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.streamId=null,this.mediaInfo=null,this.segmentType=null,this.quality=NaN,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representationId=null,this.endFragment=null},se=n(9032);function ue(e,t){if(e){if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(r.headers.keys());try{for(d.s();!(i=d.n()).done;){var g=i.value;u+=g+": "+r.headers.get(g)+"\r\n"}}catch(e){d.e(e)}finally{d.f()}if(e.response.responseHeaders=u,!r.body)return r.arrayBuffer().then((function(t){e.response.response=t;var n={loaded:t.byteLength,total:t.byteLength,stream:!1};e.progress(n),e.onload(),e.onend()}));var h,p,v,_,T=parseInt(r.headers.get("Content-Length"),10),S=0,b=!1,A=new Uint8Array,I=0;if(m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_AAST&&o){var R=t,w=0,N=(v=r.body.tee(),_=2,function(e){if(Array.isArray(e))return e}(v)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}}(v,_)||ue(v,_)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),C=N[0],D=N[1];h=C.getReader(),p=[],h.read().then((function r(i){var a=i.value,s=i.done;if(w=Date.now(),a&&a.length){var c=w-R,f=a.length;p.push({chunkDownloadTimeRelativeMS:w-t,chunkDownloadDurationMS:c,chunkBytes:f,kbps:Math.round(8*f/(c/1e3)),bufferLevel:n.getCurrentBufferLevel(l.mediaType)})}if(s){var d=w-t,g=p.reduce((function(e,t){return e+t.chunkBytes}),0);return o.addMeasurement(l,d,p,y,E,u),void e.progress({loaded:g,total:g,lengthComputable:!0,time:o.getEstimatedDownloadDurationMS(l),stream:!0})}return R=Date.now(),h.read().then(r)})),e.reader=D.getReader()}else e.reader=r.body.getReader();var O=[],M=[],P=[],L=!0;c(e,(function t(n){var r=n.value;if(n.done){if(A){if(m!==a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_AAST){var i=null,o=null;m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING?(i=function(e,t){try{var n,r;n=e.filter((function(t,n){return n1){for(var a=0,o=0,s=0;s1)i.push(8*r[s].bytes/u),o=0;else{0===o&&(o=n[s].ts,a=0);var l=r[s].ts-o;l>1?(a+=r[s].bytes,i.push(8*a/l),o=0):a+=r[s].bytes}}if(i.length>0)return i.reduce((function(e,t){return e+t}),0)/i.length}return null}catch(e){return null}}(M,P),i&&(o=8*S/i)):m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA&&(o=f(O,S)),e.progress({loaded:S,total:isNaN(T)?S:T,lengthComputable:!0,time:o,stream:!0})}e.response.response=A.buffer}return e.onload(),void e.onend()}if(r&&r.length>0){A=function(e,t){if(0===e.length)return t;var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(A,r),S+=r.length,O.push({ts:Date.now(),bytes:r.length}),m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&L&&s.findLastTopIsoBoxCompleted(["moof"],A,I).found&&(L=!1,M.push({ts:performance.now(),bytes:r.length}));var u=s.findLastTopIsoBoxCompleted(["moov","mdat"],A,I);if(u.found){var l,d=u.lastCompletedOffset+u.size;m!==a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING||L||(L=!0,P.push({ts:performance.now(),bytes:A.length})),d===A.length?(l=A,A=new Uint8Array):(l=new Uint8Array(A.subarray(0,d)),A=A.subarray(d)),e.progress({data:l.buffer,lengthComputable:!1,noTrace:!0}),I=0}else I=u.lastCompletedOffset,b||(e.progress({lengthComputable:!1,noTrace:!0}),b=!0)}c(e,t)}))})).catch((function(t){e.onerror&&e.onerror(t)}))}))}function c(e,t){e.reader.read().then(t).catch((function(t){e.onerror&&200===e.response.status&&e.onerror(t)}))}function f(e,t){try{if((e=e.filter((function(n){return n.bytes>t/4/e.length}))).length>1){var n=0,r=(e[e.length-1].ts-e[0].ts)/e.length;return e.forEach((function(t,i){var a=e[i+1];if(a){var o=a.ts-t.ts;n+=o=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Ze(e,t){if(e){if("string"==typeof e)return Be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Be(e,t):void 0}}function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&Me.Y.indexOf(n[0].schemeIdUri)>=0)return t===a.Z.IMAGE}if(e.ContentComponent_asArray&&e.ContentComponent_asArray.length>0){if(e.ContentComponent_asArray.length>1)return t===a.Z.MUXED;if(e.ContentComponent_asArray[0].contentType===t)return!0}var r=t===a.Z.TEXT?new RegExp("(ttml|vtt|wvtt|stpp)"):new RegExp(t);if(e.Representation_asArray&&e.Representation_asArray.length){var i=e.Representation_asArray[0].codecs;if(r.test(i))return!0}if(e.hasOwnProperty(o.Z.MIME_TYPE))return r.test(e.mimeType);if(e.Representation_asArray)for(var s,u=0;u0){var t=e.Representation_asArray[0];if(t.hasOwnProperty(o.Z.SEGMENT_TEMPLATE)||t.hasOwnProperty(o.Z.SEGMENT_TIMELINE)||t.hasOwnProperty(o.Z.SEGMENT_LIST)||t.hasOwnProperty(o.Z.SEGMENT_BASE))return!0}return!1}function d(e){return l(e,a.Z.VIDEO)}function g(e){return l(e,a.Z.TEXT)}function h(e){return l(e,a.Z.IMAGE)}function p(e){return e&&Array.isArray(e.Representation_asArray)&&e.Representation_asArray.sort((function(e,t){return e.bandwidth-t.bandwidth})),e}function m(e,t){return e&&e.Period_asArray&&u(t)&&e.Period_asArray[t]?e.Period_asArray[t].AdaptationSet_asArray:[]}function y(e){return e&&e.Period_asArray?e.Period_asArray:[]}function E(e){var t=!1;return e&&e.hasOwnProperty("type")&&(t=e.type===o.Z.DYNAMIC),t}function v(e){return e&&e.EssentialProperty_asArray&&e.EssentialProperty_asArray.length?e.EssentialProperty_asArray.map((function(e){return{schemeIdUri:e.schemeIdUri,value:e.value}})):null}function _(e){if(!e||!e.S_asArray)return NaN;var t=e.S_asArray[0],n=e.S_asArray[1];return t.hasOwnProperty("d")?t.d:n.t-t.t}function T(e,t){if(!e)throw new Error("Period cannot be null or undefined");var n=ye.DEFAULT_ID+"_"+t;return e.hasOwnProperty(o.Z.ID)&&e.id.length>0&&"__proto__"!==e.id&&(n=e.id),n}function b(e,t,n){var r,i=[];if(!e)return i;for(r=0;r0&&u(e)?r[e]:null},getIndexForAdaptation:function(e,t,n){if(!e)return-1;for(var r=m(t,n),a=0;a0&&u(e)?n[e]:null},getCodec:function(e,t,n){var r=null;if(e&&e.Representation_asArray&&e.Representation_asArray.length>0){var i=u(t)&&t>=0&&t0?e.Representation_asArray[0].mimeType:null},getKID:function(e){return e&&e.hasOwnProperty(o.Z.CENC_DEFAULT_KID)?e[o.Z.CENC_DEFAULT_KID]:null},getLabelsForAdaptation:function(e){if(!e||!Array.isArray(e.Label_asArray))return[];for(var t=[],n=0;n0&&(n=-1!==e.profiles.indexOf(t)),n},getDuration:function(e){return e&&e.hasOwnProperty(o.Z.MEDIA_PRESENTATION_DURATION)?e.mediaPresentationDuration:e&&"dynamic"==e.type?Number.POSITIVE_INFINITY:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE},getBandwidth:function(e){return e&&e.bandwidth?e.bandwidth:NaN},getManifestUpdatePeriod:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=NaN;return e&&e.hasOwnProperty(o.Z.MINIMUM_UPDATE_PERIOD)&&(n=e.minimumUpdatePeriod),isNaN(n)?n:Math.max(n-t,1)},getPublishTime:function(e){return e&&e.hasOwnProperty(o.Z.PUBLISH_TIME)?new Date(e[o.Z.PUBLISH_TIME]):null},getRepresentationCount:function(e){return e&&Array.isArray(e.Representation_asArray)?e.Representation_asArray.length:0},getBitrateListForAdaptation:function(e){var t=p(e);return(t&&Array.isArray(t.Representation_asArray)?t.Representation_asArray:[]).map((function(e){return{bandwidth:e.bandwidth,width:e.width||0,height:e.height||0,scanType:e.scanType||null,id:e.id||null}}))},getRepresentationFor:function(e,t){return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&u(e)?t.Representation_asArray[e]:null},getRepresentationsForAdaptation:function(e){var t,n,r,i,a=[],s=function(e){if(e&&e.period&&u(e.period.index)){var t=e.period.mpd.manifest.Period_asArray[e.period.index];if(t&&t.AdaptationSet_asArray&&u(e.index))return p(t.AdaptationSet_asArray[e.index])}}(e);if(s&&s.Representation_asArray){if(e&&e.period&&u(e.period.index)){var l=A(e.period.mpd.manifest);l&&(n=l[0])}for(var f=0,d=s.Representation_asArray.length;f=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n]+)>/g,(function(e,t){return"$"+n[t]})))}if("function"==typeof t){var a=this;return r[Symbol.replace].call(this,e,(function(){var e=[];return e.push.apply(e,arguments),"object"!==ze(e[e.length-1])&&e.push(o(e,a)),t.apply(this,e)}))}return r[Symbol.replace].call(this,e,t)},We.apply(this,arguments)}function Xe(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&et(e,t)}function Qe(e){var t="function"==typeof Map?new Map:void 0;return Qe=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return Je(e,arguments,tt(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),et(r,e)},Qe(e)}function Je(e,t,n){return Je=$e()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&et(i,n.prototype),i},Je.apply(null,arguments)}function $e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function et(e,t){return et=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},et(e,t)}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},tt(e)}var nt="static",rt="dynamic",it="cmsd-",at=it+nt,ot=it+rt,st="stream",ut=["mb","st","sf","v"],lt={video:"v",audio:"a",text:"tt",stream:st},ct=/^[-0-9]/;function ft(){var e,t,n,r,i=this.context,a=(0,u.Z)(i).getInstance();function o(){n={},r={}}function s(e){e&&Object.keys(e).forEach((function(t){ut.includes(t)||delete e[t]}))}function c(e){return!e||"false"!==e.toLowerCase()&&(ct.test(e)?parseInt(e,10):e.replace(/["]+/g,""))}function d(e){try{for(var n={},r=e.split(","),i=0;i=0;c--){var f=u[c].match(We(/^((?:(?!:)[\s\S])*):[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(.*)$/,{key:1,value:2}));if(f&&f.groups){var p=f.groups.key.toLowerCase(),m=f.groups.value;switch(p){case at:i=d(m),a.trigger(l.Z.CMSD_STATIC_HEADER,i);break;case ot:o||(o=g(m))}}}var y=st;return i&&i.ot?y=i.ot:t&&(y=h(t)),s(n[y]),s(r[y]),i&&(n[y]=Object.assign(n[y]||{},i)),o&&(r[y]=Object.assign(r[y]||{},o)),{static:i,dynamic:o}},getMaxBitrate:function(e){var t=h(e);return p(rt,t,"mb")||-1},getEstimatedThroughput:function(e){var t=h(e);return p(rt,t,"etp")||null},getResponseDelay:function(e){var t=h(e);return p(rt,t,"rd")||null},getRoundTripTime:function(e){var t=h(e);return p(rt,t,"rtt")||null}},t=(0,f.Z)(i).getInstance().getLogger(e),o(),e}ft.__dashjs_factory_name="CmsdModel";var dt=c.Z.getSingletonFactory(ft);function gt(){var e,t,n=this.context,r={};function i(){t=(0,f.Z)(n).getInstance().getLogger(e)}function a(e){for(var t={},n=0,r=0,i=0,a=0,o=e.length,s=0;se.bitrate&&(n=!1):t=e.bitrate})),n}return e={setup:i,addMeasurement:function(e,t,n,i,o){e&&e.mediaType&&!r[e.mediaType]&&(r[e.mediaType]=[]);var s=e.mediaInfo.bitrateList.find((function(t){return t.id===e.representationId}));r[e.mediaType].push({index:e.index,repId:e.representationId,mediaType:e.mediaType,requestTimeMS:i,adjustedAvailabilityStartTimeMS:e.availabilityStartTime.getTime(),segDurationMS:1e3*e.duration,chunksDurationMS:n.reduce((function(e,t){return e+t.chunkDownloadDurationMS}),0),segmentBytes:n.reduce((function(e,t){return e+t.chunkBytes}),0),bitrate:s&&s.bandwidth,bitrateList:e.mediaInfo.bitrateList,chunkMeasurements:n,fetchDownloadDurationMS:t,throughputCapacityDelayMS:o,getEstimatedBufferLevel:a(n.slice(1))}),r[e.mediaType].length>10&&r[e.mediaType].shift()},getThroughputCapacityDelayMS:function(e,t){var n=r[e.mediaType]&&r[e.mediaType].slice(-3);return!n||n.length<3?0:o(n)?t/4>250?250:t/4:0},getEstimatedDownloadDurationMS:function(e){var n=r[e.mediaType].slice(-1).pop(),i=r[e.mediaType].slice(-3),a=n.chunkMeasurements.slice(-1).pop().chunkDownloadTimeRelativeMS;n.bufferLevelAtSegmentStart=n.getEstimatedBufferLevel(a/2),n.bufferLevelAtSegmentEnd=n.getEstimatedBufferLevel(a);var s=o(i),u=s?.6:.8;if(n.isBufferStable&&1.05*n.segDurationMS.2*n.chunkMeasurements.length){var p=c/f,m=n.segmentBytes/p;return n.fetchDownloadDurationMSn.bitrate)return y=e.bandwidth,!0})),y===n.bitrate?n.fetchDownloadDurationMS*u:u*n.segmentBytes*8*1e3/y}},i(),e}gt.__dashjs_factory_name="LowLatencyThroughputModel";var ht=c.Z.getSingletonFactory(gt),pt=n(5717);function mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yt(e){e=e||{};var t,n,r,i,o,s,c,d,g,h,p,m=this.context,y=e.errHandler,E=e.dashMetrics,v=e.mediaPlayerModel,_=e.requestModifier,T=e.boxParser,b=e.errors,A=e.requestTimeout||0,I=(0,u.Z)(m).getInstance(),R=(0,N.Z)(m).getInstance();function w(e,t){var u,f=e.request,p=[],b=!0,N=!0,D=new Date,O=D,M=0,P=null,L=null;if(!_||!E||!y)throw new Error("config object is not correct or missing");var F,x=function(e){f.requestStartDate=D,f.requestEndDate=new Date,f.firstByteDate=f.firstByteDate||D,f.fileLoaderType=L;var t=u.response?u.response.responseURL:null,n=u.response?u.response.status:null,r=u.response&&u.response.getAllResponseHeaders?u.response.getAllResponseHeaders():u.response?u.response.responseHeaders:null,i=r&&R.get().streaming.cmsd&&R.get().streaming.cmsd.enabled?c.parseResponseHeaders(r,f.mediaType):null;E.addHttpRequest(f,t,n,r,e?p:null,i)},k=function(e){N=!1,x(e),f.type===C.w.MPD_TYPE&&(E.addManifestUpdate(f),I.trigger(l.Z.MANIFEST_LOADING_FINISHED,{request:f}))},U=function(){if(P&&(clearTimeout(P),P=null),-1!==n.indexOf(u)&&(n.splice(n.indexOf(u),1),N))if(k(!1),t>0){try{R.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&f.type===C.w.MEDIA_SEGMENT_TYPE&&v.getRetryAttemptsForType(C.w.MEDIA_SEGMENT_TYPE)===t&&I.trigger(l.Z.ATTEMPT_BACKGROUND_SYNC)}catch(e){}t--;var r={config:e};i.push(r),r.timeout=setTimeout((function(){-1!==i.indexOf(r)&&(i.splice(i.indexOf(r),1),w(e,t))}),v.getRetryIntervalsForType(f.type))}else{if(f.type===C.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE)return;y.error(new S.Z(o[f.type],f.url+" is not available",{request:f,response:u.response})),e.error&&e.error(f,"error",u.response.statusText,u.response),e.complete&&e.complete(f,u.response.statusText)}};f.hasOwnProperty("availabilityTimeComplete")&&!1===f.availabilityTimeComplete&&window.fetch&&"arraybuffer"===f.responseType&&f.type===C.w.MEDIA_SEGMENT_TYPE?((F=fe(m).create({requestModifier:_,lowLatencyThroughputModel:g,boxParser:T})).setup({dashMetrics:E}),L=a.Z.FILE_LOADER_TYPES.FETCH):(F=(0,se.Z)(m).create({requestModifier:_}),L=a.Z.FILE_LOADER_TYPES.XHR);var Z=null,B=_.modifyRequestURL?_.modifyRequestURL(f.url):f.url;if(R.get().streaming.cmcd&&R.get().streaming.cmcd.enabled){var G=R.get().streaming.cmcd.mode;if(G===a.Z.CMCD_MODE_QUERY){var q=function(e){try{var t=[],n=s.getQueryParameter(e);return n&&t.push(n),t}catch(e){return[]}}(f);B=Ye.Z.addAditionalQueryParameterToUrl(B,q)}else G===a.Z.CMCD_MODE_HEADER&&(Z=s.getHeaderParameters(f))}var Y=d.getXHRWithCredentialsForType(f.type);if(f.queryParams){var j=Object.keys(f.queryParams).map((function(e){return{key:e,value:f.queryParams[e]}}));B=Ye.Z.addAditionalQueryParameterToUrl(B,j)}f.url=B,u={url:B,method:C.w.GET,withCredentials:Y,request:f,onload:function(){u.response.status>=200&&u.response.status<=299&&(k(!0),e.success&&e.success(u.response.response,u.response.statusText,u.response.responseURL),e.complete&&e.complete(f,u.response.statusText))},onend:U,onerror:U,progress:function(t){var n=new Date;b&&(b=!1,(!t.lengthComputable||t.lengthComputable&&t.total!==t.loaded)&&(f.firstByteDate=n)),t.lengthComputable&&(f.bytesLoaded=t.loaded,f.bytesTotal=t.total),t.noTrace||(p.push({s:O,d:t.time?t.time:n.getTime()-O.getTime(),b:[t.loaded?t.loaded-M:0]}),O=n,M=t.loaded),P&&(clearTimeout(P),P=null),R.get().streaming.fragmentRequestProgressTimeout>0&&(P=setTimeout((function(){h.warn("Abort request "+u.url+" due to progress timeout"),u.response.onabort=null,u.loader.abort(u),U()}),R.get().streaming.fragmentRequestProgressTimeout)),e.progress&&t&&e.progress(t)},onabort:function(){x(!0),P&&(clearTimeout(P),P=null),e.abort&&e.abort(f)},ontimeout:function(e){var t;if(e.lengthComputable){var n=e.loaded/e.total*100;t="Request timeout: loaded: "+e.loaded+", out of: "+e.total+" : "+n.toFixed(3)+"% Completed"}else t="Request timeout: non-computable download size";h.warn(t)},loader:F,timeout:A,headers:Z};var H=(new Date).getTime();if(isNaN(f.delayLoadingTime)||H>=f.delayLoadingTime)n.push(u),F.load(u);else{var V={httpRequest:u};r.push(V),V.delayTimeout=setTimeout((function(){if(-1!==r.indexOf(V)){r.splice(r.indexOf(V),1);try{D=new Date,O=D,n.push(V.httpRequest),F.load(V.httpRequest)}catch(e){V.httpRequest.onerror()}}}),f.delayLoadingTime-H)}}return t={load:function(e){e.request?w(e,v.getRetryAttemptsForType(e.request.type)):e.error&&e.error(e.request,"error")},abort:function(){i.forEach((function(e){clearTimeout(e.timeout),e.config.request&&e.config.abort&&e.config.abort(e.config.request)})),i=[],r.forEach((function(e){return clearTimeout(e.delayTimeout)})),r=[],n.forEach((function(e){e.request.type!==C.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE&&(e.onloadend=e.onerror=e.onprogress=void 0,e.loader.abort(e))})),n=[]}},h=(0,f.Z)(m).getInstance().getLogger(t),n=[],r=[],i=[],s=Ke(m).getInstance(),c=dt(m).getInstance(),g=ht(m).getInstance(),d=(0,pt.Z)(m).getInstance(),mt(p={},C.w.MPD_TYPE,b.DOWNLOAD_ERROR_ID_MANIFEST_CODE),mt(p,C.w.XLINK_EXPANSION_TYPE,b.DOWNLOAD_ERROR_ID_XLINK_CODE),mt(p,C.w.INIT_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE),mt(p,C.w.MEDIA_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),mt(p,C.w.INDEX_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),mt(p,C.w.BITSTREAM_SWITCHING_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),mt(p,C.w.OTHER_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),o=p,t}yt.__dashjs_factory_name="HTTPLoader";var Et=c.Z.getClassFactory(yt);function vt(){var e;function t(){e={}}function n(){t()}return n(),{getLoader:function(t){for(var n in e)if(e.hasOwnProperty(n)&&t.startsWith(n))return e[n];return Et},registerLoader:function(t,n){e[t]=n},unregisterLoader:function(t){e[t]&&delete e[t]},unregisterAllLoader:t,reset:n}}vt.__dashjs_factory_name="SchemeLoaderFactory";var _t=c.Z.getSingletonFactory(vt);function Tt(e){e=e||{};var t,n,r=this.context;return t=_t(r).getInstance(),{load:function(i){if(!n){var a=t.getLoader(i&&i.request?i.request.url:null);n=a(r).create({errHandler:e.errHandler,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,dashMetrics:e.dashMetrics,boxParser:e.boxParser?e.boxParser:null,constants:e.constants?e.constants:null,dashConstants:e.dashConstants?e.dashConstants:null,urlUtils:e.urlUtils?e.urlUtils:null,requestTimeout:isNaN(e.requestTimeout)?0:e.requestTimeout,errors:e.errors})}n.load(i)},abort:function(){n&&n.abort()}}}Tt.__dashjs_factory_name="URLLoader";var St=c.Z.getClassFactory(Tt);function bt(e){return bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bt(e)}function At(e,t){return At=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},At(e,t)}function It(e,t){return!t||"object"!==bt(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Rt(e){return Rt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Rt(e)}var wt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&At(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Rt(t);if(n){var i=Rt(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return It(this,e)});function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=r.call(this,e)).checkForExistenceOnly=!0,t}return i}(p.Z);function Nt(e){e=e||{};var t,n,r=this.context,i=e.eventBus,o=e.events,s=e.urlUtils,u=e.errors,l=e.streamId;return t={checkForExistence:function(e){var t=function(t){i.trigger(o.CHECK_FOR_EXISTENCE_COMPLETED,{request:e,exists:t})};if(e){var r=new wt(e.url);n.load({request:r,success:function(){t(!0)},error:function(){t(!1)}})}else t(!1)},load:function(e){var r=function(n,r){i.trigger(o.LOADING_COMPLETED,{request:e,response:n||null,error:r||null,sender:t})};e?n.load({request:e,progress:function(n){i.trigger(o.LOADING_PROGRESS,{request:e,stream:n.stream,streamId:l}),n.data&&i.trigger(o.LOADING_DATA_PROGRESS,{request:e,response:n.data||null,error:null,sender:t})},success:function(e){r(e)},error:function(e,t,n){r(void 0,new S.Z(u.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,n,t))},abort:function(e){e&&i.trigger(o.LOADING_ABANDONED,{mediaType:e.mediaType,request:e,sender:t})}}):r(void 0,new S.Z(u.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,u.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},abort:function(){n&&n.abort()},reset:function(){n&&(n.abort(),n=null)}},n=St(r).create({errHandler:e.errHandler,errors:u,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,urlUtils:s,constants:a.Z,boxParser:e.boxParser,dashConstants:e.dashConstants,requestTimeout:e.settings.get().streaming.fragmentRequestTimeout}),t}Nt.__dashjs_factory_name="FragmentLoader";var Ct=c.Z.getClassFactory(Nt);function Dt(){return{modifyResponseAsync:function(e){return Promise.resolve(e)}}}Dt.__dashjs_factory_name="SegmentResponseModifier";var Ot=c.Z.getSingletonFactory(Dt);function Mt(e){e=e||{};var t,n,r,i=this.context,o=(0,u.Z)(i).getInstance(),s=e.errHandler,c=e.mediaPlayerModel,g=e.dashMetrics,h=(0,f.Z)(i).getInstance(),p=Ot(i).getInstance(),m=e.streamInfo;function y(){return m.id}function E(){for(var e in r)r[e].reset();r={}}function v(e){if(e.sender){var t=e.request,r=e.response,i=t.isInitializationRequest(),s=t.mediaInfo.streamInfo;if(e.error&&(t.mediaType===a.Z.AUDIO||t.mediaType===a.Z.VIDEO||t.mediaType===a.Z.TEXT&&t.mediaInfo.isFragmented)&&o.trigger(l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD,{entry:e.request.serviceLocation}),r&&s){var u=function(e,t,n,r){var i=new oe;return i.streamId=n,i.mediaInfo=t.mediaInfo,i.segmentType=t.type,i.start=t.startTime,i.duration=t.duration,i.end=i.start+i.duration,i.bytes=e,i.index=t.index,i.quality=t.quality,i.representationId=t.representationId,i.endFragment=r,i}(r,t,m.id,e.type!==l.Z.FRAGMENT_LOADING_PROGRESS);p.modifyResponseAsync(u).then((function(e){o.trigger(i?l.Z.INIT_FRAGMENT_LOADED:l.Z.MEDIA_FRAGMENT_LOADED,{chunk:e,request:t},{streamId:s.id,mediaType:t.mediaType})})).catch((function(e){n.error(e),o.trigger(i?l.Z.INIT_FRAGMENT_LOADED:l.Z.MEDIA_FRAGMENT_LOADED,{chunk:u,request:t},{streamId:s.id,mediaType:t.mediaType})}))}else n.warn("No "+t.mediaType+" bytes to push or stream is inactive.")}}return t={getStreamId:y,getModel:function(t){var n=r[t];return n||(n=T(i).create({streamInfo:m,type:t,dashMetrics:g,fragmentLoader:Ct(i).create({dashMetrics:g,mediaPlayerModel:c,errHandler:s,requestModifier:(0,X.Z)(i).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:o,events:l.Z,errors:w,dashConstants:e.dashConstants,urlUtils:e.urlUtils,streamId:y()}),debug:h,eventBus:o,events:l.Z}),r[t]=n),n},reset:function(){o.off(d.Z.FRAGMENT_LOADING_COMPLETED,v,this),o.off(d.Z.FRAGMENT_LOADING_PROGRESS,v,this),E()}},n=h.getLogger(t),E(),o.on(d.Z.FRAGMENT_LOADING_COMPLETED,v,t),o.on(d.Z.FRAGMENT_LOADING_PROGRESS,v,t),t}Mt.__dashjs_factory_name="FragmentController";var Pt=c.Z.getClassFactory(Mt),Lt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=null,this.width=null,this.height=null,this.x=null,this.y=null},Ft=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN};function xt(e){var t,n,r=this.context,i=e.streamInfo;function o(e){n.setTrackByIndex(e)}function s(){n&&n.reset()}return t={getStreamId:function(){return i.id},initialize:function(){n.addTracks();var e=n.getTracks();e&&e.length>0&&o(0)},provide:function(e,t){if("function"==typeof t){var r,i,a=n.getCurrentTrack();if(!a||a.segmentDuration<=0||null==e)t(null);else{(i=n.getThumbnailRequestForTime(e))&&(a.segmentDuration=i.duration),r=e%a.segmentDuration;var o=Math.floor(r*a.tilesHor*a.tilesVert/a.segmentDuration),s=new Lt;if(s.width=Math.floor(a.widthPerTile),s.height=Math.floor(a.heightPerTile),s.x=Math.floor(o%a.tilesHor)*a.widthPerTile,s.y=Math.floor(o/a.tilesHor)*a.heightPerTile,"readThumbnail"in a)return a.readThumbnail(e,(function(e){s.url=e,t(s)}));if(i)s.url=i.url,a.segmentDuration=NaN;else{var u=Math.floor(e/a.segmentDuration);s.url=function(e,t){var n=t+e.startNumber,r=(0,H.vi)(e.templateUrl,"Number",n);return r=(0,H.vi)(r,"Time",(n-1)*e.segmentDuration*e.timescale),r=(0,H.vi)(r,"Bandwidth",e.bandwidth),(0,H.eR)(r)}(a,u)}t(s)}}},setTrackByIndex:o,getCurrentTrackIndex:function(){return n.getCurrentTrackIndex()},getBitrateList:function(){var e=n.getTracks(),t=0;return e.map((function(e){var n=new Ft;return n.mediaType=a.Z.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n}))},reset:s},s(),n=(0,Me.Z)(r).create({streamInfo:i,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController}),t}xt.__dashjs_factory_name="ThumbnailController";var kt=c.Z.getClassFactory(xt),Ut=n(7417);function Zt(e){var t;e=e||{};var n=[],r=(0,u.Z)(this.context).getInstance(),i=e.updateEventName,a=e.addBlacklistEventName;function o(e){-1===n.indexOf(e)&&(n.push(e),r.trigger(i,{entry:e}))}return t={add:o,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},a&&r.on(a,(function(e){o(e.entry)}),t),t}Zt.__dashjs_factory_name="BlackListController";var Bt=c.Z.getClassFactory(Zt),Gt=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT,a.Z.MUXED,a.Z.IMAGE];function qt(e){e=e||{};var t,n,r,i,s,c,d,g,h,p,m,y,E,v,_,T,b,A,I=this.context,R=(0,u.Z)(I).getInstance(),N=(0,Q.Z)(I).getInstance(),C=e.manifestModel,D=e.mediaPlayerModel,O=e.dashMetrics,M=e.manifestUpdater,P=e.adapter,L=e.timelineConverter,F=e.capabilities,x=e.errHandler,k=e.abrController,U=e.playbackController,Z=e.eventController,B=e.mediaController,G=e.protectionController,q=e.textController,Y=e.videoModel,j=e.streamInfo,H=e.settings;function V(e,t){return new Promise((function(i,o){ne(),p=!0,ie();var s=Y.getElement(),u=[];Gt.forEach((function(t){(t!==a.Z.TEXT||e)&&(t!==a.Z.VIDEO||!s||s&&/^VIDEO$/i.test(s.nodeName))&&u.push(K(t,e))})),Promise.all(u).then((function(){return e=t,new Promise((function(t){var n={},i=r.map((function(t){return t.createBufferSinks(e)}));Promise.all(i).then((function(e){e.forEach((function(e){e&&(n[e.getType()]=e)})),t(n)})).catch((function(){t(n)}))}));var e})).then((function(t){if(p=!1,0===r.length){var a="No streams to play.";x.error(new S.Z(w.MANIFEST_ERROR_ID_NOSTREAMS_CODE,a,C.getValue())),n.fatal(a)}else oe();e&&q.createTracks(j),i(t)})).catch((function(e){o(e)}))}))}function K(t,i){var s,u=P.getAllMediaInfoForType(j,t),c=[],f=null;if(!u||0===u.length)return n.info("No "+t+" data."),Promise.resolve();t===a.Z.VIDEO&&(d=!0),t===a.Z.AUDIO&&(g=!0);for(var h=0,p=u.length;h0&&(B.setInitialMediaSettingsForType(t,j),q.addMediaInfosToBuffer(j,t,c)),u=u.filter((function(e){return!e.isEmbedded})),0===u.length)return Promise.resolve();if(t===a.Z.IMAGE)return(y=kt(I).create({streamInfo:j,adapter:P,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:T,eventBus:R,events:l.Z,dashConstants:o.Z,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController})).initialize(),Promise.resolve();R.trigger(l.Z.STREAM_INITIALIZING,{streamInfo:j,mediaInfo:f}),B.setInitialMediaSettingsForType(t,j);var v=function(t,n){var i=t&&t.length>0?t[0]:null,o=m.getModel(i?i.type:null),s=i?i.type:null,u=i?i.mimeType:null,l=i?i.isFragmented:null,c=ae(I).create({streamInfo:j,type:s,mimeType:u,timelineConverter:L,adapter:P,manifestModel:C,mediaPlayerModel:D,fragmentModel:o,dashMetrics:e.dashMetrics,baseURLController:e.baseURLController,segmentBaseController:e.segmentBaseController,abrController:k,playbackController:U,mediaController:B,textController:q,errHandler:x,settings:H,boxParser:_,segmentBlacklistController:E});c.initialize(n,d,l),r.push(c);for(var f=0;f0&&Z.addInlineEvents(e,j.id)}}function oe(){for(var e=r.length,t=h.audio||h.video?new S.Z(w.DATA_UPDATE_FAILED_ERROR_CODE,w.DATA_UPDATE_FAILED_ERROR_MESSAGE):null,n=0;n0&&e.Representation_asArray[0].ContentProtection)}function pe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e||!e.hasOwnProperty("getStreamInfo"))return!1;var r=e.getStreamInfo(),i=n?n.getStreamInfo():te();if(!r||!i)return!1;var a=P.getAdaptationForType(r.index,t,r),o=P.getAdaptationForType(i.index,t,i);if(!a||!o)return!a&&!o;var s=a&&o&&a.mimeType===o.mimeType,u=o.Representation_asArray.map((function(e){return e.codecs})),l=a.Representation_asArray.map((function(e){return e.codecs})),c=l.some((function(e){return u.indexOf(e)>-1})),f=l.some((function(e){return u.some((function(t){return F.codecRootCompatibleWithCodec(t,e)}))}));return c||f&&s}function me(e){v=e}function ye(){return v}return t={initialize:function(){R.on(l.Z.BUFFERING_COMPLETED,se,t),R.on(l.Z.DATA_UPDATE_COMPLETED,ue,t),R.on(l.Z.INBAND_EVENTS,le,t),G&&(R.on(l.Z.KEY_ERROR,re,t),R.on(l.Z.SERVER_CERTIFICATE_UPDATED,re,t),R.on(l.Z.LICENSE_REQUEST_COMPLETE,re,t),R.on(l.Z.KEY_SYSTEM_SELECTED,re,t),R.on(l.Z.KEY_SESSION_CREATED,re,t),R.on(l.Z.KEY_STATUSES_CHANGED,re,t)),q.initializeForStream(j),R.trigger(l.Z.STREAM_UPDATED,{streamInfo:j})},getStreamId:function(){return j?j.id:null},activate:function(e,t){return new Promise((function(n,r){if(!s)return ye()?(s=!0,R.trigger(l.Z.STREAM_ACTIVATED,{streamInfo:j}),void n(t)):void function(e,t){return V(e,t)}(e,t).then((function(e){s=!0,R.trigger(l.Z.STREAM_ACTIVATED,{streamInfo:j}),n(e)})).catch((function(e){r(e)}));n(t)}))},deactivate:W,getIsActive:function(){return s},getDuration:function(){return j?j.duration:NaN},getStartTime:$,getId:ee,getStreamInfo:te,getHasAudioTrack:function(){return g},getHasVideoTrack:function(){return d},startPreloading:function(e,t){return new Promise((function(i,a){ye()?a():(n.info("[startPreloading] Preloading next stream with id ".concat(ee())),me(!0),V(e,t).then((function(){for(var e=0;e0;){var e=A.pop(),t=e.newMediaInfo,r=ce(e.oldMediaInfo);if(!r)return;n.push(r.prepareTrackSwitch()),n.push(r.selectMediaInfo(t))}return Promise.all(n)})).then((function(){p=!1,oe(),R.trigger(l.Z.STREAM_UPDATED,{streamInfo:j}),t()}))}))},reset:function(e){m&&(m.reset(),m=null),k&&j&&k.clearDataForStream(j.id),E&&(E.reset(),E=null),X(e),j=null,R.off(l.Z.DATA_UPDATE_COMPLETED,ue,t),R.off(l.Z.BUFFERING_COMPLETED,se,t),R.off(l.Z.INBAND_EVENTS,le,t),G&&(R.off(l.Z.KEY_ERROR,re,t),R.off(l.Z.SERVER_CERTIFICATE_UPDATED,re,t),R.off(l.Z.LICENSE_REQUEST_COMPLETE,re,t),R.off(l.Z.KEY_SYSTEM_SELECTED,re,t),R.off(l.Z.KEY_SESSION_CREATED,re,t),R.off(l.Z.KEY_STATUSES_CHANGED,re,t))},getProcessors:de,setMediaSource:function(e){return new Promise((function(t,i){for(var a=[],o=0;o1&&void 0!==arguments[1]?arguments[1]:null;return pe(e,a.Z.VIDEO,t)&&pe(e,a.Z.AUDIO,t)},isProtectionCompatible:function(e){return!e||ge(a.Z.VIDEO,e)&&ge(a.Z.AUDIO,e)},getPreloaded:ye,getIsEndedEventSignaled:function(){return b},setIsEndedEventSignaled:J,getAdapter:function(){return P},getHasFinishedBuffering:function(){return c},setPreloaded:me,startScheduleControllers:function(){for(var e=r.length,t=0;t4&&i[e].shift()}function I(e,t){if(e&&e.request&&e.request.serviceLocation){var n=e.request.serviceLocation;-1===r[t].all.indexOf(n)&&r[t].all.push(n),r[t].current=n}}function R(){var e=g.getValue(),t=y.getContentSteering(e);return t||(t=p.getServiceDescriptionSettings().contentSteering),t}function N(){return new Promise((function(e){try{var a=R();if(!a||!a.serverUrl)return void e();var u=function(e){var t=e.serverUrl;n&&n.reloadUri&&(t=v.isRelative(n.reloadUri)?v.resolve(n.reloadUri,e.serverUrl):n.reloadUri);var a=[],o=r.baseUrl.all.concat(r.location.all);if(o.length>0){var s=o.map((function(e){var t=function(e){if(!e||!i[e]||0===i[e].length)return-1;var t=i[e].reduce((function(e,t){return e+t}))/i[e].length;return parseInt(t)}(e);return{serviceLocation:e,throughput:t}}));s.sort((function(e,t){return t.throughput-e.throughput}));var u="",l="";s.forEach((function(e,t){0!==t&&(u="".concat(u,","),e.throughput>-1&&(l="".concat(l,","))),u="".concat(u).concat(e.serviceLocation),e.throughput>-1&&(l="".concat(l).concat(e.throughput))})),a.push({key:"_DASH_pathway",value:'"'.concat(u,'"')}),a.push({key:"_DASH_throughput",value:l})}return t=Ye.Z.addAditionalQueryParameterToUrl(t,a)}(a),l=new jt(u);s.load({request:l,success:function(t){!function(e){e&&e[o.Z.CONTENT_STEERING_RESPONSE.VERSION]&&1===parseInt(e[o.Z.CONTENT_STEERING_RESPONSE.VERSION])&&((n=new Ht).version=e[o.Z.CONTENT_STEERING_RESPONSE.VERSION],e[o.Z.CONTENT_STEERING_RESPONSE.TTL]&&!isNaN(e[o.Z.CONTENT_STEERING_RESPONSE.TTL])&&(n.ttl=e[o.Z.CONTENT_STEERING_RESPONSE.TTL]),e[o.Z.CONTENT_STEERING_RESPONSE.RELOAD_URI]&&(n.reloadUri=e[o.Z.CONTENT_STEERING_RESPONSE.RELOAD_URI]),e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_PRIORITY]&&(n.pathwayPriority=e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_PRIORITY]),e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_CLONES]&&(n.pathwayClones=e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_CLONES],n.pathwayClones=n.pathwayClones.filter((function(e){return function(e){return e[o.Z.CONTENT_STEERING_RESPONSE.BASE_ID]&&e[o.Z.CONTENT_STEERING_RESPONSE.ID]&&e[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT]&&e[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][o.Z.CONTENT_STEERING_RESPONSE.HOST]}(e)}))),O())}(t),m.trigger(d.Z.CONTENT_STEERING_REQUEST_COMPLETED,{currentSteeringResponseData:n,url:u}),e()},error:function(r,i,a,o){!function(e,r){try{switch(t.warn("Error fetching data from content steering server",e),r.status){case 410:break;case 429:var i=r&&r.getResponseHeader?r.getResponseHeader("retry-after"):null;null!==i&&(n||(n={}),n.ttl=parseInt(i)),O();break;default:O()}}catch(e){t.error(e)}}(r,o),e(r)},complete:function(){r.baseUrl.all=C(r.baseUrl),r.location.all=C(r.location)}})}catch(t){e(t)}}))}function C(e){return e.all&&0!==e.all.length&&e.current?e.all.filter((function(t){return t===e.current})):[]}function D(e){try{var r=[];return e&&0!==e.length&&n&&n.pathwayClones&&0!==n.pathwayClones.length?(n.pathwayClones.forEach((function(t){var n=e.filter((function(e){return t[o.Z.CONTENT_STEERING_RESPONSE.BASE_ID]===e.serviceLocation})),i=null;if(n&&n.length>0&&(i=n[0]),i){var a=new URL(i.url),s=t[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][o.Z.CONTENT_STEERING_RESPONSE.HOST];s=Ye.Z.stringHasProtocol(s)?s:"".concat(a.protocol,"//").concat(s);var u={synthesizedUrl:"".concat(s).concat(a.pathname),serviceLocation:t[o.Z.CONTENT_STEERING_RESPONSE.ID],queryParams:t[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][o.Z.CONTENT_STEERING_RESPONSE.PARAMS],reference:i};r.push(u)}})),r):r}catch(e){return t.error(e),[]}}function O(){n&&n.ttl&&!isNaN(n.ttl)&&(a&&clearTimeout(a),a=setTimeout((function(){N()}),1e3*n.ttl))}function M(){a&&clearTimeout(a),a=null}function P(){n=null,i={},r={baseUrl:{current:null,all:[]},location:{current:null,all:[]}},M()}return e={reset:function(){P(),m.off(d.Z.FRAGMENT_LOADING_STARTED,_,e),m.off(d.Z.MANIFEST_LOADING_STARTED,T,e),m.off(d.Z.MANIFEST_LOADING_FINISHED,S,e),m.off(d.Z.THROUGHPUT_MEASUREMENT_STORED,b,e)},setConfig:function(e){e&&(e.adapter&&(y=e.adapter),e.errHandler&&(u=e.errHandler),e.dashMetrics&&(l=e.dashMetrics),e.mediaPlayerModel&&(c=e.mediaPlayerModel),e.requestModifier&&(h=e.requestModifier),e.manifestModel&&(g=e.manifestModel),e.serviceDescriptionController&&(p=e.serviceDescriptionController),e.eventBus&&(m=e.eventBus))},loadSteeringData:N,getCurrentSteeringResponseData:function(){return n},shouldQueryBeforeStart:function(){var e=R();return!!e&&e.queryBeforeStart},getSteeringDataFromManifest:R,stopSteeringRequestTimer:M,getSynthesizedBaseUrlElements:function(e){try{return D(e).map((function(e){var t=new Se(e.synthesizedUrl,e.serviceLocation);return t.queryParams=e.queryParams,t.dvbPriority=e.reference.dvbPriority,t.dvbWeight=e.reference.dvbWeight,t.availabilityTimeOffset=e.reference.availabilityTimeOffset,t.availabilityTimeComplete=e.reference.availabilityTimeComplete,t}))}catch(e){return t.error(e),[]}},getSynthesizedLocationElements:function(e){try{return D(e).map((function(e){var t=new Pe(e.synthesizedUrl,e.serviceLocation);return t.queryParams=e.queryParams,t}))}catch(e){return t.error(e),[]}},initialize:function(){s=St(E).create({errHandler:u,dashMetrics:l,mediaPlayerModel:c,requestModifier:h,errors:w}),m.on(d.Z.FRAGMENT_LOADING_STARTED,_,e),m.on(d.Z.MANIFEST_LOADING_STARTED,T,e),m.on(d.Z.MANIFEST_LOADING_FINISHED,S,e),m.on(d.Z.THROUGHPUT_MEASUREMENT_STORED,b,e)}},t=(0,f.Z)(E).getInstance().getLogger(e),P(),e}Vt.__dashjs_factory_name="ContentSteeringController";var Kt=c.Z.getSingletonFactory(Vt);function zt(){var e,t,n,r=this.context,i=(0,N.Z)(r).getInstance();return e={select:function(e){if(!e||0===e.length)return null;var r=null;return i.get().streaming.applyContentSteering&&(r=function(e){var r=n.getCurrentSteeringResponseData();return r&&r.pathwayPriority&&r.pathwayPriority.length>0?function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0,i=null,a=function(){var a=e[r],o=n.findIndex((function(e){return e.serviceLocation&&e.serviceLocation===a}));if(-1!==o&&!t.contains(n[o].serviceLocation))return i=n[o],"break";r+=1};r0&&void 0!==arguments[0]&&arguments[0];s=!0;var t=g.getValue(),n=t.url,r=null,i=p.getPatchLocation(t),a=h.select(i),o=null;if(a&&!e)n=a.url,r=a.serviceLocation,o=a.queryParams;else{var u=R(t),l=h.select(u);l&&(n=l.url,r=l.serviceLocation,o=l.queryParams)}T.isRelative(n)&&(n=T.resolve(n,t.url)),c.load(n,r,o)}function R(e){var t=p.getLocation(e),n=y.getSynthesizedLocationElements(t);return t.concat(n)}function N(e){if(e){if(p.getIsPatch(e)){var r=e;e=g.getValue();var u=p.isPatchValid(e,r),c=u;if(u){var f=p.getPublishTime(e);c=p.applyPatchToManifest(e,r);var d=p.getPublishTime(e);c=f.getTime()!=d.getTime()}if(!c)return t.debug("Patch provided is invalid, performing full manifest refresh"),void I(!0);e.loadedTime=new Date}}else(e=g.getValue()).loadedTime=new Date;if(g.getValue()&&g.getValue().type===o.Z.DYNAMIC&&e.type===o.Z.STATIC)return _.trigger(l.Z.DYNAMIC_TO_STATIC),s=!1,void(a=!0);g.setValue(e);var h=new Date,m=(h.getTime()-e.loadedTime.getTime())/1e3;1e3*(n=p.getManifestUpdatePeriod(e,m))>2147483647&&(n=2147483.647),_.trigger(l.Z.MANIFEST_UPDATED,{manifest:e}),t.info("Manifest has been refreshed at "+h+"["+h.getTime()/1e3+"] "),i||A()}function C(){i||(s?A(E.get().streaming.manifestUpdateRetryInterval):I())}function D(e){e.error?e.error.code===w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&m.error(e.error):N(e.manifest)}function O(){i=!1,A()}function M(){(i=!E.get().streaming.scheduling.scheduleWhilePaused)&&b()}function P(){s=!1}return e={initialize:function(){S(),_.on(l.Z.STREAMS_COMPOSED,P,this),_.on(d.Z.PLAYBACK_STARTED,O,this),_.on(d.Z.PLAYBACK_PAUSED,M,this),_.on(l.Z.INTERNAL_MANIFEST_LOADED,D,this)},setManifest:function(e){N(e)},refreshManifest:I,getIsUpdating:function(){return s},setConfig:function(e){e&&(e.manifestModel&&(g=e.manifestModel),e.adapter&&(p=e.adapter),e.manifestLoader&&(c=e.manifestLoader),e.errHandler&&(m=e.errHandler),e.locationSelector&&(h=e.locationSelector),e.settings&&(E=e.settings),e.contentSteeringController&&(y=e.contentSteeringController))},reset:function(){_.off(d.Z.PLAYBACK_STARTED,O,this),_.off(d.Z.PLAYBACK_PAUSED,M,this),_.off(l.Z.STREAMS_COMPOSED,P,this),_.off(l.Z.INTERNAL_MANIFEST_LOADED,D,this),S()}},t=(0,f.Z)(v).getInstance().getLogger(e),h=Wt(v).create(),e}Xt.__dashjs_factory_name="ManifestUpdater";var Qt=c.Z.getClassFactory(Xt);function Jt(){var e,t,n,r,i,a,o,s,c,d,g,h,p,m,y,E,v=this.context,_=(0,u.Z)(v).getInstance(),T=(0,Q.Z)(v).getInstance();function b(){s=[],c=[],d=null,g=null,p=null,h=NaN,n=!1,r=!1,m=i.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function A(){i.get().streaming.utcSynchronization.enabled&&!n&&!r&&p&&p.value&&p.schemeIdUri&&!isNaN(h)&&!isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)&&(g&&(Date.now()-g)/1e3<30||(s=[],r=!0,I(isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)?2:i.get().streaming.utcSynchronization.backgroundAttempts)))}function I(e){try{if(e<=0)return void B();var t=Date.now();a[p.schemeIdUri](p.value,(function(n){var r=Date.now(),i=N(t,r,n);s.push(i),I(e-1)}),(function(){B()}))}catch(e){B()}}function R(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e||0;if(!c||0===c.length||t>=c.length)D();else{var n=c[t];if(n)if(a.hasOwnProperty(n.schemeIdUri)){var r=(new Date).getTime();a[n.schemeIdUri](n.value,(function(e){var t=(new Date).getTime(),i=N(r,t,e);p=n,D(i)}),(function(){R(t+1)}))}else R(t+1);else D()}}function N(e,t,n){return n-(t-(t-e)/2)}function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,t=isNaN(e);t&&i.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource?U():Z(t,e)}function O(e){var t=Date.parse(e);return isNaN(t)&&(t=function(e){var t,n,r=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/.exec(e);return t=Date.UTC(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10),parseInt(r[4],10),parseInt(r[5],10),r[6]&&(parseInt(r[6],10)||0),r[7]&&1e3*parseFloat(r[7])||0),r[9]&&r[10]&&(n=60*parseInt(r[9],10)+parseInt(r[10],10),t+=("+"===r[8]?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function M(e){return Date.parse(e)}function P(e){return Date.parse(e)}function L(e,t,n){n()}function F(e,t,n){var r=O(e);isNaN(r)?n():t(r)}function x(e,t,n,r,i){var a,o,s=!1,u=new XMLHttpRequest,l=i?C.w.HEAD:C.w.GET,c=t.match(/\S+/g);if(t=c.shift(),a=function(){s||(s=!0,c.length?x(e,c.join(" "),n,r,i):r())},o=function(){var t,r;200===u.status&&(t=i?u.getResponseHeader("Date"):u.response,r=e(t),isNaN(r)||(n(r),s=!0))},T.isRelative(t)){var f=E.resolve();f&&(t=T.resolve(t,f.url))}u.open(l,t),u.timeout=5e3,u.onload=o,u.onloadend=a,u.send()}function k(e,t,n){x(P,e,t,n,!0)}function U(){var e=o.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;isNaN(t)?Z(!0):Z(!1,t-Date.now())}function Z(e,r){if(isNaN(h)||isNaN(r)||e||function(e){try{var n,r=G(e),a=isNaN(m)?30:m,o=isNaN(i.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:i.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,s=isNaN(i.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:i.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,u=isNaN(i.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:i.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts;r?(n=Math.min(a*o,s),t.debug("Increasing timeBetweenSyncAttempts to ".concat(n))):(n=Math.max(a/o,u),t.debug("Decreasing timeBetweenSyncAttempts to ".concat(n))),m=n}catch(e){}}(r),!e&&!isNaN(r)){d=Date.now(),n=!1;var a=isNaN(h);h=r,a&&A(),t.debug("Completed UTC sync. Setting client - server offset to ".concat(r))}e&&(p=null,n=!1,y.error(new S.Z(w.TIME_SYNC_FAILED_ERROR_CODE,w.TIME_SYNC_FAILED_ERROR_MESSAGE))),_.trigger(l.Z.UPDATE_TIME_SYNC_OFFSET,{offset:r}),_.trigger(l.Z.TIME_SYNCHRONIZATION_COMPLETED)}function B(){if(s&&0!==s.length){var e=s.reduce((function(e,t){return e+t}),0)/s.length;G(e)?t.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(t.debug("Completed background UTC sync. Setting client - server offset to ".concat(e)),h=e,_.trigger(l.Z.UPDATE_TIME_SYNC_OFFSET,{offset:h})),r=!1,g=Date.now()}}function G(e){try{if(isNaN(h))return!0;var t=i.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(i.get().streaming.utcSynchronization.maximumAllowedDrift)?i.get().streaming.utcSynchronization.maximumAllowedDrift:100;return e>=h-t&&e<=h+t}catch(e){return!0}}return e={initialize:function(){b(),a={"urn:mpeg:dash:utc:http-head:2014":k,"urn:mpeg:dash:utc:http-xsdate:2014":x.bind(null,O),"urn:mpeg:dash:utc:http-iso:2014":x.bind(null,M),"urn:mpeg:dash:utc:direct:2014":F,"urn:mpeg:dash:utc:http-head:2012":k,"urn:mpeg:dash:utc:http-xsdate:2012":x.bind(null,O),"urn:mpeg:dash:utc:http-iso:2012":x.bind(null,M),"urn:mpeg:dash:utc:direct:2012":F,"urn:mpeg:dash:utc:http-ntp:2014":L,"urn:mpeg:dash:utc:ntp:2014":L,"urn:mpeg:dash:utc:sntp:2014":L}},attemptSync:function(e,t){c=e,n||(function(e){try{if(!e||!i.get().streaming.utcSynchronization.enabled)return!1;var t=isNaN(m)?30:m;return!(d&&t&&!isNaN(t))||(Date.now()-d)/1e3>=t}catch(e){return!0}}(t)?(n=!0,R()):_.trigger(l.Z.TIME_SYNCHRONIZATION_COMPLETED))},setConfig:function(e){e&&(e.dashMetrics&&(o=e.dashMetrics),e.baseURLController&&(E=e.baseURLController),e.errHandler&&(y=e.errHandler),e.settings&&(i=e.settings))},reset:function(){b(),_.off(l.Z.ATTEMPT_BACKGROUND_SYNC,A,e)}},t=(0,f.Z)(v).getInstance().getLogger(e),_.on(l.Z.ATTEMPT_BACKGROUND_SYNC,A,e),e}Jt.__dashjs_factory_name="TimeSyncController";var $t=c.Z.getSingletonFactory(Jt);$t.HTTP_TIMEOUT_MS=5e3,c.Z.updateSingletonFactory(Jt.__dashjs_factory_name,$t);var en=$t;function tn(){var e,t,n,r,i,a=this.context,o=(0,u.Z)(a).getInstance();return e={attachMediaSource:function(e){var n=window.URL.createObjectURL(t);return e.setSource(n),"managedMediaSource"===r&&(e.setDisableRemotePlayback(!0),t.addEventListener("startstreaming",(function(){o.trigger(d.Z.MANAGED_MEDIA_SOURCE_START_STREAMING)})),t.addEventListener("endstreaming",(function(){o.trigger(d.Z.MANAGED_MEDIA_SOURCE_END_STREAMING)}))),n},createMediaSource:function(){var e="WebKitMediaSource"in window,n="MediaSource"in window;return"ManagedMediaSource"in window?(t=new ManagedMediaSource,r="managedMediaSource",i.info("Created ManagedMediaSource")):n?(t=new MediaSource,r="mediaSource",i.info("Created MediaSource")):e&&(t=new WebKitMediaSource,i.info("Created WebkitMediaSource")),t},detachMediaSource:function(e){e.setSource(null)},setConfig:function(e){e&&e.settings&&(n=e.settings)},setDuration:function e(r){t&&"open"===t.readyState&&(null===r&&isNaN(r)||t.duration!==r&&(r!==1/0||n.get().streaming.buffer.mediaSourceDurationInfinity||(r=Math.pow(2,32)),function(e){for(var t=e.sourceBuffers,n=0;n=0&&e0?Math.max(0,i):0,b(r,i,e),b(n,i,e),A(r),A(n),a=e,c=!1}}catch(e){c=!1,t.error(e)}}function b(e,n,r){try{N(e,(function(i){if(void 0!==i){var a=isNaN(i.duration)?0:i.duration;i.calculatedPresentationTime<=r&&i.calculatedPresentationTime+n+a>=r?D(i,d.Z.EVENT_MODE_ON_START):(C(r,a+n,i.calculatedPresentationTime)||function(e){try{var n=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>n}catch(e){return t.error(e),!1}}(i))&&(t.debug("Removing event ".concat(i.id," from period ").concat(i.eventStream.period.id," as it is expired or invalid")),function(e,n){try{var r=n.eventStream.schemeIdUri,i=n.eventStream.period.id,a=n.eventStream.value,o=n.id;e[i][r]=e[i][r].filter((function(e){return a&&e.eventStream.value&&e.eventStream.value!==a||e.id!==o})),0===e[i][r].length&&delete e[i][r]}catch(e){t.error(e)}}(e,i))}}))}catch(e){t.error(e)}}function A(e){try{for(var n in e)e.hasOwnProperty(n)&&0===Object.keys(e[n]).length&&delete e[n]}catch(e){t.error(e)}}function I(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.eventStream.schemeIdUri,i=e.eventStream.value,a=e.id,o=p;t[r]||(t[r]=[]);var s=t[r].findIndex((function(e){return(!i||e.eventStream.value&&e.eventStream.value===i)&&e.id===a}));if(-1===s)t[r].push(e),e.triggeredReceivedEvent=!1,e.triggeredStartEvent=!1,o=y;else if(n){var u=t[r][s];e.triggeredReceivedEvent=u.triggeredReceivedEvent,e.triggeredStartEvent=u.triggeredStartEvent,t[r][s]=e,o=m}return o}function R(e){try{if(1==e.eventStream.value){var n,r=e.calculatedPresentationTime;n=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,v.trigger(d.Z.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:r,newDuration:n,newManifestValidAfter:NaN},{mode:d.Z.EVENT_MODE_ON_START})}}catch(e){t.error(e)}}function w(e){try{var n=s.getTime();N(e,(function(e){var t=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.duration)?e.eventStream.period.duration:NaN,r=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.start)?e.eventStream.period.start:NaN;if(!isNaN(t)&&!isNaN(r)){var i=e.calculatedPresentationTime;Math.abs(i-n)<300&&D(e,d.Z.EVENT_MODE_ON_START)}}))}catch(e){t.error(e)}}function N(e,n){try{if(e)for(var r=Object.keys(e),i=0;ir}catch(e){return t.error(e),!1}}function D(e,n){try{var r=s.getTime(),i=e.id;if(n===d.Z.EVENT_MODE_ON_RECEIVE&&!e.triggeredReceivedEvent)return t.debug("Received event ".concat(i)),e.triggeredReceivedEvent=!0,void v.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n});e.triggeredStartEvent||(e.eventStream.schemeIdUri===h&&1==e.eventStream.value?0===e.duration&&0===e.presentationTimeDelta||(t.debug("Starting manifest refresh event ".concat(i," at ").concat(r)),function(){try{_(),o.refreshManifest()}catch(e){t.error(e)}}()):"urn:mpeg:dash:event:callback:2015"===e.eventStream.schemeIdUri&&1==e.eventStream.value?(t.debug("Starting callback event ".concat(i," at ").concat(r)),function(e){try{(0,se.Z)(E).create({}).load({method:"get",url:e,request:{responseType:"arraybuffer"}})}catch(e){t.error(e)}}(e.messageData)):(t.debug("Starting event ".concat(i," from period ").concat(e.eventStream.period.id," at ").concat(r)),v.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n})),e.triggeredStartEvent=!0)}catch(e){t.error(e)}}return e={addInlineEvents:function(e,r){try{if(_(),n[r]||(n[r]={}),e)for(var i=0;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&h.updateManifestUpdateInfo({currentTime:G.getTime(),buffered:B.getBufferRange(),presentationStartTime:e[0].start,clientTimeOffset:N.getClientTimeOffset()}),C.length>0&&function(e){0!==e.length?C=C.filter((function(n){var r=e.filter((function(e){return e.id===n.getId()})).length>0||n.getId()===D.getId();return r||(t.debug("Removing stream ".concat(n.getId())),n.reset(!0)),r})):t.warn("No periods included in the current manifest. Skipping the filtering of outdated stream objects.")}(e);for(var n=[],r=0,i=e.length;r2&&void 0!==arguments[2]&&arguments[2];function a(){if(Z&&"open"===Z.readyState){t.debug("MediaSource is open!"),window.URL.revokeObjectURL(r),Z.removeEventListener("sourceopen",a),Z.removeEventListener("webkitsourceopen",a),xe();var o=h.getCurrentDVRInfo();p.setSeekable(o.range.start,o.range.end),i?(isNaN(e)||G.seek(e,!0,!0),D.setMediaSource(Z).then((function(){D.initializeForTextWithMediaSource(Z)}))):me(e,n)}}function o(){Z.addEventListener("sourceopen",a,!1),Z.addEventListener("webkitsourceopen",a,!1),r=p.attachMediaSource(B),t.debug("MediaSource attached to element. Waiting on open...")}Z?n?me(e,n):(p.detachMediaSource(B),o()):(Z=p.createMediaSource(),o())}function me(e,t){D.activate(Z,t?W:void 0,e).then((function(t){if(t){var n=Object.keys(t);n.length>0&&t[n[0]].getBuffer().changeType&&(Q=!0),W=t}isNaN(e)||(oe.trigger(l.Z.SEEK_TARGET,{time:e},{streamId:D.getId()}),G.seek(e,!1,!0),D.startScheduleControllers()),x=!1,oe.trigger(l.Z.PERIOD_SWITCH_COMPLETED,{toStreamInfo:Ke()})}))}function ye(e){var t=be(e.seekTime);t&&t!==D?t&&t!==D&&(Ee(),function(e,t){var n=e&&!isNaN(e.seekTime)?e.seekTime:NaN,r=D.getProcessors().map((function(t){return t.prepareOuterPeriodPlaybackSeeking(e)}));Promise.all(r).then((function(){he(t,D,n)})).catch((function(e){R.error(e)}))}(e,t)):(Ee(),function(e){D.getProcessors().forEach((function(t){return t.prepareInnerPeriodPlaybackSeeking(e)})),je(ee.USER_REQUEST_STOP_REASON)}(e)),He($.SEEK_START_REASON)}function Ee(){ve()}function ve(){X&&X.length>0&&(X.forEach((function(e){e.deactivate(!0)})),X=[])}function _e(e){if(e.newMediaInfo.streamInfo.id===D.getId()){if(ve(),J.get().streaming.buffer.resetSourceBuffersForTrackSwitch&&e.oldMediaInfo&&e.oldMediaInfo.codec!==e.newMediaInfo.codec){var t=G.getTime();return D.deactivate(!1),void pe(t,!1,!1)}D.prepareTrackChange(e)}}function Te(e,t){try{return J.get().streaming.buffer.reuseExistingSourceBuffers&&(t.isProtectionCompatible(e)||te)&&(Q&&J.get().streaming.buffer.useChangeTypeForTrackSwitch||t.isMediaCodecCompatible(e,t))}catch(e){return!1}}function Se(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(Z&&!e.getPreloaded()){var n=Te(e,t);n&&e.startPreloading(Z,W).then((function(){X.push(e)}))}}function be(e){if(isNaN(e))return null;for(var t=C.length,n=0;nG.getLiveDelay())&&(V=!1,He($.INITIAL_PLAYOUT_START_REASON),G.play())}e&&e.mediaType&&h.addBufferLevel(e.mediaType,new Date,1e3*e.bufferLevel)}function Re(e){e.streamInfo.id===D.getId()&&e.reason&&e.reason.forceReplace&&ve(),ze(e.streamInfo.id).prepareQualityChange(e)}function we(){if(g.getIsDynamic()&&0!==G.getOriginalLiveDelay()&&D){var e=g.getStreamsInfo();if(e.length>0){var t=e[0].manifestInfo,n=Be(e,t);G.computeAndSetLiveDelay(n,t)}}}function Ne(){if(qe()){var e=B.getPlaybackQuality();e&&h.addDroppedFrames(e)}}function Ce(){t.debug("[onPlaybackStarted]"),!V&&H&&He($.RESUME_FROM_PAUSE_START_REASON),V&&(V=!1),K&&(K=!1,J.get().streaming.applyContentSteering&&!y.shouldQueryBeforeStart()&&y.loadSteeringData()),H=!1}function De(e){t.debug("[onPlaybackPaused]"),e.ended||(H=!0,je(ee.USER_REQUEST_STOP_REASON))}function Oe(e){t.debug("Stream with id ".concat(e.streamInfo.id," finished buffering"));var n=e.streamInfo.isLast;Z&&n?(t.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),p.signalEndOfStream(Z)):Me()}function Me(){if(D&&D.getHasFinishedBuffering())for(var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{var t=e||D||null;if(t){var n=t.getStreamInfo();return C.filter((function(e){var t=e.getStreamInfo();return t.start>n.start&&n.id!==t.id}))}}catch(e){return[]}}(D),t=0;t0&&void 0!==arguments[0]?arguments[0]:null,t=e||D||null;if(!t)return null;for(var n=t.getStreamInfo(),r=n.start,i=0,a=-1,o=NaN;i0&&(isNaN(o)||u=0?C[a]:null}();n?(t.debug("StreamController onEnded, found next stream with id ".concat(n.getStreamInfo().id,". Switching from ").concat(D.getStreamInfo().id," to ").concat(n.getStreamInfo().id)),he(n,D,NaN)):(t.debug("StreamController no next stream found"),D.setIsEndedEventSignaled(!1)),je(n?ee.END_OF_PERIOD_STOP_REASON:ee.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&(Pe(),y.stopSteeringRequestTimer())}function xe(e){var t=e||Ke().manifestInfo.duration;p.setDuration(t)}function ke(e){var t=_.getURIFragmentData();if(!t||!t.t)return NaN;var n=$e()[0].getStreamInfo().start;return t.t=t.t.split(",")[0],Ze(e,t.t,n)}function Ue(e,t){var n=0;return e||(n=$e()[0].getStreamInfo().start),Ze(e,t,n)}function Ze(e,t,n){var r=g.getRegularPeriods()[0],i=t.toString(),a=-1!==i.indexOf("posix:")?"now"===i.substring(6)?Date.now()/1e3:parseFloat(i.substring(6)):NaN;return e&&!isNaN(a)?N.calcPresentationTimeFromWallTime(new Date(1e3*a),r):parseFloat(i)+n}function Be(e,t){try{var n=NaN;if(t&&!isNaN(t.maxFragmentDuration)&&isFinite(t.maxFragmentDuration))return t.maxFragmentDuration;if(e&&1===e.length){var r=e[0],i=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT].reduce((function(e,t){var n=g.getMediaInfoForType(r,t);return n&&!1!==n.isFragmented&&e.push(n),e}),[]).reduce((function(e,t){var n=g.getVoRepresentations(t);return n&&n.length>0&&n.forEach((function(t){t&&e.push(t)})),e}),[]).reduce((function(e,t){var n=g.convertRepresentationToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e}),[]);n=Math.max.apply(Math,function(e){if(Array.isArray(e))return sn(e)}(o=i)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return sn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sn(e,t):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}return isFinite(n)?n:NaN}catch(e){return NaN}var o}function Ge(e){if(e.error)U=!0,Qe();else{t.info("Manifest updated... updating data system wide.");var n=e.manifest;g.updatePeriods(n);var i=g.getUTCTimingSources();!g.getIsDynamic()||i&&0!==i.length||oe.trigger(d.Z.CONFORMANCE_VIOLATION,{level:on.LEVELS.WARNING,event:on.EVENTS.NO_UTC_TIMING_ELEMENT});var a=g.getIsDynamic()?i.concat(j.getUTCTimingSources()):i;r.filterUnsupportedFeatures(n).then((function(){E.initialize(n),m.attemptSync(a,g.getIsDynamic())}))}}function qe(){return!!D&&D.getHasVideoTrack()}function Ye(){return!!D&&D.getHasAudioTrack()}function je(e,t){t=t||new Date,Le().forEach((function(n){n.finalisePlayList(t,e)})),h.addPlayList()}function He(e){h.createPlaylistMetrics(1e3*G.getTime(),e)}function Ve(e){if(e.error){var n="";switch(e.error.code){case 1:n="MEDIA_ERR_ABORTED";break;case 2:n="MEDIA_ERR_NETWORK";break;case 3:n="MEDIA_ERR_DECODE",ie.counts.mediaErrorDecode+=1;break;case 4:n="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:n="MEDIA_ERR_ENCRYPTED";break;default:n="UNKNOWN"}"MEDIA_ERR_DECODE"===n&&J.get().errors.recoverAttempts.mediaErrorDecode>=ie.counts.mediaErrorDecode?function(){t.warn("A MEDIA_ERR_DECODE occured: Resetting the MediaSource");var e=G.getTime();D.deactivate(!1),t.warn("MediaSource has been resetted. Resuming playback from time ".concat(e)),pe(e,!1,!1)}():(k=!0,e.error.message&&(n+=" ("+e.error.message+")"),e.error.msExtendedCode&&(n+=" (0x"+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),t.fatal("Video Element Error: "+n),e.error&&t.fatal(e.error),R.error(new S.Z(e.error.code,n)),Qe())}}function Ke(){return D?D.getStreamInfo():null}function ze(e){for(var t=0,n=C.length;t1&&void 0!==arguments[1]?arguments[1]:NaN;se(),re=t,o.load(e)},loadWithManifest:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;ue(),re=t,i.setManifest(e)},getActiveStreamProcessors:Le,setConfig:function(e){e&&(e.capabilities&&(n=e.capabilities),e.capabilitiesFilter&&(r=e.capabilitiesFilter),e.manifestLoader&&(o=e.manifestLoader),e.manifestModel&&(c=e.manifestModel),e.mediaPlayerModel&&(Y=e.mediaPlayerModel),e.customParametersModel&&(j=e.customParametersModel),e.protectionController&&(O=e.protectionController),e.adapter&&(g=e.adapter),e.dashMetrics&&(h=e.dashMetrics),e.errHandler&&(R=e.errHandler),e.timelineConverter&&(N=e.timelineConverter),e.videoModel&&(B=e.videoModel),e.playbackController&&(G=e.playbackController),e.serviceDescriptionController&&(q=e.serviceDescriptionController),e.contentSteeringController&&(y=e.contentSteeringController),e.textController&&(M=e.textController),e.abrController&&(T=e.abrController),e.mediaController&&(b=e.mediaController),e.settings&&(J=e.settings),e.baseURLController&&(E=e.baseURLController),e.uriFragmentModel&&(_=e.uriFragmentModel),e.segmentBaseController&&(v=e.segmentBaseController),e.manifestUpdater&&(i=e.manifestUpdater))},setProtectionData:function(e){P=e,O&&O.setProtectionData(P)},getIsStreamSwitchInProgress:function(){return x},switchToVideoElement:function(e){D&&(G.initialize(Ke()),pe(e,!1,!0))},getHasMediaOrInitialisationError:function(){return k||U},getStreams:$e,getActiveStream:function(){return D},getInitialPlayback:function(){return V},getAutoPlay:function(){return L},refreshManifest:function(){i.getIsUpdating()||i.refreshManifest()},reset:Qe},t=(0,f.Z)(ae).getInstance().getLogger(e),m=en(ae).getInstance(),p=nn(ae).getInstance(),I=F(ae).getInstance(),Xe(),e}un.__dashjs_factory_name="StreamController";var ln=c.Z.getSingletonFactory(un);function cn(){var e,t,n,r,i,o,s,c,d,g,h,p,m=this.context,y=(0,u.Z)(m).getInstance();function E(){p.debug("Stopping the gap controller"),i&&(clearInterval(i),i=null),function(){y.off(l.Z.WALLCLOCK_TIME_UPDATED,b,this),y.off(l.Z.INITIAL_STREAM_SWITCH,S,this),y.off(l.Z.PLAYBACK_SEEKING,v,this),y.off(l.Z.BUFFER_REPLACEMENT_STARTED,_,e),y.off(l.Z.TRACK_CHANGE_RENDERED,T,e)}(),i=null,o=NaN,r=0,g=null,h={}}function v(){g&&(clearTimeout(g),g=null)}function _(e){try{if(e.streamId!==c.getActiveStreamInfo().id||e.mediaType!==a.Z.VIDEO&&e.mediaType!==a.Z.AUDIO)return;e.streamId===c.getActiveStreamInfo().id&&(h[e.mediaType]=!0)}catch(e){p.error(e)}}function T(e){e&&e.mediaType&&(h[e.mediaType]=!1)}function S(){i||function(){try{i||(p.debug("Starting the gap controller"),i=setInterval((function(){A()&&N(s.getTime())}),100))}catch(e){}}()}function b(){if(A(n.get().streaming.gaps.enableSeekFix)&&++r>=10){var e=s.getTime();t===e?N(e,!0):(t=e,o=NaN),r=0}}function A(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!c.getActiveStream())return!1;var t=Object.keys(h).some((function(e){return h[e]})),r=!!e&&I();return!t&&n.get().streaming.gaps.jumpGaps&&c.getActiveStreamProcessors().length>0&&(!s.isSeeking()||r)&&!s.isPaused()&&!c.getIsStreamSwitchInProgress()&&!c.getHasMediaOrInitialisationError()}function I(){var e=c.getActiveStream(),t=parseFloat((e.getStartTime()+e.getDuration()).toFixed(5));return s.getTime()+n.get().streaming.gaps.threshold>=t}function R(e,t){try{if(!e||e.length<=1&&t>0)return NaN;for(var r=NaN,i=0;isNaN(r)&&i0?e.end(i-1):0;t=e.start(n)&&t<=e.end(n))return!0;return!1}function N(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=n.get().streaming.gaps.enableStallFix,a=n.get().streaming.gaps.stallSeek,u=n.get().streaming.gaps.smallGapLimit,l=n.get().streaming.gaps.jumpLargeGaps,f=d.getBufferRange(),h=NaN,m=!1;if(t=R(f,e),!isNaN(t)){var y=f.start(t),E=y-e;E>0&&(E<=u||l)&&(h=y)}var v=s.getTimeToStreamEnd();if(isNaN(h)&&r&&isFinite(v)&&!isNaN(v)&&v0&&o!==h&&h>e&&!g){var _=h-e;if(m){var T=c.getStreamForTime(h),S=T&&!!T.getPreloaded();p.warn("Jumping to end of stream because of gap from ".concat(e," to ").concat(h,". Gap duration: ").concat(_)),s.seek(h,!0,S)}else{var b=s.getIsDynamic(),A=t>0?f.end(t-1):e,I=b?1e3*Math.max(0,_-.1):0;g=window.setTimeout((function(){s.seek(h,!0,!0),p.warn("Jumping gap occuring in period ".concat(c.getActiveStream().getStreamId()," starting at ").concat(A," and ending at ").concat(h,". Jumping by: ").concat(h-A)),g=null}),I)}o=h}}return e={reset:E,setConfig:function(e){e&&(e.settings&&(n=e.settings),e.playbackController&&(s=e.playbackController),e.streamController&&(c=e.streamController),e.videoModel&&(d=e.videoModel))},initialize:function(){!function(){y.on(l.Z.WALLCLOCK_TIME_UPDATED,b,this),y.on(l.Z.INITIAL_STREAM_SWITCH,S,this),y.on(l.Z.PLAYBACK_SEEKING,v,this),y.on(l.Z.BUFFER_REPLACEMENT_STARTED,_,e),y.on(l.Z.TRACK_CHANGE_RENDERED,T,e)}()}},p=(0,f.Z)(m).getInstance().getLogger(e),E(),e}cn.__dashjs_factory_name="GapController";var fn=c.Z.getSingletonFactory(cn);function dn(){var e,t,n,r,i,o,c,g,h,p,m=this.context,y=(0,u.Z)(m).getInstance();function E(){t=!1;var e=Ye.Z.parseUserAgent();n=e&&e.browser&&e.browser.name&&"safari"===e.browser.name.toLowerCase()}function v(){t=!1}function _(e){if(e.streamId===o.getActiveStreamInfo().id&&h){var t=c.getLiveDelay();c.getBufferLevel()>t/2&&(h=!1)}}function T(e){e.streamId===o.getActiveStreamInfo().id&&(h=e.state===s.Z.BUFFER_EMPTY)}function S(){g.getCatchupModeEnabled()||r.setPlaybackRate(1)}function b(){c.getIsDynamic()&&g.getCatchupModeEnabled()&&(g.getCatchupPlaybackRates().max>0||g.getCatchupPlaybackRates().min<0)&&!c.isPaused()&&!c.isSeeking()&&function(){try{return!(!c.getTime()>0||t)&&(I()===a.Z.LIVE_CATCHUP_MODE_LOLP?function(e,t){try{return Math.abs(A())>0||e0}catch(e){return!1}}())}catch(e){return!1}}()&&function(){if(!t&&r){var e,o=r.getPlaybackRate(),s=g.getCatchupPlaybackRates(),u=c.getBufferLevel(),l=A(),f=g.getCatchupMaxDrift();if(!isNaN(f)&&f>0&&l>f)p.info("[CatchupController]: Low Latency catchup mechanism. Latency too high, doing a seek to live point"),t=!0,c.seekToCurrentLive(!0,!1);else{var d=c.getCurrentLiveLatency(),m=c.getLiveDelay();e=I()===a.Z.LIVE_CATCHUP_MODE_LOLP?function(e,t,n,r,i){var a;if(i0&&(s=1),s}(s,d,m,u);var y=n?.25:.02/(.5/s.max);e&&Math.abs(o-e)>=y&&(p.debug("[CatchupController]: Setting playback rate to ".concat(e)),r.setPlaybackRate(e))}}}()}function A(){return c.getCurrentLiveLatency()-c.getLiveDelay()}function I(){var e=i.get().streaming.liveCatchup.playbackBufferMin;return i.get().streaming.liveCatchup.mode!==a.Z.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?a.Z.LIVE_CATCHUP_MODE_DEFAULT:a.Z.LIVE_CATCHUP_MODE_LOLP}function R(){g.getCatchupPlaybackRates(!0)}return e={reset:function(){y.off(d.Z.BUFFER_LEVEL_UPDATED,_,e),y.off(d.Z.BUFFER_LEVEL_STATE_CHANGED,T,e),y.off(d.Z.PLAYBACK_PROGRESS,b,e),y.off(d.Z.PLAYBACK_TIME_UPDATED,b,e),y.off(d.Z.PLAYBACK_SEEKED,v,e),y.off(l.Z.SETTING_UPDATED_CATCHUP_ENABLED,S,e),y.off(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MIN,R,e),y.off(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MAX,R,e),y.off(d.Z.STREAM_INITIALIZED,R,e),E(),r.setPlaybackRate(1,!0)},setConfig:function(e){e&&(e.settings&&(i=e.settings),e.videoModel&&(r=e.videoModel),e.streamController&&(o=e.streamController),e.playbackController&&(c=e.playbackController),e.mediaPlayerModel&&(g=e.mediaPlayerModel))},initialize:function(){y.on(d.Z.BUFFER_LEVEL_UPDATED,_,e),y.on(d.Z.BUFFER_LEVEL_STATE_CHANGED,T,e),y.on(d.Z.PLAYBACK_PROGRESS,b,e),y.on(d.Z.PLAYBACK_TIME_UPDATED,b,e),y.on(d.Z.PLAYBACK_SEEKED,v,e),y.on(l.Z.SETTING_UPDATED_CATCHUP_ENABLED,S,e),y.on(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MIN,R,e),y.on(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MAX,R,e),y.on(d.Z.STREAM_INITIALIZED,R,e),R()}},p=(0,f.Z)(m).getInstance().getLogger(e),E(),e}dn.__dashjs_factory_name="CatchupController";var gn=c.Z.getSingletonFactory(dn),hn=[a.Z.SERVICE_DESCRIPTION_DVB_LL_SCHEME],pn="video",mn="audio";function yn(){var e,t,n,r,i,s=this.context;function u(){t={liveDelay:NaN,liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN}},minBitrate:{},maxBitrate:{},initialBitrate:{},contentSteering:null},n=[]}function l(e,n,i){try{t[e][n]=i/1e3}catch(e){r.error(e)}}return e={getServiceDescriptionSettings:function(){return t},getProducerReferenceTimeOffsets:function(){return n},calculateProducerReferenceTimeOffsets:function(e){try{var t=[];if(e&&e.length>0){var s=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT],u=i.getAvailabilityStartTime()/1e3;e.forEach((function(e){var n=s.reduce((function(t,n){return t.concat(i.getAllMediaInfoForType(e,n))}),[]).reduce((function(t,n){return i.getProducerReferenceTimes(e,n).forEach((function(r){var a=i.getVoRepresentations(n);if(a&&a.length>0&&a[0].adaptation&&a[0].segmentInfoType===o.Z.SEGMENT_TEMPLATE){var s=a[0],l=new Date(r[o.Z.WALL_CLOCK_TIME]).getTime()/1e3-(r[o.Z.PRESENTATION_TIME]/s[o.Z.TIMESCALE]-s[o.Z.PRESENTATION_TIME_OFFSET]+e.start),c=u-l;t.push({id:r[o.Z.ID],to:c})}})),t}),[]);t=t.concat(n)}))}n=t}catch(e){r.error(e),n=[]}},applyServiceDescription:function(e){if(e&&e.serviceDescriptions){var i=e.serviceDescriptions.filter((function(e){return hn.includes(e.schemeIdUri)})),o=e.serviceDescriptions.filter((function(e){return null==e.schemeIdUri})),s=i.length>0?i[i.length-1]:o[o.length-1];s&&(s.latency&&s.latency.target>0&&function(e){var i;if(e.schemeIdUri,a.Z.SERVICE_DESCRIPTION_DVB_LL_SCHEME,i=function(e){return{liveDelay:e.latency.target/1e3,maxDrift:!isNaN(e.latency.max)&&e.latency.max>e.latency.target?(e.latency.max-e.latency.target+500)/1e3:NaN,referenceId:e.latency.referenceId||NaN}}(e),n.length>0){var o=function(e){var t,r=0,i=n.filter((function(t){return t.id===e.referenceId}));return 0===i.length?(r=n.length>0?n[0].to:0,t=n[0].id||NaN):(r=i[0].to||0,t=i[0].id||NaN),{to:r,id:t}}(i),s=o.to,u=o.id;t.liveDelay=i.liveDelay-s,t.liveCatchup.maxDrift=i.maxDrift,r.debug("\n Found latency properties coming from service description. Applied time offset of ".concat(s," from ProducerReferenceTime element with id ").concat(u,".\n Live Delay: ").concat(i.liveDelay-s,", Live catchup max drift: ").concat(i.maxDrift,"\n "))}else t.liveDelay=i.liveDelay,t.liveCatchup.maxDrift=i.maxDrift,r.debug("Found latency properties coming from service description: Live Delay: ".concat(i.liveDelay,", Live catchup max drift: ").concat(i.maxDrift))}(s),s.playbackRate&&function(e){var n=e.playbackRate.min?Math.round(1e3*(e.playbackRate.min-1))/1e3:NaN,i=e.playbackRate.max?Math.round(1e3*(e.playbackRate.max-1))/1e3:NaN;t.liveCatchup.playbackRate.min=n,t.liveCatchup.playbackRate.max=i,r.debug("Found latency properties coming from service description: Live catchup min playback rate: ".concat(n)),r.debug("Found latency properties coming from service description: Live catchup max playback rate: ".concat(i))}(s),s.operatingQuality,s.operatingBandwidth&&function(e){if(e&&e.operatingBandwidth&&e.operatingBandwidth.mediaType&&"all"!==e.operatingBandwidth.mediaType){var t={};t.minBandwidth=e.operatingBandwidth.min,t.maxBandwidth=e.operatingBandwidth.max,t.targetBandwidth=e.operatingBandwidth.target;var n=[];e.operatingBandwidth.mediaType===pn||e.operatingBandwidth.mediaType===mn?n.push(e.operatingBandwidth.mediaType):"any"===e.operatingBandwidth.mediaType&&(n.push(mn),n.push(pn)),n.forEach((function(e){isNaN(t.minBandwidth)||l("minBitrate",e,t.minBandwidth),isNaN(t.maxBandwidth)||l("maxBitrate",e,t.maxBandwidth),isNaN(t.targetBandwidth)||l("initialBitrate",e,t.targetBandwidth)}))}}(s),s.contentSteering&&function(e){t.contentSteering=e.contentSteering}(s))}},reset:function(){u()},setConfig:function(e){e&&e.adapter&&(i=e.adapter)}},r=(0,f.Z)(s).getInstance().getLogger(e),u(),e}yn.__dashjs_factory_name="ServiceDescriptionController";var En=c.Z.getSingletonFactory(yn),vn=n(3973),_n=n.n(vn),Tn=n(3039);function Sn(){var e,t,n,r,i,o,s,c,d=this.context,g=(0,u.Z)(d).getInstance();function h(e,t){return e&&n[t]&&n[t][e]?n[t][e].list:[]}function p(e,t){return e&&n[t]&&n[t][e]?n[t][e].current:null}function m(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&e.streamInfo){var i=e.type,s=e.streamInfo,u=s.id,f=p(i,u);if(n[u]&&n[u][i]&&(n[u][i].current=e,n[u][i].current&&(i!==a.Z.TEXT&&!v(e,f)||i===a.Z.TEXT&&e.isFragmented)&&g.trigger(l.Z.CURRENT_TRACK_CHANGED,{oldMediaInfo:f,newMediaInfo:e,switchMode:r.get().streaming.trackSwitchMode[i]},{streamId:u}),!t)){var d=T(e);if(!d||!n[u][i].storeLastSettings)return;d.roles&&(d.role=d.roles[0],delete d.roles),d.accessibility&&(d.accessibility=d.accessibility[0]),d.audioChannelConfiguration&&(d.audioChannelConfiguration=d.audioChannelConfiguration[0]),o[i]=d,c.setSavedMediaSettings(i,d)}}}function y(e,t){e&&t&&(i[e]=t)}function E(e){return e?i[e]:null}function v(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;var n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=JSON.stringify(e.viewpointsWithSchemeIdUri)===JSON.stringify(t.viewpointsWithSchemeIdUri),a=e.lang===t.lang,o=e.codec===t.codec,s=e.roles.toString()===t.roles.toString(),u=JSON.stringify(e.rolesWithSchemeIdUri)===JSON.stringify(t.rolesWithSchemeIdUri),l=e.accessibility.toString()===t.accessibility.toString(),c=JSON.stringify(e.accessibilitiesWithSchemeIdUri)===JSON.stringify(t.accessibilitiesWithSchemeIdUri),f=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString(),d=JSON.stringify(e.audioChannelConfigurationsWithSchemeIdUri)===JSON.stringify(t.audioChannelConfigurationsWithSchemeIdUri);return n&&o&&r&&i&&a&&s&&u&&l&&c&&f&&d}function _(){n={},o={},i={audio:null,video:null,text:null}}function T(e){var t={lang:e.lang,viewpoint:e.viewpoint,roles:e.roles,accessibility:e.accessibility,audioChannelConfiguration:e.audioChannelConfiguration,codec:e.codec};return t.lang||t.viewpoint||t.role&&t.role.length>0||t.accessibility&&t.accessibility.length>0||t.audioChannelConfiguration&&t.audioChannelConfiguration.length>0?t:null}function S(e,t,n){var r=[];return e.forEach((function(e){t(n,e)&&r.push(e)})),0!==r.length?r:e}function b(e,t){try{return!e.lang||e.lang instanceof RegExp?t.lang.match(e.lang):""!==t.lang&&(0,Tn.extendedFilter)(t.lang,_n()(e.lang)).length>0}catch(e){return!1}}function A(e,t){return void 0===e.index||null===e.index||t.index===e.index}function I(e,t){return!e.viewpoint||e.viewpoint===t.viewpoint}function R(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0];return r||t.type===a.Z.AUDIO&&n}function w(e,t){return e.accessibility?!!t.accessibility.filter((function(t){return t===e.accessibility}))[0]:!t.accessibility.length}function N(e,t){return!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0]}function C(e,t){return!e.codec||e.codec===t.codec}function D(e){var t,n=0,r=[];return e.forEach((function(e){(t=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))))>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function O(e){var t,n=1/0,r=[];return e.forEach((function(e){var i=e.bitrateList.reduce((function(e,t){var n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0);(t=i/e.bitrateList.length)n?(n=t,r=[e]):t===n&&r.push(e)})),r}function P(e,n){if(e===a.Z.TEXT)return n[0];var i,o=r.get().streaming.selectionModeForInitialTrack,u=s.getCustomInitialTrackSelectionFunction();if(u&&"function"==typeof u)i=u(n);else switch(o){case a.Z.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY:i=function(e){var t,n,r=(t=0,n=[],e.forEach((function(e){isNaN(e.selectionPriority)||(e.selectionPriority>t?(t=e.selectionPriority,n=[e]):e.selectionPriority===t&&n.push(e))})),n);return r.length>1&&(r=D(r)),r.length>1&&(r=M(r)),r}(n);break;case a.Z.TRACK_SELECTION_MODE_HIGHEST_BITRATE:i=function(e){var t=D(e);return t.length>1&&(t=M(t)),t}(n);break;case a.Z.TRACK_SELECTION_MODE_FIRST_TRACK:i=L(n);break;case a.Z.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:i=function(e){var t=O(e);return t.length>1&&(t=D(t)),t}(n);break;case a.Z.TRACK_SELECTION_MODE_WIDEST_RANGE:i=function(e){var t=M(e);return t.length>1&&(t=D(e)),t}(n);break;default:t.warn("Track selection mode ".concat(o," is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK")),i=L(n)}return i.length>0?i[0]:n[0]}function L(e){return e[0]}return e={setInitialMediaSettingsForType:function(e,t){var n=o[e]||E(e),r=h(e,t.id),i=[];n||((n=c.getSavedMediaSettings(e))&&delete n.codec,y(e,n)),r&&0!==r.length&&(n&&(i=S(i=Array.from(r),b,n),i=S(i,A,n),i=S(i,I,n),e===a.Z.AUDIO&&o[e]||(i=S(i,R,n)),i=S(i,w,n),i=S(i,N,n),i=S(i,C,n)),0===i.length?m(P(e,r),!0):i.length>1?m(P(e,i)):m(i[0]))},addTrack:function(e){if(e){var t=e.type;if((i=t)===a.Z.AUDIO||i===a.Z.VIDEO||i===a.Z.TEXT||i===a.Z.IMAGE){var i,o,s=e.streamInfo.id;n[s]||(n[s]={audio:{list:[],storeLastSettings:o=r.get().streaming.saveLastMediaSettingsForCurrentStreamingSession,current:null},video:{list:[],storeLastSettings:o,current:null},text:{list:[],storeLastSettings:o,current:null},image:{list:[],storeLastSettings:o,current:null}});for(var u=n[s][t].list,l=0,c=u.length;l2&&void 0!==arguments[2]&&arguments[2];try{var r=!1;if(e.lang){if(e.lang instanceof RegExp)r=t.lang.match(e.lang);else if(""!==t.lang){var i=_n()(e.lang);i&&(r=(0,Tn.extendedFilter)(t.lang,i).length>0)}}else r=!0;var o=void 0===e.index||null===e.index||t.index===e.index,s=!e.viewpoint||e.viewpoint===t.viewpoint,u=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0],l=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],c=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return r&&o&&s&&(u||t.type===a.Z.AUDIO&&n)&&l&&c}catch(e){return!1}},matchSettingsLang:b,matchSettingsIndex:A,matchSettingsViewPoint:I,matchSettingsRole:R,matchSettingsAccessibility:w,matchSettingsAudioChannelConfig:N,saveTextSettingsDisabled:function(){c.setSavedMediaSettings(a.Z.TEXT,null)},setConfig:function(e){e&&(e.domStorage&&(c=e.domStorage),e.settings&&(r=e.settings),e.customParametersModel&&(s=e.customParametersModel))},reset:_},t=(0,f.Z)(d).getInstance().getLogger(e),_(),e}Sn.__dashjs_factory_name="MediaController";var bn=c.Z.getSingletonFactory(Sn);c.Z.updateSingletonFactory(Sn.__dashjs_factory_name,bn);var An=bn,In=NaN,Rn=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data={baseUrls:t||null,selectedIdx:n||In},this.children=[]};function wn(){var e,t,n,r,i=this.context,a=Oe(i).getInstance();function o(e,t,n){var r=s(n);e[t]?a.areEqual(r,e[t].data.baseUrls)||(e[t].data.baseUrls=r,e[t].data.selectedIdx=In):e[t]=new Rn(r)}function s(e){var t=n.getBaseURLsFromElement(e),i=r.getSynthesizedBaseUrlElements(t);return i&&i.length>0&&(t=t.concat(i)),t}function u(e,n){var r=n||t;e(r.data),r.children&&r.children.forEach((function(t){return u(e,t)}))}function l(){t=new Rn}return e={reset:l,update:function(e){!function(e){!function(){if(!n||!n.hasOwnProperty("getBaseURLsFromElement")||!n.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}();var r=s(e);a.areEqual(r,t.data.baseUrls)||(t.data.baseUrls=r,t.data.selectedIdx=In),e&&e.Period_asArray&&e.Period_asArray.forEach((function(e,r){o(t.children,r,e),e.AdaptationSet_asArray&&e.AdaptationSet_asArray.forEach((function(e,i){o(t.children[r].children,i,e),e.Representation_asArray&&e.Representation_asArray.sort(n.getRepresentationSortFunction()).forEach((function(e,n){o(t.children[r].children[i].children,n,e)}))}))}))}(e)},getForPath:function(e){var n=t,r=[n.data];return e&&e.forEach((function(e){(n=n.children[e])&&r.push(n.data)})),r.filter((function(e){return e.baseUrls.length}))},invalidateSelectedIndexes:function(e){u((function(t){isNaN(t.selectedIdx)||e===t.baseUrls[t.selectedIdx].serviceLocation&&(t.selectedIdx=In)}))},setConfig:function(e){e.adapter&&(n=e.adapter),e.contentSteeringController&&(r=e.contentSteeringController)},getBaseUrls:function(e){return s(e)}},l(),e}wn.__dashjs_factory_name="BaseURLTreeModel";var Nn=c.Z.getClassFactory(wn);function Cn(e){var t=(e=e||{}).blacklistController;return{select:function(e){return e&&function(e){var t,n,r=0,i=[],a=0;if((n=e.sort((function(e,t){var n=e.dvbPriority-t.dvbPriority;return isNaN(n)?0:n})).filter((function(e,t,n){return!t||n[0].dvbPriority&&e.dvbPriority&&n[0].dvbPriority===e.dvbPriority}))).length)return n.length>1&&(n.forEach((function(e){r+=e.dvbWeight,i.push(r)})),t=Math.floor(Math.random()*(r-1)),i.every((function(e,n){return a=n,!(t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0,i=NaN,a=function(){var a=e[r],o=t.findIndex((function(e){return e.serviceLocation&&e.serviceLocation===a}));if(-1!==o&&!n.contains(t[o].serviceLocation))return i=o,"break";r+=1};r0&&(n=i(r.defaultServiceLocationArray,e.baseUrls))}var a=t.getCurrentSteeringResponseData();return e.baseUrls&&e.baseUrls.length&&a&&a.pathwayPriority&&a.pathwayPriority.length&&(n=i(a.pathwayPriority,e.baseUrls)),n},setConfig:function(e){e.blacklistController&&(n=e.blacklistController),e.contentSteeringController&&(t=e.contentSteeringController)}},t=Kt(r).getInstance(),e}Pn.__dashjs_factory_name="ContentSteeringSelector";var Ln=c.Z.getClassFactory(Pn);function Fn(){var e,t,n,r,i,a,o=this.context,s=(0,u.Z)(o).getInstance(),c=(0,N.Z)(o).getInstance();function f(){t.reset()}return e={chooseSelector:function(e){(0,z.PS)(e,"boolean"),a=e?r:n},select:function(e){if(e){if(c.get().streaming.applyContentSteering){var t=i.selectBaseUrlIndex(e);isNaN(t)||-1===t||(e.selectedIdx=t)}if(!isNaN(e.selectedIdx))return e.baseUrls[e.selectedIdx];var r=a.select(e.baseUrls);return r?(e.selectedIdx=e.baseUrls.indexOf(r),r):(s.trigger(l.Z.URL_RESOLUTION_FAILED,{error:new S.Z(w.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,w.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(a===n&&f()))}},reset:f,setConfig:function(e){e.selector&&(a=e.selector),e.contentSteeringSelector&&(i=e.contentSteeringSelector)}},t=Bt(o).create({updateEventName:l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,addBlacklistEventName:l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD}),n=Mn(o).create({blacklistController:t}),r=Dn(o).create({blacklistController:t}),(i=Ln(o).create()).setConfig({blacklistController:t}),a=n,e}Fn.__dashjs_factory_name="BaseURLSelector";var xn=c.Z.getClassFactory(Fn);function kn(){var e,t,n,r,i,a=this.context,o=(0,u.Z)(a).getInstance(),s=(0,Q.Z)(a).getInstance();function c(e){n.update(e),r.chooseSelector(t.getIsDVB(e)),o.trigger(d.Z.BASE_URLS_UPDATED,{baseUrls:f(e)})}function f(e){return n.getBaseUrls(e)}return e={reset:function(){n.reset(),r.reset()},initialize:function(e){n.setConfig({adapter:t,contentSteeringController:i}),c(e)},resolve:function(e){var t=n.getForPath(e).reduce((function(e,t){var n=r.select(t);return n?(s.isRelative(n.url)?e.url=s.resolve(n.url,e.url):(e.url=n.url,e.serviceLocation=n.serviceLocation),e.availabilityTimeOffset=n.availabilityTimeOffset,e.availabilityTimeComplete=n.availabilityTimeComplete,e.queryParams=n.queryParams,e):new Se}),new Se);if(!s.isRelative(t.url))return t},setConfig:function(e){e.baseURLTreeModel&&(n=e.baseURLTreeModel),e.baseURLSelector&&(r=e.baseURLSelector),e.adapter&&(t=e.adapter),e.contentSteeringController&&(i=e.contentSteeringController)},getBaseUrls:f,update:c},n=Nn(a).create(),r=xn(a).create(),o.on(l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,(function(e){n.invalidateSelectedIndexes(e.entry)}),e),e}kn.__dashjs_factory_name="BaseURLController";var Un=c.Z.getClassFactory(kn);function Zn(e){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zn(e)}function Bn(e,t){return Bn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Bn(e,t)}function Gn(e,t){return!t||"object"!==Zn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function qn(e){return qn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},qn(e)}var Yn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bn(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=qn(t);if(n){var i=qn(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Gn(this,e)});function i(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(n=r.call(this)).url=e||null,n.type=t||null,n.mediaType=a.Z.STREAM,n.responseType="",n}return i}(p.Z);function jn(e){e=e||{};var t=this.context,n=(0,u.Z)(t).getInstance(),r=St(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,errors:w});return{load:function(e,t,i){var a=function(r,a){t.resolved=!0,t.resolvedContent=r||null,n.trigger(l.Z.XLINK_ELEMENT_LOADED,{element:t,resolveObject:i,error:r||a?null:new S.Z(w.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,w.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+e)})};if("urn:mpeg:dash:resolve-to-zero:2013"===e)a(null,!0);else{var o=new Yn(e,C.w.XLINK_EXPANSION_TYPE);r.load({request:o,success:function(e){a(e)},error:function(){a(null)}})}},reset:function(){r&&(r.abort(),r=null)}}}jn.__dashjs_factory_name="XlinkLoader";var Hn=c.Z.getClassFactory(jn),Vn=function(e){void 0===(e=e||{}).escapeMode&&(e.escapeMode=!0),void 0===e.attributePrefix&&(e.attributePrefix="_"),e.arrayAccessForm=e.arrayAccessForm||"none",e.emptyNodeForm=e.emptyNodeForm||"text",void 0===e.enableToStringFunc&&(e.enableToStringFunc=!0),e.arrayAccessFormPaths=e.arrayAccessFormPaths||[],void 0===e.skipEmptyTextNodesForObj&&(e.skipEmptyTextNodesForObj=!0),void 0===e.stripWhitespaces&&(e.stripWhitespaces=!0),e.datetimeAccessFormPaths=e.datetimeAccessFormPaths||[],void 0===e.useDoubleQuotes&&(e.useDoubleQuotes=!1),e.xmlElementsFilter=e.xmlElementsFilter||[],e.jsonPropertiesFilter=e.jsonPropertiesFilter||[],void 0===e.keepCData&&(e.keepCData=!1),void 0===e.ignoreRoot&&(e.ignoreRoot=!1);function t(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!=t||(t=e.nodeName),t}function n(e){return"string"==typeof e?e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):e}function r(e,t,n,r){for(var i=0;i0&&r(e.arrayAccessFormPaths,t,n,i)&&(t[n]=[t[n]])}function a(e){var t=e.split(/[-T:+Z]/g),n=new Date(t[0],t[1]-1,t[2]),r=t[5].split(".");if(n.setHours(t[3],t[4],r[0]),r.length>1&&n.setMilliseconds(r[1]),t[6]&&t[7]){var i=60*t[6]+Number(t[7]);i=0+("-"==(/\d\d-\d\d:\d\d$/.test(e)?"-":"+")?-1*i:i),n.setMinutes(n.getMinutes()-i-n.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(n=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())));return n}function o(t,n,i,a){return!(1==n&&e.xmlElementsFilter.length>0)||r(e.xmlElementsFilter,t,i,a)}function s(n,u){if(9==n.nodeType){for(var l=new Object,c=n.childNodes,f=0;f0){var o=i.split(".#")[0];return r(e.datetimeAccessFormPaths,t,n,o)?a(t):t}return t}(l.__text,h,u+"."+h)),null!=l["#cdata-section"]&&(l.__cdata=l["#cdata-section"],delete l["#cdata-section"],"property"==e.arrayAccessForm&&delete l["#cdata-section_asArray"]),0==l.__cnt&&"text"==e.emptyNodeForm?l="":1==l.__cnt&&null!=l.__text?l=l.__text:1!=l.__cnt||null==l.__cdata||e.keepCData?l.__cnt>1&&null!=l.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==l.__text||""==l.__text.trim())&&delete l.__text:l=l.__cdata,delete l.__cnt,!e.enableToStringFunc||null==l.__text&&null==l.__cdata||(l.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),l}if(3==n.nodeType||4==n.nodeType)return n.nodeValue}function u(t,r,i,a){var o="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+r;if(null!=i)for(var s=0;s":">")}function l(e,t){return""}function c(t,n){return"property"==e.arrayAccessForm&&(i="_asArray",-1!==(r=n.toString()).indexOf(i,r.length-i.length))||0==n.toString().indexOf(e.attributePrefix)||0==n.toString().indexOf("__")||t[n]instanceof Function;var r,i}function f(e){var t=0;if(e instanceof Object)for(var n in e)c(e,n)||t++;return t}function d(t,n,i){return 0==e.jsonPropertiesFilter.length||""==i||r(e.jsonPropertiesFilter,t,n,i)}function g(t){var n=[];if(t instanceof Object)for(var r in t)-1==r.toString().indexOf("__")&&0==r.toString().indexOf(e.attributePrefix)&&n.push(r);return n}function h(t){var r="";return t instanceof Object?r+=function(t){var r="";return null!=t.__cdata&&(r+=""),null!=t.__text&&(e.escapeMode?r+=n(t.__text):r+=t.__text),r}(t):null!=t&&(e.escapeMode?r+=n(t):r+=t),r}function p(e,t){return""===e?t:e+"."+t}function m(e,t,n,r){var i="";if(0==e.length)i+=u(e,t,n,!0);else for(var a=0;a0)for(var r in e)if(!c(e,r)&&(""==t||d(e,r,p(t,r)))){var i=e[r],a=g(i);null==i||null==i?n+=u(i,r,a,!0):i instanceof Object?i instanceof Array?n+=m(i,r,a,t):i instanceof Date?(n+=u(i,r,a,!1),n+=i.toISOString(),n+=l(i,r)):f(i)>0||null!=i.__text||null!=i.__cdata?(n+=u(i,r,a,!1),n+=y(i,p(t,r)),n+=l(i,r)):n+=u(i,r,a,!0):(n+=u(i,r,a,!1),n+=h(i),n+=l(i,r))}return n+h(e)}this.parseXmlString=function(e){var t;if(window.ActiveXObject||window,void 0===e)return null;if(window.DOMParser){var n=new window.DOMParser;try{(t=n.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}}else 0==e.indexOf("")+2)),(t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e);return t},this.asArray=function(e){return void 0===e||null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?a(e):e},this.xml2json=function(e){return s(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return y(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}},Kn="onLoad";function zn(e){e=e||{};var t,n,r,i,a,s,c=this.context,f=(0,u.Z)(c).getInstance(),d=(0,Q.Z)(c).getInstance();function g(e,t,n){var r,i,a={};a.elements=e,a.type=t,a.resolveType=n,0===a.elements.length&&p(a);for(var o=0;o")+2),r=t.resolvedContent.substr(0,i)+""+t.resolvedContent.substr(i)+"",t.resolvedContent=a.xml_str2json(r)}(function(e){var t;for(t=0;t=0;o--){if(n=(t=e.elements[o]).type+"_asArray",t.resolvedContent){if(t.resolvedContent)for(s=0;s0&&r.run(i)}(e),"onActuate"===e.resolveType&&f.trigger(l.Z.XLINK_READY,{manifest:i}),e.resolveType===Kn)switch(e.type){case o.Z.PERIOD:for(t=0;t=0;a--)(i=e[a]).hasOwnProperty("xlink:href")&&"urn:mpeg:dash:resolve-to-zero:2013"===i["xlink:href"]&&e.splice(a,1);for(a=0;a=0}return!1}),(function(e){return String(e)}))}return i}(er);function sr(e){return sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sr(e)}function ur(e,t){return ur=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ur(e,t)}function lr(e,t){return!t||"object"!==sr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function cr(e){return cr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},cr(e)}var fr=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,dr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ur(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=cr(t);if(n){var i=cr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return lr(this,e)});function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.call(this,(function(e){for(var t=[o.Z.MIN_BUFFER_TIME,o.Z.MEDIA_PRESENTATION_DURATION,o.Z.MINIMUM_UPDATE_PERIOD,o.Z.TIMESHIFT_BUFFER_DEPTH,o.Z.MAX_SEGMENT_DURATION,o.Z.MAX_SUBSEGMENT_DURATION,o.Z.SUGGESTED_PRESENTATION_DELAY,o.Z.START,a.Z.START_TIME,o.Z.DURATION],n=t.length,r=0;r=0}return!1}),(function(e){return _n()(e)||String(e)}))}return i}(er);function Or(e,t){for(var n=0;n-1?(p&&(t=p.createMssParser(),p.createMssFragmentProcessor(),p.registerEvents()),t):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?Vr(c).create({debug:f}):t}return t={load:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=new Date,u=new Yn(e,C.w.MPD_TYPE);t&&(u.serviceLocation=t),a&&(u.queryParams=a),u.requestStartDate||(u.requestStartDate=o),g.trigger(l.Z.MANIFEST_LOADING_STARTED,{request:u}),r.load({request:u,success:function(t,r,a){var o,u,c;if(i)if(a&&a!==e?(u=h.parseBaseUrl(a),o=a):(h.isRelative(e)&&(e=h.resolve(e,window.location.href)),u=h.parseBaseUrl(e)),"No Content"!=r)if(null===s&&(s=E(t)),null!==s){i.setMatchers(s.getMatchers()),i.setIron(s.getIron());try{c=s.parse(t)}catch(t){return void g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}if(c){if(c.url=o||e,c.originalUrl||(c.originalUrl=c.url),d&&d.get().streaming.enableManifestDurationMismatchFix&&c.mediaPresentationDuration&&c.Period_asArray.length>1){var f=c.Period_asArray.reduce((function(e,t){return e+t.duration}),0);!isNaN(f)&&c.mediaPresentationDuration>f&&(n.warn("Media presentation duration greater than duration of all periods. Setting duration to total period duration"),c.mediaPresentationDuration=f)}c.baseUri=u,c.loadedTime=new Date,i.resolveManifestOnLoad(c),g.trigger(l.Z.ORIGINAL_MANIFEST_LOADED,{originalManifest:t})}else g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}else g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))});else g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,r){g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+"".concat(e,", ").concat(r))})}})},reset:function(){g.off(l.Z.XLINK_READY,y,t),p&&p.reset(),i&&(i.reset(),i=null),r&&(r.abort(),r=null)}},n=f.getLogger(t),g.on(l.Z.XLINK_READY,y,t),r=St(c).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,urlUtils:h,constants:a.Z,dashConstants:o.Z,errors:w,requestTimeout:e.settings.get().streaming.manifestRequestTimeout}),i=Wn(c).create({errHandler:m,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),s=null,t}Kr.__dashjs_factory_name="ManifestLoader";var zr=c.Z.getClassFactory(Kr);function Wr(){var e=this.context,t=(0,u.Z)(e).getInstance();return{error:function(e){t.trigger(l.Z.ERROR,{error:e})}}}Wr.__dashjs_factory_name="ErrorHandler";var Xr=c.Z.getSingletonFactory(Wr),Qr=n(1715);function Jr(){var e,t,n,r,i,o,s=this.context,c=(0,u.Z)(s).getInstance();function d(e,r){if(!r||!r.Period_asArray||0===r.Period_asArray.length)return Promise.resolve();var i=[];return r.Period_asArray.forEach((function(r){i.push(function(e,r){return new Promise((function(i){if(e&&e.AdaptationSet_asArray&&0!==e.AdaptationSet_asArray.length){var s=[];e.AdaptationSet_asArray.forEach((function(e){t.getIsTypeOf(e,r)&&s.push(function(e,r){return new Promise((function(i){if(e.Representation_asArray&&0!==e.Representation_asArray.length){var s=[],u=[];e.Representation_asArray.forEach((function(i,o){var l=t.getCodec(e,o,!1),c=function(e,t,n){switch(e){case a.Z.VIDEO:return function(e,t){return{codec:t,width:e.width||null,height:e.height||null,framerate:e.frameRate||null,bitrate:e.bandwidth||null}}(t,n);case a.Z.AUDIO:return function(e,t){var n=e.audioSamplingRate||null;return{codec:t,bitrate:e.bandwidth||null,samplerate:n}}(t,n);default:return null}}(r,i,l);u.push(c),s.push(n.supportsCodec(c,r))})),Promise.all(s).then((function(t){e.Representation_asArray=e.Representation_asArray.filter((function(e,n){return t[n]||o.debug("[Stream] Codec ".concat(u[n].codec," not supported ")),t[n]})),i()})).catch((function(){i()}))}else i()}))}(e,r))})),Promise.all(s).then((function(){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){var t=e.Representation_asArray&&e.Representation_asArray.length>0;return t||(c.trigger(l.Z.ADAPTATION_SET_REMOVED_NO_CAPABILITIES,{adaptationSet:e}),o.warn("AdaptationSet has been removed because of no supported Representation")),t})),i()})).catch((function(){i()}))}else i()}))}(r,e))})),Promise.all(i)}return e={setConfig:function(e){e&&(e.adapter&&(t=e.adapter),e.capabilities&&(n=e.capabilities),e.settings&&(r=e.settings),e.customParametersModel&&(i=e.customParametersModel))},filterUnsupportedFeatures:function(e){return new Promise((function(s){var u=[];u.push(d(a.Z.VIDEO,e)),u.push(d(a.Z.AUDIO,e)),Promise.all(u).then((function(){r.get().streaming.capabilities.filterUnsupportedEssentialProperties&&function(e){e&&e.Period_asArray&&0!==e.Period_asArray.length&&e.Period_asArray.forEach((function(e){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){var r=t.getEssentialPropertiesForRepresentation(e);if(r&&r.length>0)for(var i=0;i0)}))}))}(e),function(e){var t=i.getCustomCapabilitiesFilters();t&&0!==t.length&&e&&e.Period_asArray&&0!==e.Period_asArray.length&&e.Period_asArray.forEach((function(e){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){return!t.some((function(t){return!t(e)}))})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}))}(e),s()})).catch((function(){s()}))}))}},o=(0,f.Z)(s).getInstance().getLogger(e),e}Jr.__dashjs_factory_name="CapabilitiesFilter";var $r=c.Z.getSingletonFactory(Jr),ei=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null};function ti(){var e;return{initialize:function(t){if(e=new ei,!t)return null;var n=t.indexOf("#");if(-1!==n)for(var r=t.substr(n+1).split("&"),i=0,a=r.length;i0?(n&&t.warn("Supplied minimum playback rate is a positive value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):e1?(n&&t.warn("Supplied maximum playback rate is out of range and will be limited to ".concat(1,": ").concat(200,"% playback speed.")),1):e}function u(){var e=a.get().streaming.buffer.stableBufferTime>0?a.get().streaming.buffer.stableBufferTime:a.get().streaming.buffer.fastSwitchEnabled?20:12,t=n.getLiveDelay();return!isNaN(t)&&t>0?Math.min(e,t):e}return e={getCatchupMaxDrift:function(){if(!isNaN(a.get().streaming.liveCatchup.maxDrift)&&a.get().streaming.liveCatchup.maxDrift>0)return a.get().streaming.liveCatchup.maxDrift;var e=r.getServiceDescriptionSettings();return e&&e.liveCatchup&&!isNaN(e.liveCatchup.maxDrift)&&e.liveCatchup.maxDrift>0?e.liveCatchup.maxDrift:12},getCatchupModeEnabled:function(){return null!==a.get().streaming.liveCatchup.enabled?a.get().streaming.liveCatchup.enabled:n.getInitialCatchupModeActivated()},getStableBufferTime:u,getInitialBufferLevel:function(){var e=a.get().streaming.buffer.initialBufferLevel;return isNaN(e)||e<0?0:Math.min(u(),e)},getRetryAttemptsForType:function(e){var t=isNaN(a.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:a.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return n.getLowLatencyModeEnabled()?a.get().streaming.retryAttempts[e]*t:a.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){var t=isNaN(a.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:a.get().streaming.retryIntervals.lowLatencyReductionFactor;return n.getLowLatencyModeEnabled()?a.get().streaming.retryIntervals[e]/t:a.get().streaming.retryIntervals[e]},getCatchupPlaybackRates:function(e){var t=a.get().streaming.liveCatchup.playbackRate;if(!isNaN(t.min)||!isNaN(t.max))return{min:o(t.min,e),max:s(t.max,e)};var n=r.getServiceDescriptionSettings();if(n&&n.liveCatchup&&(!isNaN(n.liveCatchup.playbackRate.min)||!isNaN(n.liveCatchup.playbackRate.max))){var i=n.liveCatchup.playbackRate;return{min:o(i.min,e),max:s(i.max,e)}}return{min:-.5,max:.5}},getAbrBitrateParameter:function(e,t){try{var n=a.get().streaming.abr[e][t];if(!isNaN(n)&&-1!==n)return n;var i=r.getServiceDescriptionSettings();return i&&i[e]&&!isNaN(i[e][t])?i[e][t]:-1}catch(e){return-1}},setConfig:function(e){e.playbackController&&(n=e.playbackController),e.serviceDescriptionController&&(r=e.serviceDescriptionController)},reset:function(){}},t=(0,f.Z)(i).getInstance().getLogger(e),e}oi.__dashjs_factory_name="MediaPlayerModel";var si=c.Z.getSingletonFactory(oi),ui=n(1767);function li(e){var t=(e=e||{}).abrController,n=e.switchHistory,r=e.droppedFramesHistory,i=e.currentRequest,a=e.useBufferOccupancyABR,o=e.useL2AABR,s=e.useLoLPABR,u=e.streamProcessor?e.streamProcessor.getScheduleController():null,l=e.streamProcessor?e.streamProcessor.getRepresentationInfo():null,c=e.videoModel?e.videoModel:null;function f(){return l?l.mediaInfo:null}return{getMediaType:function(){var e=f();return e?e.type:null},getMediaInfo:f,getDroppedFramesHistory:function(){return r},getCurrentRequest:function(){return i},getSwitchHistory:function(){return n},getStreamInfo:function(){var e=f();return e?e.streamInfo:null},getScheduleController:function(){return u},getAbrController:function(){return t},getRepresentationInfo:function(){return l},useBufferOccupancyABR:function(){return a},useL2AABR:function(){return o},useLoLPABR:function(){return s},getVideoModel:function(){return c}}}li.__dashjs_factory_name="RulesContext";var ci=c.Z.getClassFactory(li),fi=n(2068);function di(){var e=[],t=[];return{push:function(n){n.newValue===fi.Z.NO_CHANGE&&(n.newValue=n.oldValue),e[n.oldValue]||(e[n.oldValue]={noDrops:0,drops:0,dropSize:0});var r=n.newValue-n.oldValue,i=r<0?1:0,a=i?-r:0,o=i?0:1;if(e[n.oldValue].drops+=i,e[n.oldValue].dropSize+=a,e[n.oldValue].noDrops+=o,t.push({idx:n.oldValue,noDrop:o,drop:i,dropSize:a}),t.length>8){var s=t.shift();e[s.idx].drops-=s.drop,e[s.idx].dropSize-=s.dropSize,e[s.idx].noDrops-=s.noDrop}},getSwitchRequests:function(){return e},reset:function(){e=[],t=[]}}}di.__dashjs_factory_name="SwitchRequestHistory";var gi=c.Z.getClassFactory(di);function hi(){var e={},t={},n={};return{push:function(r,i,a){if(i){e[r]||(e[r]=[],t[r]=0,n[r]=0);var o=a&&a.droppedVideoFrames?a.droppedVideoFrames:0,s=a&&a.totalVideoFrames?a.totalVideoFrames:0,u=o-t[r];t[r]=o;var l=s-n[r];n[r]=s;var c=e[r];isNaN(i)||(c[i]?(c[i].droppedVideoFrames+=u,c[i].totalVideoFrames+=l):c[i]={droppedVideoFrames:u,totalVideoFrames:l})}},getFrameHistory:function(t){return e[t]},clearForStream:function(r){try{delete e[r],delete t[r],delete n[r]}catch(e){}},reset:function(){e={},t={},n={}}}}hi.__dashjs_factory_name="DroppedFramesHistory";var pi=c.Z.getClassFactory(hi);function mi(e){var t,n,r,i,o,s=this.context,l=(e=e||{}).settings,c=(0,u.Z)(s).getInstance();function f(e,t,n,r){var i=Math.pow(.5,n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;var a=Math.pow(.5,n/r.slow);e.slowEstimate=(1-a)*t+a*e.slowEstimate,e.totalWeight+=n}function g(e,s,u){return l.get().streaming.abr.movingAverageMethod!==a.Z.MOVING_AVERAGE_SLIDING_WINDOW?function(e,t){var n=e?o.throughputHalfLife:o.latencyHalfLife,a=e?r[t]:i[t];if(!a||a.totalWeight<=0)return NaN;var s=a.fastEstimate/(1-Math.pow(.5,a.totalWeight/n.fast)),u=a.slowEstimate/(1-Math.pow(.5,a.totalWeight/n.slow));return e?Math.min(s,u):Math.max(s,u)}(e,s):function(e,r,i){var a=function(e,r,i){var a,o;if(e?(a=t[r],o=i?3:4):(a=n[r],o=4),a){if(o>=a.length)o=a.length;else if(e)for(var s=1;s=1.3||u<=1/1.3)&&(o+=1)===a.length)break}}else o=0;return o}(e,r,i),o=(e?t:n)[r];return 0!==a&&o&&0!==o.length?(o=o.slice(-a)).reduce((function(e,t){return e+t}))/o.length:NaN}(e,s,u)}function h(e,t){return g(!0,e,t)}function p(e){t[e]=t[e]||[],n[e]=n[e]||[],r[e]=r[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},i[e]=i[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function m(){t={},n={},r={},i={}}var y={push:function(e,s,u){if(s.trace&&s.trace.length){var g,h=s.tresponse.getTime()-s.trequest.getTime()||1,m=s._tfinish.getTime()-s.tresponse.getTime()||1,y=s.trace.reduce((function(e,t){return e+t.b[0]}),0),E=0;if(0!==(g=s._fileLoaderType&&s._fileLoaderType===a.Z.FILE_LOADER_TYPES.FETCH?s.trace.reduce((function(e,t){return e+t.d}),0):u?m:h+m)&&(E=Math.round(8*y/g)),s.cmsd){var v=s.cmsd.dynamic&&s.cmsd.dynamic.etp?s.cmsd.dynamic.etp:null;if(v){var _=l.get().streaming.cmsd.abr.etpWeightRatio;_>0&&_<=1&&(E=E*(1-_)+v*_)}}if(p(e),function(e,t,n){return e===a.Z.VIDEO?n0&&!t[e].hasCachedEntries)return;t[e].hasCachedEntries=!0}else t[e]&&t[e].hasCachedEntries&&function(e){delete t[e],delete n[e],delete r[e],delete i[e],p(e)}(e);t[e].push(E),c.trigger(d.Z.THROUGHPUT_MEASUREMENT_STORED,{throughput:E,mediaType:e,httpRequest:s}),t[e].length>20&&t[e].shift(),n[e].push(h),n[e].length>20&&n[e].shift(),f(r[e],E,.001*m,o.throughputHalfLife),f(i[e],h,1,o.latencyHalfLife)}},getAverageThroughput:h,getSafeAverageThroughput:function(e,t){var n=h(e,t);return isNaN(n)||(n*=l.get().streaming.abr.bandwidthSafetyFactor),n},getAverageLatency:function(e){return g(!1,e)},reset:m};return o={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},m(),y}mi.__dashjs_factory_name="ThroughputHistory";var yi=c.Z.getClassFactory(mi);function Ei(){var e,t,n,r,i,o,c,g,h,p,m,y,E,v,_,S,b,A,I,R,w,N,D,O,M,P,L,F=this.context,x=(0,f.Z)(F).getInstance(),k=(0,u.Z)(F).getInstance();function U(){i={},o={},g={},c={},R={},D={},O={},M={},void 0===p&&(p=!1),w&&w.reset(),I=void 0,w=void 0,N=void 0,clearTimeout(h),h=null}function Z(t){var i=t.request.mediaType,a=t.streamId;if(i&&a&&c[a]&&L.get().streaming.abr.autoSwitchBitrate[i]){var o=c[a][i];if(o){var u=ci(F).create({abrController:e,streamProcessor:o,currentRequest:t.request,useBufferOccupancyABR:D[i],useL2AABR:O[i],useLoLPABR:M[i],videoModel:v}),l=n.shouldAbandonFragment(u,a);l.quality>fi.Z.NO_CHANGE&&o.getFragmentModel().getRequests({state:T.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(g[a][i].state=s.Z.ABANDON_LOAD,R[a][i].reset(),R[a][i].push({oldValue:j(i,a),newValue:l.quality,confidence:1,reason:l.reason}),H(i,r.getActiveStreamInfo(),l.quality,l.reason),clearTimeout(h),h=setTimeout((function(){g[a][i].state=s.Z.ALLOW_LOAD,h=null}),L.get().streaming.abandonLoadTimeout))}}}function B(e){e.mediaType===a.Z.VIDEO&&(void 0!==I&&w.push(e.streamId,I,v.getPlaybackQuality()),I=e.newQuality)}function G(e){var n,r;e.metric!==s.Z.HTTP_REQUEST||!e.value||e.value.type!==C.w.MEDIA_SEGMENT_TYPE||e.mediaType!==a.Z.AUDIO&&e.mediaType!==a.Z.VIDEO||N.push(e.mediaType,e.value,L.get().streaming.abr.useDeadTimeLatency),e.metric!==s.Z.BUFFER_LEVEL||e.mediaType!==a.Z.AUDIO&&e.mediaType!==a.Z.VIDEO||(n=e.mediaType,r=.001*e.value.level,L.get().streaming.abr.ABRStrategy===a.Z.ABR_STRATEGY_DYNAMIC&&function(e,n){try{var r=_.getStableBufferTime(),i=r,a=.5*r,o=D[e],s=n>(o?a:i);D[e]=s,s!==o&&(s?t.info("["+e+"] switching from throughput to buffer occupancy ABR rule (buffer: "+n.toFixed(3)+")."):t.info("["+e+"] switching from buffer occupancy to throughput ABR rule (buffer: "+n.toFixed(3)+")."))}catch(e){t.error(e)}}(n,r))}function q(e,n){try{var r;return i[n]=i[n]||{},i[n].hasOwnProperty(e)||(i[n][e]=0),r=function(e,t){var n=i[t][e],r=n;if(!c[t]||!c[t][e])return r;var a=Y(e,t);void 0!==a&&(r=Math.max(n,a));var o=function(e,t){try{var n=_.getAbrBitrateParameter("maxBitrate",e);return n>-1?W(c[t][e].getMediaInfo(),n,t):void 0}catch(e){return}}(e,t);return void 0!==o&&(r=Math.min(r,o)),r}(e,n),r=function(e,t,n){var r=i[n][t],a=L.get().streaming.abr.maxRepresentationRatio[t];return isNaN(a)||a>=1||a<0?e:Math.min(e,Math.round(r*a))}(r,e,n),r=function(e,t,n){if(t!==a.Z.VIDEO||!L.get().streaming.abr.limitBitrateByPortal||!c[n]||!c[n][t])return e;p||Q();var r=c[n][t].getStreamInfo(),i=E.getAdaptationForType(r.index,t,r).Representation_asArray,o=e;if(m>0&&y>0){for(;o>0&&i[o]&&m-1){var r=c[t][e].getMediaInfo(),i=X(r),a=W(r,n,t);return i[a]&&a1&&void 0!==arguments[1]?arguments[1]:null;try{return t||(t=r.getActiveStreamInfo().id),e&&c[t]&&c[t][e]&&t?(o[t]=o[t]||{},o[t].hasOwnProperty(e)||(o[t][e]=0),o[t][e]):0}catch(e){return 0}}function H(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t&&t.id&&e){var i=t.id,a=j(e,i);(0,z.SE)(n);var o=q(e,i);n!==a&&n>=0&&n<=o&&V(e,a,n,o,r,i)}}function V(e,n,r,i,a,s){if(e&&c[s]&&c[s][e]){var u=c[s][e].getStreamInfo(),f=u&&u.manifestInfo&&u.manifestInfo.isDynamic,d=P.getCurrentBufferLevel(e);t.info("Stream ID: "+s+" ["+e+"] switch from "+n+" to "+r+"/"+i+" (buffer: "+d+") "+(a?JSON.stringify(a):".")),o[s]=o[s]||{},o[s][e]=r;var g=K(s,e,r);k.trigger(l.Z.QUALITY_CHANGE_REQUESTED,{oldQuality:n,newQuality:r,reason:a,streamInfo:u,bitrateInfo:g,maxIdx:i,mediaType:e},{streamId:u.id,mediaType:e});var h=N.getAverageThroughput(e,f);isNaN(h)||A.setSavedBitrateSettings(e,h)}}function K(e,t,n){if(t&&c&&c[e]&&c[e][t]){var r=X(c[e][t].getMediaInfo());return r[n]?r[n]:null}return null}function W(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=e&&e.type?c[n][e.type].getRepresentationInfo():null;if(L.get().streaming.abr.useDeadTimeLatency&&r&&i&&i.fragmentDuration){r/=1e3;var a=i.fragmentDuration;if(r>a)return 0;var o=r/a;t*=1-o}for(var s=X(e),u=s.length-1;u>=0;u--){var l=s[u];if(1e3*t>=l.bitrate)return u}return 0}function X(e){var t=[];if(!e||!e.bitrateList)return t;for(var n,r=e.bitrateList,i=e.type,a=0,o=r.length;a1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t=r.getActiveStreamInfo().id),e&&c&&c[t]&&c[t][e]){var n=q(e,t),i=X(c[t][e].getMediaInfo());return i[n]?i[n]:null}return null},getMinAllowedIndexFor:Y,getMaxAllowedIndexFor:q,getInitialBitrateFor:function(e,t){if(function(){if(!A||!A.hasOwnProperty("getSavedBitrateSettings"))throw new Error(a.Z.MISSING_CONFIG_ERROR)}(),e===a.Z.TEXT)return NaN;var n=A.getSavedBitrateSettings(e),r=_.getAbrBitrateParameter("initialBitrate",e),i=L.get().streaming.abr.initialRepresentationRatio[e];if(-1===r)if(i>-1){var o=c[t][e].getStreamInfo(),s=E.getAdaptationForType(o.index,e,o).Representation_asArray;r=Array.isArray(s)?s[Math.max(Math.round(s.length*i)-1,0)].bandwidth/1e3:0}else r=isNaN(n)?e===a.Z.VIDEO?1e3:100:n;return r},getQualityFor:j,getAbandonmentStateFor:function(e,t){return g[e]&&g[e][t]?g[e][t].state:null},setPlaybackQuality:H,checkPlaybackQuality:function(t,r){try{if(!(t&&c&&c[r]&&c[r][t]))return!1;if(w){var i=v.getPlaybackQuality();i&&w.push(r,I,i)}if(!L.get().streaming.abr.autoSwitchBitrate[t])return!1;var a=j(t,r),o=ci(F).create({abrController:e,switchHistory:R[r][t],droppedFramesHistory:w,streamProcessor:c[r][t],currentValue:a,useBufferOccupancyABR:D[t],useL2AABR:O[t],useLoLPABR:M[t],videoModel:v}),u=Y(t,r),l=q(t,r),f=n.getMaxQuality(o),d=f.quality;return void 0!==u&&(d>fi.Z.NO_CHANGE?d:a)l&&(d=l),R[r][t].push({oldValue:a,newValue:d}),d>fi.Z.NO_CHANGE&&d!==a&&(g[r][t].state===s.Z.ALLOW_LOAD||d0}function y(){if(n&&m()&&0===n.playbackRate){var e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function E(e,t){n&&n.addEventListener(e,t)}function v(e,t){n&&n.removeEventListener(e,t)}function _(){return n?n.readyState:NaN}function T(){return n?n.buffered:null}function S(e,t,r,i,a){if(n)for(var o=0;o=e?(t(),null):function(e,t){var n=function n(){v(e,n),t(e)};return E(e,n),{func:n,event:e}}(Ti.get(e),t)}return e={addEventListener:E,addTextTrack:function(e,t,r,i,a){if(!n)return null;var o=S(e,t,r,i,a);return o||((o=n.addTextTrack(e,t,r)).isEmbedded=a,o.isTTML=i),o},appendChild:function(e){n&&(n.appendChild(e),void 0!==e.isTTML&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},getBufferRange:T,getClientHeight:function(){return n?n.clientHeight:NaN},getClientWidth:function(){return n?n.clientWidth:NaN},getElement:function(){return n},getEnded:function(){return n?n.ended:null},getPlaybackQuality:function(){if(!n)return null;var e="webkitDroppedFrameCount"in n&&"webkitDecodedFrameCount"in n,t=null;return"getVideoPlaybackQuality"in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},getPlaybackRate:function(){return n?n.playbackRate:null},getPlayedRanges:function(){return n?n.played:null},getReadyState:_,getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return o},getTextTrack:S,getTextTracks:function(){return n?n.textTracks:[]},getTime:function(){return n?isNaN(r)?n.currentTime:r:null},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetLeft:function(){if(n){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN}return NaN},getVideoRelativeOffsetTop:function(){if(n){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN}return NaN},getVideoWidth:function(){return n?n.videoWidth:NaN},getVttRenderingDiv:function(){return s},initialize:function(){g.on(l.Z.PLAYBACK_PLAYING,y,this)},isPaused:function(){return n?n.paused:null},isSeeking:function(){return n?n.seeking||!isNaN(r):null},isStalled:m,pause:function(){n&&(n.pause(),n.autoplay=!1)},play:function(){if(n){n.autoplay=!0;var e=n.play();e&&e.catch&&"undefined"!=typeof Promise&&e.catch((function(e){"NotAllowedError"===e.name&&g.trigger(l.Z.PLAYBACK_NOT_ALLOWED),t.warn("Caught pending play exception - continuing (".concat(e,")"))}))}},removeChild:function(e){n&&n.removeChild(e)},removeEventListener:v,reset:function(){clearTimeout(c),g.off(l.Z.PLAYBACK_PLAYING,y,this)},setCurrentTime:function(e,t){n&&(i&&i.func&&i.event&&v(i.event,i.func),r=e,i=b(a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(function(){if(n)if(n.currentTime!==r)try{r=t?function(e){var t=T(),n=e,r=9999999999;if(t)for(var i=0;i=a&&e<=o)return e;s1&&void 0!==arguments[1]&&arguments[1];n&&(!t&&n.readyState<=2&&e>0?n.addEventListener("canplay",p):n.playbackRate=e)},setSource:function(e){n&&(e?n.src=e:(n.removeAttribute("src"),n.load()))},setStallState:function(e,t){!function(e,t){t?function(e){null!==e&&n&&!n.seeking&&-1===h.indexOf(e)&&h.push(e)}(e):function(e){var t=h.indexOf(e);null!==e&&-1!==t&&h.splice(t,1)}(e)}(e,t)},setTTMLRenderingDiv:function(e){(o=e).style.position="absolute",o.style.display="flex",o.style.overflow="hidden",o.style.pointerEvents="none",o.style.top=0,o.style.left=0},setVttRenderingDiv:function(e){s=e},waitForReadyState:b,setDisableRemotePlayback:function(e){n&&(n.disableRemotePlayback=e)}},t=(0,f.Z)(d).getInstance().getLogger(e),r=NaN,e}Si.__dashjs_factory_name="VideoModel";var bi=c.Z.getSingletonFactory(Si),Ai=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}],Ii="dashjs_?_bitrate",Ri="dashjs_?_settings",wi="localStorage",Ni="lastBitrate",Ci="lastMediaSettings";function Di(e){e=e||{};var t,n,r,i=this.context,o=e.settings;function s(e){if(void 0!==r)return r;var t;r=!1;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return n.warn("DOMStorage access denied: "+e.message),r}if(!t||e!==wi&&"sessionStorage"!==e)return r;try{t.setItem("1","1"),t.removeItem("1"),r=!0}catch(e){n.warn("DOMStorage is supported, but cannot be used: "+e.message)}return r}function u(){var e=6e5;return Math.round((new Date).getTime()/e)*e}function l(e,t){return s(e)&&o.get().streaming[t+"CachingInfo"].enabled}function c(){if(!o)throw new Error(a.Z.MISSING_CONFIG_ERROR)}return t={getSavedBitrateSettings:function(e){if(c(),!o.get().streaming.lastBitrateCachingInfo.enabled)return NaN;var t=NaN;if(l(wi,Ni)){var r=Ii.replace(/\?/,e);try{var i=JSON.parse(localStorage.getItem(r))||{},a=(new Date).getTime()-parseInt(i.timestamp,10)>=o.get().streaming.lastBitrateCachingInfo.ttl||!1,s=parseFloat(i.bitrate);isNaN(s)||a?a&&localStorage.removeItem(r):(t=s,n.debug("Last saved bitrate for "+e+" was "+s))}catch(e){return null}}return t},setSavedBitrateSettings:function(e,t){if(l(wi,Ni)&&t){var r=Ii.replace(/\?/,e);try{localStorage.setItem(r,JSON.stringify({bitrate:t.toFixed(3),timestamp:u()}))}catch(e){n.error(e.message)}}},getSavedMediaSettings:function(e){if(c(),!o.get().streaming.lastMediaSettingsCachingInfo.enabled)return null;var t=null;if(l(wi,Ci)){var n=Ri.replace(/\?/,e);try{var r=JSON.parse(localStorage.getItem(n))||{},i=(new Date).getTime()-parseInt(r.timestamp,10)>=o.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;t=r.settings,i&&(localStorage.removeItem(n),t=null)}catch(e){return null}}return t},setSavedMediaSettings:function(e,t){if(l(wi,Ci)){var r=Ri.replace(/\?/,e);try{localStorage.setItem(r,JSON.stringify({settings:t,timestamp:u()}))}catch(e){n.error(e.message)}}}},n=(0,f.Z)(i).getInstance().getLogger(t),s(wi)&&Ai.forEach((function(e){var t=localStorage.getItem(e.oldKey);if(t){localStorage.removeItem(e.oldKey);try{localStorage.setItem(e.newKey,t)}catch(e){n.error(e.message)}}})),t}Di.__dashjs_factory_name="DOMStorage";var Oi=c.Z.getSingletonFactory(Di),Mi=n(2032),Pi=n(2011);function Li(){var e,t,n,r,i,a,o,s,u,l,c,f,d,g=this.context;function h(e,n,i,a){var o=null,u=e?d.resolve(e.path):null,l=a||{init:!0,url:u?u.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:n};t.debug("Start searching for initialization.");var c=E(l);s.load({request:c,success:function(t){if(l.bytesLoaded=l.range.end,!(o=r.findInitRange(t)))return l.range.end=l.bytesLoaded+l.bytesToLoad,h(e,n,i,l);e.range=o,i(e)},error:function(){i(e)}}),t.debug("Perform init search: "+l.url)}function m(e,n,i,a,o,u){if(i&&(void 0===i.start||void 0===i.end)){var l=i?i.toString().split("-"):null;i=l?{start:parseFloat(l[0]),end:parseFloat(l[1])}:null}o=o||y;var c=null,f=null,g=!!i,h=e?d.resolve(e.path):null,p={init:!1,url:h?h.url:void 0,range:g?i:{start:0,end:1500},searching:!g,bytesLoaded:u?u.bytesLoaded:0,bytesToLoad:1500,mediaType:n},v=E(p);s.load({request:v,success:function(i){var s=p.bytesToLoad,u=i.byteLength;if(p.bytesLoaded=p.range.end-p.range.start,c=r.parse(i),(f=c.getBox("sidx"))&&f.isComplete){var l,d,g=f.references;if(null!=g&&g.length>0&&(l=1===g[0].reference_type),l){var h,y,E,v;t.debug("Initiate multiple SIDX load."),p.range.end=p.range.start+f.size;var _=[],T=0,S=(f.offset||p.range.start)+f.size,b=function(t){t?(_=_.concat(t),++T>=y&&(_.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),o(_,e,a))):o(null,e,a)};for(h=0,y=g.length;h16777215?(n.getUint32(r)!==e.tag&&(i=!1),a=4):e.tag>65535?(256*n.getUint16(r)+n.getUint8(r+2)!==e.tag&&(i=!1),a=3):e.tag>255?(n.getUint16(r)!==e.tag&&(i=!1),a=2):(n.getUint8(r)!==e.tag&&(i=!1),a=1),!i&&e.required&&!t)throw new Error("required tag not found");return i&&(r+=a),i}function a(e){var t=1,i=128,a=-1,o=0,s=n.getUint8(r),u=0;for(u=0;u<8;u+=1){if((s&i)===i){o=void 0===e?s&~i:s,a=u;break}i>>=1}for(u=0;u4)return function(e){for(var t=Math.floor(Number.MAX_SAFE_INTEGER/256),i=0,a=0;at)throw new Error("Value exceeds safe integer limit");i*=256;var o=n.getUint8(r+a);if(i>Number.MAX_SAFE_INTEGER-o)throw new Error("Value exceeds safe integer limit");i+=o}return r+=e,i}(e);for(var t=0,i=0;i>>0},moreData:function(){return r1&&a){var l=d(a,n);if(i[a.id]&&i[a.id][n])for(var f=0,g=u.length;f0))return u;s=r[0].mpd.manifest}var l=E(e,o),c=t.getAdaptationsForType(s,e?e.index:null,n);return u=f(s,l,e,c,n),n===a.TEXT&&(c=t.getAdaptationsForType(s,e?e.index:null,a.VIDEO),u=u.concat(f(s,l,e,c,n,!0))),u}function g(e){var n=h(e);return t.getRegularPeriods(n)}function h(e){var n=m(e);return t.getMpd(n)}function p(){r=[],i={}}function m(e){return e||(r.length>0?r[0].mpd.manifest:null)}function y(e){try{var n=E(e.streamInfo,r),i=t.getAdaptationsForPeriod(n);return e&&e.streamInfo&&void 0!==e.streamInfo.id&&i?i[e.index]:null}catch(e){return null}}function E(e,t){for(var n=t.length,r=0;r=0&&void 0!==s&&(n=t?"cea-608:"+t:"cea-608",u.embeddedCaptions=!0),n})),u.accessibilitiesWithSchemeIdUri=o,r=t.getAudioChannelConfigurationForAdaptation(l),u.audioChannelConfiguration=r.map((function(e){return e.value})),u.audioChannelConfigurationsWithSchemeIdUri=r,0===u.audioChannelConfiguration.length&&Array.isArray(l.Representation_asArray)&&l.Representation_asArray.length>0&&(i=t.getAudioChannelConfigurationForRepresentation(l.Representation_asArray[0]),u.audioChannelConfiguration=i.map((function(e){return e.value})),u.audioChannelConfigurationsWithSchemeIdUri=i),a=t.getRolesForAdaptation(l),u.roles=a.map((function(e){return e.value})),u.rolesWithSchemeIdUri=a,u.codec=t.getCodec(l),u.mimeType=t.getMimeType(l),u.contentProtection=t.getContentProtectionData(l),u.bitrateList=t.getBitrateListForAdaptation(l),u.selectionPriority=t.getSelectionPriority(l),u.contentProtection){var c=u.contentProtection.map((function(e){return t.getKID(e)})).filter((function(e){return null!==e}));if(c.length){var f=c[0];u.contentProtection.forEach((function(e){e.keyId=f}))}}if(u.isText=t.getIsText(l),u.supplementalProperties=t.getSupplementalPropertiesForAdaptation(l),(!u.supplementalProperties||0===Object.keys(u.supplementalProperties).length)&&Array.isArray(l.Representation_asArray)&&l.Representation_asArray.length>0){var d=l.Representation_asArray.map((function(e){return t.getSupplementalPropertiesForRepresentation(e)}));d.every((function(e){return JSON.stringify(e)===JSON.stringify(d[0])}))&&(u.supplementalProperties=d[0])}if(u.supplementalPropertiesAsArray=t.getSupplementalPropertiesAsArrayForAdaptation(l),(!u.supplementalPropertiesAsArray||0===u.supplementalPropertiesAsArray.length)&&Array.isArray(l.Representation_asArray)&&l.Representation_asArray.length>0){var g=l.Representation_asArray.map((function(e){return t.getSupplementalPropertiesAsArrayForRepresentation(e)}));g.every((function(e){return JSON.stringify(e)===JSON.stringify(g[0])}))&&(u.supplementalPropertiesAsArray=g[0])}return u.essentialProperties=t.getEssentialPropertiesForAdaptation(l),u.essentialPropertiesAsArray=t.getEssentialPropertiesAsArrayForAdaptation(l),u.isFragmented=t.getIsFragmented(l),u.isEmbedded=!1,u}function _(e,t,n){e.id=t,e.index=100+parseInt(t.substring(2,3)),e.type=a.TEXT,e.codec="cea-608-in-SEI",e.isEmbedded=!0,e.isFragmented=!1;var r=_n()(n);e.lang=r||n,e.roles=["caption"],e.rolesWithSchemeIdUri=[{schemeIdUri:"urn:mpeg:dash:role:2011",value:"caption"}]}function T(e){var n,r,i=new ji;return i.id=e.id,i.index=e.index,i.start=e.start,i.duration=e.duration,i.manifestInfo=(n=e.mpd,(r=new Hi).dvrWindowSize=n.timeShiftBufferDepth,r.loadedTime=n.manifest.loadedTime,r.availableFrom=n.availabilityStartTime,r.minBufferTime=n.manifest.minBufferTime,r.maxFragmentDuration=n.maxSegmentDuration,r.duration=t.getDuration(n.manifest),r.isDynamic=t.getIsDynamic(n.manifest),r.serviceDescriptions=t.getServiceDescriptions(n.manifest),r.protocol=n.manifest.protocol,r),i.isLast=1===e.mpd.manifest.Period_asArray.length||Math.abs(i.start+i.duration-i.manifestInfo.duration)<1,i}function S(){if(!a)throw new Error("setConfig function has to be called previously")}function b(e){return r.length>0?r[0].mpd.manifest.Period_asArray[e]:null}function A(e,t,n){var r,i,a,o,s;if(e)for(r=e.AdaptationSet_asArray,o=0;o0?e.segments[0].duration:NaN),n.MSETimeOffset=e.MSETimeOffset,n.mediaInfo=v(e.adaptation),n}return null},getStreamsInfo:function(e,t){var n=[],i=r;if(e&&(S(),i=g(e)),i.length>0){(!t||t>i.length)&&(t=i.length);for(var a=0;a0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a},getProducerReferenceTimes:function(e,n){var i,a,o=E(e,r);return i=n?n.id:null,r.length>0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a?t.getProducerReferenceTimesForAdaptation(a):[]},getRealPeriodByIndex:function(e){return t.getRealPeriodForIndex(e,r[0].mpd.manifest)},getEssentialPropertiesForRepresentation:function(e){try{return t.getEssentialPropertiesForRepresentation(e)}catch(e){return[]}},getVoRepresentations:function(e){var n=y(e);return t.getRepresentationsForAdaptation(n)},getEventsFor:function(e,n,i){var a=[];if(r.length>0){var o=r[0].mpd.manifest;if(e instanceof ji){var s=E(e,r);a=t.getEventsForPeriod(s)}else if(e instanceof Yi){var u=E(i,r);a=t.getEventStreamForAdaptationSet(o,y(e),u)}else if(e instanceof qi){var l=E(i,r);a=t.getEventStreamForRepresentation(o,n,l)}}return a},getEvent:function(e,t,n,r){try{if(!e||!t||isNaN(n)||!r)return null;var i=e.scheme_id_uri,a=e.value;if(!t[i+"/"+a])return null;var o,s=new _e,u=e.timescale||1,l=r.adaptation.period.start,c=t[i+"/"+a],f=isNaN(r.presentationTimeOffset)?isNaN(c.presentationTimeOffset)?0:c.presentationTimeOffset:r.presentationTimeOffset,d=e.presentation_time_delta/u;o=0===e.version?l+n-f+d:l-f+d;var g=e.event_duration/u,h=e.id,p=e.message_data;return s.eventStream=c,s.eventStream.value=a,s.eventStream.timescale=u,s.duration=g,s.id=h,s.calculatedPresentationTime=o,s.messageData=p,s.presentationTimeDelta=d,s}catch(e){return null}},getMpd:h,setConfig:function(e){e&&(e.constants&&(a=e.constants),e.cea608parser&&(s=e.cea608parser),e.errHandler&&t.setConfig({errHandler:e.errHandler}),e.BASE64&&t.setConfig({BASE64:e.BASE64}))},updatePeriods:function(e){if(!e)return null;S(),r=g(e)},getIsTextTrack:function(e){return t.getIsText(e)},getUTCTimingSources:function(){var e=m();return t.getUTCTimingSources(e)},getSuggestedPresentationDelay:function(){var e=r.length>0?r[0].mpd:null;return t.getSuggestedPresentationDelay(e)},getAvailabilityStartTime:function(e){var n=h(e);return t.getAvailabilityStartTime(n)},getIsTypeOf:function(e,n){return t.getIsTypeOf(e,n)},getIsDynamic:function(e){var n=m(e);return t.getIsDynamic(n)},getDuration:function(e){var n=m(e);return t.getDuration(n)},getRegularPeriods:g,getContentSteering:function(e){return t.getContentSteering(e)},getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){var n=t.getPatchLocation(e),r=t.getPublishTime(e);return n&&0!==n.length&&r?n.filter((function(e){return isNaN(e.ttl)||r.getTime()+e.ttl>(new Date).getTime()})):[]},getManifestUpdatePeriod:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.getManifestUpdatePeriod(e,n)},getPublishTime:function(e){return t.getPublishTime(e)},getIsDVB:function(e){return t.hasProfile(e,"urn:dvb:dash:profile:dvb-dash:2014")},getIsPatch:function(e){return n.getIsPatch(e)},getBaseURLsFromElement:function(e){return t.getBaseURLsFromElement(e)},getRepresentationSortFunction:function(){return t.getRepresentationSortFunction()},getCodec:function(e,n,r){return t.getCodec(e,n,r)},getPeriodById:function(e){if(!e||0===r.length)return null;var t=r.filter((function(t){return t.id===e}));return t&&t.length>0?t[0]:null},setCurrentMediaInfo:function(e,t,n){i[e]=i[e]||{},i[e][t]=i[e][t]||{},i[e][t]=n},isPatchValid:function(e,r){var i=t.getId(e),a=n.getMpdId(r),o=t.getPublishTime(e),s=n.getPublishTime(r),u=n.getOriginalPublishTime(r);return!!(i&&a&&i==a&&o&&u&&o.getTime()==u.getTime()&&s&&o.getTime()1?i[r]=u:1==u.length?i[r]=u[0]:delete i[r+"_asArray"]}"add"!==t.action&&"replace"!==t.action||Object.keys(t.value).forEach((function(e){var n=t.value[e],a=i[e+"_asArray"]||[];if(0===a.length&&i[e]&&a.push(i[e]),0===a.length)a=n;else{var u=a.length;u=e==r&&-1!=o?o+(s?0:1)+("replace"==t.action?-1:0):s?0:a.length,a.splice.apply(a,[u,0].concat(n))}i[e+"_asArray"]=a,i[e]=1==a.length?a[0]:a}))}}}))},areMediaInfosEqual:c,reset:p},t=qe(u).getInstance(),n=Qi(u).getInstance(),p(),e}Ji.__dashjs_factory_name="DashAdapter";var $i=c.Z.getSingletonFactory(Ji);function ea(e,t){for(var n=0;nr.get().streaming.metrics.maxListDepth&&i[t].shift())}function m(e,t,n){p(e,t,n),g(e,t,n)}return t={clearCurrentMetricsForType:function(e){delete n[e],f(e)},clearAllCurrentMetrics:function(){n={},c()},getMetricsFor:h,addHttpRequest:function e(t,n,r,i,a,o,u,l,c,f,d,g,h,p,y,E,v){var _=new C.w;null!=o&&o!==i&&(e(t,null,r,i,a,null,null,l,c,null,null,null,h,null,null,E,v),_.actualurl=o),_.tcpid=n,_.type=r,_.url=i,_.range=l,_.trequest=c,_.tresponse=f,_.responsecode=g,_.cmsd=v,_._tfinish=d,_._stream=t,_._mediaduration=h,_._quality=a,_._responseHeaders=p,_._serviceLocation=u,_._fileLoaderType=E,y?y.forEach((function(e){!function(e,t,n,r){var i=new C.O;i.s=t,i.d=n,i.b=r,e.trace.push(i),e.interval||(e.interval=0),e.interval+=n}(_,e.s,e.d,e.b)})):(delete _.interval,delete _.trace),m(t,s.Z.HTTP_REQUEST,_)},addRepresentationSwitch:function(e,t,n,r,i){var a=new ra;a.t=t,a.mt=n,a.to=r,i?a.lto=i:delete a.lto,m(e,s.Z.TRACK_SWITCH,a)},addBufferLevel:function(e,t,n){var r=new ia;r.t=t,r.level=n,m(e,s.Z.BUFFER_LEVEL,r)},addBufferState:function(e,t,n){var r=new aa;r.target=n,r.state=t,m(e,s.Z.BUFFER_STATE,r)},addDVRInfo:function(e,t,n,r){var i=new oa;i.time=t,i.range=r,i.manifestInfo=n,m(e,s.Z.DVR_INFO,i)},addDroppedFrames:function(e,t){var n=new sa,r=h(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,r.length>0&&r[r.length-1]==n||m(e,s.Z.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,r,i,a,o,u,l){var c=new da;c.mediaType=e,c.t=t,c.type=n,c.startTime=r,c.availabilityStartTime=i,c.duration=a,c.quality=o,c.range=u,c.state=l,m(e,s.Z.SCHEDULING_INFO,c)},addRequestsQueue:function(e,t,n){var r=new ga;r.loadingRequests=t,r.executedRequests=n,h(e).RequestsQueue=r,g(e,s.Z.REQUESTS_QUEUE,r)},addManifestUpdate:function(e,t,n,r,i,o,u,l,c,f){var d=new la;d.mediaType=e,d.type=t,d.requestTime=n,d.fetchTime=r,d.availabilityStartTime=i,d.presentationStartTime=o,d.clientTimeOffset=u,d.currentTime=l,d.buffered=c,d.latency=f,p(a.Z.STREAM,s.Z.MANIFEST_UPDATE,d),g(e,s.Z.MANIFEST_UPDATE,d)},updateManifestUpdateInfo:function(e,t){if(e){for(var n in t)e[n]=t[n];d(e.mediaType,s.Z.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,r,i){if(e){var a=new ca;a.id=t,a.index=n,a.start=r,a.duration=i,e.streamInfo.push(a),d(e.mediaType,s.Z.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,r,i,a,o,u){if(e&&e.representationInfo){var l=new fa;l.id=t,l.index=n,l.streamIndex=r,l.mediaType=i,l.startNumber=o,l.fragmentInfoType=u,l.presentationTimeOffset=a,e.representationInfo.push(l),d(e.mediaType,s.Z.MANIFEST_UPDATE_TRACK_INFO,e)}},addPlayList:function(e){e.trace&&Array.isArray(e.trace)?e.trace.forEach((function(e){e.hasOwnProperty("subreplevel")&&!e.subreplevel&&delete e.subreplevel})):delete e.trace,m(a.Z.STREAM,s.Z.PLAY_LIST,e)},addDVBErrors:function(e){m(a.Z.STREAM,s.Z.DVB_ERRORS,e)}},n={},t}ha.__dashjs_factory_name="MetricsModel";var pa=c.Z.getSingletonFactory(ha);function ma(e){e=e||{};var t,n,r,i,o=this.context,u=e.metricsModel;function l(e){var t=u.getMetricsFor(e,!0);if(!t)return null;var n,r=t.HttpList,i=null;if(!r||r.length<=0)return null;for(n=r.length-1;n>=0;){if(r[n].responsecode){i=r[n];break}n--}return i}function c(e){var t=u.getMetricsFor(e,!0);return t&&t.HttpList?t.HttpList:[]}function f(e,t){if(!e)return null;var n=e[t];return n&&0!==n.length?n[n.length-1]:null}return t={getCurrentRepresentationSwitch:function(e){return f(u.getMetricsFor(e,!0),s.Z.TRACK_SWITCH)},getCurrentBufferState:function(e){return f(u.getMetricsFor(e,!0),s.Z.BUFFER_STATE)},getCurrentBufferLevel:function(e){var t=f(u.getMetricsFor(e,!0),s.Z.BUFFER_LEVEL);return t?ta.round10(t.level/1e3,-3):0},getCurrentHttpRequest:l,getHttpRequests:c,getCurrentDroppedFrames:function(){return f(u.getMetricsFor(a.Z.VIDEO,!0),s.Z.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return f(u.getMetricsFor(e,!0),s.Z.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return f(e?u.getMetricsFor(e,!0):u.getMetricsFor(a.Z.VIDEO,!0)||u.getMetricsFor(a.Z.AUDIO,!0),s.Z.DVR_INFO)},getCurrentManifestUpdate:function(){return f(u.getMetricsFor(a.Z.STREAM),s.Z.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){if(!t)return null;var n={},r=l(e);r&&(n=Ye.Z.parseHttpHeaders(r._responseHeaders));var i=n[t.toLowerCase()];return void 0===i?null:i},getLatestMPDRequestHeaderValueByID:function(e){if(!e)return null;var t,n,r,i={};for(r=(t=c(a.Z.STREAM)).length-1;r>=0;r--)if((n=t[r]).type===C.w.MPD_TYPE){i=Ye.Z.parseHttpHeaders(n._responseHeaders);break}var o=i[e.toLowerCase()];return void 0===o?null:o},addRepresentationSwitch:function(e,t,n,r,i){u.addRepresentationSwitch(e,t,n,r,i)},addDVRInfo:function(e,t,n,r){u.addDVRInfo(e,t,n,r)},updateManifestUpdateInfo:function(e){var t=this.getCurrentManifestUpdate();u.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){var t=this.getCurrentManifestUpdate();u.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){var n=this.getCurrentManifestUpdate();u.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){u.addManifestUpdate(a.Z.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,r,i,a){u.addHttpRequest(e.mediaType,null,e.type,e.url,e.quality,t,e.serviceLocation||null,e.range||null,e.requestStartDate,e.firstByteDate,e.requestEndDate,n,e.duration,r,i,e.fileLoaderType,a)},addSchedulingInfo:function(e,t){u.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){u.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){u.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){u.addBufferState(e,t,n)},addDroppedFrames:function(e){u.addDroppedFrames(a.Z.VIDEO,e)},addPlayList:function(){i&&(u.addPlayList(i),i=null)},addDVBErrors:function(e){u.addDVBErrors(e)},createPlaylistMetrics:function(e,t){(i=new $).start=new Date,i.mstart=e,i.starttype=t},createPlaylistTraceMetrics:function(e,t,i){!0===n&&(n=!1,(r=new ee).representationid=e,r.start=new Date,r.mstart=t,r.playbackspeed=null!==i?i.toString():null)},updatePlayListTraceMetrics:function(e){if(r)for(var t in r)r[t]=e[t]},pushPlayListTraceMetrics:function(e,t){if(!1===n&&i&&r&&r.start){var a=r.start,o=e.getTime()-a.getTime();r.duration=o,r.stopreason=t,i.trace.push(r),n=!0}},clearAllCurrentMetrics:function(){u.clearAllCurrentMetrics()}},u=u||pa(o).getInstance({settings:e.settings}),n=!0,r=null,i=null,t}ma.__dashjs_factory_name="DashMetrics";var ya=c.Z.getSingletonFactory(ma);function Ea(){var e,t,n,r,i=this.context,s=(0,u.Z)(i).getInstance(),c=(0,N.Z)(i).getInstance();function f(e){r=e}function g(e,t,n,r){var i,a=t.adaptation.period.mpd,o=a.availabilityStartTime;if(r)i=n&&a.timeShiftBufferDepth!==Number.POSITIVE_INFINITY?new Date(o.getTime()+1e3*(e+a.timeShiftBufferDepth)):a.availabilityEndTime;else if(n){var s=t.availabilityTimeOffset;i=new Date(o.getTime()+1e3*(e-s))}else i=o;return i}function h(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*r)/1e3}function p(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function m(e){var n={start:NaN,end:NaN},r=e[0].getAdapter().getRegularPeriods()[0],i=h(new Date,r);if(!e||0===e.length)return{range:n,now:i};e.forEach((function(e){var r=e.getAdapter(),s=r.getMediaInfoForType(e.getStreamInfo(),a.Z.VIDEO)||r.getMediaInfoForType(e.getStreamInfo(),a.Z.AUDIO),u=r.getVoRepresentations(s)[0],l={start:NaN,end:NaN};if(u)if(u.segmentInfoType===o.Z.SEGMENT_TIMELINE)l=function(e){var n,r,i,a,o=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],s=t.getRepresentationFor(e.index,o),u=s.SegmentTemplate||s.SegmentList,l=u.SegmentTimeline,c=u.timescale,f=l.S_asArray,d={start:0,end:0},g=f[0].t,h=!isNaN(g),m=h?g:0,y=0;for(h&&(d.start=p(m/c,e)),i=0,a=f.length;il.start)&&(n.start=l.start),!isNaN(l.end)&&(isNaN(n.end)||n.end2&&void 0!==arguments[2]&&arguments[2];try{for(var r=0,i=!1,a=NaN;!i&&r=t)?(a=t,i=!0):!n&&o.start>t&&(isNaN(a)||o.starta)&&(a=o.start+o.duration),r+=1}return a}catch(e){return t}}function v(e){void 0===e.offset||isNaN(e.offset)||f(e.offset/1e3)}function _(){r=0,n=0}function T(){s.off(l.Z.UPDATE_TIME_SYNC_OFFSET,v,this),_()}return e={initialize:function(){_(),s.on(l.Z.UPDATE_TIME_SYNC_OFFSET,v,this)},getClientTimeOffset:function(){return r},setClientTimeOffset:f,getClientReferenceTime:function(){return Date.now()-1e3*n+1e3*r},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return g(e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return g(e,t,n,!0)},calcPresentationTimeFromWallTime:h,calcPresentationTimeFromMediaTime:p,calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcWallTimeForSegment:function(e,t){var n,r,i;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},calcTimeShiftBufferWindow:function(e,t){if(!t)return function(e){var t={start:NaN,end:NaN},n=0,r=NaN;return e.forEach((function(e){var t=e.getStreamInfo();n+=t.duration,(isNaN(r)||t.start0&&(p.spans.push({name:m,line:T,row:c}),T="");var w="style_cea608_"+R.foreground+"_"+R.background;R.underline&&(w+="_underline"),R.italics&&(w+="_italics"),E.hasOwnProperty(w)||(E[w]=JSON.parse(JSON.stringify(R))),S=R,m=w}T+=I.uchar}T.trim().length>0&&p.spans.push({name:m,line:T,row:c}),g=!0,h=b}else g=!1,h=-1,d&&(d.p.push(p),p={start:s,end:u,spans:[]},d.y2=c,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null)}d&&(d.p.push(p),d.y2=c+1,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null);var N=[];for(c=0;c0){if(0!==f&&k!=U.row){var Z=document.createElement("br");Z.className="lineBreak",L.appendChild(Z)}var B=!1;k===U.row&&(B=!0),k=U.row;var G=E[U.name],q=document.createElement("span");q.className="spanPadding "+U.name+" customSpanColor",q.style.cssText=i(r,G),0!==f&&B?f===x.spans.length-1?q.textContent=o(U.line):q.textContent=U.line:x.spans.length>1&&f1&&e.isEmbedded?t=e.id&&e.id===a.Z.CC1:1===y.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===y.length&&(t=e.index===s[0].index),t}(e),t.isFragmented=e.isFragmented,t.isEmbedded=!!e.isEmbedded,t.isTTML=function(e){return e.codec&&e.codec.search(a.Z.STPP)>=0||e.mimeType&&e.mimeType.search(a.Z.TTML)>=0}(e),t.kind=function(e,t){var n=e.roles&&e.roles.length>0?t[e.roles[0]]:t.caption;return n=n===t.caption||n===t.subtitle?n:t.caption}(e,{subtitle:"subtitles",caption:"captions"}),D.addTextTrack(t)}function G(e){var t=e.chunk;t.mediaInfo.embeddedCaptions&&Y(t.bytes,t)}function q(e){m=e}function Y(e,s){var u=s.mediaInfo,l=u.type,f=u.mimeType,h=u.codec||f;h?-1!==u.codec.indexOf("application/mp4")?function(e,i,s){var u;if("InitializationSegment"===i.segmentType)d=!0,g=r.getMediaTimescaleFromMoov(e);else{if(!d)return;(u=r.getSamplesInfo(e).sampleList).length>0&&(p=u[0].cts-i.start*g),s.search(a.Z.STPP)>=0?function(e,r,i){var s,u;for(o=null!==o?o:V(i),s=0;s0&&D.addCaptions(m,0,s)}(e,u)}}(e,s,h):l===a.Z.VIDEO?function(e,t){var a,o;if(t.segmentType===C.w.INIT_SEGMENT_TYPE)0===E&&(E=r.getMediaTimescaleFromMoov(e));else if(t.segmentType===C.w.MEDIA_SEGMENT_TYPE){if(0===E)return void n.warn("CEA-608: No timescale for embeddedTextTrack yet");var s=(o=r.getSamplesInfo(e)).lastSequenceNumber,u=Math.trunc(t.start),l=Math.trunc(t.end);if(T[0]||T[1]||function(){for(var e,t=0;t0){o.cts!==u?l=0:l+=1;var g=H();n.fields[d].push([o.cts+g*E,f[d],l]),u=o.cts}return n.fields.forEach((function(e){e.sort((function(e,t){return e[0]===t[0]?e[2]-t[2]:e[0]-t[0]}))})),n}(e,o.sampleList),f=0;f=0?t=F.get().streaming.text.webvtt.customRenderingEnabled&&M?M:O:(e.search(a.Z.TTML)>=0||e.search(a.Z.STPP)>=0)&&(t=P),t}function K(e){y.forEach((function(t){var n=D.getTrackIdxForId(t.id);n>=0&&D.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return t={initialize:function(){U||(y=[],m=null,E=0,T=[],v=null,_=null,U=!0,b=Ca(x).getInstance(),k.on(l.Z.VIDEO_CHUNK_RECEIVED,G,t),k.on(l.Z.BUFFER_CLEARED,K,t))},addMediaInfos:function(e,n,r){if(s=s.concat(n),e===a.Z.TEXT&&n[0].isFragmented&&!n[0].isEmbedded){c=r,t.buffered=(0,wa.Z)(x).create(),h=R.getTracksFor(a.Z.TEXT,L.id).filter((function(e){return e.isFragmented}));for(var i=R.getCurrentTrackFor(a.Z.TEXT,L.id),o=0;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);nn/r?o=(s=t)/r*n:s=(o=e)/n*r;var u,l,c=0,f=0;return o/s>i?(f=s,c=s*i):(c=o,f=o/i),u=(e-c)/2,l=(t-f)/2,a?{x:u+.1*c,y:l+.1*f,w:.8*c,h:.8*f}:{x:u,y:l,w:c,h:f}}function M(e,t){var n=N.getClientWidth(),r=N.getClientHeight(),i=N.getVideoWidth(),a=N.getVideoHeight(),o=N.getVideoRelativeOffsetTop(),s=N.getVideoRelativeOffsetLeft();if(0!==i&&0!==a){var u=i/a,l=!1;e.isFromCEA608&&(u=3.5/3,l=!0);var f=O.call(this,n,r,i,a,u,l),y=f.w,E=f.h,T=f.x,b=f.y;if(y!=h||E!=p||T!=c||b!=g||t){if(c=T+s,g=b+o,h=y,p=E,m){var A=m.style;A&&(A.left=c+"px",A.top=g+"px",A.width=h+"px",A.height=p+"px",A.zIndex=v&&document[v]||_?S:null,w.trigger(d.Z.CAPTION_CONTAINER_RESIZE))}var I=e.activeCues;if(I)for(var R=I.length,C=0;C=e.startTime}function k(e,t){return!!D.get().streaming.text.extendSegmentedCues&&!!function(e,t,n){for(var r=0;r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(N.getTextTracks());try{for(n.s();!(e=n.n()).done;){var r=e.value;r.manualMode===a.Z.TEXT_SHOWING&&t.push(r)}}catch(e){n.e(e)}finally{n.f()}return t}function W(e){return e>=0&&i[e]?N.getTextTrack(i[e].kind,i[e].id,i[e].lang,i[e].isTTML,i[e].isEmbedded):null}function X(e){var t=this;if(e!==s){var n=W(s=e);Q.call(this,n),E&&(clearInterval(E),E=null),n&&"html"===n.renderingType&&(M.call(this,n,!0),window.ResizeObserver?(b=new window.ResizeObserver((function(){M.call(t,n,!0)}))).observe(N.getElement()):E=setInterval(M.bind(this,n),500))}}function Q(e){ie.call(this),e&&"html"===e.renderingType?ne.call(this):re.call(this)}function J(e,t){if(!e.cues)return!1;for(var n=0;n3&&void 0!==arguments[3])||arguments[3];return!!e&&(isNaN(t)||(r?e.startTime:e.endTime)>=t)&&(isNaN(n)||(r?e.endTime:e.startTime)<=n)}function ee(e,t,n){var r,i;if(!(n0?"native":"custom",o="native"===a?e.cues:e.manualCueList;if(!o||0===o.length)return;for(var s=o.length-1;s>=0;s--)!$(o[s],t,n,!0)||(r=o[s],void 0,i=N.getTime(),r.startTime>=i&&r.endTime<=i)||("native"===a?e.removeCue(o[s]):(K(o[s]),delete e.manualCueList[s]))}}function te(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e&&(e.cues||e.manualCueList)){var i=e.cues&&e.cues.length>0?"native":"custom",a="native"===i?e.cues:e.manualCueList;if(!a||0===a.length)return;for(var o=a.length-1,s=o;s>=0;s--)$(a[s],t,n,r)&&("native"===i?(a[s].onexit&&a[s].onexit(),e.removeCue(a[s])):(K(a[s]),delete e.manualCueList[s]))}}function ne(){var e=document.getElementById("native-cue-style");if(!e){(e=document.createElement("style")).id="native-cue-style",document.head.appendChild(e);var t=e.sheet,r=N.getElement();try{r&&(r.id?t.insertRule("#"+r.id+"::cue {background: transparent}",0):0!==r.classList.length?t.insertRule("."+r.className+"::cue {background: transparent}",0):t.insertRule("video::cue {background: transparent}",0))}catch(e){n.info(""+e.message)}}}function re(){var e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function ie(){if(m)for(;m.firstChild;)m.removeChild(m.firstChild)}return t={initialize:function(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(r=window.VTTCue||window.TextTrackCue,i=[],o=[],s=-1,c=0,g=0,h=0,p=0,m=null,y=null,E=null,_=!1,S=2147483647,T=null,A="requestAnimationFrame"in window,void 0!==document.fullscreenElement?v="fullscreenElement":void 0!==document.webkitIsFullScreen?v="webkitIsFullScreen":document.msFullscreenElement?v="msFullscreenElement":document.mozFullScreen&&(v="mozFullScreen"))},getStreamId:function(){return C.id},addTextTrack:function(e){i.push(e)},addCaptions:Z,createTracks:function(){var e=D.get().streaming.text.dispatchForManualRendering;i.sort((function(e,t){return e.index-t.index})),m=N.getTTMLRenderingDiv(),y=N.getVttRenderingDiv();for(var t,n,r,u,c,f,g=-1,h=0;h=0){w.on(d.Z.PLAYBACK_METADATA_LOADED,(function e(){var t=W(g);t&&"html"===t.renderingType&&M.call(this,t,!0),w.off(d.Z.PLAYBACK_METADATA_LOADED,e,this)}),this);for(var v=0;v0){var n=t[0].manualCueList;n&&n.length>0&&n.forEach((function(t){t.startTime<=e&&t.endTime>=e&&!t.isActive?(t.isActive=!0,D.get().streaming.text.dispatchForManualRendering?G(t):WebVTT.processCues(window,[t],y,t.cueID)):t.isActive&&(t.startTime>e||t.endTime0){var t=e[0].manualCueList;t&&t.length>0&&t.forEach((function(e){if(e.isActive)if(e.isActive=!1,D.get().streaming.text.dispatchForManualRendering)q(e);else if(y)for(var t=y.childNodes,n=0;n1){var n=e.split(/:/)[1],r=!1;n&&-1!=n.search(/%/)&&(r=!0,n=parseInt(n.replace(/%/,""),10)),(e.match(/align/)||e.match(/A/))&&(t.align=n),(e.match(/line/)||e.match(/L/))&&(t.line="auto"===n?n:parseInt(n,10),r&&(t.snapToLines=!1)),(e.match(/position/)||e.match(/P/))&&(t.position=n),(e.match(/size/)||e.match(/S/))&&(t.size=n)}})),t}function c(e,t){for(var n,i=t,a="",o="";""!==e[i]&&i1)for(var s=0;s0&&"WEBVTT"!==d&&d.match(r)){var g=u(d),h=g.cuePoints,p=g.styles,m=c(e,f+1),y=s(h[0].replace(i,"")),E=s(h[1].replace(i,""));!isNaN(y)&&!isNaN(E)&&y>=o&&E>y?""!==m?(o=y,l.push({start:y,end:E,data:m,styles:p})):t.error("Skipping cue due to empty/malformed cue text"):t.error("Skipping cue due to incorrect cue timing")}}return l},getCaptionStyles:l},t=(0,f.Z)(o).getInstance().getLogger(e),n=/(?:\r\n|\r|\n)/gm,r=/-->/,i=/(^[\s]+|[\s]+$)/g,a=/\s\b/g,e}ka.__dashjs_factory_name="VTTParser";var Ua=c.Z.getSingletonFactory(ka);function Za(){var e,t;return e={parse:function(e){var n=[];return t.oncue=function(e){e.start=e.startTime,e.end=e.endTime,e.data=e.text,e.styles={align:e.align,line:e.line,position:e.position,size:e.size},n.push(e)},t.parse(e),n}},function(){try{window&&window.WebVTT&&window.WebVTT.Parser&&(t=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()))}catch(e){}}(),e}Za.__dashjs_factory_name="VttCustomRenderingParser";var Ba=c.Z.getSingletonFactory(Za);function Ga(){var e,t,n=this.context,r=(0,u.Z)(n).getInstance(),i=0;return e={parse:function(e,n,a,o,s){var u,c,f,g="",h=[],p={},m={},y="",E="",v={onOpenTag:function(e,n,i){if(i[" imagetype"]&&!i[" imageType"]&&(r.trigger(d.Z.CONFORMANCE_VIOLATION,{level:on.LEVELS.ERROR,event:on.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[" imageType"]=i[" imagetype"]),"image"===n&&("http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"===e||"http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"===e)){if(!i[" imageType"]||"PNG"!==i[" imageType"].value)return void t.warn("smpte-tt imageType != PNG. Discarded");y=i["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){y&&(m[y]=E.trim()),E="",y=""},onText:function(e){y&&(E+=e)}};if(!e)throw g="no ttml data to parse",new Error(g);p.data=e,r.trigger(l.Z.TTML_TO_PARSE,p);var _=(0,Ma.fromXML)(p.data,(function(e){g=e}),v);r.trigger(l.Z.TTML_PARSED,{ttmlString:p.data,ttmlDoc:_});var T,S=_.getMediaTimeEvents();for(f=0;fe.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(n=c.resolve(u[0].path).url)}var f=e.essentialPropertiesAsArray.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===a.Z.FONT_DOWNLOAD_DVB_SCHEME})),d=e.supplementalPropertiesAsArray.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===a.Z.FONT_DOWNLOAD_DVB_SCHEME}));f.length>0?(o=!0,i=f):i=d,i.forEach((function(i){if(function(e){return!(!(e.value&&"1"===e.value&&e.dvbUrl&&e.dvbUrl.length>0&&e.dvbFontFamily&&e.dvbFontFamily.length>0&&e.dvbMimeType)||e.dvbMimeType!==a.Z.OFF_MIMETYPE&&e.dvbMimeType!==a.Z.WOFF_MIMETYPE)}(i)){var u=(l=i.dvbUrl,c=n,s.isPathAbsolute(l)?l:s.isRelative(l)?c?s.resolve(l,c):s.resolve(l):l);r.push({fontFamily:i.dvbFontFamily,url:u,mimeType:i.dvbMimeType,trackId:e.id,streamId:t,isEssential:o,status:"unloaded",fontFace:new FontFace(i.dvbFontFamily,"url(".concat(u,")"),{display:"swap"})})}var l,c}))}function h(e,t){var n=r[e];r[e]=ja(ja({},n),{},{status:t})}function p(){r=[]}return t={addFontsFromTracks:function(e,t){if(e&&Array.isArray(e)&&t)for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(r);try{for(t.s();!(e=t.n()).done;){var i=e.value,a=document.fonts.delete(i.fontFace);n.debug("Removal of fontFamily: ".concat(i.fontFamily," was ").concat(a?"successful":"unsuccessful"))}}catch(e){t.e(e)}finally{t.f()}}(),p()}},n=(0,f.Z)(i).getInstance().getLogger(t),p(),t}Ka.__dashjs_factory_name="DVBFonts";var za=c.Z.getClassFactory(Ka);function Wa(e){var t,n,r,i,o,s,c,g,h,p,m,y,E,v,_=this.context,T=e.adapter,S=e.errHandler,b=e.manifestModel,A=e.mediaController,I=e.baseURLController,R=e.videoModel,w=e.settings;function N(e){if(v.error("Could not download ".concat(e.isEssential?"an essential":"a"," font - fontFamily: ").concat(e.fontFamily,", url: ").concat(e.url)),e.isEssential){var t=i[e.streamId].getTrackIdxForId(e.trackId);i[e.streamId].setModeForTrackIdx(t,a.Z.TEXT_DISABLED)}}function C(e){if(v.debug("Successfully downloaded ".concat(e.isEssential?"an essential":"a"," font - fontFamily: ").concat(e.fontFamily,", url: ").concat(e.url)),e.isEssential){var t=i[e.streamId].getTrackIdxForId(e.trackId);t===i[e.streamId].getCurrentTrackIdx()?i[e.streamId].setModeForTrackIdx(t,a.Z.TEXT_SHOWING):i[e.streamId].setModeForTrackIdx(t,a.Z.TEXT_HIDDEN)}}function D(e){var t=e.tracks,r=e.index,o=e.streamId;if(!1===w.get().streaming.text.defaultEnabled&&!P()||y)L(o,-1);else{var s=A.getCurrentTrackFor(a.Z.TEXT,o);if(s){var u={lang:s.lang,role:s.roles[0],index:s.index,codec:s.codec,accessibility:s.accessibility[0]};t.some((function(e,t){if(A.matchSettings(u,e))return L(o,t),r=t,!0}))}h=!1}n[o].lastEnabledIndex=r,g.trigger(d.Z.TEXT_TRACKS_ADDED,{enabled:P(),index:r,tracks:t,streamId:o}),m=!0,E.addFontsFromTracks(t,o),E.getFonts().forEach((function(e){if(e.isEssential){var t=i[e.streamId].getTrackIdxForId(e.trackId);i[e.streamId].setModeForTrackIdx(t,a.Z.TEXT_DISABLED)}})),E.downloadFonts()}function O(e){try{var t=e.streamId;if(!i[t]||isNaN(e.time))return;i[t].manualCueProcessing(e.time)}catch(e){}}function M(e){try{var t=e.streamId;if(!i[t])return;i[t].disableManualTracks()}catch(e){}}function P(){var e=!0;return h&&!p&&(e=!1),e}function L(e,t){(h=-1===t)&&A&&A.saveTextSettingsDisabled();var n=F(e);if(n!==t&&i[e]){i[e].disableManualTracks();var o=i[e].getCurrentTrackInfo(),s=o?R.getTextTrack(o.kind,o.id,o.lang,o.isTTML,o.isEmbedded):null;s&&s.mode!==a.Z.TEXT_DISABLED&&i[e].setModeForTrackIdx(n,a.Z.TEXT_HIDDEN),i[e].setCurrentTrackIdx(t),o=i[e].getCurrentTrackInfo();var u=w.get().streaming.text.dispatchForManualRendering;o&&!u&&o.mode!==a.Z.TEXT_DISABLED&&i[e].setModeForTrackIdx(t,a.Z.TEXT_SHOWING),o&&o.isFragmented&&!o.isEmbedded?function(e,t,n){if(r[e])for(var o=r[e].getConfig().fragmentedTracks,s=0;s3&&void 0!==arguments[3]?arguments[3]:null,a=e.id;r[a]&&r[a].addMediaInfos(t,n,i)},reset:function(){E.reset(),x(),g.off(l.Z.TEXT_TRACKS_QUEUE_INITIALIZED,D,t),g.off(l.Z.DVB_FONT_DOWNLOAD_FAILED,N,t),g.off(l.Z.DVB_FONT_DOWNLOAD_COMPLETE,C,t),w.get().streaming.text.webvtt.customRenderingEnabled&&(g.off(l.Z.PLAYBACK_TIME_UPDATED,O,t),g.off(l.Z.PLAYBACK_SEEKING,M,t)),Object.keys(r).forEach((function(e){r[e].resetEmbedded(),r[e].reset()}))}},p=!1,m=!1,y=!1,o=Ua(_).getInstance(),s=Ba(_).getInstance(),c=qa(_).getInstance(),g=(0,u.Z)(_).getInstance(),v=(0,f.Z)(_).getInstance().getLogger(t),x(),t}Wa.__dashjs_factory_name="TextController";var Xa=c.Z.getClassFactory(Wa);function Qa(){var e,t,n,r,g,p,m,y,E,v,_,T,b,A,I,R,D,O,M,P,L,F,x,k,U,Z,B,G,q,Y,j,H,V,K,W,J,$,ee,te,ne="You must first call initialize() and set a source before calling this method",re="You must first call initialize() and set a valid source and view before calling this method",ie="You must first call attachView() to set the video element before calling this method",ae="You must first call attachSource() with a valid source before calling this method",oe="MediaPlayer not initialized!",se=this.context,ue=(0,u.Z)(se).getInstance(),le=(0,N.Z)(se).getInstance(),ce=(0,f.Z)(se).getInstance({settings:le});function fe(){Ie(null),be(null),r=null,A&&(A.reset(),A=null),I&&(I.reset(),I=null),P&&P.reset(),le.reset(),D&&(D.reset(),D=null)}function de(){return!!n&&!!J.getElement()}function ge(){return(0,Mi.e)()}function he(){if(!m)throw re;return G.isPaused()}function pe(){if(!m)throw re;return G.getIsDynamic()}function me(e){var t=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,n=H.getCurrentDVRInfo(t);if(!n)return 0;var r=G.getOriginalLiveDelay(),i=n.range.start+e;return i>n.range.end-r&&(i=n.range.end-r),i}function ye(e){if(!m)throw re;var t=Se().currentTime;if(void 0!==e)t=U.getTimeRelativeToStreamId(t,e);else if(G.getIsDynamic()){var n=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,r=H.getCurrentDVRInfo(n);t=null===r||0===t?0:Math.max(0,t-r.range.start)}return t}function Ee(){if(!m)throw re;var e=Se().duration;if(G.getIsDynamic()){var t=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,n=H.getCurrentDVRInfo(t);e=n?n.range.end-n.range.start:0}return e}function ve(e){(0,z.PS)(e,"boolean"),y=e}function _e(){P.restoreDefaultUTCTimingSources()}function Te(){return H}function Se(){if(!J.getElement())throw ie;return J.getElement()}function be(e){if(!g)throw oe;J.setElement(e),e&&(De(),function(){if(!I){var e=dashjs.MetricsReporting;if("function"==typeof e){var t=e(se).create();I=t.createMetricsReporting({debug:ce,eventBus:ue,mediaElement:Se(),adapter:O,dashMetrics:H,mediaPlayerModel:M,events:l.Z,constants:a.Z,metricsConstants:s.Z})}}}(),function(){if(!R){var e=dashjs.MssHandler;"function"==typeof e&&(w.extend(e.errors),R=e(se).create({eventBus:ue,mediaPlayerModel:M,dashMetrics:H,manifestModel:V,playbackController:G,streamController:U,protectionController:A,baseURLController:F,errHandler:L,events:l.Z,constants:a.Z,debug:ce,initSegmentType:C.w.INIT_SEGMENT_TYPE,BASE64:_a,ISOBoxer:Ta,settings:le}))}}(),U&&U.switchToVideoElement(E)),m&&we(),Pe(E)}function Ae(e){if(!p)throw ne;var t=U.getActiveStreamInfo();return t?b.getTracksFor(e,t.id):[]}function Ie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;if(!g)throw oe;"string"==typeof e&&$.initialize(e),null==t&&(t=NaN),isNaN(t)||(t=Math.max(0,t)),E=t,n=e,(p||m)&&we(),de()&&Pe(E)}function Re(){if(!p)throw ne;var e=U.getActiveStreamInfo();return e?U.getStreamById(e.id):null}function we(){m=!1,p=!1,O.reset(),U.reset(),B.reset(),j.reset(),G.reset(),q.reset(),Y.reset(),v.reset(),b.reset(),te.reset(),A&&(le.get().streaming.protection.keepProtectionMediaKeys?A.stop():(A.reset(),A=null,De())),Z.reset(),K.reset(),W.reset()}function Ne(){var e=Ce();U||(U=ln(se).getInstance()),Z||(Z=Xa(se).create({errHandler:L,manifestModel:V,adapter:O,mediaController:b,baseURLController:F,videoModel:J,settings:le})),k.setConfig({capabilities:x,customParametersModel:P,adapter:O,settings:le,manifestModel:V,errHandler:L}),U.setConfig({capabilities:x,capabilitiesFilter:k,manifestLoader:e,manifestModel:V,mediaPlayerModel:M,customParametersModel:P,protectionController:A,textController:Z,adapter:O,dashMetrics:H,errHandler:L,timelineConverter:T,videoModel:J,playbackController:G,serviceDescriptionController:q,contentSteeringController:Y,abrController:v,mediaController:b,settings:le,baseURLController:F,uriFragmentModel:$,segmentBaseController:te}),B.setConfig({settings:le,playbackController:G,streamController:U,videoModel:J,timelineConverter:T,adapter:O}),G.setConfig({streamController:U,serviceDescriptionController:q,dashMetrics:H,adapter:O,videoModel:J,timelineConverter:T,settings:le}),j.setConfig({streamController:U,playbackController:G,mediaPlayerModel:M,videoModel:J,settings:le}),v.setConfig({streamController:U,domStorage:ee,mediaPlayerModel:M,customParametersModel:P,cmsdModel:W,dashMetrics:H,adapter:O,videoModel:J,settings:le}),K.setConfig({abrController:v,dashMetrics:H,playbackController:G}),W.setConfig({}),v.initialize(),U.initialize(y,r),Z.initialize(),B.initialize(),j.initialize(),K.initialize(),W.initialize(),Y.initialize(),te.initialize()}function Ce(){return zr(se).create({debug:ce,errHandler:L,dashMetrics:H,mediaPlayerModel:M,requestModifier:(0,X.Z)(se).getInstance(),mssHandler:R,settings:le})}function De(){if(A)return A;var e=dashjs.Protection;if("function"==typeof e){var t=e(se).create();return l.Z.extend(e.events),d.Z.extend(e.events,{publicOnly:!0}),w.extend(e.errors),x||(x=(0,Qr.Z)(se).getInstance()),A=t.createProtectionSystem({debug:ce,errHandler:L,videoModel:J,customParametersModel:P,capabilities:x,eventBus:ue,events:l.Z,BASE64:_a,constants:a.Z,cmcdModel:K,settings:le})}return null}function Oe(){if(!g)throw oe;if(D)return D;var e=dashjs.OfflineController;if("function"==typeof e){l.Z.extend(e.events),d.Z.extend(e.events,{publicOnly:!0}),w.extend(e.errors);var t=Ce(),n=Qt(se).create();return n.setConfig({manifestModel:V,adapter:O,manifestLoader:t,errHandler:L,contentSteeringController:Y}),D=e(se).create({debug:ce,manifestUpdater:n,baseURLController:F,manifestLoader:t,manifestModel:V,mediaPlayerModel:M,abrController:v,playbackController:G,adapter:O,errHandler:L,dashMetrics:H,timelineConverter:T,segmentBaseController:te,schemeLoaderFactory:_,eventBus:ue,events:l.Z,errors:w,constants:a.Z,settings:le,dashConstants:o.Z,urlUtils:(0,Q.Z)(se).getInstance()})}return null}function Me(e){var t=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,n=H.getCurrentDVRInfo(t);return n?e+(n.manifestInfo.availableFrom.getTime()/1e3+n.range.start):0}function Pe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN;D&&D.resetRecords(),!p&&n&&(p=!0,t.info("Streaming Initialized"),Ne(),"string"==typeof n?U.load(n,e):U.loadWithManifest(n,e)),!m&&de()&&(m=!0,t.info("Playback Initialized"))}return e={initialize:function(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:NaN;x||(x=(0,Qr.Z)(se).getInstance()).setConfig({settings:le}),L||(L=Xr(se).getInstance()),x.supportsMediaSource()?(g||(g=!0,T=va(se).getInstance(),v||(v=_i(se).getInstance()).setConfig({settings:le}),_||(_=_t(se).getInstance()),G||(G=h(se).getInstance()),b||(b=An(se).getInstance()),U||(U=ln(se).getInstance()),B||(B=fn(se).getInstance()),j||(j=gn(se).getInstance()),q||(q=En(se).getInstance()),Y||(Y=Kt(se).getInstance()),k||(k=$r(se).getInstance()),O=$i(se).getInstance(),V=ii(se).getInstance(),K=Ke(se).getInstance(),W=dt(se).getInstance(),H=ya(se).getInstance({settings:le}),ee=Oi(se).getInstance({settings:le}),O.setConfig({constants:a.Z,cea608parser:i(),errHandler:L,BASE64:_a}),F||(F=Un(se).create()),F.setConfig({adapter:O,contentSteeringController:Y}),q.setConfig({adapter:O}),te||(te=Gi(se).getInstance({dashMetrics:H,mediaPlayerModel:M,errHandler:L,baseURLController:F,events:l.Z,eventBus:ue,debug:ce,boxParser:(0,Ut.Z)(se).getInstance(),requestModifier:(0,X.Z)(se).getInstance(),errors:w})),b.setConfig({domStorage:ee,settings:le,customParametersModel:P}),M.setConfig({playbackController:G,serviceDescriptionController:q}),Y.setConfig({adapter:O,errHandler:L,dashMetrics:H,mediaPlayerModel:M,manifestModel:V,serviceDescriptionController:q,eventBus:ue,requestModifier:(0,X.Z)(se).getInstance()}),_e(),ve(void 0===r||r),Oe()),e&&be(e),n&&Ie(n,o),t.info("[dash.js "+ge()+"] MediaPlayer has been initialized")):L.error(new S.Z(w.CAPABILITY_MEDIASOURCE_ERROR_CODE,w.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(x=e.capabilities),e.capabilitiesFilter&&(k=e.capabilitiesFilter),e.streamController&&(U=e.streamController),e.textController&&(Z=e.textController),e.gapController&&(B=e.gapController),e.playbackController&&(G=e.playbackController),e.serviceDescriptionController&&(q=e.serviceDescriptionController),e.contentSteeringController&&(Y=e.contentSteeringController),e.catchupController&&(j=e.catchupController),e.mediaPlayerModel&&(M=e.mediaPlayerModel),e.customParametersModel&&(P=e.customParametersModel),e.abrController&&(v=e.abrController),e.schemeLoaderFactory&&(_=e.schemeLoaderFactory),e.mediaController&&(b=e.mediaController),e.settings&&(le=e.settings))},on:function(e,t,n,r){ue.on(e,t,n,r)},off:function(e,t,n){ue.off(e,t,n)},extend:function(e,t,n){c.Z.extend(e,t,n,se)},attachView:be,attachSource:Ie,refreshManifest:function(e){if(!g)throw oe;if(!de())return e(null,ae);var t=this;"function"==typeof e&&ue.on(l.Z.INTERNAL_MANIFEST_LOADED,(function n(r){ue.off(l.Z.INTERNAL_MANIFEST_LOADED,n,t),r.error?e(null,r.error):e(r.manifest)}),t),U.refreshManifest()},isReady:de,preload:function(){if(!J.getElement()&&!p){if(!n)throw ae;Pe(E)}},play:function(){if(!m)throw re;(!y||he()&&m)&&G.play(!0)},isPaused:he,pause:function(){if(!m)throw re;G.pause()},isSeeking:function(){if(!m)throw re;return G.isSeeking()},isDynamic:pe,getLowLatencyModeEnabled:function(){if(!m)throw re;return G.getLowLatencyModeEnabled()},seek:function(e){if(!m)throw re;if((0,z.PS)(e,"number"),isNaN(e))throw a.Z.BAD_ARGUMENT_ERROR;e<0&&(e=0);var t=G.getIsDynamic()?me(e):e,n=Se();!G.getIsDynamic()&&n.duration&&(t=Math.min(n.duration,t)),G.seek(t,!1,!1,!0)},seekToOriginalLive:function(){m&&pe()&&G.seekToOriginalLive()},setPlaybackRate:function(e){Se().playbackRate=e},getPlaybackRate:function(){return Se().playbackRate},setMute:function(e){(0,z.PS)(e,"boolean"),Se().muted=e},isMuted:function(){return Se().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw a.Z.BAD_ARGUMENT_ERROR;Se().volume=e},getVolume:function(){return Se().volume},time:ye,duration:Ee,timeAsUTC:function(){if(!m)throw re;return ye()<0?NaN:Me(ye())},durationAsUTC:function(){if(!m)throw re;return Me(Ee())},getActiveStream:Re,getDVRWindowSize:function(){var e=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,t=H.getCurrentDVRInfo(e);return t?t.manifestInfo.dvrWindowSize:0},getDVRSeekOffset:me,getAvailableBaseUrls:function(){var e=V.getValue();return e?F.getBaseUrls(e):[]},getAvailableLocations:function(){var e=V.getValue();if(!e)return[];var t=O.getLocation(e),n=Y.getSynthesizedLocationElements(t);return t.concat(n)},getTargetLiveDelay:function(){if(!m)throw re;return G.getOriginalLiveDelay()},convertToTimeCode:function(e){e=Math.max(e,0);var t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(0===t?"":t<10?"0"+t.toString()+":":t.toString()+":")+(n<10?"0"+n.toString():n.toString())+":"+(r<10?"0"+r.toString():r.toString())},formatUTC:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=new Date(1e3*e),a=i.toLocaleDateString(t),o=i.toLocaleTimeString(t,{hour12:n});return r?o+" "+a:o},getVersion:ge,getDebug:function(){return ce},getBufferLength:function(e){var n=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT];if(e)return-1!==n.indexOf(e)?Te().getCurrentBufferLevel(e)||NaN:(t.warn("getBufferLength requested for invalid type"),NaN);var r=n.map((function(e){return Ae(e).length>0?Te().getCurrentBufferLevel(e):Number.MAX_VALUE})).reduce((function(e,t){return Math.min(e,t)}));return r===Number.MAX_VALUE?NaN:r},getTTMLRenderingDiv:function(){return J?J.getTTMLRenderingDiv():null},getVideoElement:Se,getSource:function(){if(!n)throw ae;return n},updateSource:function(e){n=e,U.load(n)},getCurrentLiveLatency:function(){if(!g)throw oe;return m?G.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(e){if(!p)throw ne;return v.getTopBitrateInfoFor(e)},setAutoPlay:ve,getAutoPlay:function(){return y},getDashMetrics:Te,getQualityFor:function(e){if(!p)throw ne;if(e===a.Z.IMAGE){var t=Re();if(!t)return-1;var n=t.getThumbnailController();return n?n.getCurrentTrackIndex():-1}return v.getQualityFor(e)},setQualityFor:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!p)throw ne;if(e===a.Z.IMAGE){var r=Re();if(!r)return;var i=r.getThumbnailController();i&&i.setTrackByIndex(t)}v.setPlaybackQuality(e,U.getActiveStreamInfo(),t,{forceReplace:n})},updatePortalSize:function(){v.setElementSize(),v.setWindowResizeEventCalled(!0)},enableText:function(e){var t=U.getActiveStreamInfo();return!(!t||!Z)&&Z.enableText(t.id,e)},enableForcedTextStreaming:function(e){return!(!U.getActiveStreamInfo()||!Z)&&Z.enableForcedTextStreaming(e)},isTextEnabled:function(){var e=U.getActiveStreamInfo();return!(!e||!Z)&&Z.isTextEnabled(e)},setTextTrack:function(e){if(!m)throw re;var t=U.getActiveStreamInfo();t&&Z&&Z.setTextTrack(t.id,e)},getBitrateInfoListFor:function(e){if(!p)throw ne;var t=Re();return t?t.getBitrateListFor(e):[]},getStreamsFromManifest:function(e){if(!p)throw ne;return O.getStreamsInfo(e)},getTracksFor:Ae,getTracksForTypeFromManifest:function(e,t,n){if(!p)throw ne;return(n=n||O.getStreamsInfo(t,1)[0])?O.getAllMediaInfoForType(n,e,t):[]},getCurrentTrackFor:function(e){if(!p)throw ne;var t=U.getActiveStreamInfo();return b.getCurrentTrackFor(e,t.id)},setInitialMediaSettingsFor:function(e,t){if(!g)throw oe;b.setInitialSettings(e,t)},getInitialMediaSettingsFor:function(e){if(!g)throw oe;return b.getInitialSettings(e)},setCurrentTrack:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!p)throw ne;b.setTrack(e,t)},addABRCustomRule:function(e,t,n){P.addAbrCustomRule(e,t,n)},removeABRCustomRule:function(e){P.removeAbrCustomRule(e)},removeAllABRCustomRule:function(){P.removeAllAbrCustomRule()},getABRCustomRules:function(){return P.getAbrCustomRules()},getAverageThroughput:function(e){var t=v.getThroughputHistory(),n=G.getIsDynamic();return t?t.getAverageThroughput(e,n):0},retrieveManifest:function(e,t){var n=Ce(),r=this;ue.on(l.Z.INTERNAL_MANIFEST_LOADED,(function e(i){i.error?t(null,i.error):t(i.manifest),ue.off(l.Z.INTERNAL_MANIFEST_LOADED,e,r),n.reset()}),r),$.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){P.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){P.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){P.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:_e,setXHRWithCredentialsForType:function(e,t){P.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return P.getXHRWithCredentialsForType(e)},getProtectionController:function(){return De()},attachProtectionController:function(e){A=e},setProtectionData:function(e){r=e,U&&U.setProtectionData(r)},registerLicenseRequestFilter:function(e){P.registerLicenseRequestFilter(e)},registerLicenseResponseFilter:function(e){P.registerLicenseResponseFilter(e)},unregisterLicenseRequestFilter:function(e){P.unregisterLicenseRequestFilter(e)},unregisterLicenseResponseFilter:function(e){P.unregisterLicenseResponseFilter(e)},registerCustomCapabilitiesFilter:function(e){P.registerCustomCapabilitiesFilter(e)},unregisterCustomCapabilitiesFilter:function(e){P.unregisterCustomCapabilitiesFilter(e)},setCustomInitialTrackSelectionFunction:function(e){P.setCustomInitialTrackSelectionFunction(e)},resetCustomInitialTrackSelectionFunction:function(){P.resetCustomInitialTrackSelectionFunction(null)},attachTTMLRenderingDiv:function(e){if(!J.getElement())throw ie;J.setTTMLRenderingDiv(e)},attachVttRenderingDiv:function(e){if(!J.getElement())throw ie;J.setVttRenderingDiv(e)},getCurrentTextTrackIndex:function(){var e=U.getActiveStreamInfo();if(e&&Z)return Z.getCurrentTrackIdx(e.id)},provideThumbnail:function(e,t){if("function"==typeof t)if(e<0)t(null);else{var n=G.getIsDynamic()?me(e):e,r=U.getStreamForTime(n);if(null!==r){var i=r.getThumbnailController();if(i)return i.provide(n,t);t(null)}else t(null)}},getDashAdapter:function(){return O},getOfflineController:function(){return Oe()},triggerSteeringRequest:function(){if(Y)return Y.loadSteeringData()},getCurrentSteeringResponseData:function(){if(Y)return Y.getCurrentSteeringResponseData()},getSettings:function(){return le.get()},updateSettings:function(e){le.update(e)},resetSettings:function(){le.reset()},reset:fe,destroy:function(){fe(),c.Z.deleteSingletonInstances(se)}},t=ce.getLogger(e),g=!1,m=!1,p=!1,y=!0,E=NaN,A=null,D=null,r=null,O=null,te=null,l.Z.extend(d.Z),M=si(se).getInstance(),P=(0,pt.Z)(se).getInstance(),J=bi(se).getInstance(),$=ni(se).getInstance(),e}Qa.__dashjs_factory_name="MediaPlayer";var Ja=c.Z.getClassFactory(Qa);Ja.events=d.Z,Ja.errors=w,c.Z.updateClassFactory(Qa.__dashjs_factory_name,Ja);var $a=Ja},8825:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function a(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var s=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=o(t);if(n){var i=o(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return a(this,e)});function s(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this)).AST_IN_FUTURE="astInFuture",e.BASE_URLS_UPDATED="baseUrlsUpdated",e.BUFFER_EMPTY="bufferStalled",e.BUFFER_LOADED="bufferLoaded",e.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",e.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",e.DVB_FONT_DOWNLOAD_ADDED="dvbFontDownloadAdded",e.DVB_FONT_DOWNLOAD_COMPLETE="dvbFontDownloadComplete",e.DVB_FONT_DOWNLOAD_FAILED="dvbFontDownloadFailed",e.DYNAMIC_TO_STATIC="dynamicToStatic",e.ERROR="error",e.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",e.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",e.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",e.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",e.LOG="log",e.MANIFEST_LOADING_STARTED="manifestLoadingStarted",e.MANIFEST_LOADING_FINISHED="manifestLoadingFinished",e.MANIFEST_LOADED="manifestLoaded",e.METRICS_CHANGED="metricsChanged",e.METRIC_CHANGED="metricChanged",e.METRIC_ADDED="metricAdded",e.METRIC_UPDATED="metricUpdated",e.PERIOD_SWITCH_STARTED="periodSwitchStarted",e.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",e.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",e.QUALITY_CHANGE_RENDERED="qualityChangeRendered",e.TRACK_CHANGE_RENDERED="trackChangeRendered",e.STREAM_INITIALIZING="streamInitializing",e.STREAM_UPDATED="streamUpdated",e.STREAM_ACTIVATED="streamActivated",e.STREAM_DEACTIVATED="streamDeactivated",e.STREAM_INITIALIZED="streamInitialized",e.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",e.TEXT_TRACKS_ADDED="allTextTracksAdded",e.TEXT_TRACK_ADDED="textTrackAdded",e.CUE_ENTER="cueEnter",e.CUE_EXIT="cueExit",e.THROUGHPUT_MEASUREMENT_STORED="throughputMeasurementStored",e.TTML_PARSED="ttmlParsed",e.TTML_TO_PARSE="ttmlToParse",e.CAPTION_RENDERED="captionRendered",e.CAPTION_CONTAINER_RESIZE="captionContainerResize",e.CAN_PLAY="canPlay",e.CAN_PLAY_THROUGH="canPlayThrough",e.PLAYBACK_ENDED="playbackEnded",e.PLAYBACK_ERROR="playbackError",e.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",e.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",e.PLAYBACK_LOADED_DATA="playbackLoadedData",e.PLAYBACK_PAUSED="playbackPaused",e.PLAYBACK_PLAYING="playbackPlaying",e.PLAYBACK_PROGRESS="playbackProgress",e.PLAYBACK_RATE_CHANGED="playbackRateChanged",e.PLAYBACK_SEEKED="playbackSeeked",e.PLAYBACK_SEEKING="playbackSeeking",e.PLAYBACK_STALLED="playbackStalled",e.PLAYBACK_STARTED="playbackStarted",e.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",e.PLAYBACK_VOLUME_CHANGED="playbackVolumeChanged",e.PLAYBACK_WAITING="playbackWaiting",e.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged",e.EVENT_MODE_ON_START="eventModeOnStart",e.EVENT_MODE_ON_RECEIVE="eventModeOnReceive",e.CONFORMANCE_VIOLATION="conformanceViolation",e.REPRESENTATION_SWITCH="representationSwitch",e.ADAPTATION_SET_REMOVED_NO_CAPABILITIES="adaptationSetRemovedNoCapabilities",e.CONTENT_STEERING_REQUEST_COMPLETED="contentSteeringRequestCompleted",e.INBAND_PRFT="inbandPrft",e.MANAGED_MEDIA_SOURCE_START_STREAMING="managedMediaSourceStartStreaming",e.MANAGED_MEDIA_SOURCE_END_STREAMING="managedMediaSourceEndStreaming",e}return s}(n(8342).Z));t.Z=s},3393:function(e,t){"use strict";function n(e,t){for(var n=0;n=400||t.responsecode<100||t.responsecode>=600)&&l({errorcode:t.responsecode||i.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}function h(e){var t;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=i.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=i.CORRUPT_MEDIA_OTHER;break;default:return}l({errorcode:t})}return t={initialize:function(){r.on(u.MANIFEST_UPDATED,c,t),r.on(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,f,t),r.on(u.METRIC_ADDED,g,t),r.on(u.METRIC_UPDATED,g,t),r.on(u.PLAYBACK_ERROR,h,t),r.on(a.Z.BECAME_REPORTING_PLAYER,d,t)},reset:function(){r.off(u.MANIFEST_UPDATED,c,t),r.off(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,f,t),r.off(u.METRIC_ADDED,g,t),r.off(u.METRIC_UPDATED,g,t),r.off(u.PLAYBACK_ERROR,h,t),r.off(a.Z.BECAME_REPORTING_PLAYER,d,t)}}}o.__dashjs_factory_name="DVBErrorsTranslator";var s=dashjs.FactoryMaker.getSingletonFactory(o),u=n(2295);function l(e){e=e||{};var t,n,r=!1,i=this.context,a=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach((function(e){var t=e.starttime,r=t+e.duration;n.add(t,r)})),r=!!e[0]._useWallClockTime)},reset:function(){n.clear()},isEnabled:function(){var e,t=n.length;if(!t)return!0;e=r?(new Date).getTime()/1e3:a.currentTime;for(var i=0;i=200&&i.status<300)&&(n&&n()))};c.push(i);try{i.open("GET",e),i.onloadend=a,i.onerror=a,i.send()}catch(e){i.onerror()}}(i="".concat(s,"?").concat(i),0,(function(){o=!1}))}))},initialize:function(e,t){var n;if(u=t,!(s=e.dvbReportingUrl))throw new Error("required parameter missing (dvb:reportingUrl)");a||((n=e.dvbProbability)&&(1e3===n||n/1e3>=i.random())&&(o=!0),a=!0)},reset:function(){g()}},n=d(l).getInstance(),i=h(l).getInstance(),r=(0,p.Z)(l).getInstance(),g(),t}m.__dashjs_factory_name="DVBReporting";var y=dashjs.FactoryMaker.getClassFactory(m);function E(e){e=e||{};var t,n={"urn:dvb:dash:reporting:2014":y},r=this.context,i=e.debug?e.debug.getLogger(t):{},a=e.metricsConstants,o=e.mediaPlayerModel||{};return{create:function(e,t){var s;try{(s=n[e.schemeIdUri](r).create({metricsConstants:a,mediaPlayerModel:o})).initialize(e,t)}catch(t){s=null,i.error("ReportingFactory: could not create Reporting with schemeIdUri ".concat(e.schemeIdUri," (").concat(t.message,")"))}return s},register:function(e,t){n[e]=t},unregister:function(e){delete n[e]}}}E.__dashjs_factory_name="ReportingFactory";var v=dashjs.FactoryMaker.getSingletonFactory(E);function _(e){var t=[],n=v(this.context).getInstance(e);return{initialize:function(e,r){e.some((function(e){var i=n.create(e,r);if(i)return t.push(i),!0}))},reset:function(){t.forEach((function(e){return e.reset()})),t=[]},report:function(e,n){t.forEach((function(t){return t.report(e,n)}))}}}_.__dashjs_factory_name="ReportingController";var T=dashjs.FactoryMaker.getClassFactory(_);function S(){return{reconstructFullMetricName:function(e,t,n){var r=e;return t&&(r+="("+t,n&&n.length&&(r+=","+n),r+=")"),r},validateN:function(e){if(!e)throw new Error("missing n");if(isNaN(e))throw new Error("n is NaN");if(e<0)throw new Error("n must be positive");return e}}}S.__dashjs_factory_name="HandlerHelpers";var b=dashjs.FactoryMaker.getSingletonFactory(S);function A(e){var t,n,r,i,a;e=e||{};var o=this.context,s=b(o).getInstance(),u=[],l=e.metricsConstants;function c(){var e=function(){try{return Object.keys(u).map((function(e){return u[e]})).reduce((function(e,t){return e.level0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}},{key:"getPSSHForKeySystem",value:function(t,n){var r=e.parsePSSHList(n);return t&&r.hasOwnProperty(t.uuid.toLowerCase())?r[t.uuid.toLowerCase()]:null}},{key:"parseInitDataFromContentProtection",value:function(e,t){return"pssh"in e?(e.pssh.__text=e.pssh.__text.replace(/\r?\n|\r/g,"").replace(/\s+/g,""),t.decodeArray(e.pssh.__text).buffer):null}},{key:"parsePSSHList",value:function(e){if(null==e)return[];for(var t=new DataView(e.buffer||e),n={},r=0;;){var i,a,o=void 0,s=r;if(r>=t.buffer.byteLength)break;if(i=r+t.getUint32(r),r+=4,1886614376===t.getUint32(r))if(r+=4,0===(a=t.getUint8(r))||1===a){r++,r+=3,o="";var u=void 0,l=void 0;for(u=0;u<4;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=4,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<6;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;r+=6,r+=4,n[o=o.toLowerCase()]=t.buffer.slice(s,i),r=i}else r=i;else r=i}return n}},{key:"getLicenseServerUrlFromMediaInfo",value:function(e,t){try{if(!e||0===e.length)return null;for(var n=0,r=null;n0){var o=a.contentProtection.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===t}));if(o&&o.length>0)for(var s=0;s=0?u[t.ks.systemString].priority:e.length)-(u&&u[n.ks.systemString]&&u[n.ks.systemString].priority>=0?u[n.ks.systemString].priority:e.length)}));for(var a=0;a0&&A.setServerCertificate(N.decodeArray(t.serverCertificate).buffer),x()}})).catch((function(e){f=null,v=!1,t||I.trigger(R.KEY_SYSTEM_SELECTED,{data:null,error:new g.Z(d.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,d.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+e.error)})}))}}(e,t)}function x(){for(var e,t=0;t0?t.audioRobustness:c,u=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:c,l=e.sessionType,f=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:"optional",d=t&&t.persistentState?t.persistentState:"temporary"===l?"optional":"required";return i.forEach((function(e){e.type===C.AUDIO?n.push(new o(e.codec,a)):e.type===C.VIDEO&&r.push(new o(e.codec,u))})),new s(n,r,f,d,[l])}function j(e){e.error?I.trigger(R.KEY_STATUSES_CHANGED,{data:null,error:e.error}):n.debug("DRM: key status = "+e.status)}function H(e){n.debug("DRM: onKeyMessage");var t=e.data;I.trigger(R.KEY_MESSAGE,{data:t});var r=t.messageType?t.messageType:"license-request",o=t.message,s=t.sessionToken,u=B(f),l=b.getLicenseServerModelInstance(f,u,r),c={sessionToken:s,messageType:r};if(o&&0!==o.byteLength){if(!l)return n.debug("DRM: License server request not required for this message (type = "+e.data.messageType+"). Session ID = "+s.getSessionId()),void V(c);if(b.isClearKey(f)){var E=b.processClearKeyLicenseRequest(f,u,o);if(E&&E.keyPairs&&E.keyPairs.length>0)return n.debug("DRM: ClearKey license request handled by application!"),V(c),void A.updateKeySession(s,E)}!function(e,t,n){var r=e.sessionToken,o=e.messageType?e.messageType:"license-request",s={sessionToken:r,messageType:o},u=f?f.systemString:null,l=function(e,t,n,r,o){var s=null,u=r.message;if(e&&e.serverURL){var l=e.serverURL;"string"==typeof l&&""!==l?s=l:"object"===_(l)&&l.hasOwnProperty(t)&&(s=l[t])}else if(e&&e.laURL&&""!==e.laURL)s=e.laURL;else if(!(s=a.getLicenseServerUrlFromMediaInfo(i,f.schemeIdURI))&&!b.isClearKey(f)){var c=a.getPSSHData(n.initData);(s=f.getLicenseServerURLFromInitData(c))||(s=r.laURL)}return s=o.getServerURLFromMessage(s,u,t)}(n,o,r,e,t);if(l){var c={},E=!1;n&&W(c,n.httpRequestHeaders);var v=e.message;W(c,f.getRequestHeadersFromMessage(v)),Object.keys(c).forEach((function(e){"authorization"===e.toLowerCase()&&(E=!0)})),n&&"boolean"==typeof n.withCredentials&&(E=n.withCredentials);var T=function(e){if(A)if(e.status>=200&&e.status<=299){var n=y.Z.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),i=new p(e.responseURL,n,e.response);Q(P.getLicenseResponseFilters(),i).then((function(){var n=t.getLicenseMessage(i.data,u,o);null!==n?(V(s),A.updateKeySession(r,n)):X(e,s,u,o,t)}))}else X(e,s,u,o,t)},S=function(e){V(s,new g.Z(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+u+' update, XHR aborted. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},I=function(e){V(s,new g.Z(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+u+' update, XHR error. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},R=f.getLicenseRequestFromMessage(v),w=t.getHTTPMethod(o),N=t.getResponseType(u,o),C=n&&!isNaN(n.httpTimeout)?n.httpTimeout:8e3,D=r.getSessionId()||null,O=new h(l,w,N,c,E,o,D,R),L=isNaN(M.get().streaming.retryAttempts[m.w.LICENSE])?3:M.get().streaming.retryAttempts[m.w.LICENSE];Q(P.getLicenseRequestFilters(),O).then((function(){K(O,L,C,T,S,I)}))}else V(s,new g.Z(d.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,d.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE))}(t,l,u)}else V(c,new g.Z(d.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,d.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function V(e,t){I.trigger(R.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function K(e,t,r,i,a,o){var s=new XMLHttpRequest;if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled&&M.get().streaming.cmcd.mode===E.Z.CMCD_MODE_QUERY){var u=O.getQueryParameter({url:e.url,type:m.w.LICENSE});u&&(e.url=y.Z.addAditionalQueryParameterToUrl(e.url,[u]))}for(var l in s.open(e.method,e.url,!0),s.responseType=e.responseType,s.withCredentials=e.withCredentials,r>0&&(s.timeout=r),e.headers)s.setRequestHeader(l,e.headers[l]);if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled&&M.get().streaming.cmcd.mode===E.Z.CMCD_MODE_HEADER){var c=O.getHeaderParameters({url:e.url,type:m.w.LICENSE});if(c)for(var f in c){var d=c[f];d&&s.setRequestHeader(f,d)}}var g=function(){t--;var n=isNaN(M.get().streaming.retryIntervals[m.w.LICENSE])?1e3:M.get().streaming.retryIntervals[m.w.LICENSE];S=setTimeout((function(){K(e,t,r,i,a,o)}),n)};s.onload=function(){T=null,this.status>=200&&this.status<=299||t<=0?i(this):(n.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+t),g())},s.ontimeout=s.onerror=function(){T=null,t<=0?o(this):(n.warn("License request network request failed . Retrying it... Pending retries: "+t),g())},s.onabort=function(){a(this)},I.trigger(R.LICENSE_REQUEST_SENDING,{url:e.url,headers:e.headers,payload:e.data,sessionId:e.sessionId}),T=s,s.send(e.data)}function z(){T&&(T.onloadend=T.onerror=T.onprogress=void 0,T.abort(),T=null),S&&(clearTimeout(S),S=null)}function W(e,t){if(t)for(var n in t)e[n]=t[n]}function X(e,t,n,r,i){var a="NONE",o=null;e.response&&(a=i.getErrorResponse(e.response,n,r),o={serverResponse:e.response||null,responseCode:e.status||null,responseText:e.statusText||null}),V(t,new g.Z(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+' update, XHR complete. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState+". Response is "+a,o))}function Q(e,t){return e?e.reduce((function(e,n){return e.then((function(){return n(t)}))}),Promise.resolve()):Promise.resolve()}function J(e,t){if(!M.get().streaming.protection.ignoreEmeEncryptedEvent){if(n.debug("DRM: onNeedKey"),"cenc"!==e.key.initDataType)return void n.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+e.key.initDataType);if(0===i.length&&(n.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(t=void 0===t?1:t+1)<5))return void D.push(setTimeout((function(){J(e,t)}),500));var o=e.key.initData;if(ArrayBuffer.isView(o)&&(o=o.buffer),f){var s=a.getPSSHForKeySystem(f,o);if(s&&G(s))return}n.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(o)));var c=b.getSupportedKeySystemsFromSegmentPssh(o,u,l);if(0===c.length)return void n.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!");!function(e){r.push(e),F(e,!1)}(c)}}return t={initializeForMedia:function(e){if(!e)throw new Error("mediaInfo can not be null or undefined");L(),i.push(e)},clearMediaInfoArray:function(){i=[]},handleKeySystemFromManifest:function(){if(i&&0!==i.length){var e=[];i.forEach((function(t){var n=b.getSupportedKeySystemsFromContentProtection(t.contentProtection,u,l);n.length>0&&(0===e.length&&(e=n),r.push(n))})),e&&e.length>0&&F(e,!0)}},createKeySession:Z,loadKeySession:U,removeKeySession:function(e){L(),A.removeKeySession(e)},closeKeySession:function(e){L(),A.closeKeySession(e)},setServerCertificate:function(e){L(),A.setServerCertificate(e)},setMediaElement:q,setSessionType:function(e){l=e},setRobustnessLevel:function(e){c=e},setProtectionData:function(e){u=e,b.setProtectionData(e)},getSupportedKeySystemsFromContentProtection:function(e){return L(),b.getSupportedKeySystemsFromContentProtection(e,u,l)},getKeySystems:function(){return b?b.getKeySystems():[]},setKeySystems:function(e){b&&b.setKeySystems(e)},stop:function(){z(),A&&A.stop()},reset:function(){I.off(R.INTERNAL_KEY_MESSAGE,H,t),I.off(R.INTERNAL_KEY_STATUS_CHANGED,j,t),L(),z(),q(null),f=null,v=!1,A&&(A.reset(),A=null),D.forEach((function(e){return clearTimeout(e)})),D=[],i=[],r=[]}},n=w.getLogger(t),r=[],i=[],l="temporary",c="",T=null,S=null,I.on(R.INTERNAL_KEY_MESSAGE,H,t),I.on(R.INTERNAL_KEY_STATUS_CHANGED,j,t),t}T.__dashjs_factory_name="ProtectionController";var S=v.Z.getClassFactory(T),b=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keyID=t,this.key=n};function A(e,t){for(var n=0;n%CUSTOMDATA%'.replace("%CUSTOMDATA%",t),a=[],o=0;o0&&(e[0]&&("string"==typeof e[0]?t=e[0]:n=e[0]),e[1]&&("string"==typeof e[1]?t=e[1]:n=e[1])),{status:t,keyId:n}}function _(e,t){var r={session:e,keyId:t.keyId,initData:t.initData,sessionId:t.sessionId,sessionType:t.sessionType,handleEvent:function(e){switch(e.type){case"keystatuseschange":c.trigger(f.KEY_STATUSES_CHANGED,{data:this}),e.target.keyStatuses.forEach((function(){var e=v(arguments);"expired"===e.status?c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,{error:new g.Z(d.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,d.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)}):c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,e)}));break;case"message":var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;c.trigger(f.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,void 0,e.messageType)})}},getKeyId:function(){return this.keyId},getSessionId:function(){return e.sessionId},getSessionType:function(){return this.sessionType},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){var t=!1;return e.keyStatuses.forEach((function(){var e=v(arguments);"usable"===e.status&&(t=!0)})),t}};return e.addEventListener("keystatuseschange",r),e.addEventListener("message",r),e.closed.then((function(){E(r),n.debug("DRM: Session closed. SessionID = "+r.getSessionId()),c.trigger(f.KEY_SESSION_CLOSED,{data:r.getSessionId()})})),o.push(r),r}return t={getAllInitData:function(){for(var e=[],t=0;t=1?t():(e=t.bind(this),r.addEventListener("loadedmetadata",e))}return t={getAllInitData:function(){for(var e=[],t=0;t0&&(t=o.ksConfiguration.videoCapabilities[0]),null===t&&o.ksConfiguration.audioCapabilities&&o.ksConfiguration.audioCapabilities.length>0&&(t=o.ksConfiguration.audioCapabilities[0]),null===t)throw new Error("Can not create sessions for unknown content types.");var r=t.contentType,s=a.createSession(r,new Uint8Array(e.initData),e.cdmData?new Uint8Array(e.cdmData):null),l=function(e,t){return{session:e,keyId:t.keyId,initData:t.initData,getKeyId:function(){return this.keyId},getSessionId:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(e){switch(e.type){case y.error:h.trigger(p.KEY_ERROR,{error:new g.Z(d.MEDIA_KEYERR_CODE,"KeyError",this)});break;case y.message:var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;h.trigger(p.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,e.destinationURL)});break;case y.ready:n.debug("DRM: Key added."),h.trigger(p.KEY_ADDED);break;case y.close:n.debug("DRM: Session closed. SessionID = "+this.getSessionId()),h.trigger(p.KEY_SESSION_CLOSED,{data:this.getSessionId()})}}}}(s,e);s.addEventListener(y.error,l),s.addEventListener(y.message,l),s.addEventListener(y.ready,l),s.addEventListener(y.close,l),u.push(l),n.debug("DRM: Session created. SessionID = "+l.getSessionId()),h.trigger(p.KEY_SESSION_CREATED,{data:l})},updateKeySession:function(e,t){var n=e.session;c.isClearKey(i)?n.update(new Uint8Array(t.toJWK())):n.update(new Uint8Array(t)),h.trigger(p.KEY_SESSION_UPDATED)},closeKeySession:v,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:E,reset:E},n=m.getLogger(t),r=null,i=null,a=null,o=null,u=[],c=re(f).getInstance(),l={handleEvent:function(e){if(e.type===y.needkey&&e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;h.trigger(p.NEED_KEY,{key:new le(t,"cenc")})}}},t}pe.__dashjs_factory_name="ProtectionModel_3Feb2014";var me=dashjs.FactoryMaker.getClassFactory(pe);function ye(e){e=e||{};var t,n,r,i,a,o,u,l,c,f=this.context,h=e.eventBus,p=e.events,m=e.debug,y=e.api,E=e.errHandler;function v(){r&&S();for(var e=0;e0&&(t=o.shift(),u.push(t),t.sessionId=e.sessionId,h.trigger(p.KEY_SESSION_CREATED,{data:t})):o.length>0&&(t=o.shift(),u.push(t),0!==o.length&&E.error(new g.Z(d.MEDIA_KEY_MESSAGE_ERROR_CODE,d.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){var s=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=s,h.trigger(p.INTERNAL_KEY_MESSAGE,{data:new ce(t,s,e.defaultURL)})}else n.warn("No session token found for key message")}}},t}ye.__dashjs_factory_name="ProtectionModel_01b";var Ee=dashjs.FactoryMaker.getClassFactory(ye),ve=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],_e=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];function Te(){var e,t=this.context;function n(e,t){for(var n=0;nd.Z.NO_CHANGE}))}function T(e){var t,n,r,i,a,o={},s=null;if(0!==e.length){for(o[d.Z.PRIORITY.STRONG]={quality:d.Z.NO_CHANGE,reason:null},o[d.Z.PRIORITY.WEAK]={quality:d.Z.NO_CHANGE,reason:null},o[d.Z.PRIORITY.DEFAULT]={quality:d.Z.NO_CHANGE,reason:null},t=0,n=e.length;tr.quality)&&(o[r.priority].quality=r.quality,o[r.priority].reason=r.reason||null);return o[d.Z.PRIORITY.WEAK].quality!==d.Z.NO_CHANGE&&(s=o[d.Z.PRIORITY.WEAK]),o[d.Z.PRIORITY.DEFAULT].quality!==d.Z.NO_CHANGE&&(s=o[d.Z.PRIORITY.DEFAULT]),o[d.Z.PRIORITY.STRONG].quality!==d.Z.NO_CHANGE&&(s=o[d.Z.PRIORITY.STRONG]),s&&(i=s.quality,a=s.reason),(0,d.Z)(f).create(i,a)}}return{initialize:function(){t=[],n=[],v.get().streaming.abr.useDefaultABRRules&&(v.get().streaming.abr.ABRStrategy===g.Z.ABR_STRATEGY_L2A?t.push((0,l.Z)(f).create({dashMetrics:E,settings:v})):v.get().streaming.abr.ABRStrategy===g.Z.ABR_STRATEGY_LoLP?t.push((0,c.Z)(f).create({dashMetrics:E})):(t.push((0,u.Z)(f).create({dashMetrics:E,mediaPlayerModel:m,settings:v})),t.push((0,r.Z)(f).create({dashMetrics:E})),v.get().streaming.abr.additionalAbrRules.insufficientBufferRule&&t.push((0,i.Z)(f).create({dashMetrics:E,settings:v})),v.get().streaming.abr.additionalAbrRules.switchHistoryRule&&t.push((0,s.Z)(f).create()),v.get().streaming.abr.additionalAbrRules.droppedFramesRule&&t.push((0,o.Z)(f).create()),v.get().streaming.abr.additionalAbrRules.abandonRequestsRule&&n.push((0,a.Z)(f).create({dashMetrics:E,mediaPlayerModel:m,settings:v})))),y.getAbrCustomRules().forEach((function(e){e.type===h&&t.push(e.rule(f).create()),e.type===p&&n.push(e.rule(f).create())}))},reset:function(){[t,n].forEach((function(e){e&&e.length&&e.forEach((function(e){return e.reset&&e.reset()}))})),t=[],n=[]},getMaxQuality:function(e){return T(_(t.map((function(t){return t.getMaxIndex(e)}))))||(0,d.Z)(f).create()},getMinSwitchRequest:T,shouldAbandonFragment:function(e,t){var r=T(_(n.map((function(n){return n.shouldAbandon(e,t)}))));return r&&(r.reason.forceAbandon=!0),r||(0,d.Z)(f).create()},getQualitySwitchRules:function(){return t}}}m.__dashjs_factory_name="ABRRulesCollection";var y=f.Z.getClassFactory(m);y.QUALITY_SWITCH_RULES=h,y.ABANDON_FRAGMENT_RULES=p,f.Z.updateSingletonFactory(m.__dashjs_factory_name,y),t.Z=y},7423:function(e,t,n){"use strict";var r=n(2068),i=n(5448),a=n(6398);function o(e){e=e||{};var t,n,i,s,u,l=this.context,c=e.mediaPlayerModel,f=e.dashMetrics,d=e.settings;function g(){i={},s={},u=[]}return t={shouldAbandon:function(e){var t=(0,r.Z)(l).create(r.Z.NO_CHANGE,{name:o.__dashjs_factory_name});if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getCurrentRequest")&&e.hasOwnProperty("getRepresentationInfo")&&e.hasOwnProperty("getAbrController")))return t;var a,g,h=e.getMediaInfo(),p=e.getMediaType(),m=e.getStreamInfo(),y=m?m.id:null,E=e.getCurrentRequest();if(!isNaN(E.index)){a=p,g=E.index,i[a]=i[a]||{},i[a][g]=i[a][g]||{};var v=c.getStableBufferTime();if(f.getCurrentBufferLevel(p)>v)return t;var _=i[p][E.index];if(null===_||null===E.firstByteDate||s.hasOwnProperty(_.id))return t;if(void 0===_.firstByteTime&&(u[p]=[],_.firstByteTime=E.firstByteDate.getTime(),_.segmentDuration=E.duration,_.bytesTotal=E.bytesTotal,_.id=E.index),_.bytesLoaded=E.bytesLoaded,_.elapsedTime=(new Date).getTime()-_.firstByteTime,_.bytesLoaded>0&&_.elapsedTime>0&&function(e,t){u[e]=u[e]||[],u[e].push(t)}(p,Math.round(8*_.bytesLoaded/_.elapsedTime)),u[p].length>=d.get().streaming.abr.abrRulesParameters.abandonRequestsRule.minLengthToAverage&&_.elapsedTime>d.get().streaming.abr.abrRulesParameters.abandonRequestsRule.graceTimeThreshold&&_.bytesLoaded<_.bytesTotal){var T=u[p].reduce((function(e,t){return e+t}),0);if(_.measuredBandwidthInKbps=Math.round(T/u[p].length),_.estimatedTimeOfDownload=+(8*_.bytesTotal/_.measuredBandwidthInKbps/1e3).toFixed(2),_.estimatedTimeOfDownload<_.segmentDuration*d.get().streaming.abr.abrRulesParameters.abandonRequestsRule.abandonMultiplier||0===e.getRepresentationInfo().quality)return t;if(!s.hasOwnProperty(_.id)){var S=e.getAbrController(),b=_.bytesTotal-_.bytesLoaded,A=S.getBitrateList(h),I=S.getQualityForBitrate(h,_.measuredBandwidthInKbps*d.get().streaming.abr.bandwidthSafetyFactor,y),R=S.getMinAllowedIndexFor(p,y),w=void 0!==R?Math.max(R,I):I;b>_.bytesTotal*A[w].bitrate/A[S.getQualityFor(p,y)].bitrate&&(t.quality=w,t.reason.throughput=_.measuredBandwidthInKbps,t.reason.fragmentID=_.id,t.reason.rule=this.getClassName(),s[_.id]=_,n.debug("["+p+"] frag id",_.id," is asking to abandon and switch to quality to ",w," measured bandwidth was",_.measuredBandwidthInKbps),delete i[p][_.id])}}else _.bytesLoaded===_.bytesTotal&&delete i[p][_.id]}return t},reset:g},n=(0,a.Z)(l).getInstance().getLogger(t),g(),t}o.__dashjs_factory_name="AbandonRequestsRule",t.Z=i.Z.getClassFactory(o)},3112:function(e,t,n){"use strict";var r=n(3860),i=n(2068),a=n(5448),o=n(7855),s=n(5595),u=n(8512),l=n(6398),c=n(8825),f=n(3393),d=10;function g(e){e=e||{};var t,n,a,g=this.context,h=e.dashMetrics,p=e.mediaPlayerModel,m=(0,s.Z)(g).getInstance();function y(e,t,n){var r=n.reduce((function(e,t,r){return t>n[e]?r:e}),0);if(0===r)return null;var i=Math.max(e,d+2*t.length),a=(n[r]-1)/(i/d-1);return{gp:a,Vp:d/a}}function E(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function v(e,t){var n=p.getStableBufferTime();if(e.stableBufferTime!==n){var r=y(n,e.bitrates,e.utilities);if(r.Vp!==e.Vp||r.gp!==e.gp){var i=h.getCurrentBufferLevel(t),a=i+e.placeholderBuffer;a-=d,a*=r.Vp/e.Vp,a+=d,e.stableBufferTime=n,e.Vp=r.Vp,e.gp=r.gp,e.placeholderBuffer=Math.max(0,a-i)}}}function _(e,t){return e.Vp*(e.utilities[t]+e.gp)}function T(e,t){for(var n=e.bitrates[t],r=e.utilities[t],i=0,a=t-1;a>=0;--a)if(e.utilities[a]t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=n,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=n,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,R(t,e.chunk.mediaInfo.type)}}}function I(e){if(e&&e.metric===r.Z.HTTP_REQUEST&&e.value&&e.value.type===o.w.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=a[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),R(t,e.mediaType))}}function R(e,t){if(!isNaN(e.lastSegmentStart)&&!isNaN(e.lastSegmentRequestTimeMs)&&!isNaN(e.placeholderBuffer)){if(e.placeholderBuffer*=.99,!isNaN(e.lastSegmentFinishTimeMs)){var n=h.getCurrentBufferLevel(t)+.001*(e.lastSegmentFinishTimeMs-e.lastSegmentRequestTimeMs),r=_(e,e.lastQuality),i=Math.max(0,r-n);e.placeholderBuffer=Math.min(i,e.placeholderBuffer)}e.lastSegmentWasReplacement&&!isNaN(e.lastSegmentDurationS)&&(e.placeholderBuffer+=e.lastSegmentDurationS),e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN}}function w(e){if(e){var t=a[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function N(e){if(e){var t=a[e.mediaType];if(t&&0!==t.state){var n,r=h.getCurrentBufferLevel(e.mediaType);n=t.abrQuality>0?T(t,t.abrQuality):d;var i=Math.max(0,n-r);t.placeholderBuffer=Math.min(t.placeholderBuffer,i)}}}function C(){a={}}return t={getMaxIndex:function(e){var t=(0,i.Z)(g).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useBufferOccupancyABR")))return t;var r=e.getMediaInfo(),o=e.getMediaType(),s=e.getScheduleController(),u=e.getStreamInfo(),l=e.getAbrController(),c=l.getThroughputHistory(),f=u?u.id:null,d=u&&u.manifestInfo&&u.manifestInfo.isDynamic,m=e.useBufferOccupancyABR();if(t.reason=t.reason||{},!m)return t;s.setTimeToLoadDelay(0);var S=function(e){var t=e.getMediaType(),n=a[t];return n?0!==n.state&&v(n,t):(n=function(e){var t={},n=e.getMediaInfo().bitrateList.map((function(e){return e.bandwidth})),r=function(e){return e.map((function(e){return Math.log(e)}))}(n);r=r.map((function(e){return e-r[0]+1}));var i=p.getStableBufferTime(),a=y(i,n,r);return a?(t.state=1,t.bitrates=n,t.utilities=r,t.stableBufferTime=i,t.Vp=a.Vp,t.gp=a.gp,t.lastQuality=0,E(t)):t.state=0,t}(e),a[t]=n),n}(e);if(0===S.state)return t;var b,A=h.getCurrentBufferLevel(o),I=c.getAverageThroughput(o,d),R=c.getSafeAverageThroughput(o,d),w=c.getAverageLatency(o);if(t.reason.state=S.state,t.reason.throughput=I,t.reason.latency=w,isNaN(I))return t;switch(S.state){case 1:b=l.getQualityForBitrate(r,R,f,w),t.quality=b,t.reason.throughput=R,S.placeholderBuffer=Math.max(0,T(S,b)-A),S.lastQuality=b,!isNaN(S.lastSegmentDurationS)&&A>=S.lastSegmentDurationS&&(S.state=2);break;case 2:!function(e,t){var n=Date.now();if(isNaN(e.lastSegmentFinishTimeMs)){if(!isNaN(e.lastCallTimeMs)){var r=.001*(n-e.lastCallTimeMs);e.placeholderBuffer+=Math.max(0,r)}}else{var i=.001*(n-e.lastSegmentFinishTimeMs);e.placeholderBuffer+=Math.max(0,i)}e.lastCallTimeMs=n,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,v(e,t)}(S,o),b=function(e,t){for(var n=e.bitrates.length,r=NaN,i=NaN,a=0;a=i)&&(i=o,r=a)}return r}(S,A+S.placeholderBuffer);var N=l.getQualityForBitrate(r,R,f,w);b>S.lastQuality&&b>N&&(b=Math.max(N,S.lastQuality));var C=Math.max(0,A+S.placeholderBuffer-_(S,b));C<=S.placeholderBuffer?(S.placeholderBuffer-=C,C=0):(C-=S.placeholderBuffer,S.placeholderBuffer=0,b375&&u/l>.15)){c=f-1,t.debug("index: "+c+" Dropped Frames: "+u+" Total Frames: "+l);break}return(0,i.Z)(n).create(c,{droppedFrames:u})}return r}},t=(0,a.Z)(n).getInstance().getLogger(e),e}o.__dashjs_factory_name="DroppedFramesRule",t.Z=r.Z.getClassFactory(o)},6535:function(e,t,n){"use strict";var r=n(5595),i=n(8512),a=n(5448),o=n(6398),s=n(2068),u=n(3393),l=n(3860),c=n(8825);function f(e){e=e||{};var t,n,a,f=this.context,d=(0,r.Z)(f).getInstance(),g=e.dashMetrics;function h(){(a={})[u.Z.VIDEO]={ignoreCount:2},a[u.Z.AUDIO]={ignoreCount:2}}function p(){h()}function m(e){isNaN(e.startTime)||e.mediaType!==u.Z.AUDIO&&e.mediaType!==u.Z.VIDEO||a[e.mediaType].ignoreCount>0&&a[e.mediaType].ignoreCount--}return t={getMaxIndex:function(e){var t=(0,s.Z)(f).create();if(!e||!e.hasOwnProperty("getMediaType"))return t;!function(){if(!g||!g.hasOwnProperty("getCurrentBufferLevel")||!g.hasOwnProperty("getCurrentBufferState"))throw new Error(u.Z.MISSING_CONFIG_ERROR)}();var r=e.getMediaType(),i=g.getCurrentBufferState(r),o=e.getRepresentationInfo().fragmentDuration,c=e.getStreamInfo(),d=c?c.id:null,h=e.getScheduleController(),p=c&&c.manifestInfo&&c.manifestInfo.isDynamic;if(function(e,t){return!e&&a[t].ignoreCount>0}(h.getPlaybackController().getLowLatencyModeEnabled(),r)||!o)return t;if(i&&i.state===l.Z.BUFFER_EMPTY)n.debug("["+r+"] Switch to index 0; buffer is empty."),t.quality=0,t.reason="InsufficientBufferRule: Buffer is empty";else{var m=e.getMediaInfo(),y=e.getAbrController(),E=y.getThroughputHistory(),v=g.getCurrentBufferLevel(r),_=E.getAverageThroughput(r,p),T=E.getAverageLatency(r),S=_*(v/o)*.5;t.quality=y.getQualityForBitrate(m,S,d,T),t.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return t},reset:function(){h(),d.off(c.Z.PLAYBACK_SEEKING,p,t),d.off(i.Z.BYTES_APPENDED_END_FRAGMENT,m,t)}},n=(0,o.Z)(f).getInstance().getLogger(t),h(),d.on(c.Z.PLAYBACK_SEEKING,p,t),d.on(i.Z.BYTES_APPENDED_END_FRAGMENT,m,t),t}f.__dashjs_factory_name="InsufficientBufferRule",t.Z=a.Z.getClassFactory(f)},1914:function(e,t,n){"use strict";var r=n(3860),i=n(2068),a=n(5448),o=n(7855),s=n(5595),u=n(8512),l=n(6398),c=n(3393);function f(e){e=e||{};var t,n,a,f,d=this.context,g=e.dashMetrics,h=(0,s.Z)(d).getInstance();function p(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,e.lastSegmentUrl=""}function m(){for(var e in n)if(n.hasOwnProperty(e)){var t=n[e];0!==t.state&&(t.state=1,p(t))}}function y(e){if(e&&e.chunk&&e.chunk.mediaInfo){var t=n[e.chunk.mediaInfo.type],r=a[e.chunk.mediaInfo.type];if(t&&0!==t.state){var i=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||i>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=i,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=i,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,v(t,r)}}}function E(e){if(e&&e.metric===r.Z.HTTP_REQUEST&&e.value&&e.value.type===o.w.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=n[e.mediaType],i=a[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),v(t,i))}}function v(e,t){isNaN(e.lastSegmentStart)||isNaN(e.lastSegmentRequestTimeMs)||(t.segment_request_start_s=.001*e.lastSegmentRequestTimeMs,t.segment_download_finish_s=.001*e.lastSegmentFinishTimeMs,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN)}function _(e){if(e&&e.mediaType){var t=n[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function T(e,t){if(e.length!==t.length)return-1;for(var n=0,r=0;r=O.B_target){D.state=2,O.Q=s;for(var M=0;Mx&&(Z=-1),O.w[B]=O.prev_w[B]+Z*(U/(2*u))*((O.Q+s)*(C*m[B]/x));O.w=function(e){for(var t=e.length,n=!1,r=[],i=0;i=a[l+1]){n=!0;break}n||(s=(o+a[t-1]-1)/t);for(var c=0;cD.lastQuality&&m[D.lastQuality+1]<=x&&(t=D.lastQuality+1),m[t]>=x&&(O.Q=2*Math.max(s,O.Q)),D.lastSegmentUrl=k.url}r.quality=t,r.reason.throughput=w,r.reason.latency=N,r.reason.bufferLevel=I,D.lastQuality=r.quality;break;default:f.debug("L2A ABR rule invoked in bad state."),r.quality=_.getQualityForBitrate(l,R,v.id,N),r.reason.state=D.state,r.reason.throughput=R,r.reason.latency=N,D.state=1,p(D)}return r},reset:function(){S(),h.off(u.Z.PLAYBACK_SEEKING,m,t),h.off(u.Z.MEDIA_FRAGMENT_LOADED,y,t),h.off(u.Z.METRIC_ADDED,E,t),h.off(u.Z.QUALITY_CHANGE_REQUESTED,_,t)}},f=(0,l.Z)(d).getInstance().getLogger(t),S(),h.on(u.Z.PLAYBACK_SEEKING,m,t),h.on(u.Z.MEDIA_FRAGMENT_LOADED,y,t),h.on(u.Z.METRIC_ADDED,E,t),h.on(u.Z.QUALITY_CHANGE_REQUESTED,_,t),t}f.__dashjs_factory_name="L2ARule",t.Z=a.Z.getClassFactory(f)},6070:function(e,t,n){"use strict";var r=n(5448),i=n(6398),a=n(2068);function o(){var e,t,n=this.context;return e={getMaxIndex:function(e){for(var r=e?e.getSwitchHistory():null,i=r?r.getSwitchRequests():[],o=0,s=0,u=0,l=(0,a.Z)(n).create(),c=0;c=6&&o/s>.075)){l.quality=c>0&&i[c].drops>0?c-1:c,l.reason={index:l.quality,drops:o,noDrops:s,dropSize:u},t.debug("Switch history rule index: "+l.quality+" samples: "+(o+s)+" drops: "+o);break}return l}},t=(0,i.Z)(n).getInstance().getLogger(e),e}o.__dashjs_factory_name="SwitchHistoryRule",t.Z=r.Z.getClassFactory(o)},5628:function(e,t,n){"use strict";var r=n(5448),i=n(2068),a=n(3393),o=n(3860);function s(e){e=e||{};var t=this.context,n=e.dashMetrics;return{getMaxIndex:function(e){var r=(0,i.Z)(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("useBufferOccupancyABR")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("getScheduleController")))return r;!function(){if(!n||!n.hasOwnProperty("getCurrentBufferState"))throw new Error(a.Z.MISSING_CONFIG_ERROR)}();var s=e.getMediaInfo(),u=e.getMediaType(),l=n.getCurrentBufferState(u),c=e.getScheduleController(),f=e.getAbrController(),d=e.getStreamInfo(),g=d?d.id:null,h=d&&d.manifestInfo?d.manifestInfo.isDynamic:null,p=f.getThroughputHistory(),m=p.getSafeAverageThroughput(u,h),y=p.getAverageLatency(u),E=e.useBufferOccupancyABR();return isNaN(m)||!l||E||f.getAbandonmentStateFor(g,u)!==o.Z.ABANDON_LOAD&&(l.state===o.Z.BUFFER_LOADED||h)&&(r.quality=f.getQualityForBitrate(s,m,g,y),c.setTimeToLoadDelay(0),r.reason={throughput:m,latency:y}),r},reset:function(){}}}s.__dashjs_factory_name="ThroughputRule",t.Z=r.Z.getClassFactory(s)},4722:function(e,t,n){"use strict";var r=n(5448),i=n(6398);function a(){var e,t,n,r,a,o,s,u,l,c=this.context;function f(){n=null,r=1,a=100,o=0,s=null,u=null,l="dynamic_weight_selection"}function d(){var e=0;if(n)for(var t=0;te&&(e=r.state.throughput)}return e}function g(e,t,n){var r=e.map((function(e,r){return n[r]*Math.pow(e-t[r],2)})).reduce((function(e,t){return e+t}));return(r<0?-1:1)*Math.sqrt(Math.abs(r))}function h(e,t){return g([e.state.throughput,e.state.latency,e.state.rebuffer,e.state.switch],[t.state.throughput,t.state.latency,t.state.rebuffer,t.state.switch],[1,1,1,1])}function p(e,t,n){for(var r=0;ro)&&(a=u,o=l)}t.push(a)}for(var h=null,p=null,m=0;mh)&&(h=y,p=m)}var v=[];for(v.push(t[p]),t.splice(p,1);t.length>0;){for(var _=null,T=null,S=0;S1&&(S=d()),c/=a,t.debug("getNextQuality called throughput:".concat(S," latency:").concat(c," bufferSize:").concat(f," currentQualityIndex:").concat(m," playbackRate:").concat(h));var b=T[m],A=b.bitrate*y.getSegmentDuration()/_,I=Math.max(0,A-v);if(v-Aw?w=C:CI?M-I:0;f.setupPerSegmentQoe(I,w,R),f.logSegmentMetrics(D,P,T,S);var L=(0,l.Z)(g).create({targetLatency:1.5,bufferMin:.3,segmentDuration:I,qoeEvaluator:f});return n.quality=i.getNextQuality(p,1e3*b,T,E,S,h,L),n.reason={throughput:b,latency:T},n.priority=s.Z.PRIORITY.STRONG,y.setTimeToLoadDelay(0),n.quality!==h&&t.debug("[TgcLearningRule]["+r+"] requesting switch to index: ",n.quality,"Average throughput",Math.round(b),"kbps"),n}catch(e){throw e}},reset:function(){i.reset(),f.reset()}},t=(0,r.Z)(g).getInstance().getLogger(n),i=(0,a.Z)(g).create(),f=(0,o.Z)(g).create(),n}f.__dashjs_factory_name="LoLPRule",t.Z=i.Z.getClassFactory(f)},6523:function(e,t,n){"use strict";var r=n(5448);function i(e){var t,n,r,i,a=e.targetLatency,o=e.bufferMin,s=e.segmentDuration,u=e.qoeEvaluator;function l(){return s}function c(e,t){var n=l();return t>n?e-n:e+n-t}return t={getMinBuffer:function(){return o},getSegmentDuration:l,getNextBufferWithBitrate:function(e,t,n){return c(t,e*s/n)},getNextBuffer:c,findWeightVector:function(e,t,i,l,f,d){var g=null,h=null,p=null,m=Math.abs(t-r);return e.forEach((function(e){n.forEach((function(n){n[0];var r=n[1],l=n[2],y=(n[3],e.bitrate*s/f),E=c(i,y),v=(0===l?10:1/l)*Math.max(1e-5,y-E),_=(0===r?10:1/r)*e.state.latency,T=u.calculateSingleUseQoe(e.bitrate,v,_,d);(null===g||T>g)&&function(e,t,n){return!(e>a+n)&&t>=o}(t,E,m)&&(g=T,h=n,p=e.bitrate)}))})),null===h&&null===p&&(h=-1),r=t,h}},4,n=function e(t,n,r){if(r===n)return t;for(var a=t.length,o=0;o=0&&e.value){var t=e.value.split("x");2!==t.length||isNaN(t[0])||isNaN(t[1])||(r.tilesHor=parseInt(t[0],10),r.tilesVert=parseInt(t[1],10))}})),t?m.updateSegmentData(e).then((function(t){!function(e,t,n){var r=[],i=function(e,t){var n,r,i,a,o=[],s=0;for(n=0,r=e.segments.length;ne)return i=t.url,!0})),i?n(i):t.segments.some((function(i){if(i.mediaStartTime<=e&&i.mediaStartTime+i.duration>e){var a=T.resolve(t.path);return y.load({method:"get",url:a.url,request:{range:i.mediaRange,responseType:"arraybuffer"},onload:function(e){var t=E.getSamplesInfo(e.target.response),a=new Blob([e.target.response.slice(t.sampleList[0].offset,t.sampleList[0].offset+t.sampleList[0].size)],{type:"image/jpeg"}),o=window.URL.createObjectURL(a);r.push({start:i.mediaStartTime,end:i.mediaStartTime+i.duration,url:o}),n&&n(o)}}),!0}}))}}(r,e,t)})):(r.startNumber=e.startNumber,r.segmentDuration=e.segmentDuration,r.timescale=e.timescale,r.templateUrl=function(e){var t=N.isRelative(e.media)?N.resolve(e.media,T.resolve(e.path).url):e.media;return t?(0,u.Aj)(t,e.id):""}(e)),r.tilesHor>0&&r.tilesVert>0&&(r.widthPerTile=r.width/r.tilesHor,r.heightPerTile=r.height/r.tilesVert,n.push(r))}function D(){n=[],h=-1,p=null}return t={getTracks:function(){return n},addTracks:function(){if(S&&_&&(p=_.getMediaInfoForType(S,r.Z.IMAGE))){var e=_.getVoRepresentations(p);e&&e.length>0&&e.forEach((function(e){(e.segmentInfoType===i.Z.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===i.Z.SEGMENT_TIMELINE)&&C(e),e.segmentInfoType===i.Z.SEGMENT_BASE&&C(e,!0)})),n.length>0&&n.sort((function(e,t){return e.bitrate-t.bitrate}))}},reset:D,setTrackByIndex:function(e){n&&0!==n.length&&(e>=n.length&&(e=n.length-1),h=e)},getCurrentTrack:function(){return h<0?null:n[h]},getCurrentTrackIndex:function(){return h},getThumbnailRequestForTime:function(e){for(var t,r=_.getVoRepresentations(p),i=0;i>>0|e[t+2]<<8>>>0|e[t+1]<<16>>>0|e[t]<<24>>>0}function l(e,t){return String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t])}return t={parse:a,findLastTopIsoBoxCompleted:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new s.Z(0,!1);for(var r,i=t instanceof ArrayBuffer?new Uint8Array(t):t,a=0;n=0?r=new s.Z(n,!0,o):a=n+o),n+=o}return r||new s.Z(a,!1)},getMediaTimescaleFromMoov:function(e){var t=a(e),n=t?t.getBox("mdhd"):void 0;return n?n.timescale:NaN},getSamplesInfo:function(e){if(!e||0===e.byteLength)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};var t,n,r,i,o,s,u,l,c,f,d,g,h,p,m,y,E=a(e),v=E.getBoxes("moof"),_=E.getBoxes("mfhd");m=E.getBoxes("moof").length,p=_[_.length-1].sequence_number,n=0,o=[];var T=-1,S=-1;for(f=0;fS&&(T++,S+=M.entries[T].sample_delta),u==S){O.subSizes=[];var P=M.entries[T];for(g=0;g=t.byteLength)return new s.Z(0,!1);for(var r,i=t instanceof ArrayBuffer?new Uint8Array(t):t,a=0;n=0?r=new s.Z(n,!0,o,c):a=n+o),n+=o}return r||new s.Z(a,!1)}},e=(0,r.Z)(n).getInstance().getLogger(t),t}u.__dashjs_factory_name="BoxParser",t.Z=a.Z.getSingletonFactory(u)},1715:function(e,t,n){"use strict";n.d(t,{B:function(){return s}});var r=n(5448),i=n(7803),a=n(3393),o=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];function s(){var e="ManagedMediaSource"in window,t="WebKitMediaSource"in window,n="MediaSource"in window;return e||t||n}function u(){var e,t,n;return e={setConfig:function(e){e&&e.settings&&(t=e.settings)},supportsMediaSource:s,supportsEncryptedMedia:function(){return n},supportsCodec:function(e,n){return n!==a.Z.AUDIO&&n!==a.Z.VIDEO?Promise.resolve(!0):function(e,n){return t.get().streaming.capabilities.useMediaCapabilitiesApi&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo&&(e.codec&&n===a.Z.AUDIO||n===a.Z.VIDEO&&e.codec&&e.width&&e.height&&e.bitrate&&e.framerate)}(e,n)?function(e,t){return new Promise((function(n){if(e&&e.codec){var r={type:"media-source"};r[t]={},r[t].contentType=e.codec,r[t].width=e.width,r[t].height=e.height,r[t].bitrate=parseInt(e.bitrate),r[t].framerate=parseFloat(e.framerate),navigator.mediaCapabilities.decodingInfo(r).then((function(e){n(e.supported)})).catch((function(){n(!1)}))}else n(!1)}))}(e,n):function(e){return new Promise((function(t){if(e&&e.codec){var n=e.codec;e.width&&e.height&&(n+=';width="'+e.width+'";height="'+e.height+'"'),"ManagedMediaSource"in window&&ManagedMediaSource.isTypeSupported(n)||"MediaSource"in window&&MediaSource.isTypeSupported(n)||"WebKitMediaSource"in window&&WebKitMediaSource.isTypeSupported(n)?t(!0):t(!1)}else t(!1)}))}(e)},setEncryptedMediaSupported:function(e){n=e},supportsEssentialProperty:function(e){try{return-1!==i.Y.indexOf(e.schemeIdUri)||a.Z.FONT_DOWNLOAD_DVB_SCHEME===e.schemeIdUri}catch(e){return!0}},codecRootCompatibleWithCodec:function(e,t){for(var n,r=e.split(".")[0],i=0===t.indexOf(r),a=0;athis.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&tthis.customTimeRangeArray[n].start&&ethis.customTimeRangeArray[n].start&&t=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return(0,i.SE)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}a.__dashjs_factory_name="CustomTimeRanges",t.Z=r.Z.getClassFactory(a)},5:function(e,t,n){"use strict";var r=n(5448);function i(){var e,t=/^[a-z][a-z0-9+\-_.]*:/i,n=/^https?:\/\//i,r=/^https:\/\//i,i=/^([a-z][a-z0-9+\-_.]*:\/\/[^\/]+)\/?/i,a=function(e,t){try{return new window.URL(e,t).toString()}catch(t){return e}},o=function(e,t){var n=s;if(!t)return e;if(!c(e))return e;f(e)&&(n=u),d(e)&&(n=l);var r=n(t),i="/"!==r.charAt(r.length-1)&&"/"!==e.charAt(0)?"/":"";return[r,e].join(i)};function s(e){var t=e.indexOf("/"),n=e.lastIndexOf("/");return-1!==t?n===t+1?e:(-1!==e.indexOf("?")&&(e=e.substring(0,e.indexOf("?"))),e.substring(0,n+1)):""}function u(e){var t=e.match(i);return t?t[1]:""}function l(e){var n=e.match(t);return n?n[0]:""}function c(e){return!t.test(e)}function f(e){return c(e)&&"/"===e.charAt(0)}function d(e){return 0===e.indexOf("//")}return function(){try{new window.URL("x","http://y"),e=a}catch(e){}finally{e=e||o}}(),{parseBaseUrl:s,parseOrigin:u,parseScheme:l,isRelative:c,isPathAbsolute:f,isSchemeRelative:d,isHTTPURL:function(e){return n.test(e)},isHTTPS:function(e){return r.test(e)},removeHostname:function(e){return/^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(e)[2].substring(1)},resolve:function(t,n){return e(t,n)}}}i.__dashjs_factory_name="DefaultURLUtils",t.Z=r.Z.getSingletonFactory(i)},8260:function(e,t,n){"use strict";var r=n(2839),i=n(5448);function a(){var e;function t(t){var r=[];if(!t||!e||"function"!=typeof e.fetchAll)return r;for(var i,a=e.fetchAll(t),o=0,s=a.length;o0?n[n.length-1]:null}}}a.__dashjs_factory_name="IsoFile",t.Z=i.Z.getClassFactory(a)},7473:function(e,t,n){"use strict";n.d(t,{k:function(){return i}});var r=n(5448);function i(e,t){var n={url:e.url,method:e.method,headers:Object.assign({},e.headers),credentials:e.withCredentials?"include":void 0,range:e.request.range};return Promise.resolve(t.modifyRequest(n)).then((function(){return Object.assign(e,n,{withCredentials:"include"===n.credentials})}))}function a(){return{modifyRequest:null,modifyRequestURL:function(e){return e},modifyRequestHeader:function(e,t){return t.url,e}}}a.__dashjs_factory_name="RequestModifier",t.Z=r.Z.getSingletonFactory(a)},3106:function(e,t,n){"use strict";n.d(t,{PS:function(){return a},SE:function(){return o}});var r=n(3393);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){if(i(e)!==t)throw r.Z.BAD_ARGUMENT_ERROR}function o(e){if(null===e||isNaN(e)||e%1!=0)throw r.Z.BAD_ARGUMENT_ERROR+" : argument is not an integer"}},2594:function(e,t,n){"use strict";var r=n(5448),i=n(5);function a(){var e,t=[],n=this.context;function r(n,r,i){var a=function(n){var r;for(r=0;r-1}),!0),t.extendedFilter=n((function(e,t){var n=e.split("-"),r=t.split("-"),i=0,a=0;if("*"!==r[a]&&n[i]!==r[a])return!1;for(i++,a++;a-1||!e[i]||!e[i].length)&&h(e,i,o[i])}function g(e,t,n){var r,i,a,o,s=!1;if(n){if(i=r=e[t],r&&"object"==typeof r)for(i=[],a=-1;++a1&&m<9){if(g.language=h.slice(0,m),m<4)for(c=0;45===p.charCodeAt(m)&&i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&i(p.charCodeAt(m+3))&&!i(p.charCodeAt(m+4));){if(c>2)return y(m,3,"Too many extended language subtags, expected at most 3 subtags");g.extendedLanguageSubtags.push(h.slice(m+1,m+4)),m+=4,c++}for(45===p.charCodeAt(m)&&i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&i(p.charCodeAt(m+3))&&i(p.charCodeAt(m+4))&&!i(p.charCodeAt(m+5))&&(g.script=h.slice(m+1,m+5),m+=5),45===p.charCodeAt(m)&&(i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&!i(p.charCodeAt(m+3))?(g.region=h.slice(m+1,m+3),m+=3):a(p.charCodeAt(m+1))&&a(p.charCodeAt(m+2))&&a(p.charCodeAt(m+3))&&!a(p.charCodeAt(m+4))&&(g.region=h.slice(m+1,m+4),m+=4));45===p.charCodeAt(m);){for(f=l=m+1;r(p.charCodeAt(f));){if(f-l>7)return y(f,1,"Too long variant, expected at most 8 characters");f++}if(!(f-l>4||f-l>3&&a(p.charCodeAt(l))))break;g.variants.push(h.slice(l,f)),m=f}for(;45===p.charCodeAt(m)&&120!==p.charCodeAt(m+1)&&r(p.charCodeAt(m+1))&&45===p.charCodeAt(m+2)&&r(p.charCodeAt(m+3));){for(f=m+2,c=0;45===p.charCodeAt(f)&&r(p.charCodeAt(f+1))&&r(p.charCodeAt(f+2));)for(f=(l=f+1)+2,c++;r(p.charCodeAt(f));){if(f-l>7)return y(f,2,"Too long extension, expected at most 8 characters");f++}if(!c)return y(f,4,"Empty extension, extensions must have at least 2 characters of content");g.extensions.push({singleton:h.charAt(m+1),extensions:h.slice(m+3,f).split("-")}),m=f}}else m=0;if(0===m&&120===p.charCodeAt(m)||45===p.charCodeAt(m)&&120===p.charCodeAt(m+1))for(f=m=m?m+2:1;45===p.charCodeAt(f)&&r(p.charCodeAt(f+1));){for(f=l=m+1;r(p.charCodeAt(f));){if(f-l>7)return y(f,5,"Too long private-use area, expected at most 8 characters");f++}g.privateuse.push(h.slice(m+1,f)),m=f}return m!==h.length?y(m,6,"Found superfluous content after tag"):g;function y(e,t,n){return d.warning&&d.warning(n,t,e),d.forgiving?g:{language:null,extendedLanguageSubtags:[],script:null,region:null,variants:[],extensions:[],privateuse:[],irregular:null,regular:null}}};var u={}.hasOwnProperty},6713:function(e){"use strict";e.exports=function(e){var t,n,r,i=e||{},a=[];if(i.irregular||i.regular)return i.irregular||i.regular;if(i.language)for(a=a.concat(i.language,i.extendedLanguageSubtags||[],i.script||[],i.region||[],i.variants||[]),t=i.extensions||[],n=-1;++no)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|p(e,t),r=s(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(G(e,Uint8Array)){var t=new Uint8Array(e);return g(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer))return g(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return g(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return u.from(r,t,n);var i=function(e){if(u.isBuffer(e)){var t=0|h(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||q(e.length)?s(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return c(e),s(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),n=s(t),r=0;r=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function E(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var f=!0,d=0;di&&(r=i):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=w)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr.length?u.from(a).copy(r,i):Uint8Array.prototype.set.call(r,a,i);else{if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i)}i+=a.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tn&&(e+=" ... "),""},a&&(u.prototype[a]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if(G(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;f>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function N(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function x(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return x(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return x(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}var Y=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},6693:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,a=u(e),o=a[0],s=a[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,o,s)),c=0,f=s>0?o-4:o;for(n=0;n>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=16383,s=0,u=r-i;su?u:s+o));return 1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),a.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,r){for(var i,a,o=[],s=t;s>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},2165:function(e,t){t.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<>1,c=-7,f=n?i-1:0,d=n?-1:1,g=e[t+f];for(f+=d,a=g&(1<<-c)-1,g>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=d,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=d,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(g?-1:1);o+=Math.pow(2,r),a-=l}return(g?-1:1)*o*Math.pow(2,a-r)},t.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:a-1,h=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+g]=255&s,g+=h,s/=256,i-=8);for(o=o<0;e[n+g]=255&o,g+=h,o/=256,l-=8);e[n+g-h]|=128*p}},6934:function(e,t){var n={parseBuffer:function(e){return new r(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(i.prototype._boxProcessors[e]=t)},createFile:function(){return new r},createBox:function(e,t,n){var r=i.create(e);return t&&t.append(r,n),r},createFullBox:function(e,t,r){var i=n.createBox(e,t,r);return i.version=0,i.flags=0,i},Utils:{}};n.Utils.dataViewToString=function(e,t){var n=t||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(n).decode(e);var r=[],i=0;if("utf-8"===n)for(;i>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},n.Utils.appendBox=function(e,t,n){if(t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,-1!==n)if(null!=n){var r,i=-1;if("number"==typeof n)i=n;else{if("string"==typeof n)r=n;else{if("object"!=typeof n||!n.type)return void e.boxes.push(t);r=n.type}for(var a=0;a>3,t},i.prototype._readUint=function(e){var t,n,r=null,i=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:r=this._raw.getUint8(i);break;case 16:r=this._raw.getUint16(i);break;case 24:r=((t=this._raw.getUint16(i))<<8)+(n=this._raw.getUint8(i+2));break;case 32:r=this._raw.getUint32(i);break;case 64:t=this._raw.getUint32(i),n=this._raw.getUint32(i+4),r=t*Math.pow(2,32)+n}return this._cursor.offset+=e>>3,r},i.prototype._readString=function(e){for(var t="",n=0;n0?e:this._raw.byteLength-(this._cursor.offset-this._offset);if(t>0){var n=new Uint8Array(this._raw.buffer,this._cursor.offset,t);return this._cursor.offset+=t,n}return null},i.prototype._readUTF8String=function(){var e=this._raw.byteLength-(this._cursor.offset-this._offset),t=null;return e>0&&(t=new DataView(this._raw.buffer,this._cursor.offset,e),this._cursor.offset+=e),t?n.Utils.dataViewToString(t):t},i.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())}},i.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},i.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset>3}else this.size+=e>>3},i.prototype._writeUint=function(e,t){if(this._rawo){var n,r,i=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setUint8(i,t);break;case 16:this._rawo.setUint16(i,t);break;case 24:n=(16776960&t)>>8,r=255&t,this._rawo.setUint16(i,n),this._rawo.setUint8(i+2,r);break;case 32:this._rawo.setUint32(i,t);break;case 64:r=t-(n=Math.floor(t/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(i,n),this._rawo.setUint32(i+4,r)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeString=function(e,t){for(var n=0;n>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},i.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},i.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},i.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},i.prototype._boxProcessors.mp4a=i.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},i.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},i.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},i.prototype._boxProcessors.prft=function(){this._procFullBox(),this._procField("reference_track_ID","uint",32),this._procField("ntp_timestamp_sec","uint",32),this._procField("ntp_timestamp_frac","uint",32),this._procField("media_time","uint",1==this.version?64:32)},i.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},i.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},i.prototype._boxProcessors.sdtp=function(){this._procFullBox();var e=-1;this._parsing&&(e=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",e,"uint",8)},i.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(e){this._parsing||(e.reference=(1&e.reference_type)<<31,e.reference|=2147483647&e.referenced_size,e.sap=(1&e.starts_with_SAP)<<31,e.sap|=(3&e.SAP_type)<<28,e.sap|=268435455&e.SAP_delta_time),this._procEntryField(e,"reference","uint",32),this._procEntryField(e,"subsegment_duration","uint",32),this._procEntryField(e,"sap","uint",32),this._parsing&&(e.reference_type=e.reference>>31&1,e.referenced_size=2147483647&e.reference,e.starts_with_SAP=e.sap>>31&1,e.SAP_type=e.sap>>28&7,e.SAP_delta_time=268435455&e.sap)}))},i.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},i.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(e){this._procEntryField(e,"ranges_count","uint",32),this._procSubEntries(e,"ranges",e.ranges_count,(function(e){this._procEntryField(e,"level","uint",8),this._procEntryField(e,"range_size","uint",24)}))}))},i.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.sttg=function(){this._procField("settings","utf8")},i.prototype._boxProcessors.stts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_count","uint",32),this._procEntryField(e,"sample_delta","uint",32)}))},i.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_delta","uint",32),this._procEntryField(e,"subsample_count","uint",16),this._procSubEntries(e,"subsamples",e.subsample_count,(function(e){this._procEntryField(e,"subsample_size","uint",1===this.version?32:16),this._procEntryField(e,"subsample_priority","uint",8),this._procEntryField(e,"discardable","uint",8),this._procEntryField(e,"codec_specific_parameters","uint",32)}))}))},i.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},i.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},i.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(e){this._procEntryField(e,"time","uint",1===this.version?64:32),this._procEntryField(e,"moof_offset","uint",1===this.version?64:32),this._procEntryField(e,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(e,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(e,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},i.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},i.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(e){256&this.flags&&this._procEntryField(e,"sample_duration","uint",32),512&this.flags&&this._procEntryField(e,"sample_size","uint",32),1024&this.flags&&this._procEntryField(e,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(e,"sample_composition_time_offset",1===this.version?"int":"uint",32)}))},i.prototype._boxProcessors["url "]=i.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},i.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},i.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},i.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},i.prototype._boxProcessors.vtte=function(){}},5530:function(e,t,n){"use strict";e.exports=n(6146).polyfill()},6146:function(e,t,n){e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,i=void 0,a=void 0,o=function(e,t){g[r]=e,g[r+1]=t,2===(r+=2)&&(a?a(h):v())};var s="undefined"!=typeof window?window:void 0,u=s||{},l=u.MutationObserver||u.WebKitMutationObserver,c="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(h,1)}}var g=new Array(1e3);function h(){for(var e=0;e0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,l=c,console&&console.warn&&console.warn(l)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=c.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)r(u,this,t);else{var l=u.length,c=h(u,l);for(n=0;n=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3101:function(e){"use strict";var t=Array.isArray,n=Object.keys,r=Object.prototype.hasOwnProperty;e.exports=function e(i,a){if(i===a)return!0;if(i&&a&&"object"==typeof i&&"object"==typeof a){var o,s,u,l=t(i),c=t(a);if(l&&c){if((s=i.length)!=a.length)return!1;for(o=s;0!=o--;)if(!e(i[o],a[o]))return!1;return!0}if(l!=c)return!1;var f=i instanceof Date,d=a instanceof Date;if(f!=d)return!1;if(f&&d)return i.getTime()==a.getTime();var g=i instanceof RegExp,h=a instanceof RegExp;if(g!=h)return!1;if(g&&h)return i.toString()==a.toString();var p=n(i);if((s=p.length)!==n(a).length)return!1;for(o=s;0!=o--;)if(!r.call(a,p[o]))return!1;for(o=s;0!=o--;)if(!e(i[u=p[o]],a[u]))return!1;return!0}return i!=i&&a!=a}},3362:function(e,t,n){!function(e,t,n,r,i){function a(e){if("contents"in e)for(var t=("styleAttrs"in e?e.styleAttrs[r.byName.ruby.qname]:null),n="span"===e.kind&&("container"===t||"textContainer"===t||"baseContainer"===t),i=e.contents.length-1;i>=0;i--)!n||"styleAttrs"in e.contents[i]&&r.byName.ruby.qname in e.contents[i].styleAttrs?a(e.contents[i]):delete e.contents[i]}function o(e,t,n,r){var i=r&&"seq"===r.timeContainer,a=0;r&&(a=i&&n?n.end:r.begin),t.begin=t.explicit_begin?t.explicit_begin+a:a;var s=t.begin,u=null;if("sets"in t)for(var l=0;l0;){var r=t.styleRefs.pop();r in e.styles?(F(e,e.styles[r],n),k(e.styles[r].styleAttrs,t.styleAttrs)):Z(n,"Non-existant style id referenced")}}function x(e,t,n,r){for(var i=t.length-1;i>=0;i--){var a=t[i];a in e.styles?k(e.styles[a].styleAttrs,n):Z(r,"Non-existant style id referenced")}}function k(e,t){for(var n in e)e.hasOwnProperty(n)&&(n in t||(t[n]=e[n]))}function U(e,t){if(e&&e.warn&&e.warn(t))throw t}function Z(e,t){if(e&&e.error&&e.error(t))throw t}function B(e,t){throw e&&e.fatal&&e.fatal(t),t}function G(e,t){for(var n,r=0,i=e.length-1;r<=i;){var a=e[n=Math.floor((r+i)/2)];if(at))return{found:!0,index:n};i=n-1}}return{found:!1,index:r}}e.fromXML=function(e,i,p){var m=t.parser(!0,{xmlns:!0}),y=[],E=[],v=[],_=0,T=null;m.onclosetag=function(e){if(y[0]instanceof N)null!==T.head&&null!==T.head.styling&&x(T.head.styling,y[0].styleRefs,y[0].styleAttrs,i),delete y[0].styleRefs;else if(y[0]instanceof c)for(var t in y[0].styles)y[0].styles.hasOwnProperty(t)&&F(y[0],y[0].styles[t],i);else if(y[0]instanceof A||y[0]instanceof I){if(y[0].contents.length>1){var r,a=[y[0].contents[0]];for(r=1;r0&&p&&"onCloseTag"in p&&p.onCloseTag());v.shift(),E.shift(),y.shift()},m.ontext=function(e){if(void 0===y[0]);else if(y[0]instanceof I||y[0]instanceof A){if(y[0]instanceof I){var t=y[0].styleAttrs[r.byName.ruby.qname];if("container"===t||"textContainer"===t||"baseContainer"===t)return}var n=new R;n.initFromText(T,y[0],e,E[0],v[0],i),y[0].contents.push(n)}else y[0]instanceof s&&_>0&&p&&"onText"in p&&p.onText(e)},m.onopentag=function(e){var t=e.attributes["xml:space"];t?v.unshift(t.value):0===v.length?v.unshift("default"):v.unshift(v[0]);var a=e.attributes["xml:lang"];if(a?E.unshift(a.value):0===E.length?E.unshift(""):E.unshift(E[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==T&&B(i,"Two elements at ("+this.line+","+this.column+")"),(T=new u).initFromNode(e,E[0],i),y.unshift(T);else if("head"===e.local)y[0]instanceof u||B(i,"Parent of element is not at ("+this.line+","+this.column+")"),y.unshift(T.head);else if("styling"===e.local)y[0]instanceof l||B(i,"Parent of element is not at ("+this.line+","+this.column+")"),y.unshift(T.head.styling);else if("style"===e.local){var o;y[0]instanceof c?((o=new f).initFromNode(e,i),o.id?T.head.styling.styles[o.id]=o:Z(i,"