From 3e5854a0ded7d5f365055e6da3711db24fb1c8cf Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 17 Oct 2021 20:09:54 +0100 Subject: [PATCH] Dash test --- src/Yavsc/Controllers/HomeController.cs | 5 ++++- src/Yavsc/Views/Home/Dash.cshtml | 19 +++++++++++++++++++ src/Yavsc/wwwroot/js/dash.all.min.js | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/Yavsc/Views/Home/Dash.cshtml create mode 100644 src/Yavsc/wwwroot/js/dash.all.min.js diff --git a/src/Yavsc/Controllers/HomeController.cs b/src/Yavsc/Controllers/HomeController.cs index 6ee8b78d..90dc0fb0 100644 --- a/src/Yavsc/Controllers/HomeController.cs +++ b/src/Yavsc/Controllers/HomeController.cs @@ -86,7 +86,10 @@ namespace Yavsc.Controllers { return View(); } - + public IActionResult Dash() + { + return View(); + } public ActionResult Chat() { if (User.Identity.IsAuthenticated) diff --git a/src/Yavsc/Views/Home/Dash.cshtml b/src/Yavsc/Views/Home/Dash.cshtml new file mode 100644 index 00000000..e2193ce4 --- /dev/null +++ b/src/Yavsc/Views/Home/Dash.cshtml @@ -0,0 +1,19 @@ +@{ + ViewData["Title"] = @SR["Dash"]; +} + +
+ +
+ +@section scripts { + + +} + diff --git a/src/Yavsc/wwwroot/js/dash.all.min.js b/src/Yavsc/wwwroot/js/dash.all.min.js new file mode 100644 index 00000000..3883d0a5 --- /dev/null +++ b/src/Yavsc/wwwroot/js/dash.all.min.js @@ -0,0 +1,19 @@ +!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()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist/",n(n.s=104)}([function(e,t,n){"use strict";function r(e,t){for(var n=0;n0&&(r+=" ");for(var s=arguments.length,u=new Array(s>2?s-2:0),l=2;l=e&&g[e](r),p&&p.get().debug.dispatchEvent&&h.trigger(i.a.LOG,{message:r,level:e})}return t={getLogger:function(e){return{fatal:y.bind(e),error:E.bind(e),warn:_.bind(e),info:v.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&&(g[o]=m(window.console.error),g[s]=m(window.console.error),g[u]=m(window.console.warn),g[l]=m(window.console.info),g[c]=m(window.console.debug)),t}f.__dashjs_factory_name="Debug";var d=a.a.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.a.updateSingletonFactory(f.__dashjs_factory_name,d),t.a=d},function(e,t,n){"use strict";var r=n(3),i=n(4);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}return{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.a.EVENT_MODE_ON_RECEIVE)))})).forEach((function(e){return e&&e.callback.call(e.scope,n)}))}},reset:function(){e={}}}}a.__dashjs_factory_name="EventBus";var o=r.a.getSingletonFactory(a);o.EVENT_PRIORITY_LOW=0,o.EVENT_PRIORITY_HIGH=5e3,r.a.updateSingletonFactory(a.__dashjs_factory_name,o),t.a=o},function(e,t,n){"use strict";t.a=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.code=t||null,this.message=n||null,this.data=r||null}},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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=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}}();return function(){var n,r=s(e);if(t){var i=s(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return o(this,n)}}function o(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 s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=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)}(n,e);var t=a(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.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 n}(n(24).a));t.a=u},function(e,t,n){"use strict";n.d(t,"e",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return s})),n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return f}));var r=n(27);function i(e,t){for(;e.lengthr&&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 h,p,g=r/a,m=i/a;return h=e.calcPresentationTimeFromMediaTime(g,n),l(e,n,p=u(n,m,h,g,e,h+m,t,f),t)?(p.replacementTime=d||r,o=s(o,"Number",p.replacementNumber),o=s(o,"Time",p.replacementTime),p.media=o,p.mediaRange=c,p):null}},function(e,t,n){"use strict";var r=n(3);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";var a=r.a.getSingletonFactory(i);function o(){var e,t=[],n=this.context;function r(n,r,i){var a=function(n){var r;for(r=0;r0&&(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;n=e-n}))}function m(e,t){t<=e+.5||(r=r.filter((function(n){var r=p(n);return isNaN(n.startTime)||n.startTime>=t-r||isNaN(n.duration)||n.startTime+n.duration<=e+r})))}function y(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)?p(i):n,!isNaN(a)&&!isNaN(o)&&t+n>=a&&t-n0&&m(n,t)}else g()},abortRequests:function(){n.debug("abort requests"),l.abort(),a=[]},executeRequest:function(e){switch(e.action){case i.a.ACTION_DOWNLOAD:E(e,"loading"),a.push(e),function(e){o.trigger(s.FRAGMENT_LOADING_STARTED,{request:e},{streamId:f.id,mediaType:d}),l.load(e)}(e);break;default:n.warn("Unknown request action.")}},reset:function(){o.off(s.LOADING_COMPLETED,_,this),o.off(s.LOADING_DATA_PROGRESS,v,this),o.off(s.LOADING_ABANDONED,T,this),l&&l.reset(),S()},resetInitialSettings:S,addExecutedRequest:function(e){r.push(e)}},n=c.getLogger(t),S(),o.on(s.LOADING_COMPLETED,_,t),o.on(s.LOADING_DATA_PROGRESS,v,t),o.on(s.LOADING_ABANDONED,T,t),t}a.__dashjs_factory_name="FragmentModel";var o=r.a.getClassFactory(a);o.FRAGMENT_MODEL_LOADING="loading",o.FRAGMENT_MODEL_EXECUTED="executed",o.FRAGMENT_MODEL_CANCELED="canceled",o.FRAGMENT_MODEL_FAILED="failed",r.a.updateClassFactory(a.__dashjs_factory_name,o),t.a=o},function(e,t,n){"use strict";var r=n(3),i=n(41);function a(e){e=e||{};var t,n,r=this.context;return t=Object(i.a)(r).getInstance(),{load:function(i){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})).load(i)},abort:function(){n&&n.abort()}}}a.__dashjs_factory_name="URLLoader";var o=r.a.getClassFactory(a);t.a=o},function(e,t,n){"use strict";var r=n(6);function i(e,t){for(var n=0;n0?n[n.length-1]:null}}}s.__dashjs_factory_name="IsoFile";var u=o.a.getClassFactory(s),l=n(22),c=n.n(l);var f=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lastCompletedOffset=t,this.found=n,this.size=r};function d(){var e,t,n=this.context;function i(e){if(!e)return null;void 0===e.fileStart&&(e.fileStart=0);var t=c.a.parseBuffer(e),r=u(n).create();return r.setData(t),r}function a(e,t){return e[t+3]>>>0|e[t+2]<<8>>>0|e[t+1]<<16>>>0|e[t]<<24>>>0}function o(e,t){return String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t])}return t={parse:i,findLastTopIsoBoxCompleted:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new f(0,!1);for(var r,i=t instanceof ArrayBuffer?new Uint8Array(t):t,s=0;n=0?r=new f(n,!0,u):s=n+u),n+=u}return r||new f(s,!1)},getMediaTimescaleFromMoov:function(e){var t=i(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,a,o,s,u,l,c,f,d,h,p,g,m,y,E=i(e),_=E.getBoxes("moof"),v=E.getBoxes("mfhd");m=E.getBoxes("moof").length,g=v[v.length-1].sequence_number,n=0,o=[];var T=-1,S=-1;for(f=0;f<_.length;f++){var A=_[f],b=A.getChildBoxes("traf");for(l=0;lS&&(T++,S+=M.entries[T].sample_delta),u==S){O.subSizes=[];var P=M.entries[T];for(h=0;h=t.byteLength)return new f(0,!1);for(var r,i=t instanceof ArrayBuffer?new Uint8Array(t):t,s=0;n=0?r=new f(n,!0,u,l):s=n+u),n+=u}return r||new f(s,!1)}},e=Object(r.a)(n).getInstance().getLogger(t),t}d.__dashjs_factory_name="BoxParser";t.a=o.a.getSingletonFactory(d)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){ +/*! codem-isoboxer v0.3.6 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */ +var r={parseBuffer:function(e){return new i(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(a.prototype._boxProcessors[e]=t)},createFile:function(){return new i},createBox:function(e,t,n){var r=a.create(e);return t&&t.append(r,n),r},createFullBox:function(e,t,n){var i=r.createBox(e,t,n);return i.version=0,i.flags=0,i},Utils:{}};r.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},r.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},a.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},a.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},a.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?r.Utils.dataViewToString(t):t},a.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,this._raw.byteLength-this._cursor.offset+8);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())}},a.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},a.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset>3}else this.size+=e>>3},a.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},a.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)},a.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},a.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},a.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},a.prototype._boxProcessors.mp4a=a.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)},a.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)},a.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},a.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},a.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)},a.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)},a.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)}))},a.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},a.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)}))}))},a.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},a.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)}))}))},a.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)},a.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},a.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)},a.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))}))},a.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)},a.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)},a.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)}))},a.prototype._boxProcessors["url "]=a.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},a.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},a.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},a.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},a.prototype._boxProcessors.vtte=function(){}},function(e,t,n){"use strict";var r=n(3);function i(){return{modifyRequestURL:function(e){return e},modifyRequestHeader:function(e){return e}}}i.__dashjs_factory_name="RequestModifier",t.a=r.a.getSingletonFactory(i)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n1)for(var n=1;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}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&T.a.indexOf(n[0].schemeIdUri)>=0)return t===r.a.IMAGE}if(e.ContentComponent_asArray&&e.ContentComponent_asArray.length>0){if(e.ContentComponent_asArray.length>1)return t===r.a.MUXED;if(e.ContentComponent_asArray[0].contentType===t)return!0}var a=t===r.a.TEXT?new RegExp("(ttml|vtt|wvtt|stpp)"):new RegExp(t);if(e.Representation_asArray&&e.Representation_asArray.length){var o=e.Representation_asArray[0].codecs;if(a.test(o))return!0}if(e.hasOwnProperty(i.a.MIME_TYPE))return a.test(e.mimeType);if(e.Representation_asArray)for(var s,u=0;u0){var t=e.Representation_asArray[0];if(t.hasOwnProperty(i.a.SEGMENT_TEMPLATE)||t.hasOwnProperty(i.a.SEGMENT_TIMELINE)||t.hasOwnProperty(i.a.SEGMENT_LIST)||t.hasOwnProperty(i.a.SEGMENT_BASE))return!0}return!1}function R(e){return b(e,r.a.AUDIO)}function N(e){return b(e,r.a.VIDEO)}function w(e){return b(e,r.a.TEXT)}function C(e){return b(e,r.a.IMAGE)}function D(){return function(e,t){return e.bandwidth-t.bandwidth}}function O(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&&A(t)&&e.Period_asArray[t]?e.Period_asArray[t].AdaptationSet_asArray:[]}function P(e){return e&&e.Period_asArray?e.Period_asArray:[]}function L(e){var t=!1;return e&&e.hasOwnProperty("type")&&(t=e.type===i.a.DYNAMIC),t}function F(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 x(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 U(e,t){if(!e)throw new Error("Period cannot be null or undefined");var n=l.DEFAULT_ID+"_"+t;return e.hasOwnProperty(i.a.ID)&&e.id.length>0&&"__proto__"!==e.id&&(n=e.id),n}function B(e,t){var n,a=[];if(!e)return a;for(n=0;n0&&A(e)?r[e]:null},getIndexForAdaptation:function(e,t,n){if(!e)return-1;for(var r=M(t,n),i=0;i0&&A(e)?n[e]:null},getCodec:function(e,t,n){var r=null;if(e&&e.Representation_asArray&&e.Representation_asArray.length>0){var i=A(t)&&t>=0&&t0?e.Representation_asArray[0].mimeType:null},getKID:function(e){return e&&e.hasOwnProperty(i.a.CENC_DEFAULT_KID)?e[i.a.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(i.a.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(i.a.MINIMUM_UPDATE_PERIOD)&&(n=e.minimumUpdatePeriod),isNaN(n)?n:Math.max(n-t,1)},getPublishTime:function(e){return e&&e.hasOwnProperty(i.a.PUBLISH_TIME)?new Date(e[i.a.PUBLISH_TIME]):null},getRepresentationCount:function(e){return e&&Array.isArray(e.Representation_asArray)?e.Representation_asArray.length:0},getBitrateListForAdaptation:function(e){var t=O(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&&A(e)?t.Representation_asArray[e]:null},getRepresentationsForAdaptation:function(e){var t,n,r,a,s=[],u=function(e){if(e&&e.period&&A(e.period.index)){var t=e.period.mpd.manifest.Period_asArray[e.period.index];if(t&&t.AdaptationSet_asArray&&A(e.index))return O(t.AdaptationSet_asArray[e.index])}}(e);if(u&&u.Representation_asArray){if(e&&e.period&&A(e.period.index)){var l=k(e.period.mpd.manifest);l&&(n=l[0])}for(var c=0,f=u.Representation_asArray.length;c=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=w.isRelative(e.media)?w.resolve(e.media,T.resolve(e.path).url):e.media;if(!t)return"";return Object(u.c)(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=[],p=-1,g=null}return t={getTracks:function(){return n},addTracks:function(){if(S&&v&&(g=v.getMediaInfoForType(S,r.a.IMAGE))){var e=v.getVoRepresentations(g);e&&e.length>0&&e.forEach((function(e){(e.segmentInfoType===i.a.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===i.a.SEGMENT_TIMELINE)&&C(e),e.segmentInfoType===i.a.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),p=e)},getCurrentTrack:function(){return p<0?null:n[p]},getCurrentTrackIndex:function(){return p},getThumbnailRequestForTime:function(e){for(var t,r=v.getVoRepresentations(g),i=0;it)return!1;if(e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.numberOfSegments)&&!isNaN(a.index)&&a.index>=e.mediaFinishedInformation.numberOfSegments-1){if(!l||e.segmentInfoType===u.a.SEGMENT_TEMPLATE)return!0;if(l&&e.segmentInfoType===u.a.SEGMENT_LIST&&e.adaptation.period.nextPeriodId)return!0}return!!(l&&e.adaptation.period.nextPeriodId&&e.segmentInfoType===u.a.SEGMENT_TIMELINE&&e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment)&&a&&!isNaN(a.mediaStartTime)&&!isNaN(a.duration)&&a.mediaStartTime+a.duration>=e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment-.05)},reset:function(){v(),f.off(o.a.DYNAMIC_TO_STATIC,b,t)},getNextSegmentRequestIdempotent:function(e,t){var n=a?a.index+1:0,r=m.getSegmentByIndex(t,n,a?a.mediaStartTime:-1);return r?S(e,r):null},getValidSeekTimeCloseToTargetTime:function(e,t,n,r){try{if(isNaN(e)||!t||!n)return NaN;if(e<0&&(e=0),isNaN(r)&&(r=.5),A(t,n,e))return e;for(var i=n.adaptation.period.start,a=n.adaptation.period.start+n.adaptation.period.duration,o=Math.min(e+r,a),s=Math.max(e-r,i),u=NaN,l=null;o<=a||s>=i;){var c=null,f=null;if(o<=a&&(c=A(t,n,o)),s>=i&&(f=A(t,n,s)),f){u=s,l=f;break}if(c){u=o,l=c;break}o+=r,s-=r}if(l){var d=l.startTime+l.duration;return e>=l.startTime&&d-e>r?e:e=i-.5*f.d/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,h){if(u0)for(o=0;o=i&&t-n=n&&console.log(this.time+" ["+e+"] "+t)}},l=function(e){for(var t=[],n=0;n32&&(u.log("ERROR","Too large cursor position "+this.pos),this.pos=32)},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>=32?u.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;t<32;t++)this.chars[t].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var e=[],t=!0,n=0;n<32;n++){var r=this.chars[n].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},setPenStyles:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var h=function(){this.rows=[];for(var e=0;e<15;e++)this.rows.push(new d);this.currRow=14,this.nrRollUpRows=null,this.reset()};h.prototype={reset:function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},equals:function(e){for(var t=!0,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},isEmpty:function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(e){this.rows[this.currRow].insertChar(e)},setPen:function(e){this.rows[this.currRow].setPenStyles(e)},moveCursor:function(e){this.rows[this.currRow].moveCursor(e)},setCursor:function(e){u.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},setPAC:function(e){u.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;this.nrRollUpRows&&t0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},getTextAndFormat:function(){return this.rows}};var p=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new h,this.nonDisplayedMemory=new h,this.lastOutputScreen=new h,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};p.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,u.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]}u.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=u.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 g=function(e,t,n){this.field=e||1,this.outputs=[t,n],this.channels=[new p(1,t),new p(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}};g.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,u.setTime(e);for(var o=0;o=16&&r<=31&&r===this.lastCmdA&&i===this.lastCmdB)this.lastCmdA=null,this.lastCmdB=null,u.log("DEBUG","Repeated command ("+l([r,i])+") is dropped");else if(0!==r||0!==i){if(u.log("DATA","["+l([t[o],t[o+1]])+"] -> ("+l([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)if(a=this.parseChars(r,i))if(this.currChNr&&this.currChNr>=0)this.channels[this.currChNr-1].insertChars(a);else u.log("WARNING","No channel found yet. TEXT-MODE?");n?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,u.log("WARNING","Couldn't parse cleaned data "+l([r,i])+" orig: "+l([t[o],t[o+1]])))}else this.dataCounters.padding+=2},parseCmd:function(e,t){var n=null;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 u.log("ERROR","Mismatch channel in midrow parsing"),!1;var r=this.channels[n-1];return r.insertChars([32]),r.cc_MIDROW(t),u.log("DEBUG","MIDROW ("+l([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var n,s=null;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,s=64<=t&&t<=95?1===n?r[e]:a[e]:1===n?i[e]:o[e];var u=this.interpretPAC(s,t);return this.channels[n-1].setPAC(u),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},interpretPAC:function(e,t){var n=t,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=t;o=17===a?t+80:18===a?t+112:t+144,u.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=l(i);u.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=s[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;e=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 h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n/g,">").replace(/"/g,""").replace(/'/g,"'"):e}function u(e,t,n,r){for(var i=0;i0&&u(e.arrayAccessFormPaths,t,n,r)&&(t[n]=[t[n]])}function c(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 f(n,r,i,a){return!(r==t&&e.xmlElementsFilter.length>0)||u(e.xmlElementsFilter,n,i,a)}function d(s,h){if(s.nodeType==a){for(var p=new Object,g=s.childNodes,m=0;m0){var i=r.split(".#")[0];return u(e.datetimeAccessFormPaths,t,n,i)?c(t):t}return t}(p.__text,_,h+"."+_)),null!=p["#cdata-section"]&&(p.__cdata=p["#cdata-section"],delete p["#cdata-section"],"property"==e.arrayAccessForm&&delete p["#cdata-section_asArray"]),0==p.__cnt&&"text"==e.emptyNodeForm?p="":1==p.__cnt&&null!=p.__text?p=p.__text:1!=p.__cnt||null==p.__cdata||e.keepCData?p.__cnt>1&&null!=p.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==p.__text||""==p.__text.trim())&&delete p.__text:p=p.__cdata,delete p.__cnt,!e.enableToStringFunc||null==p.__text&&null==p.__cdata||(p.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),p}if(s.nodeType==n||s.nodeType==r)return s.nodeValue}function h(t,n,r,i){var a="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+n;if(null!=r)for(var o=0;o":">"}function p(e,t){return""}function g(t,n){return"property"==e.arrayAccessForm&&(r=n.toString(),i="_asArray",-1!==r.indexOf(i,r.length-i.length))||0==n.toString().indexOf(e.attributePrefix)||0==n.toString().indexOf("__")||t[n]instanceof Function;var r,i}function m(e){var t=0;if(e instanceof Object)for(var n in e)g(e,n)||t++;return t}function y(t,n,r){return 0==e.jsonPropertiesFilter.length||""==r||u(e.jsonPropertiesFilter,t,n,r)}function E(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 _(t){var n="";return t instanceof Object?n+=function(t){var n="";return null!=t.__cdata&&(n+=""),null!=t.__text&&(e.escapeMode?n+=s(t.__text):n+=t.__text),n}(t):null!=t&&(e.escapeMode?n+=s(t):n+=t),n}function v(e,t){return""===e?t:e+"."+t}function T(e,t,n,r){var i="";if(0==e.length)i+=h(e,t,n,!0);else for(var a=0;a0)for(var r in e)if(!g(e,r)&&(""==t||y(e,r,v(t,r)))){var i=e[r],a=E(i);if(null==i||null==i)n+=h(i,r,a,!0);else if(i instanceof Object)if(i instanceof Array)n+=T(i,r,a,t);else if(i instanceof Date)n+=h(i,r,a,!1),n+=i.toISOString(),n+=p(i,r);else{m(i)>0||null!=i.__text||null!=i.__cdata?(n+=h(i,r,a,!1),n+=S(i,v(t,r)),n+=p(i,r)):n+=h(i,r,a,!0)}else n+=h(i,r,a,!1),n+=_(i),n+=p(i,r)}return n+=_(e)}this.parseXmlString=function(e){var t;window.ActiveXObject||window;if(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?c(e):e},this.xml2json=function(e){return d(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return S(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}}},function(e,t,n){"use strict";var r=n(3),i=n(25),a=n(15),o=n(1);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;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}(e,t)||u(e,t)||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.")}()}function u(e,t){if(e){if("string"==typeof e)return l(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)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nt/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}}}}(r.headers.keys());try{for(p.s();!(a=p.n()).done;){var g=a.value;c+=g+": "+r.headers.get(g)+"\r\n"}}catch(e){p.e(e)}finally{p.f()}if(e.response.responseHeaders=c,!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 m,y,T=parseInt(r.headers.get("Content-Length"),10),S=0,A=!1,b=new Uint8Array,I=0;if(E===o.a.ABR_FETCH_THROUGHPUT_CALCULATION_AAST&&i){var R=n,N=0,w=s(r.body.tee(),2),C=w[0],D=w[1];m=C.getReader(),y=[],m.read().then((function r(a){var o=a.value,s=a.done;if(N=Date.now(),o&&o.length){var u=N-R,l=o.length;y.push({chunkDownloadTimeRelativeMS:N-n,chunkDownloadDurationMS:u,chunkBytes:l,kbps:Math.round(8*l/(u/1e3)),bufferLevel:t.getCurrentBufferLevel(h.mediaType)})}if(s){var f=N-n,d=y.reduce((function(e,t){return e+t.chunkBytes}),0);return i.addMeasurement(h,f,y,_,v,c),void e.progress({loaded:d,total:d,lengthComputable:!0,time:i.getEstimatedDownloadDurationMS(h),stream:!0})}return R=Date.now(),m.read().then(r)})),e.reader=D.getReader()}else e.reader=r.body.getReader();var O=[],M=[],P=[],L=!0;f(e,(function t(n){var r=n.value;if(n.done){if(b){if(E!==o.a.ABR_FETCH_THROUGHPUT_CALCULATION_AAST){var i=null;E===o.a.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);else{0===o&&(o=n[s].ts);var l=r[s].ts-o;l>1?(i.push(8*a/l),a=0,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)),e.progress({loaded:S,total:isNaN(T)?S:T,lengthComputable:!0,time:d(O,S),throughput:i,stream:!0})}e.response.response=b.buffer}return e.onload(),void e.onend()}if(r&&r.length>0){if(b=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}(b,r),S+=r.length,O.push({ts:Date.now(),bytes:r.length}),E===o.a.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&L)l.findLastTopIsoBoxCompleted(["moof"],b,I).found&&(L=!1,M.push({ts:performance.now(),bytes:r.length}));var a=l.findLastTopIsoBoxCompleted(["moov","mdat"],b,I);if(a.found){var s,u=a.lastCompletedOffset+a.size;E!==o.a.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING||L||(L=!0,P.push({ts:performance.now(),bytes:b.length})),u===b.length?(s=b,b=new Uint8Array):(s=new Uint8Array(b.subarray(0,u)),b=b.subarray(u)),e.progress({data:s.buffer,lengthComputable:!1,noTrace:!0}),I=0}else I=a.lastCompletedOffset,A||(e.progress({lengthComputable:!1,noTrace:!0}),A=!0)}f(e,t)}))})).catch((function(t){e.onerror&&e.onerror(t)}))}))},abort:function(e){if(e.abortController)e.abortController.abort();else if(e.reader)try{e.reader.cancel(),e.onabort()}catch(e){}},calculateDownloadedTime:d,setup:function(e){t=e.dashMetrics}}}c.__dashjs_factory_name="FetchLoader";var f=r.a.getClassFactory(c),d=n(5),h=n(8),p=n(36),g=n(14),m=n(6),y=n(7),E=n(2);function _(){var e,t,n=this.context,r={};function i(){t=Object(m.a)(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 g=c/f,m=n.segmentBytes/g;return n.fetchDownloadDurationMSn.bitrate)return y=e.bandwidth,!0})),y===n.bitrate?n.fetchDownloadDurationMS*u:u*n.segmentBytes*8*1e3/y}},i(),e}_.__dashjs_factory_name="LowLatencyThroughputModel";var v=r.a.getSingletonFactory(_);function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){e=e||{};var t,n,r,s,u,l,c,_,S,A=this.context,b=e.errHandler,I=e.dashMetrics,R=e.mediaPlayerModel,N=e.requestModifier,w=e.boxParser,C=e.errors,D=e.requestTimeout||0,O=Object(y.a)(A).getInstance(),M=Object(a.a)(A).getInstance();function P(e,t){var a,p=e.request,m=[],y=!0,v=!0,T=new Date,S=T,C=0;if(!N||!I||!b)throw new Error("config object is not correct or missing");var L,F=function(e){if(v=!1,p.requestStartDate=T,p.requestEndDate=new Date,p.firstByteDate=p.firstByteDate||T,!p.checkExistenceOnly){var t=a.response?a.response.responseURL:null,n=a.response?a.response.status:null,r=a.response&&a.response.getAllResponseHeaders?a.response.getAllResponseHeaders():a.response?a.response.responseHeaders:[];I.addHttpRequest(p,t,n,r,e?m:null),p.type===d.a.MPD_TYPE&&I.addManifestUpdate(p)}},x=function(){if(-1!==n.indexOf(a)&&(n.splice(n.indexOf(a),1),v))if(F(!1),t>0){try{if(M.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&p.type===d.a.MEDIA_SEGMENT_TYPE)R.getRetryAttemptsForType(d.a.MEDIA_SEGMENT_TYPE)===t&&O.trigger(E.a.ATTEMPT_BACKGROUND_SYNC)}catch(e){}t--;var r={config:e};s.push(r),r.timeout=setTimeout((function(){-1!==s.indexOf(r)&&(s.splice(s.indexOf(r),1),P(e,t))}),R.getRetryIntervalsForType(p.type))}else{if(p.type===d.a.MSS_FRAGMENT_INFO_SEGMENT_TYPE)return;b.error(new h.a(u[p.type],p.url+" is not available",{request:p,response:a.response})),e.error&&e.error(p,"error",a.response.statusText),e.complete&&e.complete(p,a.response.statusText)}};M.get().streaming.lowLatencyEnabled&&window.fetch&&"arraybuffer"===p.responseType&&p.type===d.a.MEDIA_SEGMENT_TYPE?(L=f(A).create({requestModifier:N,lowLatencyThroughputModel:c,boxParser:w})).setup({dashMetrics:I}):L=Object(i.a)(A).create({requestModifier:N});var U=null,B=N.modifyRequestURL(p.url);if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled){var k=M.get().streaming.cmcd.mode;if(k===o.a.CMCD_MODE_QUERY){var G=function(e){try{var t=[],n=l.getQueryParameter(e);return n&&t.push(n),t}catch(e){return[]}}(p);B=g.a.addAditionalQueryParameterToUrl(B,G)}else k===o.a.CMCD_MODE_HEADER&&(U=l.getHeaderParameters(p))}p.url=B;var j=p.checkExistenceOnly?d.a.HEAD:d.a.GET,Y=R.getXHRWithCredentialsForType(p.type);a={url:B,method:j,withCredentials:Y,request:p,onload:function(){a.response.status>=200&&a.response.status<=299&&(F(!0),e.success&&e.success(a.response.response,a.response.statusText,a.response.responseURL),e.complete&&e.complete(p,a.response.statusText))},onend:x,onerror:x,progress:function(t){var n=new Date;y&&(y=!1,(!t.lengthComputable||t.lengthComputable&&t.total!==t.loaded)&&(p.firstByteDate=n)),t.lengthComputable&&(p.bytesLoaded=t.loaded,p.bytesTotal=t.total),t.noTrace||(m.push({s:S,d:t.time?t.time:n.getTime()-S.getTime(),b:[t.loaded?t.loaded-C:0],t:t.throughput}),S=n,C=t.loaded),e.progress&&t&&e.progress(t)},onabort:function(){e.abort&&e.abort(p)},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";_.warn(t)},loader:L,timeout:D,headers:U};var H=(new Date).getTime();if(isNaN(p.delayLoadingTime)||H>=p.delayLoadingTime)n.push(a),L.load(a);else{var K={httpRequest:a};r.push(K),K.delayTimeout=setTimeout((function(){if(-1!==r.indexOf(K)){r.splice(r.indexOf(K),1);try{T=new Date,S=T,n.push(K.httpRequest),L.load(K.httpRequest)}catch(e){K.httpRequest.onerror()}}}),p.delayLoadingTime-H)}}return t={load:function(e){e.request?P(e,R.getRetryAttemptsForType(e.request.type)):e.error&&e.error(e.request,"error")},abort:function(){s.forEach((function(e){clearTimeout(e.timeout),e.config.request&&e.config.abort&&e.config.abort(e.config.request)})),s=[],r.forEach((function(e){return clearTimeout(e.delayTimeout)})),r=[],n.forEach((function(e){e.request.type!==d.a.MSS_FRAGMENT_INFO_SEGMENT_TYPE&&(e.onloadend=e.onerror=e.onprogress=void 0,e.loader.abort(e))})),n=[]}},_=Object(m.a)(A).getInstance().getLogger(t),n=[],r=[],s=[],l=Object(p.a)(A).getInstance(),c=v(A).getInstance(),T(S={},d.a.MPD_TYPE,C.DOWNLOAD_ERROR_ID_MANIFEST_CODE),T(S,d.a.XLINK_EXPANSION_TYPE,C.DOWNLOAD_ERROR_ID_XLINK_CODE),T(S,d.a.INIT_SEGMENT_TYPE,C.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE),T(S,d.a.MEDIA_SEGMENT_TYPE,C.DOWNLOAD_ERROR_ID_CONTENT_CODE),T(S,d.a.INDEX_SEGMENT_TYPE,C.DOWNLOAD_ERROR_ID_CONTENT_CODE),T(S,d.a.BITSTREAM_SWITCHING_SEGMENT_TYPE,C.DOWNLOAD_ERROR_ID_CONTENT_CODE),T(S,d.a.OTHER_TYPE,C.DOWNLOAD_ERROR_ID_CONTENT_CODE),u=S,t}S.__dashjs_factory_name="HTTPLoader";var A=r.a.getClassFactory(S);function b(){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 A},registerLoader:function(t,n){e[t]=n},unregisterLoader:function(t){e[t]&&delete e[t]},unregisterAllLoader:t,reset:n}}b.__dashjs_factory_name="SchemeLoaderFactory";var I=r.a.getSingletonFactory(b);t.a=I},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(60).Buffer)},function(e,t,n){(function(e){function n(e,t){for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;a--){var o=a>=0?arguments[a]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,i="/"===o.charAt(0))}return(i?"/":"")+(t=n(r(t.split("/"),(function(e){return!!e})),!i).join("/"))||"."},t.normalize=function(e){var a=t.isAbsolute(e),o="/"===i(e,-1);return(e=n(r(e.split("/"),(function(e){return!!e})),!a).join("/"))||a||(e="."),e&&o&&(e+="/"),(a?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),a=r(n.split("/")),o=Math.min(i.length,a.length),s=o,u=0;u=1;--a)if(47===(t=e.charCodeAt(a))){if(!i){r=a;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":e.slice(0,r)},t.basename=function(e,t){var n=function(e){"string"!=typeof e&&(e+="");var t,n=0,r=-1,i=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!i){n=t+1;break}}else-1===r&&(i=!1,r=t+1);return-1===r?"":e.slice(n,r)}(e);return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,n=0,r=-1,i=!0,a=0,o=e.length-1;o>=0;--o){var s=e.charCodeAt(o);if(47!==s)-1===r&&(i=!1,r=o+1),46===s?-1===t?t=o:1!==a&&(a=1):-1!==t&&(a=-1);else if(!i){n=o+1;break}}return-1===t||-1===r||0===a||1===a&&t===r-1&&t===n+1?"":e.slice(t,r)};var i="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,n(26))},function(e,t,n){t.generateISD=n(74).generateISD,t.fromXML=n(75).fromXML,t.renderHTML=n(91).render},function(e,t,n){"use strict";var r=n(3),i=n(13);function a(){return{customTimeRangeArray:[],length:0,add:function(e,t){var n=0;for(n=0;nthis.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 Object(i.a)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}a.__dashjs_factory_name="CustomTimeRanges",t.a=r.a.getClassFactory(a)},function(e,t,n){"use strict";n.d(t,"b",(function(){return s}));var r=n(3),i=n(29),a=n(1),o=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];function s(){var e="WebKitMediaSource"in window,t="MediaSource"in window;return e||t}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.a.AUDIO&&n!==a.a.VIDEO?Promise.resolve(!0):function(e,n){return t.get().streaming.capabilities.useMediaCapabilitiesApi&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo&&(e.codec&&n===a.a.AUDIO||n===a.a.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+'"'),"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.a.indexOf(e.schemeIdUri)}catch(e){return!0}},codecRootCompatibleWithCodec:function(e,t){for(var n,r=e.split(".")[0],i=0===t.indexOf(r),a=0;a0&&void 0!==arguments[0]?arguments[0]:null;return parseFloat((D(e)-U()).toFixed(5))}function D(e){var t=e||g;return t.start+t.duration}function O(){g&&o&&o.getElement()?o.play():E=!0}function M(){return g&&o?o.isPaused():null}function P(){g&&o&&o.pause()}function L(){return g&&o?o.isSeeking():null}function F(){return g&&o?o.isStalled():null}function x(e,n,r){g&&o&&(e!==(isNaN(T)?o.getTime():T)&&((S=!0===r)||(T=e,w.trigger(c.a.PLAYBACK_SEEK_ASKED)),t.info("Requesting seek to time: "+e+(S?" (internal)":"")),o.setCurrentTime(e,n)))}function U(){return g&&o?o.getTime():null}function B(){var e=U();if(m&&!isNaN(v)){var t=v/1e3;e>t&&(e-=t)}return e}function k(){return g&&o?o.getPlaybackRate():null}function G(){return g&&o?o.getEnded():null}function j(){return m}function Y(){if(!m||isNaN(v))return NaN;var e=B();if(isNaN(e)||0===e)return 0;var t=(new Date).getTime()+1e3*s.getClientTimeOffset();return Math.max(((t-v-1e3*e)/1e3).toFixed(3),0)}function H(){P(),E=!1,p=0,v=0,T=NaN,o&&(w.off(c.a.DATA_UPDATE_COMPLETED,z,this),w.off(c.a.LOADING_PROGRESS,me,this),w.off(h.a.BUFFER_LEVEL_STATE_CHANGED,ye,this),w.off(h.a.PLAYBACK_PROGRESS,fe,this),w.off(h.a.PLAYBACK_TIME_UPDATED,fe,this),w.off(h.a.PLAYBACK_ENDED,le,this),w.off(h.a.STREAM_INITIALIZING,_e,this),w.off(h.a.REPRESENTATION_SWITCH,ve,this),o.setPlaybackRate(1,!0),V(),o.removeEventListener("canplay",X),o.removeEventListener("canplaythrough",Q),o.removeEventListener("play",$),o.removeEventListener("waiting",Z),o.removeEventListener("playing",J),o.removeEventListener("pause",ee),o.removeEventListener("error",ce),o.removeEventListener("seeking",te),o.removeEventListener("seeked",ne),o.removeEventListener("timeupdate",re),o.removeEventListener("progress",ie),o.removeEventListener("ratechange",ae),o.removeEventListener("loadedmetadata",oe),o.removeEventListener("loadeddata",se),o.removeEventListener("stalled",Ee),o.removeEventListener("ended",ue)),f=null,o=null,g=null,m=null}function K(e,t){var n=r.getCurrentDVRInfo(t),i=n?n.range:null;return i?e>i.end?Math.max(i.end-p,i.start):e>0&&e+.25_+500)&&(_=e,re())):W())}),R.get().streaming.wallclockTimeUpdateInterval)}}function V(){clearInterval(f),f=null}function W(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!M()&&m&&0!==o.getReadyState()&&!L()){e||(e=n.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO);var r=B(),i=K(r,e),s=!isNaN(i)&&i!==r;s&&!L()&&(F()||b)&&(t.debug("UpdateCurrentTime: Seek to actual time: ".concat(i," from currentTime: ").concat(r)),x(i))}}function z(e){var t=i.convertRepresentationToRepresentationInfo(e.currentRepresentation),n=t?t.mediaInfo.streamInfo:null;null!==n&&g.id===n.id&&(g=n)}function X(){w.trigger(c.a.CAN_PLAY)}function Q(){w.trigger(c.a.CAN_PLAY_THROUGH)}function $(){t.info("Native video element event: play"),W(),q(),w.trigger(c.a.PLAYBACK_STARTED,{startTime:U()})}function Z(){t.info("Native video element event: waiting"),w.trigger(c.a.PLAYBACK_WAITING,{playingTime:U()})}function J(){t.info("Native video element event: playing"),w.trigger(c.a.PLAYBACK_PLAYING,{playingTime:U()})}function ee(){t.info("Native video element event: pause"),w.trigger(c.a.PLAYBACK_PAUSED,{ended:G()})}function te(){if(S)S=!1;else{var e=U();isNaN(T)||T===e||(e=T),T=NaN,t.info("Seeking to: "+e),q(),w.trigger(c.a.PLAYBACK_SEEKING,{seekTime:e,streamId:g.id})}}function ne(){t.info("Native video element event: seeked"),w.trigger(c.a.PLAYBACK_SEEKED)}function re(){g&&w.trigger(c.a.PLAYBACK_TIME_UPDATED,{timeToEnd:C(),time:U(),streamId:g.id})}function ie(){w.trigger(c.a.PLAYBACK_PROGRESS,{streamId:g.id})}function ae(){var e=k();t.info("Native video element event: ratechange: ",e),w.trigger(c.a.PLAYBACK_RATE_CHANGED,{playbackRate:e})}function oe(){t.info("Native video element event: loadedmetadata"),w.trigger(c.a.PLAYBACK_METADATA_LOADED),q()}function se(){t.info("Native video element event: loadeddata"),w.trigger(c.a.PLAYBACK_LOADED_DATA)}function ue(){t.info("Native video element event: ended"),P(),V();var e=n?n.getActiveStreamInfo():null;e&&w.trigger(c.a.PLAYBACK_ENDED,{isLast:e.isLast})}function le(e){if(f&&e.isLast){t.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended");var n=e.seekTime?e.seekTime:D();o.setCurrentTime(n),P(),V()}}function ce(e){var t=e.target||e.srcElement;w.trigger(c.a.PLAYBACK_ERROR,{error:t.error})}function fe(){m&&de()&&R.get().streaming.liveCatchup.playbackRate>0&&!M()&&!L()&&(function(){try{if(de()&&R.get().streaming.liveCatchup.playbackRate>0&&U()>0){var e=pe(),t=Y(),n=y.getLiveDelay(),r=y.getLiveCatchupLatencyThreshold(),i=R.get().streaming.liveCatchup.minDrift;if(e===a.a.LIVE_CATCHUP_MODE_LOLP){var o=he(),s=R.get().streaming.liveCatchup.playbackBufferMin;return function(e,t,n,r,i,a){try{var o=Math.abs(e-t);return(isNaN(a)||e<=a)&&(o>n||rr&&(isNaN(n)||e<=n)}catch(e){return!1}}(t,n,r,i)}}catch(e){return!1}}()?function(){if(o){var e,i=o.getPlaybackRate(),s=R.get().streaming.liveCatchup.playbackRate,u=Y(),l=y.getLiveDelay(),c=he();if(pe()===a.a.LIVE_CATCHUP_MODE_LOLP){R.get().streaming.liveCatchup.minDrift;var f=R.get().streaming.liveCatchup.playbackBufferMin;e=function(e,n,r,i,a,o,s){var u,l=e;if(or/2&&(b=!1);Math.abs(s-u)<=I&&(u=null);return{newRate:u}}(s,u,l,0,f,c,i)}else e=function(e,t,n,r,i){var a=e,o=t-n,s=5*o,u=2*a/(1+Math.pow(Math.E,-s)),l=1-a+u;b&&(r>n/2?b=!1:o>0&&(l=1));Math.abs(i-l)<=I&&(l=null);return{newRate:l}}(s,u,l,c,i);var d=e.newRate;d&&o.setPlaybackRate(d);var h=u-l;R.get().streaming.liveCatchup.maxDrift>0&&!A&&h>R.get().streaming.liveCatchup.maxDrift?(t.info("Low Latency catchup mechanism. Latency too high, doing a seek to live point"),A=!0,p=n&&n.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,x(((g=r.getCurrentDVRInfo(p))?g.range:null).end-y.getLiveDelay(),!0,!1)):A=!1}var p,g}():ge())}function de(){return R.get().streaming.liveCatchup.enabled||R.get().streaming.lowLatencyEnabled}function he(){var e=null;return n.getActiveStreamProcessors().forEach((function(t){var n=t.getBufferLevel();e=null===e?n:Math.min(e,n)})),e}function pe(){var e=R.get().streaming.liveCatchup.playbackBufferMin;return R.get().streaming.liveCatchup.mode!==a.a.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?a.a.LIVE_CATCHUP_MODE_DEFAULT:a.a.LIVE_CATCHUP_MODE_LOLP}function ge(){o&&o.setPlaybackRate(1)}function me(e){if(!1===e.stream&&R.get().streaming.lowLatencyEnabled&&!isNaN(e.request.duration)){var n=1.2*e.request.duration;n>y.getLiveDelay()&&(t.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",n.toFixed(2)),R.update({streaming:{delay:{liveDelay:n}}}))}}function ye(e){e.streamId===g.id&&(de()?e.state!==u.BUFFER_EMPTY||L()||b||(b=!0,ge()):R.get().streaming.buffer.setStallState&&o.setStallState(e.mediaType,e.state===u.BUFFER_EMPTY))}function Ee(e){w.trigger(c.a.PLAYBACK_STALLED,{e:e})}function _e(e){var n;(n=e.mediaInfo)&&n.supplementalProperties&&"true"===n.supplementalProperties[a.a.SUPPLEMENTAL_PROPERTY_LL_SCHEME]&&(t.debug("Low Latency critical SupplementalProperty set: Enabling low Latency"),R.update({streaming:{lowLatencyEnabled:!0}}))}function ve(e){var t=n.getActiveStreamInfo();if(R.get().streaming.lowLatencyEnabledByManifest&&e&&t&&e.currentRepresentation&&e.streamId&&e.streamId===t.id&&e.mediaType&&(e.mediaType===a.a.VIDEO||e.mediaType===a.a.AUDIO)){var r=!e.currentRepresentation.availabilityTimeComplete;r&&R.update({streaming:{lowLatencyEnabled:r}})}}return e={initialize:function(e,t){g=e,!0!==t&&function(){o.addEventListener("canplay",X),o.addEventListener("canplaythrough",Q),o.addEventListener("play",$),o.addEventListener("waiting",Z),o.addEventListener("playing",J),o.addEventListener("pause",ee),o.addEventListener("error",ce),o.addEventListener("seeking",te),o.addEventListener("seeked",ne),o.addEventListener("timeupdate",re),o.addEventListener("progress",ie),o.addEventListener("ratechange",ae),o.addEventListener("loadedmetadata",oe),o.addEventListener("loadeddata",se),o.addEventListener("stalled",Ee),o.addEventListener("ended",ue),m=g.manifestInfo.isDynamic,A=!1,b=!1,S=!1;var e="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",t=/safari/.test(e)&&!/chrome/.test(e);I=t?.25:.02,w.on(c.a.DATA_UPDATE_COMPLETED,z,this),w.on(c.a.LOADING_PROGRESS,me,this),w.on(h.a.BUFFER_LEVEL_STATE_CHANGED,ye,this),w.on(h.a.PLAYBACK_PROGRESS,fe,this),w.on(h.a.PLAYBACK_TIME_UPDATED,fe,this),w.on(h.a.PLAYBACK_ENDED,le,this,{priority:l.a.EVENT_PRIORITY_HIGH}),w.on(h.a.STREAM_INITIALIZING,_e,this),w.on(h.a.REPRESENTATION_SWITCH,ve,this),E&&(E=!1,O())}()},setConfig:function(e){e&&(e.streamController&&(n=e.streamController),e.dashMetrics&&(r=e.dashMetrics),e.mediaPlayerModel&&(y=e.mediaPlayerModel),e.adapter&&(i=e.adapter),e.videoModel&&(o=e.videoModel),e.timelineConverter&&(s=e.timelineConverter),e.settings&&(R=e.settings))},getTimeToStreamEnd:C,getBufferLevel:he,getTime:U,getNormalizedTime:B,getPlaybackRate:k,getPlayedRanges:function(){return g&&o?o.getPlayedRanges():null},getEnded:G,getIsDynamic:j,getStreamController:function(){return n},computeAndSetLiveDelay:function(e,n){var r,o,s,u=!isNaN(e)&&isFinite(e)?e:NaN,l=i.getSuggestedPresentationDelay();if(R.get().streaming.delay.applyServiceDescription&&isNaN(R.get().streaming.delay.liveDelay)&&isNaN(R.get().streaming.delay.liveDelayFragmentCount)&&function(e){if(!e||!e.serviceDescriptions)return;for(var n=null,r=0;r0&&(t.debug("Apply LL properties coming from service description. Target Latency (ms):",n.latency.target),R.update({streaming:{delay:{liveDelay:n.latency.target/1e3},liveCatchup:{minDrift:(n.latency.target+500)/1e3,maxDrift:n.latency.max>n.latency.target?(n.latency.max-n.latency.target+500)/1e3:void 0}}})),n.playbackRate&&n.playbackRate.max>1&&(t.debug("Apply LL properties coming from service description. Max PlaybackRate:",n.playbackRate.max),R.update({streaming:{liveCatchup:{playbackRate:n.playbackRate.max-1}}})))}(n),r=y.getLiveDelay()?y.getLiveDelay():null===R.get().streaming.delay.liveDelayFragmentCount||isNaN(R.get().streaming.delay.liveDelayFragmentCount)||isNaN(u)?!0===R.get().streaming.delay.useSuggestedPresentationDelay&&null!==l&&!isNaN(l)&&l>0?l:isNaN(u)?n&&!isNaN(n.minBufferTime)?4*n.minBufferTime:4*g.manifestInfo.minBufferTime:4*u:u*R.get().streaming.delay.liveDelayFragmentCount,null!==(s=i.getAvailabilityStartTime())&&(v=s),n&&n.dvrWindowSize>0){var c=Math.max(n.dvrWindowSize-10,n.dvrWindowSize/2);o=Math.min(r,c)}else o=r;return p=o,o},getLiveDelay:function(){return p},getCurrentLiveLatency:Y,play:O,isPaused:M,pause:P,isSeeking:L,getStreamEndTime:D,seek:x,reset:H,updateCurrentTime:W,getAvailabilityStartTime:function(){return v}},t=Object(d.a)(N).getInstance().getLogger(e),H(),e}p.__dashjs_factory_name="PlaybackController";var g=f.a.getSingletonFactory(p),m=n(18),y=n(8),E=n(9),_=n(15),v=n(5);function T(e){var t,n,r,i,o,s,u=this.context,l=Object(_.a)(u).getInstance(),f=e.textController,h=e.eventBus,p=[],g=[],m=!1,T=e.mediaSource,S=null;function A(e){return new Promise((function(t){P((function(){i.changeType&&i.changeType(e),t()}))}))}function b(e){return i=f.getTextSourceBuffer(e),Promise.resolve()}function I(){if("function"==typeof i.addEventListener)try{i.addEventListener("updateend",O,!1),i.addEventListener("error",M,!1),i.addEventListener("abort",M,!1)}catch(e){s=setInterval(O,50)}else s=setInterval(O,50)}function R(e){return new Promise((function(t){i&&l.get().streaming.buffer.useAppendWindow?P((function(){try{if(!i)return void t();var n=T.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 N(e){return new Promise((function(t){i?P((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 w(){return new Promise((function(e){P((function(){var t=i.appendWindowStart,n=i.appendWindowEnd;i&&(i.abort(),i.appendWindowStart=t,i.appendWindowEnd=n),e()}))}))}function C(){if(!m&&g.length>0){m=!0;var e=g[0];g.splice(0,1);var t=function(){m=!1,g.length>0&&C.call(this),e&&e.data&&e.data.segmentType&&e.data.segmentType!==v.a.INIT_SEGMENT_TYPE&&delete e.data.bytes,e.promise.resolve({chunk:e.data})};try{S=e.request,0===e.data.bytes.byteLength?t.call(this):(i.appendBuffer?i.appendBuffer(e.data.bytes):i.append(e.data.bytes,e.data),P(t.bind(this)))}catch(t){r.fatal('SourceBuffer append failed "'+t+'"'),g.length>0?C():m=!1,delete e.data.bytes,e.promise.reject({chunk:e.data,error:new y.a(t.code,t.message)})}}}function D(){p.length>0&&(i.updating||(p.shift()(),D()))}function O(){i.updating||D()}function M(e){var t,r,i=e.target||{};t=c.a.SOURCE_BUFFER_ERROR,r={error:i,lastRequestAppended:S}||{},h.trigger(t,r,{streamId:o.streamInfo.id,mediaType:n})}function P(e){p.push(e),i.updating||D()}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?(g.push({data:e,promise:{resolve:r,reject:i},request:n}),P(C.bind(t))):i({chunk:e,error:new y.a(E.a.APPEND_ERROR_CODE,E.a.APPEND_ERROR_MESSAGE)})}))},remove:function(e){return new Promise((function(t,n){var r=e.start,a=e.end;r>=0&&a>r?P((function(){try{i.remove(r,a),P((function(){t({from:r,to:a,unintended:!1}),e.resolve&&e.resolve()}))}catch(t){n({from:r,to:a,unintended:!1,error:new y.a(E.a.REMOVE_ERROR_CODE,E.a.REMOVE_ERROR_MESSAGE)}),e.reject&&e.reject(t)}})):t()}))},abort:function(){return new Promise((function(e){try{g=[],"open"===T.readyState?P((function(){i&&i.abort(),e()})):i&&i.setTextTrack&&"ended"===T.readyState?(i.abort(),e()):e()}catch(t){e()}}))},reset:function(){if(i){try{p=[],function(){try{"function"==typeof i.removeEventListener&&(i.removeEventListener("updateend",O,!1),i.removeEventListener("error",M,!1),i.removeEventListener("abort",M,!1)),clearInterval(s)}catch(e){r.error(e)}}(),m=!1,g=[],i.getClassName&&"TextSourceBuffer"===i.getClassName()||(r.debug("Removing sourcebuffer from media source"),T.removeSourceBuffer(i))}catch(e){}i=null}S=null},updateTimestampOffset:N,initializeForStreamSwitch:function(e,t,r){n=(o=e).type;var a=o.codec;!function(e){i=e.getBuffer()}(r),I();var s=[];return s.push(w),s.push(R(o.streamInfo)),s.push(A(a)),t&&void 0!==t.MSETimeOffset&&s.push(N(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 b(e);i=T.addSourceBuffer(s),I();var u=[];return u.push(R(o.streamInfo)),r&&void 0!==r.MSETimeOffset&&u.push(N(r.MSETimeOffset)),Promise.all(u)}catch(t){return o.type==a.a.TEXT&&!o.isFragmented||-1!==s.indexOf('codecs="stpp')||-1!==s.indexOf('codecs="vtt')?b(e):Promise.reject(t)}},updateAppendWindow:R,changeType:A},r=Object(d.a)(u).getInstance().getLogger(t),t}T.__dashjs_factory_name="SourceBufferSink";var S=f.a.getClassFactory(T);function A(){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={}}}}A.__dashjs_factory_name="InitCache";var b=f.a.getSingletonFactory(A);function I(e){e=e||{};var t,n,r,i,o,s,f,p,g,_,T,A,I,R,N,w,C,D,O=this.context,M=Object(l.a)(O).getInstance(),P=e.errHandler,L=e.fragmentModel,F=e.representationController,x=e.adapter,U=e.textController,B=e.abrController,k=e.playbackController,G=e.streamInfo,j=e.type,Y=e.settings;function H(e){s=e}function K(e){return x.convertRepresentationToRepresentationInfo(F.getRepresentationForQuality(e))}function q(e,t,n){var r=K(n);return t&&t[j]&&(j===a.a.VIDEO||j===a.a.AUDIO)?g.initializeForStreamSwitch(e,r,t[j]):g.initializeForFirstUse(G,e,r)}function V(e){Y.get().streaming.cacheInitSegments&&(n.info("Init fragment finished loading saving to",j+"'s init cache"),N.save(e.chunk)),n.debug("Append Init fragment",j," with representationId:",e.chunk.representationId," and quality:",e.chunk.quality,", data size:",e.chunk.bytes.byteLength),z(e.chunk)}function W(e){z(e.chunk,e.request)}function z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;g.append(e,t).then((function(e){Q(e)})).catch((function(e){Q(e)})),e.mediaInfo.type===a.a.VIDEO&&Ee(c.a.VIDEO_CHUNK_RECEIVED,{chunk:e})}function X(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(Y.get().streaming.buffer.bufferTimeAtTopQuality,.9*t),i=Math.min(Y.get().streaming.buffer.bufferTimeAtTopQualityLongForm,.9*t),a={streaming:{buffer:{bufferToKeep:parseFloat(e.toFixed(5)),bufferTimeAtTopQuality:parseFloat(r.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(i.toFixed(5))}}};Y.update(a)}}(),void(22!==e.error.code&&ye()||(n.warn("Clearing playback buffer to overcome quota exceed situation"),Ee(c.a.QUOTA_EXCEEDED,{criticalBufferLevel:o,quotaExceededTime:e.chunk.start}),ue(se())));if(g&&(re(),R=!1,(T=e.chunk)&&T.endFragment)){T&&!isNaN(T.index)&&(f=Math.max(T.index,f),ie());var t=g.getAllBufferRanges();T.segmentType===v.a.MEDIA_SEGMENT_TYPE&&(X(t),J(),function(){if(isNaN(D))return;if(j!==a.a.AUDIO&&j!==a.a.VIDEO)return void(D=NaN);var e=k.getTime(),t=ne(D,0);if(e===D&&t)return void(D=NaN);var n=F.getCurrentRepresentation().segmentDuration;if(!(t=ne(D,n)))return;Y.get().streaming.buffer.enableSeekDecorrelationFix&&Math.abs(e-D)>n?D<=t.end&&(k.seek(Math.max(D,t.start),!1,!0),D=NaN):en){var i=Math.max(0,e-n),a=L.getRequests({state:m.a.FRAGMENT_MODEL_EXECUTED,time:e,threshold:.01})[0];if(a&&(i=Math.min(a.startTime,i)),i>0)return{start:r,end:i}}return null}(e,n),i=function(e,t){var n=t.end(t.length-1)+.5,r=G.manifestInfo.duration>=Y.get().streaming.buffer.longFormContentDurationThreshold?Y.get().streaming.buffer.bufferTimeAtTopQualityLongForm:Y.get().streaming.buffer.bufferTimeAtTopQuality;if(n-e>r){var i=e+r,a=L.getRequests({state:m.a.FRAGMENT_MODEL_EXECUTED,time:e,threshold:.01})[0];if(a&&(i=Math.max(a.startTime+a.duration,i)),i=a&&e=p-1,t=k.getTimeToStreamEnd(G)-i<=0;!e&&!t||r||(ge(!0),n.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id ".concat(G.id," and type ").concat(j)))}function ae(){j!==a.a.AUDIO&&j!==a.a.VIDEO||((!Y.get().streaming.lowLatencyEnabled&&i=Y.get().streaming.buffer.stallThreshold||Y.get().streaming.lowLatencyEnabled&&i>0)&&oe(u.BUFFER_LOADED))}function oe(e){_===e||e===u.BUFFER_EMPTY&&0===k.getTime()||j===a.a.TEXT&&!U.isTextEnabled()||(_=e,Ee(c.a.BUFFER_LEVEL_STATE_CHANGED,{state:e}),Ee(e===u.BUFFER_LOADED?c.a.BUFFER_LOADED:c.a.BUFFER_EMPTY),n.debug(e===u.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function se(){var e=[],t=g.getAllBufferRanges();if(!t||0===t.length)return e;var n=k.getTime(),r=Math.max(0,n-Y.get().streaming.buffer.bufferToKeep),i=L.getRequests({state:m.a.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(i)r=Math.min(i.startTime,r);else if(0===n&&k.getIsDynamic())return[];if(t.start(0)<=r){for(var a={start:0,end:r},o=0;o=Y.get().streaming.buffer.bufferPruningInterval&&(A=0,g&&j!==a.a.TEXT&&(r||ue(se())))}function pe(){ae()}function ge(e){r!==e&&((r=e)?Ee(c.a.BUFFERING_COMPLETED):p=Number.POSITIVE_INFINITY)}function me(){try{var e,t,n=g.getAllBufferRanges(),r=0;if(!n)return r;for(t=0,e=n.length;t1&&void 0!==arguments[1]?arguments[1]:[];return new Promise((function(r,i){if(N&&e&&s){var a=B.getQualityFor(j,G.id);g=S(O).create({mediaSource:s,textController:U,eventBus:M}),q(e,t,a).then((function(){return fe(K(a))})).then((function(){r(g)})).catch((function(e){n.fatal("Caught error on create SourceBuffer: "+e),P.error(new y.a(E.a.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,E.a.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+j)),i(e)}))}else r(null)}))},getBuffer:function(){return g},getBufferLevel:function(){return i},getRangeAt:ne,setMediaSource:H,getMediaSource:function(){return s},appendInitSegmentFromCache:function(e){var t=N.extract(G.id,e);return!!t&&(n.info("Append Init fragment",j," with representationId:",t.representationId," and quality:",t.quality,", data size:",t.bytes.byteLength),z(t),!0)},getIsBufferingCompleted:function(){return r},setIsBufferingCompleted:ge,getIsPruningInProgress:function(){return I},reset:function(e,t){M.off(c.a.INIT_FRAGMENT_LOADED,V,this),M.off(c.a.MEDIA_FRAGMENT_LOADED,W,this),M.off(c.a.WALLCLOCK_TIME_UPDATED,he,this),M.off(h.a.PLAYBACK_PLAYING,te,this),M.off(h.a.PLAYBACK_PROGRESS,J,this),M.off(h.a.PLAYBACK_TIME_UPDATED,J,this),M.off(h.a.PLAYBACK_RATE_CHANGED,pe,this),M.off(h.a.PLAYBACK_STALLED,ee,this),_e(e,t)},prepareForPlaybackSeek:function(){return r&&ge(!1),g.abort()},prepareForReplacementTrackSwitch:function(e){return new Promise((function(t,n){g.abort().then((function(){return de()})).then((function(){return g.changeType(e)})).then((function(){return $()})).then((function(){ge(!1),t()})).catch((function(e){n(e)}))}))},prepareForNonReplacementTrackSwitch:function(e){return new Promise((function(t,n){de().then((function(){return g.changeType(e)})).then((function(){t()})).catch((function(e){n(e)}))}))},prepareForReplacementQualitySwitch:function(){return new Promise((function(e,t){g.abort().then((function(){return de()})).then((function(){return $()})).then((function(){ge(!1),e()})).catch((function(e){t(e)}))}))},updateAppendWindow:de,getAllRangesWithSafetyFactor:Z,getContinuousBufferTimeForTargetTime:function(e){try{var t=e,n=g.getAllBufferRanges();if(!n||0===n.length)return e;for(var r=0;t===e&&r=i&&t<=a&&(t=a),r+=1}return t}catch(e){}},clearBuffers:ue,pruneAllSafely:$,updateBufferTimestampOffset:fe,setSeekTarget:function(e){D=e},segmentRequestingCompleted:function(e){isNaN(e)||(p=e,ie())}},n=Object(d.a)(O).getInstance().getLogger(t),N=b(O).getInstance(),_e(),t}I.__dashjs_factory_name="BufferController";var R=f.a.getClassFactory(I);function N(e){e=e||{};var t,n,r,i,a,o,s=this.context,u=Object(l.a)(s).getInstance(),f=e.textController,d=e.errHandler,h=e.streamInfo,p=e.type;function g(e){i=e}function m(e){var t,r,i;n!==e&&((n=e)&&(t=c.a.BUFFERING_COMPLETED,i=r||{},u.trigger(t,i,{streamId:h.id,mediaType:p})))}function _(e){e.chunk.bytes&&!n&&(o.save(e.chunk),a.append(e.chunk),m(!0))}return t={initialize:function(e){g(e)},getStreamId:function(){return h.id},getType:function(){return p},getBufferControllerType:function(){return"NotFragmentedTextBufferController"},createBufferSink:function(e){return new Promise((function(t,n){try{(a=S(s).create({mediaSource:i,textController:f,eventBus:u})).initializeForFirstUse(h,e),r||(a.getBuffer()&&"function"==typeof a.getBuffer().initialize&&a.getBuffer().initialize(),r=!0),t(a)}catch(e){d.error(new y.a(E.a.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,E.a.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+p)),n(e)}}))},getBuffer:function(){return a},getBufferLevel:function(){return 0},getRangeAt:function(){return null},getAllRangesWithSafetyFactor:function(){return[]},getContinuousBufferTimeForTargetTime:function(){return Number.POSITIVE_INFINITY},setMediaSource:g,getMediaSource:function(){return i},appendInitSegmentFromCache:function(e){return null!==o.extract(h.id,e)},getIsBufferingCompleted:function(){return n},setIsBufferingCompleted:m,getIsPruningInProgress:function(){return!1},reset:function(e){u.off(c.a.INIT_FRAGMENT_LOADED,_,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=b(s).getInstance(),u.on(c.a.INIT_FRAGMENT_LOADED,_,t),t}N.__dashjs_factory_name="NotFragmentedTextBufferController";var w=f.a.getClassFactory(N);function C(e){e=e||{};var t,n,r,i,o,s,f,p,g,y,E,_,v,T=this.context,S=Object(l.a)(T).getInstance(),A=e.dashMetrics,b=e.mediaPlayerModel,I=e.fragmentModel,R=e.abrController,N=e.playbackController,w=e.textController,C=e.type,D=e.bufferController,O=e.settings;function M(e){if(!D.getIsBufferingCompleted()){P();var t=isNaN(e)?0:e;s=setTimeout(L,t)}}function P(){s&&(clearTimeout(s),s=null)}function L(){try{if(function(){try{return C===a.a.TEXT&&!w.isTextEnabled()}catch(e){return!1}}())return void P();if(function(){try{return i&&(isNaN(y)||E||(e=n.id,t=R.getMaxAllowedIndexFor(C,e),!(!isNaN(g)&&g==t||(r.info("Top quality "+C+" index has changed from "+g+" to "+t),g=t,0)))||function(){if(!C||!i)return!0;return A.getCurrentBufferLevel(C)=O.get().streaming.buffer.longFormContentDurationThreshold?O.get().streaming.buffer.bufferTimeAtTopQualityLongForm:O.get().streaming.buffer.bufferTimeAtTopQuality:b.getStableBufferTime()}catch(e){return b.getStableBufferTime()}}():e}function x(){U(!0)}function U(e){if(N&&I){var t=I.getRequests({state:m.a.FRAGMENT_MODEL_EXECUTED,time:N.getTime(),threshold:0})[0];t&&N.getTime()>=t.startTime&&((!p.mediaInfo||t.mediaInfo.type===p.mediaInfo.type&&t.mediaInfo.id!==p.mediaInfo.id)&&e&&S.trigger(c.a.TRACK_CHANGE_RENDERED,{mediaType:C,oldMediaInfo:p.mediaInfo,newMediaInfo:t.mediaInfo,streamId:n.id}),t.quality===p.quality&&t.adaptationIndex===p.adaptationIndex||!e||(r.debug("Quality change rendered for streamId ".concat(n.id," and type ").concat(C)),S.trigger(c.a.QUALITY_CHANGE_RENDERED,{mediaType:C,oldQuality:p.quality,newQuality:t.quality,streamId:n.id})),p={mediaInfo:t.mediaInfo,quality:t.quality,adaptationIndex:t.adaptationIndex})}}function B(e){r.debug("Appended bytes for ".concat(e.mediaType," and stream id ").concat(n.id)),(isNaN(e.index)||isNaN(y))&&(y=e.quality,r.info("["+C+"] lastInitializedRepresentationInfo changed to "+e.quality)),M(0)}function k(){I.abortRequests(),P()}function G(){O.get().streaming.scheduling.scheduleWhilePaused||M()}function j(e){A.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function Y(){v=!0,o=0,y=NaN,p={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},g=NaN,E=!1,_=!1}return t={initialize:function(e){f=e,S.on(c.a.BYTES_APPENDED_END_FRAGMENT,B,t),S.on(c.a.URL_RESOLUTION_FAILED,k,t),S.on(h.a.PLAYBACK_STARTED,G,t),S.on(h.a.PLAYBACK_RATE_CHANGED,j,t),S.on(h.a.PLAYBACK_TIME_UPDATED,x,t)},getType:function(){return C},getStreamId:function(){return n.id},setCurrentRepresentation:function(e){i=e},setTimeToLoadDelay:function(e){o=e},getTimeToLoadDelay:function(){return o},setSwitchTrack:function(e){E=e},getSwitchStrack:function(){return E},startScheduleTimer:M,clearScheduleTimer:P,reset:function(){S.off(c.a.BYTES_APPENDED_END_FRAGMENT,B,t),S.off(c.a.URL_RESOLUTION_FAILED,k,t),S.off(h.a.PLAYBACK_STARTED,G,t),S.off(h.a.PLAYBACK_RATE_CHANGED,j,t),S.off(h.a.PLAYBACK_TIME_UPDATED,x,t),P(),U(!1),Y(),n=null},getBufferTarget:F,getPlaybackController:function(){return N},setCheckPlaybackQuality:function(e){v=e},setInitSegmentRequired:function(e){_=e}},r=Object(d.a)(T).getInstance().getLogger(t),Y(),n=e.streamInfo,t}C.__dashjs_factory_name="ScheduleController";var D=f.a.getClassFactory(C),O=n(54),M=n(13),P=n(31),L=n(23),F=n(11),x=n(20);function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var B=function e(){U(this,e),this.start=null,this.mstart=null,this.starttype=null,this.trace=[]};B.INITIAL_PLAYOUT_START_REASON="initial_playout",B.SEEK_START_REASON="seek",B.RESUME_FROM_PAUSE_START_REASON="resume",B.METRICS_COLLECTION_START_REASON="metrics_collection_start";var k=function e(){U(this,e),this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null};k.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",k.REBUFFERING_REASON="rebuffering",k.USER_REQUEST_STOP_REASON="user_request",k.END_OF_PERIOD_STOP_REASON="end_of_period",k.END_OF_CONTENT_STOP_REASON="end_of_content",k.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",k.FAILURE_STOP_REASON="failure";var G=n(32);function j(e){e=e||{};var t,n,r,i,s,f,h,p,g,_,T,S,A,b,I=this.context,N=Object(l.a)(I).getInstance(),C=e.streamInfo,U=e.type,B=e.errHandler,j=e.mimeType,Y=e.timelineConverter,H=e.adapter,K=e.manifestModel,q=e.mediaPlayerModel,V=e.fragmentModel,W=e.abrController,z=e.playbackController,X=e.mediaController,Q=e.textController,$=e.dashMetrics,Z=e.settings,J=e.boxParser,ee=e.segmentBlacklistController;function te(){return C.id}function ne(){return U}function re(){return H.getIsTextTrack(p.getData())}function ie(){s=[],i=null,b=0,g=!1,T=!1,_=!1}function ae(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.sender)if(T)ce();else if((!re()||Q.isTextEnabled())&&f&&e.representationId&&!f.appendInitSegmentFromCache(e.representationId)){var n=p.getCurrentRepresentation();if(0===n.range)return void oe();var r=S?S.getInitRequest(i,n):null;r?V.executeRequest(r):t&&(h.setInitSegmentRequired(!0),ce())}}function oe(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(T||f.getIsPruningInProgress())ce();else{var n=le();n?(g=!1,se(n)):ue(t)}}function se(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;e.range&&(t=t.concat("_",e.range));return ee.contains(t)}(e)?(n.debug("Next fragment request url for stream id ".concat(C.id," and media type ").concat(U," is ").concat(e.url)),V.executeRequest(e)):(n.warn("Fragment request url ".concat(e.url," for stream id ").concat(C.id," and media type ").concat(U," is on the ignore list and will be skipped")),ce())}function ue(e){var t=p.getCurrentRepresentation();if(Z.get().streaming.gaps.enableSeekFix&&!r&&g&&z.isSeeking()){var a=S.getValidSeekTimeCloseToTargetTime(b,i,t,Z.get().streaming.gaps.threshold);if(!isNaN(a))return void z.seek(a,!1,!1)}if(S.isLastSegmentRequested(t,b)){var o=S.getCurrentIndex();return n.debug("Segment requesting for stream ".concat(C.id," has finished")),N.trigger(c.a.STREAM_REQUESTING_COMPLETED,{segmentIndex:o},{streamId:C.id,mediaType:U}),f.segmentRequestingCompleted(o),void h.clearScheduleTimer()}e&&ce()}function le(){var e,t=Re();if(isNaN(b)||ne()===a.a.TEXT&&!Q.isTextEnabled())return null;var n=g;if(S){var r=p&&t?p.getRepresentationForQuality(t.quality):null;e=n?S.getSegmentRequestForTime(i,r,b):S.getNextSegmentRequest(i,r)}return e}function ce(){h.startScheduleTimer(Z.get().streaming.lowLatencyEnabled?Z.get().streaming.scheduling.lowLatencyTimeout:Z.get().streaming.scheduling.defaultTimeout)}function fe(){T=!0}function de(){T=!1}function he(e){e.error||(h.setCurrentRepresentation(H.convertRepresentationToRepresentationInfo(e.currentRepresentation)),f.getIsBufferingCompleted()||f.updateBufferTimestampOffset(e.currentRepresentation))}function pe(e){$.addBufferState(U,e.state,h.getBufferTarget()),e.state!==u.BUFFER_EMPTY||z.isSeeking()||(n.info("Buffer is empty! Stalling!"),$.pushPlayListTraceMetrics(new Date,k.REBUFFERING_REASON))}function ge(e){V.syncExecutedRequestsWithBufferedRange(f.getBuffer().getAllBufferRanges(),C.duration),e.quotaExceeded&&e.from>z.getTime()&&Me(e.from),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&h.startScheduleTimer()}function me(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)),ee.add(t)}}function ye(){De(),_=!1}function Ee(e){n.info("onFragmentLoadingAbandoned request: "+e.request.url+" has been aborted"),z.isSeeking()||h.getSwitchStrack()||_||(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):Me(e.request.startTime+e.request.duration/2),h.startScheduleTimer(0))}function _e(e){n.info("OnFragmentLoadingCompleted for stream id "+C.id+" and media type "+U+" - Url:",e.request?e.request.url:"undefined",e.request.range?", Range:"+e.request.range:""),re()&&h.startScheduleTimer(0),e.error&&e.request.serviceLocation&&function(e){if(n.info("Fragment loading completed with an error"),!e||!e.request||!e.request.type)return;e.request.type===v.a.INIT_SEGMENT_TYPE?ae({representationId:e.request.representationId,sender:{}},!1):e.request.type===v.a.MEDIA_SEGMENT_TYPE&&(Me(e.request.startTime+e.request.duration/2),oe({},!1))}(e)}function ve(){Me(z.getTime()),Ie().startScheduleTimer()}function Te(e){var t=e.currentTrackInfo;if(t){var n=s.find((function(e){return e.index===t.index&&e.lang===t.lang}));n&&be(n).then((function(){f.setIsBufferingCompleted(!1),Me(z.getTime()),h.setInitSegmentRequired(!0),h.startScheduleTimer()}))}}function Se(e){Me(e.quotaExceededTime),h.clearScheduleTimer()}function Ae(){return f?f.getBuffer():null}function be(e){e===i||e&&i&&e.type!==i.type||(i=e);var t=H.getRealAdaptation(C,i),n=H.getVoRepresentations(i);if(p){var r,o=p.getData(),s=W.getMaxAllowedIndexFor(U,C.id),u=W.getMinAllowedIndexFor(U,C.id),l=null;return null!==o&&o.id===t.id||U===a.a.TEXT?r=W.getQualityFor(U,C.id):(l=W.getThroughputHistory().getAverageThroughput(U)||W.getInitialBitrateFor(U,C.id),r=W.getQualityForBitrate(i,l,C.id)),void 0!==u&&rs&&(r=s),p.updateData(t,n,U,i.isFragmented,r)}return Promise.resolve()}function Ie(){return h}function Re(e){var t;return void 0!==e?(Object(M.a)(e),t=p?p.getRepresentationForQuality(e):null):t=p?p.getCurrentRepresentation():null,H.convertRepresentationToRepresentationInfo(t)}function Ne(){return!!f&&f.getIsBufferingCompleted()}function we(e){var t=e.chunk,n=t.bytes,r=t.quality,i=Re(r),a=p&&i?p.getRepresentationForQuality(i.quality):null;if(i&&a){var o=H.getEventsFor(i.mediaInfo),s=H.getEventsFor(i,a);if(o&&o.length>0||s&&s.length>0){var u=function(e,t,n,r){try{for(var i={},a=[],o=n.concat(r),s=0,u=o.length;sZ.get().streaming.buffer.stallThreshold;if(f.getIsBufferingCompleted()&&!t)return f.prepareForNonReplacementTrackSwitch(i.codec).then((function(){N.trigger(c.a.BUFFERING_COMPLETED,{},{streamId:C.id,mediaType:U})})).catch((function(){N.trigger(c.a.BUFFERING_COMPLETED,{},{streamId:C.id,mediaType:U})})),void e();h.clearScheduleTimer(),h.setSwitchTrack(!0),t?(N.trigger(c.a.BUFFER_REPLACEMENT_STARTED,{mediaType:U,streamId:C.id},{mediaType:U,streamId:C.id}),V.abortRequests(),f.prepareForReplacementTrackSwitch(i.codec).then((function(){var e=Re();return f.updateBufferTimestampOffset(e)})).then((function(){Ce(),e()})).catch((function(){Ce(),e()}))):f.prepareForNonReplacementTrackSwitch(i.codec).then((function(){De(),e()})).catch((function(){De(),e()}))}))},prepareQualityChange:function(e){n.debug("Preparing quality switch for type ".concat(U));var t=e.newQuality;_=!0,h.clearScheduleTimer();var r=Re(t);h.setCurrentRepresentation(r),p.prepareQualityChange(t),V.abortRequests(),f.updateBufferTimestampOffset(r).then((function(){e.reason&&e.reason.forceReplace?(N.trigger(c.a.BUFFER_REPLACEMENT_STARTED,{mediaType:U,streamId:C.id},{mediaType:U,streamId:C.id}),f.prepareForReplacementQualitySwitch().then((function(){Ce(),_=!1})).catch((function(){Ce(),_=!1}))):Z.get().streaming.buffer.fastSwitchEnabled?function(e){var t=z.getTime(),n=V.getRequests({state:m.a.FRAGMENT_MODEL_EXECUTED,time:t+1.5,threshold:0})[0];if(n&&!re()){var r=f.getBufferLevel(),i=W.getAbandonmentStateFor(C.id,U);if(n.quality=1.5&&i!==u.ABANDON_LOAD)Me(t+1.5),h.setCheckPlaybackQuality(!1),h.startScheduleTimer();else ye()}else h.startScheduleTimer();_=!1}(r):ye(),$.pushPlayListTraceMetrics(new Date,k.REPRESENTATION_SWITCH_STOP_REASON),$.createPlaylistTraceMetrics(r.id,1e3*z.getTime(),z.getPlaybackRate())}))},getMediaInfo:function(){return i},getMediaSource:function(){return f.getMediaSource()},setMediaSource:function(e){f.setMediaSource(e)},getBuffer:Ae,setExplicitBufferingTime:Me,finalisePlayList:function(e,t){$.pushPlayListTraceMetrics(e,t)},probeNextRequest:function(){var e=Re(),t=p&&e?p.getRepresentationForQuality(e.quality):null;return S.getNextSegmentRequestIdempotent(i,t)},prepareInnerPeriodPlaybackSeeking:function(e){return new Promise((function(t){h.clearScheduleTimer(),V.abortRequests(),f.prepareForPlaybackSeek().then((function(){var t=f.getAllRangesWithSafetyFactor(e.seekTime);return f.clearBuffers(t)})).then((function(){var n=f.getContinuousBufferTimeForTargetTime(e.seekTime);if(!isNaN(C.duration)&&isFinite(C.duration)&&n>=C.start+C.duration)f.setIsBufferingCompleted(!0),t();else{Me(n),f.setSeekTarget(n);var r=[];r.push(f.updateAppendWindow());var i=Re();r.push(f.updateBufferTimestampOffset(i)),Promise.all(r).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(),V.abortRequests(),f.prepareForPlaybackSeek().then((function(){return f.pruneAllSafely()})).then((function(){e()}))}catch(e){t(e)}}))},reset:function(e,n){S&&S.reset(),f&&(f.reset(e,n),f=null),h&&(h.reset(),h=null),p&&(p.reset(),p=null),A&&(A=null),W&&W.unRegisterStreamType(te(),U),N.off(c.a.DATA_UPDATE_COMPLETED,he,t),N.off(c.a.INIT_FRAGMENT_NEEDED,ae,t),N.off(c.a.MEDIA_FRAGMENT_NEEDED,oe,t),N.off(c.a.MEDIA_FRAGMENT_LOADED,we,t),N.off(c.a.BUFFER_LEVEL_STATE_CHANGED,pe,t),N.off(c.a.BUFFER_CLEARED,ge,t),N.off(c.a.SEEK_TARGET,Oe,t),N.off(c.a.FRAGMENT_LOADING_ABANDONED,Ee,t),N.off(c.a.FRAGMENT_LOADING_COMPLETED,_e,t),N.off(c.a.SET_FRAGMENTED_TEXT_AFTER_DISABLED,ve,t),N.off(c.a.SET_NON_FRAGMENTED_TEXT,Te,t),N.off(c.a.QUOTA_EXCEEDED,Se,t),N.off(c.a.MANIFEST_UPDATED,fe,t),N.off(c.a.STREAMS_COMPOSED,de,t),N.off(c.a.SOURCE_BUFFER_ERROR,me,t),ie(),U=null,C=null}},n=Object(d.a)(I).getInstance().getLogger(t),ie(),N.on(c.a.DATA_UPDATE_COMPLETED,he,t,{priority:l.a.EVENT_PRIORITY_HIGH}),N.on(c.a.INIT_FRAGMENT_NEEDED,ae,t),N.on(c.a.MEDIA_FRAGMENT_NEEDED,oe,t),N.on(c.a.MEDIA_FRAGMENT_LOADED,we,t),N.on(c.a.BUFFER_LEVEL_STATE_CHANGED,pe,t),N.on(c.a.BUFFER_CLEARED,ge,t),N.on(c.a.SEEK_TARGET,Oe,t),N.on(c.a.FRAGMENT_LOADING_ABANDONED,Ee,t),N.on(c.a.FRAGMENT_LOADING_COMPLETED,_e,t),N.on(c.a.QUOTA_EXCEEDED,Se,t),N.on(c.a.SET_FRAGMENTED_TEXT_AFTER_DISABLED,ve,t),N.on(c.a.SET_NON_FRAGMENTED_TEXT,Te,t),N.on(c.a.MANIFEST_UPDATED,fe,t),N.on(c.a.STREAMS_COMPOSED,de,t),N.on(c.a.SOURCE_BUFFER_ERROR,me,t),t}j.__dashjs_factory_name="StreamProcessor";var Y=f.a.getClassFactory(j),H=n(55),K=n(58);function q(e){e=e||{};var t,n,r,i=this.context,o=Object(l.a)(i).getInstance(),s=e.errHandler,u=e.mediaPlayerModel,f=e.dashMetrics,p=Object(d.a)(i).getInstance(),g=e.streamInfo;function y(){return g.id}function _(){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.a.AUDIO||t.mediaType===a.a.VIDEO||t.mediaType===a.a.TEXT&&t.mediaInfo.isFragmented)&&o.trigger(c.a.SERVICE_LOCATION_BLACKLIST_ADD,{entry:e.request.serviceLocation}),r&&s){var u=function(e,t,n,r){var i=new H.a;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,g.id,e.type!==c.a.FRAGMENT_LOADING_PROGRESS);o.trigger(i?c.a.INIT_FRAGMENT_LOADED:c.a.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=Object(m.a)(i).create({streamInfo:g,type:t,dashMetrics:f,fragmentLoader:Object(K.a)(i).create({dashMetrics:f,mediaPlayerModel:u,errHandler:s,requestModifier:Object(L.a)(i).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:o,events:c.a,errors:E.a,dashConstants:e.dashConstants,urlUtils:e.urlUtils,streamId:y()}),debug:p,eventBus:o,events:c.a}),r[t]=n),n},reset:function(){o.off(h.a.FRAGMENT_LOADING_COMPLETED,v,this),o.off(h.a.FRAGMENT_LOADING_PROGRESS,v,this),_()}},n=p.getLogger(t),_(),o.on(h.a.FRAGMENT_LOADING_COMPLETED,v,t),o.on(h.a.FRAGMENT_LOADING_PROGRESS,v,t),t}q.__dashjs_factory_name="FragmentController";var V=f.a.getClassFactory(q);var W=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},z=n(29);var X=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},Q=n(10);function $(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 W;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=Object(Q.d)(e.templateUrl,"Number",n);return r=Object(Q.d)(r,"Time",(n-1)*e.segmentDuration*e.timescale),r=Object(Q.d)(r,"Bandwidth",e.bandwidth),Object(Q.e)(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 X;return n.mediaType=a.a.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n}))},reset:s},s(),n=Object(z.b)(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}$.__dashjs_factory_name="ThumbnailController";var Z=f.a.getClassFactory($);function J(e){var t;e=e||{};var n=[],r=Object(l.a)(this.context).getInstance(),i=e.updateEventName,a=e.addBlacklistEventName;function o(e){-1===n.indexOf(e)&&(n.push(e),r.trigger(i,{entry:e}))}function s(e){o(e.entry)}return t={add:o,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},a&&r.on(a,s,t),t}J.__dashjs_factory_name="BlackListController";var ee=f.a.getClassFactory(J),te=[a.a.VIDEO,a.a.AUDIO,a.a.TEXT,a.a.MUXED,a.a.IMAGE];function ne(e){e=e||{};var t,n,r,i,s,u,f,h,p,g,m,_,v,T,S,A,b,I,R=this.context,N=Object(l.a)(R).getInstance(),w=Object(F.a)(R).getInstance(),C=e.manifestModel,D=e.mediaPlayerModel,O=e.dashMetrics,M=e.manifestUpdater,P=e.adapter,L=e.timelineConverter,U=e.capabilities,B=e.errHandler,k=e.abrController,G=e.playbackController,j=e.eventController,H=e.mediaController,K=e.protectionController,q=e.textController,W=e.videoModel,z=e.streamInfo,X=e.settings;function Q(t,i){return new Promise((function(s,u){se(),g=!0,le();var l,d=W.getElement();te.forEach((function(i){(i!==a.a.VIDEO||!d||d&&/^VIDEO$/i.test(d.nodeName))&&function(t,i){var s,u=P.getAllMediaInfoForType(z,t),l=[],d=null;if(!u||0===u.length)return void n.info("No "+t+" data.");t===a.a.VIDEO&&(f=!0);t===a.a.AUDIO&&(h=!0);for(var p=0,g=u.length;p0&&(H.setInitialMediaSettingsForType(t,z),q.setInitialSettings(H.getInitialSettings(t)),q.addMediaInfosToBuffer(z,t,l));if(0===(u=u.filter((function(e){return!e.isEmbedded}))).length)return;if(t===a.a.IMAGE)return void(_=Z(R).create({streamInfo:z,adapter:P,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:A,eventBus:N,events:c.a,dashConstants:o.a,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController})).initialize();N.trigger(c.a.STREAM_INITIALIZING,{streamInfo:z,mediaInfo:d}),H.setInitialMediaSettingsForType(t,z);var y=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=Y(R).create({streamInfo:z,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:G,mediaController:H,textController:q,errHandler:B,settings:X,boxParser:S,segmentBlacklistController:v});c.initialize(n,f,l),r.push(c);for(var d=0;d0&&e.Representation[0].ContentProtection)}function _e(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():oe();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 U.codecRootCompatibleWithCodec(t,e)}))}));return c||f&&s}function ve(e){T=e}function Te(){return T}return t={initialize:function(){N.on(c.a.BUFFERING_COMPLETED,fe,t),N.on(c.a.DATA_UPDATE_COMPLETED,de,t),N.on(c.a.INBAND_EVENTS,he,t),K&&(N.on(c.a.KEY_ERROR,ue,t),N.on(c.a.SERVER_CERTIFICATE_UPDATED,ue,t),N.on(c.a.LICENSE_REQUEST_COMPLETE,ue,t),N.on(c.a.KEY_SYSTEM_SELECTED,ue,t),N.on(c.a.KEY_SESSION_CREATED,ue,t),N.on(c.a.KEY_STATUSES_CHANGED,ue,t)),q.initializeForStream(z),N.trigger(c.a.STREAM_UPDATED,{streamInfo:z})},getStreamId:function(){return z?z.id:null},activate:function(e,t){return new Promise((function(n,r){if(!s)return Te()?(s=!0,N.trigger(c.a.STREAM_ACTIVATED,{streamInfo:z}),void n(t)):void function(e,t){return Q(e,t)}(e,t).then((function(e){s=!0,N.trigger(c.a.STREAM_ACTIVATED,{streamInfo:z}),n(e)})).catch((function(e){r(e)}));n(t)}))},deactivate:J,getIsActive:function(){return s},getDuration:function(){return z?z.duration:NaN},getStartTime:ie,getId:ae,getStreamInfo:oe,getHasAudioTrack:function(){return h},getHasVideoTrack:function(){return f},startPreloading:function(e,t){return new Promise((function(i,a){Te()?a():(n.info("[startPreloading] Preloading next stream with id ".concat(ae())),ve(!0),Q(e,t).then((function(){for(var e=0;e0;){var e=I.pop(),t=e.newMediaInfo,r=pe(e.oldMediaInfo);if(!r)return;n.push(r.prepareTrackSwitch()),r.selectMediaInfo(t)}return Promise.all(n)})).then((function(){g=!1,ce(),N.trigger(c.a.STREAM_UPDATED,{streamInfo:z}),t()}))}))},reset:function(e){m&&(m.reset(),m=null),k&&z&&k.clearDataForStream(z.id),v&&(v.reset(),v=null),ne(e),z=null,N.off(c.a.DATA_UPDATE_COMPLETED,de,t),N.off(c.a.BUFFERING_COMPLETED,fe,t),N.off(c.a.INBAND_EVENTS,he,t),K&&(N.off(c.a.KEY_ERROR,ue,t),N.off(c.a.SERVER_CERTIFICATE_UPDATED,ue,t),N.off(c.a.LICENSE_REQUEST_COMPLETE,ue,t),N.off(c.a.KEY_SYSTEM_SELECTED,ue,t),N.off(c.a.KEY_SESSION_CREATED,ue,t),N.off(c.a.KEY_STATUSES_CHANGED,ue,t))},getProcessors:me,setMediaSource:function(e){for(var t=0;t1&&void 0!==arguments[1]?arguments[1]:null;return _e(e,a.a.VIDEO,t)&&_e(e,a.a.AUDIO,t)},isProtectionCompatible:function(e){return!e||ye(a.a.VIDEO,e)&&ye(a.a.AUDIO,e)},getPreloaded:Te,getIsEndedEventSignaled:function(){return b},setIsEndedEventSignaled:re,getAdapter:function(){return P},getHasFinishedBuffering:function(){return u},setPreloaded:ve,startScheduleControllers:function(){for(var e=r.length,t=0;t0&&void 0!==arguments[0]&&arguments[0];s=!0;var t=f.getValue(),n=t.url,r=p.getPatchLocation(t),i=p.getLocation(t);r&&!e?n=r:i&&(n=i),v.isRelative(n)&&(n=v.resolve(n,t.url)),u.load(n)}function I(e){if(e){if(p.getIsPatch(e)){var r=e;e=f.getValue();var u=p.isPatchValid(e,r),l=u;if(u){var d=p.getPublishTime(e);l=p.applyPatchToManifest(e,r);var h=p.getPublishTime(e);l=d.getTime()!=h.getTime()}if(!l)return t.debug("Patch provided is invalid, performing full manifest refresh"),void b(!0);e.loadedTime=new Date}}else(e=f.getValue()).loadedTime=new Date;if(f.getValue()&&f.getValue().type===o.a.DYNAMIC&&e.type===o.a.STATIC)return _.trigger(c.a.DYNAMIC_TO_STATIC),s=!1,void(a=!0);f.setValue(e);var g=new Date,m=(g.getTime()-e.loadedTime.getTime())/1e3;1e3*(n=p.getManifestUpdatePeriod(e,m))>2147483647&&(n=2147483.647),_.trigger(c.a.MANIFEST_UPDATED,{manifest:e}),t.info("Manifest has been refreshed at "+g+"["+g.getTime()/1e3+"] "),i||A()}function R(){i||(s?A(m.get().streaming.manifestUpdateRetryInterval):b())}function N(e){e.error?e.error.code===E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&g.error(e.error):I(e.manifest)}function w(){i=!1,A()}function C(){(i=!m.get().streaming.scheduling.scheduleWhilePaused)&&S()}function D(){s=!1}return e={initialize:function(){T(),_.on(c.a.STREAMS_COMPOSED,D,this),_.on(h.a.PLAYBACK_STARTED,w,this),_.on(h.a.PLAYBACK_PAUSED,C,this),_.on(c.a.INTERNAL_MANIFEST_LOADED,N,this)},setManifest:function(e){I(e)},refreshManifest:b,setConfig:function(e){e&&(e.manifestModel&&(f=e.manifestModel),e.adapter&&(p=e.adapter),e.manifestLoader&&(u=e.manifestLoader),e.errHandler&&(g=e.errHandler),e.settings&&(m=e.settings))},reset:function(){_.off(h.a.PLAYBACK_STARTED,w,this),_.off(h.a.PLAYBACK_PAUSED,C,this),_.off(c.a.STREAMS_COMPOSED,D,this),_.off(c.a.INTERNAL_MANIFEST_LOADED,N,this),T()}},t=Object(d.a)(y).getInstance().getLogger(e),e}ie.__dashjs_factory_name="ManifestUpdater";var ae=f.a.getClassFactory(ie);function oe(){var e,t,n,r,i,a,o,s,u,f,h,p,g,m,_,T,S=this.context,A=Object(l.a)(S).getInstance(),b=Object(F.a)(S).getInstance();function I(){s=[],u=[],f=null,h=null,g=null,p=NaN,n=!1,r=!1,m=i.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function R(){n||r||!g||!g.value||!g.schemeIdUri||isNaN(p)||isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)||(h&&(Date.now()-h)/1e3<30||(s=[],r=!0,function e(t){try{if(t<=0)return void k();var n=Date.now();a[g.schemeIdUri](g.value,(function(r){var i=Date.now(),a=N(n,i,r);s.push(a),e(t-1)}),(function(){k()}))}catch(e){k()}}(isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)?2:i.get().streaming.utcSynchronization.backgroundAttempts)))}function N(e,t,n){return n-(t-(t-e)/2)}function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,t=isNaN(e);t&&i.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource?U():B(t,e)}function C(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 D(e){return Date.parse(e)}function O(e){return Date.parse(e)}function M(e,t,n){n()}function P(e,t,n){var r=C(e);isNaN(r)?n():t(r)}function L(e,t,n,r,i){var a,o,s=!1,u=new XMLHttpRequest,l=i?v.a.HEAD:v.a.GET,c=t.match(/\S+/g);if(t=c.shift(),a=function(){s||(s=!0,c.length?L(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))},b.isRelative(t)){var f=T.resolve();f&&(t=b.resolve(t,f.url))}u.open(l,t),u.timeout=5e3,u.onload=o,u.onloadend=a,u.send()}function x(e,t,n){L(O,e,t,n,!0)}function U(){var e=o.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;isNaN(t)?B(!0):B(!1,t-Date.now())}function B(e,r){if(isNaN(p)||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)){f=Date.now(),n=!1;var a=isNaN(p);p=r,a&&R(),t.debug("Completed UTC sync. Setting client - server offset to ".concat(r))}e&&(g=null,n=!1,_.error(new y.a(E.a.TIME_SYNC_FAILED_ERROR_CODE,E.a.TIME_SYNC_FAILED_ERROR_MESSAGE))),A.trigger(c.a.UPDATE_TIME_SYNC_OFFSET,{offset:r}),A.trigger(c.a.TIME_SYNCHRONIZATION_COMPLETED)}function k(){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)),p=e,A.trigger(c.a.UPDATE_TIME_SYNC_OFFSET,{offset:p})),r=!1,h=Date.now()}}function G(e){try{if(isNaN(p))return!0;var t=i.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(i.get().streaming.utcSynchronization.maximumAllowedDrift)?i.get().streaming.utcSynchronization.maximumAllowedDrift:100;return e>=p-t&&e<=p+t}catch(e){return!0}}return e={initialize:function(){I(),a={"urn:mpeg:dash:utc:http-head:2014":x,"urn:mpeg:dash:utc:http-xsdate:2014":L.bind(null,C),"urn:mpeg:dash:utc:http-iso:2014":L.bind(null,D),"urn:mpeg:dash:utc:direct:2014":P,"urn:mpeg:dash:utc:http-head:2012":x,"urn:mpeg:dash:utc:http-xsdate:2012":L.bind(null,C),"urn:mpeg:dash:utc:http-iso:2012":L.bind(null,D),"urn:mpeg:dash:utc:direct:2012":P,"urn:mpeg:dash:utc:http-ntp:2014":M,"urn:mpeg:dash:utc:ntp:2014":M,"urn:mpeg:dash:utc:sntp:2014":M}},attemptSync:function(e,t){u=e,n||(!function(e){try{if(!e)return!1;var t=isNaN(m)?30:m;return!(f&&t&&!isNaN(t))||(Date.now()-f)/1e3>=t}catch(e){return!0}}(t)?A.trigger(c.a.TIME_SYNCHRONIZATION_COMPLETED):(n=!0,function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||0;if(!u||0===u.length||n>=u.length)return void w();var r=u[n];if(r)if(a.hasOwnProperty(r.schemeIdUri)){var i=(new Date).getTime();a[r.schemeIdUri](r.value,(function(e){var t=(new Date).getTime(),n=N(i,t,e);g=r,w(n)}),(function(){e(n+1)}))}else e(n+1);else w()}()))},setConfig:function(e){e&&(e.dashMetrics&&(o=e.dashMetrics),e.baseURLController&&(T=e.baseURLController),e.errHandler&&(_=e.errHandler),e.settings&&(i=e.settings))},reset:function(){I(),A.off(c.a.ATTEMPT_BACKGROUND_SYNC,R,e)}},t=Object(d.a)(S).getInstance().getLogger(e),A.on(c.a.ATTEMPT_BACKGROUND_SYNC,R,e),e}oe.__dashjs_factory_name="TimeSyncController";var se=f.a.getSingletonFactory(oe);se.HTTP_TIMEOUT_MS=5e3,f.a.updateSingletonFactory(oe.__dashjs_factory_name,se);var ue=se;function le(){var e,t,n,r=this.context;return e={createMediaSource:function(){var e="WebKitMediaSource"in window;return"MediaSource"in window?t=new MediaSource:e&&(t=new WebKitMediaSource),t},attachMediaSource:function(e){var n=window.URL.createObjectURL(t);return e.setSource(n),n},detachMediaSource:function(e){e.setSource(null)},setDuration:function e(r){t&&"open"===t.readyState&&(null===r&&isNaN(r)||t.duration!==r&&(!function(e){for(var t=e.sourceBuffers,n=0;n=0&&e2&&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}));return-1===s?(t[r].push(e),o=m):n&&(t[r][s]=e,o=g),o}function A(e){try{if(1==e.eventStream.value){var t,n=e.calculatedPresentationTime;t=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,E.trigger(h.a.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:n,newDuration:t,newManifestValidAfter:NaN},{mode:h.a.EVENT_MODE_ON_START})}}catch(e){}}function b(){try{if(!c){c=!0;var e=s.getTime(),t=e-a;t=a>0?Math.max(0,t):0,I(r,t,e),I(n,t,e),a=e,c=!1}}catch(e){c=!1}}function I(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?w(i,e,h.a.EVENT_MODE_ON_START):(function(e,t,n){try{return e-t>n}catch(e){return!1}}(r,a+n,i.calculatedPresentationTime)||function(e){try{var t=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>t}catch(e){return!1}}(i))&&(t.debug("Deleting event ".concat(i.id," as it is expired or invalid")),C(e,i))}}))}catch(e){}}function R(e){try{var t=s.getTime();N(e,(function(n){var r=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.duration)?n.eventStream.period.duration:NaN,i=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.start)?n.eventStream.period.start:NaN;if(!isNaN(r)&&!isNaN(i)){var a=n.calculatedPresentationTime;Math.abs(a-t)<300&&w(n,e,h.a.EVENT_MODE_ON_START)}}))}catch(e){}}function N(e,t){try{if(e)for(var n=Object.keys(e),r=0;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&function(e){D=D.filter((function(n){var r=e.filter((function(e){return e.id===n.getId()})).length>0||n.getId()===O.getId();return r||(t.debug("Removing stream ".concat(n.getId())),n.reset(!0)),r}))}(e);for(var n=[],r=0,i=e.length;r0&&n.forEach((function(t){t&&e.push(t)})),e}),[]).reduce((function(e,t){var n=f.convertRepresentationToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e}),[]);n=Math.max.apply(Math,ge(i))}return isFinite(n)?n:NaN}catch(e){return NaN}}(n,o);K.computeAndSetLiveDelay(s,o)}var u=function(){var e;if(f.getIsDynamic()){var n=p.getCurrentDVRInfo(),r=n&&n.range?n.range.end:0;e=r-K.getLiveDelay();var i=n?n.range:null;if(i){var a=Ue(!0);isNaN(a)||(t.info("Start time from URI parameters: "+a),e=Math.max(Math.min(e,a),i.start))}}else{var o=$e()[0].getStreamInfo();e=o.start;var s=Ue(!1);isNaN(s)||(t.info("Start time from URI parameters: "+s),e=Math.max(e,s))}return e}(),l=Ae(u),d=null!==l?l:D[0];ie.trigger(c.a.INITIAL_STREAM_SWITCH,{startTime:u}),fe(d,null,u),z||(z=setInterval((function(){!U&&K.getTimeToStreamEnd()<=0&&!K.isSeeking()&&ie.trigger(c.a.PLAYBACK_ENDED,{isLast:Ke().isLast})}),200))}(e),ie.trigger(c.a.STREAMS_COMPOSED),Me()})).catch((function(e){throw e}))}catch(e){w.error(new y.a(E.a.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e.message+"nostreamscomposed",s.getValue())),j=!0,Xe()}}()}function se(){J=!0}function le(e){var t=qe(e.id);return t?t.updateData(e):(t=re(ne).create({manifestModel:s,mediaPlayerModel:q,dashMetrics:p,manifestUpdater:i,adapter:f,timelineConverter:C,capabilities:n,capabilitiesFilter:r,errHandler:w,baseURLController:_,segmentBaseController:v,textController:P,abrController:S,playbackController:K,eventController:I,mediaController:A,protectionController:M,videoModel:H,streamInfo:e,settings:Z}),D.push(t),t.initialize(),Promise.resolve())}function fe(e,n,r){try{if(U||!e||n===e&&e.getIsActive())return;U=!0,ie.trigger(c.a.STREAM_SWITCH_STARTED,{fromStreamInfo:n?n.getStreamInfo():null,toStreamInfo:e.getStreamInfo()});var i=!1;O=e,n&&(i=Te(e,n),n.deactivate(i)),r=isNaN(r)?!i&&n?e.getStreamInfo().start:NaN:r,t.info("Switch to stream ".concat(e.getId(),". Seektime is ").concat(r,", current playback time is ").concat(K.getTime(),". Seamless period switch is set to ").concat(i)),Q=Q.filter((function(e){return e.getId()!==O.getId()})),K.initialize(Ke(),!!n),H.getElement()&&de(r,i)}catch(e){U=!1}}function de(e,n){var r;function i(){if(Y&&"open"===Y.readyState){t.debug("MediaSource is open!"),window.URL.revokeObjectURL(r),Y.removeEventListener("sourceopen",i),Y.removeEventListener("webkitsourceopen",i),xe();var a=p.getCurrentDVRInfo();g.setSeekable(a.range.start,a.range.end),me(e,n)}}function a(){Y.addEventListener("sourceopen",i,!1),Y.addEventListener("webkitsourceopen",i,!1),r=g.attachMediaSource(H),t.debug("MediaSource attached to element. Waiting on open...")}Y?n?me(e,n):(g.detachMediaSource(H),a()):(Y=g.createMediaSource(),a())}function me(e,t){O.activate(Y,t?X:void 0,e).then((function(t){if(t){var n=Object.keys(t);n.length>0&&t[n[0]].getBuffer().changeType&&($=!0),X=t}isNaN(e)||(ie.trigger(c.a.SEEK_TARGET,{time:e},{streamId:O.getId()}),K.seek(e,!1,!0),O.startScheduleControllers()),U=!1,ie.trigger(c.a.PERIOD_SWITCH_COMPLETED,{toStreamInfo:Ke()})}))}function ye(e){var t=K.getTime(),n=e.seekTime,r=Ae(n);r&&r!==O?r&&r!==O&&(Ee(t,n,r),function(e,t){var n=e&&!isNaN(e.seekTime)?e.seekTime:NaN,r=O.getProcessors().map((function(t){return t.prepareOuterPeriodPlaybackSeeking(e)}));Promise.all(r).then((function(){fe(t,O,n)})).catch((function(e){w.error(e)}))}(e,r)):(Ee(t,n),function(e){O.getProcessors().forEach((function(t){return t.prepareInnerPeriodPlaybackSeeking(e)})),je(k.USER_REQUEST_STOP_REASON)}(e)),Ye(B.SEEK_START_REASON)}function Ee(e,t){_e()}function _e(){Q&&Q.length>0&&(Q.forEach((function(e){e.deactivate(!0)})),Q=[])}function ve(e){e.newMediaInfo.streamInfo.id===O.getId()&&(_e(),O.prepareTrackChange(e))}function Te(e,t){try{return Z.get().streaming.buffer.reuseExistingSourceBuffers&&(t.isProtectionCompatible(e)||J)&&($||t.isMediaCodecCompatible(e,t))}catch(e){return!1}}function Se(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(Y&&!e.getPreloaded()){var n=Te(e,t);n&&e.startPreloading(Y,X).then((function(){Q.push(e)}))}}function Ae(e){if(isNaN(e))return null;for(var t=D.length,n=0;nK.getLiveDelay())&&(W=!1,Ye(B.INITIAL_PLAYOUT_START_REASON),K.play())}e&&e.mediaType&&p.addBufferLevel(e.mediaType,new Date,1e3*e.bufferLevel)}function Re(e){e.streamInfo.id===O.getId()&&e.reason&&e.reason.forceReplace&&_e(),qe(e.streamInfo.id).prepareQualityChange(e)}function Ne(){f.getIsDynamic()&&be()}function we(){if(ke()){var e=H.getPlaybackQuality();e&&p.addDroppedFrames(e)}}function Ce(){t.debug("[onPlaybackStarted]"),!W&&V&&(V=!1,Ye(B.RESUME_FROM_PAUSE_START_REASON))}function De(e){t.debug("[onPlaybackPaused]"),e.ended||(V=!0,je(k.USER_REQUEST_STOP_REASON))}function Oe(e){t.debug("Stream with id ".concat(e.streamInfo.id," finished buffering"));var n=e.streamInfo.isLast;Y&&n?(t.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),g.signalEndOfStream(Y)):Me()}function Me(){if(O&&O.getHasFinishedBuffering())for(var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{var t=e||(O||null);if(t){var n=t.getStreamInfo();return D.filter((function(e){var t=e.getStreamInfo();return t.start>n.start&&n.id!==t.id}))}}catch(e){return[]}}(O),t=0;t0&&void 0!==arguments[0]?arguments[0]:null,t=e||(O||null);if(!t)return null;var n=t.getStreamInfo(),r=n.start,i=0,a=-1,o=NaN;for(;i0&&(isNaN(o)||l=0)return D[a];return null}();n?(t.debug("StreamController onEnded, found next stream with id ".concat(n.getStreamInfo().id,". Switching from ").concat(O.getStreamInfo().id," to ").concat(n.getStreamInfo().id)),fe(n,O,NaN)):(t.debug("StreamController no next stream found"),O.setIsEndedEventSignaled(!1)),je(n?k.END_OF_PERIOD_STOP_REASON:k.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&Pe()}function xe(e){var t=e||Ke().manifestInfo.duration;g.setDuration(t)}function Ue(e){var t=T.getURIFragmentData();if(!t||!t.t)return NaN;var n=$e()[0].getStreamInfo().start;t.t=t.t.split(",")[0];var r=-1!==t.t.indexOf("posix:")?"now"===t.t.substring(6)?Date.now()/1e3:parseInt(t.t.substring(6)):NaN;return e&&!isNaN(r)?r-K.getAvailabilityStartTime()/1e3:parseInt(t.t)+n}function Be(e){if(e.error)j=!0,Xe();else{t.info("Manifest updated... updating data system wide.");var n=e.manifest;f.updatePeriods(n);var i=f.getUTCTimingSources();!f.getIsDynamic()||i&&0!==i.length||ie.trigger(h.a.CONFORMANCE_VIOLATION,{level:pe.LEVELS.WARNING,event:pe.EVENTS.NO_UTC_TIMING_ELEMENT});var a=f.getIsDynamic()?i.concat(q.getUTCTimingSources()):i,o=N.isHTTPS(e.manifest.url);a.forEach((function(e){e.value.replace(/.*?:\/\//g,"")===q.getDefaultUtcTimingSource().value.replace(/.*?:\/\//g,"")&&(e.value=e.value.replace(o?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),o?"https://":"http://"),t.debug("Matching default timing source protocol to manifest protocol: ",e.value))})),r.filterUnsupportedFeatures(n).then((function(){_.initialize(n),m.attemptSync(a,f.getIsDynamic())}))}}function ke(){return!!O&&O.getHasVideoTrack()}function Ge(){return!!O&&O.getHasAudioTrack()}function je(e,t){t=t||new Date,Le().forEach((function(n){n.finalisePlayList(t,e)})),p.addPlayList()}function Ye(e){p.createPlaylistMetrics(1e3*K.getTime(),e)}function He(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",te.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&&Z.get().errors.recoverAttempts.mediaErrorDecode>=te.counts.mediaErrorDecode?function(){t.warn("A MEDIA_ERR_DECODE occured: Resetting the MediaSource");var e=K.getTime();O.deactivate(!1),t.warn("MediaSource has been resetted. Resuming playback from time ".concat(e)),de(e,!1)}():(G=!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),w.error(new y.a(e.error.code,n)),Xe())}}function Ke(){return O?O.getStreamInfo():null}function qe(e){for(var t=0,n=D.length;t=10){var e=o.getTime();t===e?R(e,!0):(t=e,a=NaN),r=0}}function A(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=Object.keys(h).some((function(e){return h[e]})),r=!!e&&b();return!t&&n.get().streaming.gaps.jumpGaps&&s.getActiveStreamProcessors().length>0&&(!o.isSeeking()||r)&&!o.isPaused()&&!s.getIsStreamSwitchInProgress()&&!s.getHasMediaOrInitialisationError()}function b(){var e=s.getActiveStream(),t=parseFloat((e.getStartTime().toFixed(5)+e.getDuration()).toFixed(5));return o.getTime()+n.get().streaming.gaps.threshold>=t}function I(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;t1&&void 0!==arguments[1]&&arguments[1],i=n.get().streaming.gaps.smallGapLimit,l=n.get().streaming.gaps.jumpLargeGaps,c=u.getBufferRange(),d=NaN,h=!1;if(t=I(c,e),!isNaN(t)){var g=c.start(t),m=g-e;m>0&&(m<=i||l)&&(d=g)}var y=o.getTimeToStreamEnd();if(isNaN(d)&&r&&isFinite(y)&&!isNaN(y)&&y0&&a!==d&&d>e&&!f){var E=d-e;if(h){var _=s.getStreamForTime(d),v=_&&!!_.getPreloaded();p.warn("Jumping to end of stream because of gap from ".concat(e," to ").concat(d,". Gap duration: ").concat(E)),o.seek(d,!0,v)}else{var T=o.getIsDynamic(),S=t>0?c.end(t-1):e,A=T?1e3*Math.max(0,E-.1):0;f=window.setTimeout((function(){o.seek(d,!0,!0),p.warn("Jumping gap occuring in period ".concat(s.getActiveStream().getStreamId()," starting at ").concat(S," and ending at ").concat(d,". Jumping by: ").concat(E-A/1e3)),f=null}),A)}a=d}}return e={reset:y,setConfig:function(e){e&&(e.settings&&(n=e.settings),e.playbackController&&(o=e.playbackController),e.streamController&&(s=e.streamController),e.videoModel&&(u=e.videoModel))},initialize:function(){!function(){m.on(c.a.WALLCLOCK_TIME_UPDATED,S,this),m.on(c.a.INITIAL_STREAM_SWITCH,T,this),m.on(c.a.PLAYBACK_SEEKING,E,this),m.on(c.a.BUFFER_REPLACEMENT_STARTED,_,e),m.on(c.a.TRACK_CHANGE_RENDERED,v,e)}()}},p=Object(d.a)(g).getInstance().getLogger(e),y(),e}_e.__dashjs_factory_name="GapController";var ve=f.a.getSingletonFactory(_e);function Te(){var e,t,n,r,i,o,s,u,f=this.context,h=Object(l.a)(f).getInstance();function p(e,t){return e&&n[t]&&n[t][e]?n[t][e].list:[]}function g(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,u=e.streamInfo,l=u.id,f=g(i,l);if(n[l]&&n[l][i]&&!_(e,f)&&(n[l][i].current=e,n[l][i].current&&(i!==a.a.TEXT||i===a.a.TEXT&&e.isFragmented)&&h.trigger(c.a.CURRENT_TRACK_CHANGED,{oldMediaInfo:f,newMediaInfo:e,switchMode:r.get().streaming.trackSwitchMode[i]},{streamId:l}),!t)){var d=T(e);if(!d||!n[l][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,s.setSavedMediaSettings(i,d)}}}function y(e,t){e&&t&&(i[e]=t)}function E(e){return e?i[e]:null}function _(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;var n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=e.lang===t.lang,a=e.codec===t.codec,o=e.roles.toString()===t.roles.toString(),s=e.accessibility.toString()===t.accessibility.toString(),u=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&a&&r&&i&&o&&s&&u}function v(){n={},o={},u=null,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};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){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!e.lang||t.lang.match(e.lang),i=void 0===e.index||null===e.index||t.index===e.index,o=!e.viewpoint||e.viewpoint===t.viewpoint,s=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0],u=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],l=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return r&&i&&o&&(s||t.type===a.a.AUDIO&&n)&&u&&l}function A(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 b(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 R(e,n){if(e===a.a.TEXT)return n[0];var i,o=r.get().streaming.selectionModeForInitialTrack;if(u&&"function"==typeof u)i=u(n);else switch(o){case a.a.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY:i=function(e){var t=(n=e,r=0,i=[],n.forEach((function(e){isNaN(e.selectionPriority)||(e.selectionPriority>r?(r=e.selectionPriority,i=[e]):e.selectionPriority===r&&i.push(e))})),i);var n,r,i;t.length>1&&(t=A(t));t.length>1&&(t=I(t));return t}(n);break;case a.a.TRACK_SELECTION_MODE_HIGHEST_BITRATE:i=function(e){var t=A(e);t.length>1&&(t=I(t));return t}(n);break;case a.a.TRACK_SELECTION_MODE_FIRST_TRACK:i=N(n);break;case a.a.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:i=function(e){var t=b(e);t.length>1&&(t=A(t));return t}(n);break;case a.a.TRACK_SELECTION_MODE_WIDEST_RANGE:i=function(e){var t=I(e);t.length>1&&(t=A(e));return t}(n);break;default:t.warn("Track selection mode ".concat(o," is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK")),i=N(n)}return i.length>0?i[0]:n[0]}function N(e){return e[0]}return e={setInitialMediaSettingsForType:function(e,t){var n=o[e]||E(e),r=p(e,t.id),i=[];n||(n=s.getSavedMediaSettings(e),y(e,n)),r&&0!==r.length&&(n&&r.forEach((function(t){S(n,t,!!o[e])&&i.push(t)})),0===i.length?m(R(e,r),!0):i.length>1?m(R(e,i,o[e])):m(i[0]))},addTrack:function(e){if(e){var t=e.type;if((r=t)===a.a.AUDIO||r===a.a.VIDEO||r===a.a.TEXT||r===a.a.IMAGE){var r,i=e.streamInfo.id;n[i]||(n[i]={audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},image:{list:[],storeLastSettings:!0,current:null}});for(var o=n[i][t].list,s=0,u=o.length;s1&&(n.forEach((function(e){r+=e.dvb_weight,i.push(r)})),t=Math.floor(Math.random()*(r-1)),i.every((function(e,n){return a=n,!(t")+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(t=e.elements[o],n=t.type+"_asArray",t.resolvedContent){if(t.resolvedContent)for(s=0;s0&&r.run(i)}(e),"onActuate"===e.resolveType&&f.trigger(c.a.XLINK_READY,{manifest:i}),"onLoad"===e.resolveType)switch(e.type){case o.a.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-1?(p&&(t=p.createMssParser(),p.registerEvents()),t):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?Object(Qe.a)(u).create({debug:f}):t}(t)),null!==s){i.setMatchers(s.getMatchers()),i.setIron(s.getIron());try{m=s.parse(t)}catch(t){return void d.trigger(c.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new y.a(E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}m?(m.url=l||e,m.originalUrl||(m.originalUrl=m.url),m.hasOwnProperty(a.a.LOCATION)&&(g=h.parseBaseUrl(m.Location_asArray[0]),n.debug("BaseURI set by Location to: "+g)),m.baseUri=g,m.loadedTime=new Date,i.resolveManifestOnLoad(m),d.trigger(c.a.ORIGINAL_MANIFEST_LOADED,{originalManifest:t})):d.trigger(c.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new y.a(E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}else d.trigger(c.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new y.a(E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,E.a.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))});else d.trigger(c.a.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,r){d.trigger(c.a.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new y.a(E.a.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,E.a.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+"".concat(e,", ").concat(r))})}})},reset:function(){d.off(c.a.XLINK_READY,m,t),p&&p.reset(),i&&(i.reset(),i=null),r&&(r.abort(),r=null)}},n=f.getLogger(t),d.on(c.a.XLINK_READY,m,t),r=Object(Ue.a)(u).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,urlUtils:h,constants:a.a,dashConstants:o.a,errors:E.a}),i=Xe(u).create({errHandler:g,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),s=null,t}$e.__dashjs_factory_name="ManifestLoader";var Ze=f.a.getClassFactory($e);function Je(){var e=this.context,t=Object(l.a)(e).getInstance();return{error:function(e){t.trigger(c.a.ERROR,{error:e})}}}Je.__dashjs_factory_name="ErrorHandler";var et=f.a.getSingletonFactory(Je),tt=n(46);function nt(){var e,t,n,r,i,o,s=this.context;function u(e,r){if(!r||!r.Period_asArray||0===r.Period_asArray.length)return Promise.resolve();var o=[];return r.Period_asArray.forEach((function(r){o.push(function(e,r){return new Promise((function(o){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(o){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.a.VIDEO:return function(e,t){var n=e.width||null,r=e.height||null,i=e.frameRate||null,a=e.bandwidth||null;return{codec:t,width:n,height:r,framerate:i,bitrate:a}}(t,n);case a.a.AUDIO:return function(e,t){var n=e.audioSamplingRate||null,r=e.bandwidth||null;return{codec:t,bitrate:r,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]||i.debug("[Stream] Codec ".concat(u[n].codec," not supported ")),t[n]})),o()})).catch((function(){o()}))}else o()}))}(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||i.warn("AdaptationSet has been removed because of no supported Representation"),t})),o()})).catch((function(){o()}))}else o()}))}(r,e))})),Promise.all(o)}return e={setConfig:function(e){e&&(e.adapter&&(t=e.adapter),e.capabilities&&(n=e.capabilities),e.settings&&(r=e.settings))},filterUnsupportedFeatures:function(e){return new Promise((function(s){var l=[];l.push(u(a.a.VIDEO,e)),l.push(u(a.a.AUDIO,e)),Promise.all(l).then((function(){r.get().streaming.capabilities.filterUnsupportedEssentialProperties&&function(e){if(!e||!e.Period_asArray||0===e.Period_asArray.length)return;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 a=0;a0)}))}))}(e),function(e){if(!o||0===o.length||!e||!e.Period_asArray||0===e.Period_asArray.length)return;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!o.some((function(t){return!t(e)}))})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}))}(e),s()})).catch((function(){s()}))}))},setCustomCapabilitiesFilters:function(e){o=e}},i=Object(d.a)(s).getInstance().getLogger(e),e}nt.__dashjs_factory_name="CapabilitiesFilter";var rt=f.a.getSingletonFactory(nt);var it=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 at(){var e;return{initialize:function(t){if(e=new it,!t)return null;var n=t.indexOf("#");if(-1!==n)for(var r=t.substr(n+1).split("&"),i=0,a=r.length;i0&&r[e.mediaType].ignoreCount--}return t={getMaxIndex:function(e){var t=ht(i).create();if(!e||!e.hasOwnProperty("getMediaType"))return t;!function(){if(!s||!s.hasOwnProperty("getCurrentBufferLevel")||!s.hasOwnProperty("getCurrentBufferState"))throw new Error(a.a.MISSING_CONFIG_ERROR)}();var o=e.getMediaType(),l=s.getCurrentBufferState(o),c=e.getRepresentationInfo().fragmentDuration,d=e.getStreamInfo(),h=d?d.id:null;if(function(e){return!f.get().streaming.lowLatencyEnabled&&r[e].ignoreCount>0}(o)||!c)return t;if(l&&l.state===u.BUFFER_EMPTY)n.debug("["+o+"] Switch to index 0; buffer is empty."),t.quality=0,t.reason="InsufficientBufferRule: Buffer is empty";else{var p=e.getMediaInfo(),g=e.getAbrController(),m=g.getThroughputHistory(),y=s.getCurrentBufferLevel(o),E=m.getAverageThroughput(o),_=m.getAverageLatency(o),v=E*(y/c)*.5;t.quality=g.getQualityForBitrate(p,v,h,_),t.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return t},reset:function(){p(),o.off(h.a.PLAYBACK_SEEKING,g,t),o.off(c.a.BYTES_APPENDED_END_FRAGMENT,m,t)}},n=Object(d.a)(i).getInstance().getLogger(t),p(),o.on(h.a.PLAYBACK_SEEKING,g,t),o.on(c.a.BYTES_APPENDED_END_FRAGMENT,m,t),t}mt.__dashjs_factory_name="InsufficientBufferRule";var yt=f.a.getClassFactory(mt);function Et(e){e=e||{};var t,n,r,i,a,o=this.context,s=e.mediaPlayerModel,u=e.dashMetrics,l=e.settings;function c(){r={},i={},a=[]}return t={shouldAbandon:function(e){var t=ht(o).create(ht.NO_CHANGE,{name:Et.__dashjs_factory_name});if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getCurrentRequest")&&e.hasOwnProperty("getRepresentationInfo")&&e.hasOwnProperty("getAbrController")))return t;var c,f,d=e.getMediaInfo(),h=e.getMediaType(),p=e.getStreamInfo(),g=p?p.id:null,m=e.getCurrentRequest();if(!isNaN(m.index)){c=h,f=m.index,r[c]=r[c]||{},r[c][f]=r[c][f]||{};var y=s.getStableBufferTime();if(u.getCurrentBufferLevel(h)>y)return t;var E=r[h][m.index];if(null===E||null===m.firstByteDate||i.hasOwnProperty(E.id))return t;if(void 0===E.firstByteTime&&(a[h]=[],E.firstByteTime=m.firstByteDate.getTime(),E.segmentDuration=m.duration,E.bytesTotal=m.bytesTotal,E.id=m.index),E.bytesLoaded=m.bytesLoaded,E.elapsedTime=(new Date).getTime()-E.firstByteTime,E.bytesLoaded>0&&E.elapsedTime>0&&function(e,t){a[e]=a[e]||[],a[e].push(t)}(h,Math.round(8*E.bytesLoaded/E.elapsedTime)),a[h].length>=5&&E.elapsedTime>500&&E.bytesLoadedE.bytesTotal*S[I].bitrate/S[v.getQualityFor(h,g)].bitrate&&(t.quality=I,t.reason.throughput=E.measuredBandwidthInKbps,t.reason.fragmentID=E.id,i[E.id]=E,n.debug("["+h+"] frag id",E.id," is asking to abandon and switch to quality to ",I," measured bandwidth was",E.measuredBandwidthInKbps),delete r[h][E.id])}}else E.bytesLoaded===E.bytesTotal&&delete r[h][E.id]}return t},reset:c},n=Object(d.a)(o).getInstance().getLogger(t),c(),t}Et.__dashjs_factory_name="AbandonRequestsRule";var _t=f.a.getClassFactory(Et);function vt(){var e,t,n=this.context;return e={getMaxIndex:function(e){var r=ht(n).create();if(!e||!e.hasOwnProperty("getDroppedFramesHistory"))return r;var i=e.getDroppedFramesHistory(),a=e.getStreamInfo().id;if(i){var o=i.getFrameHistory(a);if(!o||0===o.length)return r;for(var s=0,u=0,l=ht.NO_CHANGE,c=1;c375&&s/u>.15)){l=c-1,t.debug("index: "+l+" Dropped Frames: "+s+" Total Frames: "+u);break}return ht(n).create(l,{droppedFrames:s})}return r}},t=Object(d.a)(n).getInstance().getLogger(e),e}vt.__dashjs_factory_name="DroppedFramesRule";var Tt=f.a.getClassFactory(vt);function St(){var e,t,n=this.context;return e={getMaxIndex:function(e){for(var r=e?e.getSwitchHistory():null,i=r?r.getSwitchRequests():[],a=0,o=0,s=0,u=ht(n).create(),l=0;l=6&&a/o>.075)){u.quality=l>0&&i[l].drops>0?l-1:l,u.reason={index:u.quality,drops:a,noDrops:o,dropSize:s},t.debug("Switch history rule index: "+u.quality+" samples: "+(a+o)+" drops: "+a);break}return u}},t=Object(d.a)(n).getInstance().getLogger(e),e}St.__dashjs_factory_name="SwitchHistoryRule";var At=f.a.getClassFactory(St);function bt(e){e=e||{};var t,n,r,i=this.context,a=e.dashMetrics,o=e.mediaPlayerModel,s=Object(l.a)(i).getInstance();function f(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,10+2*t.length),a=(n[r]-1)/(i/10-1);return{gp:a,Vp:10/a}}function p(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=o.getStableBufferTime(),a=f(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,g(t)):t.state=0,t}function g(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function m(e,t){var n=o.getStableBufferTime();if(e.stableBufferTime!==n){var r=f(n,e.bitrates,e.utilities);if(r.Vp!==e.Vp||r.gp!==e.gp){var i=a.getCurrentBufferLevel(t),s=i+e.placeholderBuffer;s-=10,s*=r.Vp/e.Vp,s+=10,e.stableBufferTime=n,e.Vp=r.Vp,e.gp=r.gp,e.placeholderBuffer=Math.max(0,s-i)}}}function y(e,t){return e.Vp*(e.utilities[t]+e.gp)}function E(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,b(t,e.chunk.mediaInfo.type)}}}function A(e){if(e&&e.metric===u.HTTP_REQUEST&&e.value&&e.value.type===v.a.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=r[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),b(t,e.mediaType))}}function b(e,t){if(!isNaN(e.lastSegmentStart)&&!isNaN(e.lastSegmentRequestTimeMs)&&!isNaN(e.placeholderBuffer)){if(e.placeholderBuffer*=.99,!isNaN(e.lastSegmentFinishTimeMs)){var n=a.getCurrentBufferLevel(t)+.001*(e.lastSegmentFinishTimeMs-e.lastSegmentRequestTimeMs),r=y(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 I(e){if(e){var t=r[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function R(e){if(e){var t=r[e.mediaType];if(t&&0!==t.state){var n,i=a.getCurrentBufferLevel(e.mediaType);n=t.abrQuality>0?E(t,t.abrQuality):10;var o=Math.max(0,n-i);t.placeholderBuffer=Math.min(t.placeholderBuffer,o)}}}function N(){r={}}return t={getMaxIndex:function(e){var t=ht(i).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useBufferOccupancyABR")))return t;var o=e.getMediaInfo(),s=e.getMediaType(),u=e.getScheduleController(),l=e.getStreamInfo(),c=e.getAbrController(),f=c.getThroughputHistory(),d=l?l.id:null,h=l&&l.manifestInfo&&l.manifestInfo.isDynamic,_=e.useBufferOccupancyABR();if(t.reason=t.reason||{},!_)return t;u.setTimeToLoadDelay(0);var v=function(e){var t=e.getMediaType(),n=r[t];return n?0!==n.state&&m(n,t):(n=p(e),r[t]=n),n}(e);if(0===v.state)return t;var T,S=a.getCurrentBufferLevel(s),A=f.getAverageThroughput(s,h),b=f.getSafeAverageThroughput(s,h),I=f.getAverageLatency(s);if(t.reason.state=v.state,t.reason.throughput=A,t.reason.latency=I,isNaN(A))return t;switch(v.state){case 1:T=c.getQualityForBitrate(o,b,d,I),t.quality=T,t.reason.throughput=b,v.placeholderBuffer=Math.max(0,E(v,T)-S),v.lastQuality=T,!isNaN(v.lastSegmentDurationS)&&S>=v.lastSegmentDurationS&&(v.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,m(e,t)}(v,s),T=function(e,t){for(var n=e.bitrates.length,r=NaN,i=NaN,a=0;a=i)&&(i=o,r=a)}return r}(v,S+v.placeholderBuffer);var R=c.getQualityForBitrate(o,b,d,I);T>v.lastQuality&&T>R&&(T=Math.max(R,v.lastQuality));var N=Math.max(0,S+v.placeholderBuffer-y(v,T));N<=v.placeholderBuffer?(v.placeholderBuffer-=N,N=0):(N-=v.placeholderBuffer,v.placeholderBuffer=0,Tt.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=a,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=a,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,E(t,i)}}}function y(e){if(e&&e.metric===u.HTTP_REQUEST&&e.value&&e.value.type===v.a.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=n[e.mediaType],i=r[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),E(t,i))}}function E(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=D.B_target){C.state=2,D.Q=l;for(var O=0;OF&&(U=-1),D.w[B]=D.prev_w[B]+U*(x/(2*c))*((D.Q+l)*(w*g[B]/F));D.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;cC.lastQuality&&g[C.lastQuality+1]<=F&&(t=C.lastQuality+1),g[t]>=F&&(D.Q=2*Math.max(l,D.Q)),u.quality=t,u.reason.throughput=R,u.reason.latency=N,u.reason.bufferLevel=b,C.lastQuality=u.quality;break;default:i.debug("L2A ABR rule invoked in bad state."),u.quality=_.getQualityForBitrate(f,I,E.id,N),u.reason.state=C.state,u.reason.throughput=I,u.reason.latency=N,C.state=1,p(C)}return u},reset:function(){S(),f.off(c.a.PLAYBACK_SEEKING,g,t),f.off(c.a.MEDIA_FRAGMENT_LOADED,m,t),f.off(c.a.METRIC_ADDED,y,t),f.off(c.a.QUALITY_CHANGE_REQUESTED,_,t)}},i=Object(d.a)(o).getInstance().getLogger(t),S(),f.on(c.a.PLAYBACK_SEEKING,g,t),f.on(c.a.MEDIA_FRAGMENT_LOADED,m,t),f.on(c.a.METRIC_ADDED,y,t),f.on(c.a.QUALITY_CHANGE_REQUESTED,_,t),t}Rt.__dashjs_factory_name="L2ARule";var Nt=f.a.getClassFactory(Rt),wt="manual_weight_selection",Ct="random_weight_selection",Dt="dynamic_weight_selection";function Ot(){var e,t,n,r,i,a,o,s,u,l=this.context;function c(){n=null,r=1,i=100,a=0,o=null,s=null,u=Dt}function f(){var e=0;if(n)for(var t=0;te&&(e=r.state.throughput)}return e}function h(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 p(e,t){return h([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 g(e,t,n){for(var r=0;ro)&&(a=u,o=l)}t.push(a)}for(var p=null,g=null,m=0;mp)&&(p=y,g=m)}var _=[];_.push(t[g]),t.splice(g,1);for(;t.length>0;){for(var v=null,T=null,S=0;S1&&(A=f()),c/=i,t.debug("getNextQuality called throughput:".concat(A," latency:").concat(c," bufferSize:").concat(d," currentQualityIndex:").concat(m," playbackRate:").concat(p));var b=S[m],I=b.bitrate*E.getSegmentDuration()/T,R=Math.max(0,I-v);if(v-In?e-n:e+n-t}return t={getMinBuffer:function(){return s},getSegmentDuration:c,getNextBufferWithBitrate:function(e,t,n){return f(t,e*u/n)},getNextBuffer:f,findWeightVector:function(e,t,i,a,c,d){var h=null,p=null,g=null,m=Math.abs(t-r);return e.forEach((function(e){n.forEach((function(n){n[0];var r=n[1],a=n[2],y=(n[3],e.bitrate*u/c),E=f(i,y),_=(0===a?10:1/a)*Math.max(1e-5,y-E),v=(0===r?10:1/r)*e.state.latency,T=l.calculateSingleUseQoe(e.bitrate,_,v,d);(null===h||T>h)&&function(e,t,n){if(e>o+n)return!1;return t>=s}(t,E,m)&&(h=T,p=n,g=e.bitrate)}))})),null===p&&null===g&&(p=-1),r=t,p}},i=[.2,.4,.6,.8,1],a=4,n=function e(t,n,r){if(r===n)return t;for(var a=t.length,o=0;oI?I=N:NA?D-A:0;i.setupPerSegmentQoe(A,I,b),i.logSegmentMetrics(w,O,_,v);var M=Ut(s).create({targetLatency:1.5,bufferMin:.3,segmentDuration:A,qoeEvaluator:i});return n.quality=r.getNextQuality(h,1e3*T,_,m,v,d,M),n.reason={throughput:T,latency:_},n.priority=ht.PRIORITY.STRONG,g.setTimeToLoadDelay(0),n.quality!==d&&console.log("[TgcLearningRule]["+l+"] requesting switch to index: ",n.quality,"Average throughput",Math.round(T),"kbps"),n}catch(e){throw e}},reset:function(){r.reset(),i.reset()}},t=Object(d.a)(s).getInstance().getLogger(n),r=Mt(s).create(),i=Ft(s).create(),n}Bt.__dashjs_factory_name="LoLPRule";var kt=f.a.getClassFactory(Bt);function Gt(e){e=e||{};var t,n,r=this.context,i=e.mediaPlayerModel,o=e.dashMetrics,s=e.settings;function u(e){return e.filter((function(e){return e.quality>ht.NO_CHANGE}))}function l(e){var t,n,i,a,o,s={},u=null;if(0!==e.length){for(s[ht.PRIORITY.STRONG]={quality:ht.NO_CHANGE,reason:null},s[ht.PRIORITY.WEAK]={quality:ht.NO_CHANGE,reason:null},s[ht.PRIORITY.DEFAULT]={quality:ht.NO_CHANGE,reason:null},t=0,n=e.length;ti.quality)&&(s[i.priority].quality=i.quality,s[i.priority].reason=i.reason||null);return s[ht.PRIORITY.WEAK].quality!==ht.NO_CHANGE&&(u=s[ht.PRIORITY.WEAK]),s[ht.PRIORITY.DEFAULT].quality!==ht.NO_CHANGE&&(u=s[ht.PRIORITY.DEFAULT]),s[ht.PRIORITY.STRONG].quality!==ht.NO_CHANGE&&(u=s[ht.PRIORITY.STRONG]),u&&(a=u.quality,o=u.reason),ht(r).create(a,o)}}return{initialize:function(){t=[],n=[],s.get().streaming.abr.useDefaultABRRules&&(s.get().streaming.abr.ABRStrategy===a.a.ABR_STRATEGY_L2A?t.push(Nt(r).create({dashMetrics:o,mediaPlayerModel:i,settings:s})):s.get().streaming.abr.ABRStrategy===a.a.ABR_STRATEGY_LoLP?t.push(kt(r).create({dashMetrics:o})):(t.push(It(r).create({dashMetrics:o,mediaPlayerModel:i,settings:s})),t.push(gt(r).create({dashMetrics:o})),s.get().streaming.abr.additionalAbrRules.insufficientBufferRule&&t.push(yt(r).create({dashMetrics:o,settings:s})),s.get().streaming.abr.additionalAbrRules.switchHistoryRule&&t.push(At(r).create()),s.get().streaming.abr.additionalAbrRules.droppedFramesRule&&t.push(Tt(r).create()),s.get().streaming.abr.additionalAbrRules.abandonRequestsRule&&n.push(_t(r).create({dashMetrics:o,mediaPlayerModel:i,settings:s})))),i.getABRCustomRules().forEach((function(e){"qualitySwitchRules"===e.type&&t.push(e.rule(r).create()),"abandonFragmentRules"===e.type&&n.push(e.rule(r).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 l(u(t.map((function(t){return t.getMaxIndex(e)}))))||ht(r).create()},getMinSwitchRequest:l,shouldAbandonFragment:function(e,t){return l(u(n.map((function(n){return n.shouldAbandon(e,t)}))))||ht(r).create()},getQualitySwitchRules:function(){return t}}}Gt.__dashjs_factory_name="ABRRulesCollection";var jt=f.a.getClassFactory(Gt);jt.QUALITY_SWITCH_RULES="qualitySwitchRules",jt.ABANDON_FRAGMENT_RULES="abandonFragmentRules",f.a.updateSingletonFactory(Gt.__dashjs_factory_name,jt);var Yt=jt;function Ht(){var e,t,n,r,i=this.context,o=Object(_.a)(i).getInstance();function s(e){var t;for(t=0;t-1?e:o.get().streaming.buffer.fastSwitchEnabled?20:12}function l(){return o.get().streaming.lowLatencyEnabled?o.get().streaming.delay.liveDelay||3:o.get().streaming.delay.liveDelay}function c(e,n){f(e,n);var r=new lt.a;r.schemeIdUri=e,r.value=n,t.push(r)}function f(e,n){Object(M.b)(e,"string"),Object(M.b)(n,"string"),t.forEach((function(r,i){r.schemeIdUri===e&&r.value===n&&t.splice(i,1)}))}return e={getABRCustomRules:function(){return r},addABRCustomRule:function(e,t,n){if("string"!=typeof e||e!==Yt.ABANDON_FRAGMENT_RULES&&e!==Yt.QUALITY_SWITCH_RULES||"string"!=typeof t)throw a.a.BAD_ARGUMENT_ERROR;var i=s(t);-1===i?r.push({type:e,rulename:t,rule:n}):(r[i].type=e,r[i].rule=n)},removeABRCustomRule:function(e){if(e){var t=s(e);-1!==t&&r.splice(t,1)}else r=[]},getStableBufferTime:u,getInitialBufferLevel:function(){var e=o.get().streaming.buffer.initialBufferLevel;return isNaN(e)||e<0?0:Math.min(u(),e)},getRetryAttemptsForType:function(e){var t=isNaN(o.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:o.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return o.get().streaming.lowLatencyEnabled?o.get().streaming.retryAttempts[e]*t:o.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){var t=isNaN(o.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:o.get().streaming.retryIntervals.lowLatencyReductionFactor;return o.get().streaming.lowLatencyEnabled?o.get().streaming.retryIntervals[e]/t:o.get().streaming.retryIntervals[e]},getLiveDelay:l,getLiveCatchupLatencyThreshold:function(){try{var e=o.get().streaming.liveCatchup.latencyThreshold,t=l();if(null!==e&&!isNaN(e))return Math.max(e,t);var n=o.get().streaming.liveCatchup.minDrift,r=!isNaN(t)&&t?isNaN(n)?l():o.get().streaming.liveCatchup.minDrift+l():NaN;return r&&!isNaN(r)?Math.max(4*r,5):NaN}catch(e){return NaN}},addUTCTimingSource:c,removeUTCTimingSource:f,getUTCTimingSources:function(){return t},clearDefaultUTCTimingSources:function(){t=[]},restoreDefaultUTCTimingSources:function(){var e=o.get().streaming.utcSynchronization.defaultTimingSource;c(e.scheme,e.value)},setXHRWithCredentialsForType:function e(t,r){t?n[t]=!!r:Object.keys(n).forEach((function(t){e(t,r)}))},getXHRWithCredentialsForType:function(e){var t=n[e];return void 0===t?n.default:t},getDefaultUtcTimingSource:function(){return o.get().streaming.utcSynchronization.defaultTimingSource},reset:function(){}},t=[],n={default:!1},r=[],e}Ht.__dashjs_factory_name="MediaPlayerModel";var Kt=f.a.getSingletonFactory(Ht);function qt(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}}}qt.__dashjs_factory_name="RulesContext";var Vt=f.a.getClassFactory(qt);function Wt(){var e=[],t=[];return{push:function(n){n.newValue===ht.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=[]}}}Wt.__dashjs_factory_name="SwitchRequestHistory";var zt=f.a.getClassFactory(Wt);function Xt(){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;t[r]=o;var l=s-n;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={}}}}Xt.__dashjs_factory_name="DroppedFramesHistory";var Qt=f.a.getClassFactory(Xt);function $t(e){var t,n,r,i,o,s=(e=e||{}).settings;function u(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 l(e,u,l){return s.get().streaming.abr.movingAverageMethod!==a.a.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,u):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];if(0===a||!o||0===o.length)return NaN;return(o=o.slice(-a)).reduce((function(e,t){return e+t}))/o.length}(e,u,l)}function c(e,t){return l(!0,e,t)}function f(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 d(){t={},n={},r={},i={}}var h={push:function(e,l,c){if(l.trace&&l.trace.length){var d=l.tresponse.getTime()-l.trequest.getTime()||1,h=l._tfinish.getTime()-l.tresponse.getTime()||1,p=l.trace.reduce((function(e,t){return e+t.b[0]}),0),g=0,m=0;if(s.get().streaming.lowLatencyEnabled){if(s.get().streaming.abr.fetchThroughputCalculationMode===a.a.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING){var y=l.trace.reduce((function(e,t){return e+t.t}),0);m=Math.round(y/l.trace.length)}0===m&&(g=l.trace.reduce((function(e,t){return e+t.d}),0))}else g=c?h:d+h;if(0!==g&&(m=Math.round(8*p/g)),f(e),function(e,t,n){return e===a.a.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],f(e)}(e);t[e].push(m),t[e].length>20&&t[e].shift(),n[e].push(d),n[e].length>20&&n[e].shift(),u(r[e],m,.001*h,o.throughputHalfLife),u(i[e],d,1,o.latencyHalfLife)}},getAverageThroughput:c,getSafeAverageThroughput:function(e,t){var n=c(e,t);return isNaN(n)||(n*=s.get().streaming.abr.bandwidthSafetyFactor),n},getAverageLatency:function(e){return l(!1,e)},reset:d};return o={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},d(),h}$t.__dashjs_factory_name="ThroughputHistory";var Zt=f.a.getClassFactory($t);function Jt(){var e,t,n,r,i,o,s,f,p,g,y,E,_,T,S,A,b,I,R,N,w,C,D,O,P,L=this.context,F=Object(d.a)(L).getInstance(),x=Object(l.a)(L).getInstance();function U(){i={},o={},f={},s={},I={},w={},C={},D={},void 0===g&&(g=!1),R&&R.reset(),b=void 0,R=void 0,N=void 0,clearTimeout(p),p=null}function B(t){var i=t.request.mediaType,a=t.streamId;if(i&&a&&s[a]&&P.get().streaming.abr.autoSwitchBitrate[i]){var o=s[a][i];if(o){var l=Vt(L).create({abrController:e,streamProcessor:o,currentRequest:t.request,useBufferOccupancyABR:w[i],useL2AABR:C[i],useLoLPABR:D[i],videoModel:T}),c=n.shouldAbandonFragment(l,a);if(c.quality>ht.NO_CHANGE){var d=o.getFragmentModel();d.getRequests({state:m.a.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(d.abortRequests(),f[a][i].state=u.ABANDON_LOAD,I[a][i].reset(),I[a][i].push({oldValue:H(i,a),newValue:c.quality,confidence:1,reason:c.reason}),K(i,r.getActiveStreamInfo(),c.quality,c.reason),clearTimeout(p),p=setTimeout((function(){f[a][i].state=u.ALLOW_LOAD,p=null}),P.get().streaming.abandonLoadTimeout))}}}}function k(e){e.mediaType===a.a.VIDEO&&(void 0!==b&&R.push(e.streamId,b,T.getPlaybackQuality()),b=e.newQuality)}function G(e){var n,r;e.metric!==u.HTTP_REQUEST||!e.value||e.value.type!==v.a.MEDIA_SEGMENT_TYPE||e.mediaType!==a.a.AUDIO&&e.mediaType!==a.a.VIDEO||N.push(e.mediaType,e.value,P.get().streaming.abr.useDeadTimeLatency),e.metric!==u.BUFFER_LEVEL||e.mediaType!==a.a.AUDIO&&e.mediaType!==a.a.VIDEO||(n=e.mediaType,r=.001*e.value.level,P.get().streaming.abr.ABRStrategy===a.a.ABR_STRATEGY_DYNAMIC&&function(e,n){var r=S.getStableBufferTime(),i=r,a=.5*r,o=w[e],s=n>(o?a:i);w[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)+")."))}(n,r))}function j(e,t){try{return i[t]=i[t]||{},i[t].hasOwnProperty(e)||(i[t][e]=0),function(e,t,n){if(t!==a.a.VIDEO||!P.get().streaming.abr.limitBitrateByPortal||!s[n]||!s[n][t])return e;g||z();var r=s[n][t].getStreamInfo(),i=_.getAdaptationForType(r.index,t,r).Representation,o=e;if(y>0&&E>0){for(;o>0&&i[o]&&y=1||a<0)return e;return Math.min(e,Math.round(r*a))}(function(e,t){var n=i[t][e],r=n;if(!s[t]||!s[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=P.get().streaming.abr.maxBitrate[e];return n>-1?V(s[t][e].getMediaInfo(),n,t):void 0}catch(e){return}}(e,t);void 0!==o&&(r=Math.min(r,o));return r}(e,t),e,t),e,t)}catch(e){return}}function Y(e,t){try{return function(e,t){try{var n=P.get().streaming.abr.minBitrate[e];if(n>-1){var r=s[t][e].getMediaInfo(),i=W(r),a=V(r,n,t);return i[a]&&a1&&void 0!==arguments[1]?arguments[1]:null;try{if(t||(t=r.getActiveStreamInfo().id),e&&s[t]&&s[t][e])if(t)return o[t]=o[t]||{},o[t].hasOwnProperty(e)||(o[t][e]=0),o[t][e];return 0}catch(e){return 0}}function K(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=H(e,i);Object(M.a)(n);var o=j(e,i);n!==a&&n>=0&&n<=o&&q(e,a,n,o,r,i)}}function q(e,n,r,i,a,u){if(e&&s[u]&&s[u][e]){var l=s[u][e].getStreamInfo(),f=O.getCurrentBufferLevel(e);t.info("Stream ID: "+u+" ["+e+"] switch from "+n+" to "+r+"/"+i+" (buffer: "+f+") "+(a?JSON.stringify(a):".")),o[u]=o[u]||{},o[u][e]=r;var d=function(e,t,n){if(t&&s&&s[e]&&s[e][t]){var r=W(s[e][t].getMediaInfo());return r[n]?r[n]:null}return null}(u,e,r);x.trigger(c.a.QUALITY_CHANGE_REQUESTED,{oldQuality:n,newQuality:r,reason:a,streamInfo:l,bitrateInfo:d,maxIdx:i,mediaType:e},{streamId:l.id,mediaType:e});var h=N.getAverageThroughput(e);isNaN(h)||A.setSavedBitrateSettings(e,h)}}function V(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=e&&e.type?s[n][e.type].getRepresentationInfo():null;if(P.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 u=W(e),l=u.length-1;l>=0;l--){var c=u[l];if(1e3*t>=c.bitrate)return l}return 0}function W(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&&s&&s[t]&&s[t][e]){var n=j(e,t),i=W(s[t][e].getMediaInfo());return i[n]?i[n]:null}return null},getMinAllowedIndexFor:Y,getMaxAllowedIndexFor:j,getInitialBitrateFor:function(e,t){if(function(){if(!A||!A.hasOwnProperty("getSavedBitrateSettings"))throw new Error(a.a.MISSING_CONFIG_ERROR)}(),e===a.a.TEXT)return NaN;var n=A.getSavedBitrateSettings(e),r=P.get().streaming.abr.initialBitrate[e],i=P.get().streaming.abr.initialRepresentationRatio[e];if(-1===r)if(i>-1){var o=s[t][e].getStreamInfo(),u=_.getAdaptationForType(o.index,e,o).Representation;if(Array.isArray(u))r=u[Math.max(Math.round(u.length*i)-1,0)].bandwidth/1e3;else r=0}else r=isNaN(n)?e===a.a.VIDEO?1e3:100:n;return r},getQualityFor:H,getAbandonmentStateFor:function(e,t){return f[e]&&f[e][t]?f[e][t].state:null},setPlaybackQuality:K,checkPlaybackQuality:function(t,r){try{if(!(t&&s&&s[r]&&s[r][t]))return!1;if(R){var i=T.getPlaybackQuality();i&&R.push(r,b,i)}if(!P.get().streaming.abr.autoSwitchBitrate[t])return!1;var a=H(t,r),o=Vt(L).create({abrController:e,switchHistory:I[r][t],droppedFramesHistory:R,streamProcessor:s[r][t],currentValue:a,useBufferOccupancyABR:w[t],useL2AABR:C[t],useLoLPABR:D[t],videoModel:T}),l=Y(t,r),c=j(t,r),d=n.getMaxQuality(o),h=d.quality;return void 0!==l&&(h>ht.NO_CHANGE?h:a)c&&(h=c),I[r][t].push({oldValue:a,newValue:h}),h>ht.NO_CHANGE&&h!==a&&(f[r][t].state===u.ALLOW_LOAD||h>a)&&(q(t,a,h,c,d.reason,r),!0)}catch(e){return!1}},setElementSize:z,setWindowResizeEventCalled:function(e){g=e},registerStreamType:function(e,t){var n=t.getStreamInfo().id;s[n]||(s[n]={}),I[n]||(I[n]={}),f[n]||(f[n]={}),I[n][e]=zt(L).create(),s[n][e]=t,f[n][e]={},f[n][e].state=u.ALLOW_LOAD,function(e){var t=P.get().streaming.abr.ABRStrategy;t===a.a.ABR_STRATEGY_L2A?(w[e]=!1,D[e]=!1,C[e]=!0):t===a.a.ABR_STRATEGY_LoLP?(w[e]=!1,D[e]=!0,C[e]=!1):t===a.a.ABR_STRATEGY_BOLA?(w[e]=!0,D[e]=!1,C[e]=!1):t===a.a.ABR_STRATEGY_THROUGHPUT?(w[e]=!1,D[e]=!1,C[e]=!1):t===a.a.ABR_STRATEGY_DYNAMIC&&(w[e]=!(!w||!w[e])&&w[e],D[e]=!1,C[e]=!1)}(e),e===a.a.VIDEO&&z()},unRegisterStreamType:function(e,t){try{s[e]&&s[e][t]&&delete s[e][t],I[e]&&I[e][t]&&delete I[e][t],f[e]&&f[e][t]&&delete f[e][t]}catch(e){}},setConfig:function(e){e&&(e.streamController&&(r=e.streamController),e.domStorage&&(A=e.domStorage),e.mediaPlayerModel&&(S=e.mediaPlayerModel),e.dashMetrics&&(O=e.dashMetrics),e.adapter&&(_=e.adapter),e.videoModel&&(T=e.videoModel),e.settings&&(P=e.settings))},reset:function(){U(),x.off(c.a.LOADING_PROGRESS,B,e),x.off(h.a.QUALITY_CHANGE_RENDERED,k,e),x.off(h.a.METRIC_ADDED,G,e),n&&n.reset()}},t=F.getLogger(e),U(),e}Jt.__dashjs_factory_name="AbrController";var en=f.a.getSingletonFactory(Jt);en.QUALITY_DEFAULT=0,f.a.updateSingletonFactory(Jt.__dashjs_factory_name,en);var tn=en,nn=n(41),rn=new Map([[a.a.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,"loadedmetadata"],[a.a.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA,"loadeddata"],[a.a.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,"canplay"],[a.a.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA,"canplaythrough"]]);function an(){var e,t,n,r,i=this.context,o=Object(l.a)(i).getInstance(),s=[];function u(){n&&(n.playbackRate=1,n.removeEventListener("canplay",u))}function f(){return s.length>0}function h(){if(n&&f()&&0===n.playbackRate){var e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function p(e,t){n&&n.addEventListener(e,t)}function g(e,t){n&&n.removeEventListener(e,t)}function m(){return n?n.readyState:NaN}function y(){return n?n.buffered:null}function E(e,t,r,i,a){if(n)for(var o=0;o=e)t();else{!function(e,t){p(e,(function n(){g(e,n),t(e)}))}(rn.get(e),t)}}(a.a.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(function(){if(n){if(n.currentTime===e)return;try{e=t?function(e){var t=y(),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",u):n.playbackRate=e)},getPlayedRanges:function(){return n?n.played:null},getEnded:function(){return n?n.ended:null},setStallState:function(e,t){!function(e,t){t?function(e){if(null===e||!n||n.seeking||-1!==s.indexOf(e))return;s.push(e)}(e):function(e){var t=s.indexOf(e);if(null===e)return;-1!==t&&s.splice(t,1)}(e)}(e,t)},getElement:function(){return n},setElement:function(e){if(!(null==e||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw"element is not video or audio DOM type!";(n=e)&&(n.preload="auto")},setSource:function(e){n&&(e?n.src=e:(n.removeAttribute("src"),n.load()))},getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return r},setTTMLRenderingDiv:function(e){(r=e).style.position="absolute",r.style.display="flex",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.top=0,r.style.left=0},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},addEventListener:p,removeEventListener:g,getReadyState:m,getBufferRange:y,getClientWidth:function(){return n?n.clientWidth:NaN},getClientHeight:function(){return n?n.clientHeight:NaN},getTextTracks:function(){return n?n.textTracks:[]},getTextTrack:E,addTextTrack:function(e,t,r,i,a){if(!n)return null;var o=E(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))},removeChild:function(e){n&&n.removeChild(e)},getVideoWidth:function(){return n?n.videoWidth:NaN},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetTop:function(){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN},getVideoRelativeOffsetLeft:function(){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN},reset:function(){o.off(c.a.PLAYBACK_PLAYING,h,this)}},t=Object(d.a)(i).getInstance().getLogger(e),e}an.__dashjs_factory_name="VideoModel";var on=f.a.getSingletonFactory(an),sn=n(36),un=[{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"}];function ln(e){e=e||{};var t,n,r,i=this.context,o=e.settings;function s(e){if(void 0!==r)return r;r=!1;var t;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return n.warn("DOMStorage access denied: "+e.message),r}if(!t||"localStorage"!==e&&"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(){return 6e5*Math.round((new Date).getTime()/6e5)}function l(e,t){return s(e)&&o.get().streaming[t+"CachingInfo"].enabled}function c(){if(!o)throw new Error(a.a.MISSING_CONFIG_ERROR)}return t={getSavedBitrateSettings:function(e){var t=NaN;if(c(),l("localStorage","lastBitrate")){var r="dashjs_?_bitrate".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("localStorage","lastBitrate")&&t){var r="dashjs_?_bitrate".replace(/\?/,e);try{localStorage.setItem(r,JSON.stringify({bitrate:t.toFixed(3),timestamp:u()}))}catch(e){n.error(e.message)}}},getSavedMediaSettings:function(e){var t=null;if(c(),l("localStorage","lastMediaSettings")){var n="dashjs_?_settings".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("localStorage","lastMediaSettings")){var r="dashjs_?_settings".replace(/\?/,e);try{localStorage.setItem(r,JSON.stringify({settings:t,timestamp:u()}))}catch(e){n.error(e.message)}}}},n=Object(d.a)(i).getInstance().getLogger(t),s("localStorage")&&un.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}ln.__dashjs_factory_name="DOMStorage";var cn=f.a.getSingletonFactory(ln),fn=n(51),dn=n(27);function hn(){var e,t,n,r,i,a,o,s,u,l,c,f,d,h=this.context;function p(e,t,n){n({segments:e,representation:t,error:e?void 0:new y.a(u.SEGMENT_BASE_LOADER_ERROR_CODE,u.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}function g(e){if(e.url){var t=new Be.a;return t.setInfo(e),t}}return e={setConfig:function(s){s.baseURLController&&(d=s.baseURLController),s.dashMetrics&&(a=s.dashMetrics),s.mediaPlayerModel&&(o=s.mediaPlayerModel),s.errHandler&&(n=s.errHandler),s.boxParser&&(r=s.boxParser),s.debug&&(t=s.debug.getLogger(e)),s.requestModifier&&(i=s.requestModifier),s.errors&&(u=s.errors),s.urlUtils&&(f=s.urlUtils),s.constants&&(l=s.constants),s.dashConstants&&(c=s.dashConstants)},initialize:function(){s=Object(Ue.a)(h).create({errHandler:n,dashMetrics:a,mediaPlayerModel:o,requestModifier:i,boxParser:r,errors:u,urlUtils:f,constants:l,dashConstants:c})},loadInitialization:function(e,n){return new Promise((function(i){!function e(n,i,a,o){var u=null,l=n?d.resolve(n.path):null,c=o||{init:!0,url:l?l.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:i};t.debug("Start searching for initialization.");var f=g(c),h=function(t){if(c.bytesLoaded=c.range.end,!(u=r.findInitRange(t)))return c.range.end=c.bytesLoaded+c.bytesToLoad,e(n,i,a,c);n.range=u,a(n)};s.load({request:f,success:h,error:function(){a(n)}}),t.debug("Perform init search: "+c.url)}(e,n,i)}))},loadSegments:function(e,n,i){return new Promise((function(a){!function e(n,i,a,o,u,l){if(a&&(void 0===a.start||void 0===a.end)){var c=a?a.toString().split("-"):null;a=c?{start:parseFloat(c[0]),end:parseFloat(c[1])}:null}u=u||p;var f=null,h=null,m=!!a,y=n?d.resolve(n.path):null,E={init:!1,url:y?y.url:void 0,range:m?a:{start:0,end:1500},searching:!m,bytesLoaded:l?l.bytesLoaded:0,bytesToLoad:1500,mediaType:i},_=g(E),v=function(a){var s=E.bytesToLoad,l=a.byteLength;if(E.bytesLoaded=E.range.end-E.range.start,f=r.parse(a),(h=f.getBox("sidx"))&&h.isComplete){var c,d,p=h.references;if(null!=p&&p.length>0&&(c=1===p[0].reference_type),c){var g,m,y,_;t.debug("Initiate multiple SIDX load."),E.range.end=E.range.start+h.size;var v=[],T=0,S=(h.offset||E.range.start)+h.size,A=function(e){e?(v=v.concat(e),++T>=m&&(v.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),u(v,n,o))):u(null,n,o)};for(g=0,m=p.length;g16777215?(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;u1&&a){var l=d(a,n);if(i[a.id]&&i[a.id][n])for(var f=0,h=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 h(e){var n=p(e);return t.getRegularPeriods(n)}function p(e){var n=m(e);return t.getMpd(n)}function g(){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",r.embeddedCaptions=!0),n})),r.audioChannelConfiguration=t.getAudioChannelConfigurationForAdaptation(i).map((function(e){return e.value})),0===r.audioChannelConfiguration.length&&Array.isArray(i.Representation_asArray)&&i.Representation_asArray.length>0&&(r.audioChannelConfiguration=t.getAudioChannelConfigurationForRepresentation(i.Representation_asArray[0]).map((function(e){return e.value}))),r.roles=t.getRolesForAdaptation(i).map((function(e){return e.value})),r.codec=t.getCodec(i),r.mimeType=t.getMimeType(i),r.contentProtection=t.getContentProtectionData(i),r.bitrateList=t.getBitrateListForAdaptation(i),r.selectionPriority=t.getSelectionPriority(i),r.contentProtection&&r.contentProtection.forEach((function(e){e.KID=t.getKID(e)})),r.isText=t.getIsText(i),r.supplementalProperties=t.getSupplementalProperties(i),r.isFragmented=t.getIsFragmented(i),r.isEmbedded=!1,r}function v(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,e.lang=n,e.roles=["caption"]}function T(e){var n,r,i=new An;return i.id=e.id,i.index=e.index,i.start=e.start,i.duration=e.duration,i.manifestInfo=(n=e.mpd,(r=new bn).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 A(e){return r.length>0?r[0].mpd.manifest.Period_asArray[e]:null}function b(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=_(e.adaptation),n}return null},getStreamsInfo:function(e,t){var n=[],i=r;if(e&&(S(),i=h(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},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){var i=[];if(r.length>0){var a=r[0].mpd.manifest;e instanceof An?i=t.getEventsForPeriod(E(e,r)):e instanceof Sn?i=t.getEventStreamForAdaptationSet(a,y(e)):e instanceof Tn&&(i=t.getEventStreamForRepresentation(a,n))}return i},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 In.a,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 h=e.event_duration,p=e.id,g=e.message_data;return s.eventStream=c,s.eventStream.value=a,s.eventStream.timescale=u,s.duration=h,s.id=p,s.calculatedPresentationTime=o,s.messageData=g,s.presentationTimeDelta=d,s}catch(e){return null}},getMpd:p,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=h(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=p(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:h,getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){var n=t.getPatchLocation(e),r=t.getPublishTime(e);if(!n||!r)return null;if(n.hasOwnProperty("ttl")&&r){var i=1e3*parseFloat(n.ttl);if(r.getTime()+i<=(new Date).getTime())return null}return n.__text},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:g},t=Object(Rn.a)(u).getInstance(),n=Mn(u).getInstance(),g(),e}Pn.__dashjs_factory_name="DashAdapter";var Ln=f.a.getSingletonFactory(Pn);function Fn(e,t){for(var n=0;nr.get().streaming.metrics.maxListDepth&&i[t].shift())}function m(e,t,n){g(e,t,n),h(e,t,n)}return t={clearCurrentMetricsForType:function(e){delete n[e],f(e)},clearAllCurrentMetrics:function(){n={},s()},getMetricsFor:p,addHttpRequest:function e(t,n,r,i,a,o,s,l,c,f,d,h,p,g,y){var E=new v.a;o&&o!==i&&(e(t,null,r,i,a,null,null,l,c,null,null,null,p,null,null),E.actualurl=o),E.tcpid=n,E.type=r,E.url=i,E.range=l,E.trequest=c,E.tresponse=f,E.responsecode=h,E._tfinish=d,E._stream=t,E._mediaduration=p,E._quality=a,E._responseHeaders=g,E._serviceLocation=s,y?y.forEach((function(e){!function(e,t,n,r,i){var a=new v.b;a.s=t,a.d=n,a.b=r,a.t=i,e.trace.push(a),e.interval||(e.interval=0),e.interval+=n}(E,e.s,e.d,e.b,e.t)})):(delete E.interval,delete E.trace),m(t,u.HTTP_REQUEST,E)},addRepresentationSwitch:function(e,t,n,r,i){var a=new Bn;a.t=t,a.mt=n,a.to=r,i?a.lto=i:delete a.lto,m(e,u.TRACK_SWITCH,a)},addBufferLevel:function(e,t,n){var r=new kn;r.t=t,r.level=n,m(e,u.BUFFER_LEVEL,r)},addBufferState:function(e,t,n){var r=new Gn;r.target=n,r.state=t,m(e,u.BUFFER_STATE,r)},addDVRInfo:function(e,t,n,r){var i=new jn;i.time=t,i.range=r,i.manifestInfo=n,m(e,u.DVR_INFO,i)},addDroppedFrames:function(e,t){var n=new Yn,r=p(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,r.length>0&&r[r.length-1]==n||m(e,u.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,r,i,a,o,s,l){var c=new Wn;c.mediaType=e,c.t=t,c.type=n,c.startTime=r,c.availabilityStartTime=i,c.duration=a,c.quality=o,c.range=s,c.state=l,m(e,u.SCHEDULING_INFO,c)},addRequestsQueue:function(e,t,n){var r=new zn;r.loadingRequests=t,r.executedRequests=n,p(e).RequestsQueue=r,h(e,u.REQUESTS_QUEUE,r)},addManifestUpdate:function(e,t,n,r,i,o,s,l,c,f){var d=new Kn;d.mediaType=e,d.type=t,d.requestTime=n,d.fetchTime=r,d.availabilityStartTime=i,d.presentationStartTime=o,d.clientTimeOffset=s,d.currentTime=l,d.buffered=c,d.latency=f,g(a.a.STREAM,u.MANIFEST_UPDATE,d),h(e,u.MANIFEST_UPDATE,d)},updateManifestUpdateInfo:function(e,t){if(e){for(var n in t)e[n]=t[n];d(e.mediaType,u.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,r,i){if(e){var a=new qn;a.id=t,a.index=n,a.start=r,a.duration=i,e.streamInfo.push(a),d(e.mediaType,u.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,r,i,a,o,s){if(e&&e.representationInfo){var l=new Vn;l.id=t,l.index=n,l.streamIndex=r,l.mediaType=i,l.startNumber=o,l.fragmentInfoType=s,l.presentationTimeOffset=a,e.representationInfo.push(l),d(e.mediaType,u.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.a.STREAM,u.PLAY_LIST,e)},addDVBErrors:function(e){m(a.a.STREAM,u.DVB_ERRORS,e)}},n={},t}Xn.__dashjs_factory_name="MetricsModel";var Qn=f.a.getSingletonFactory(Xn),$n=n(14);function Zn(e){e=e||{};var t,n,r,i,o=this.context,s=e.metricsModel;function l(e){var t=s.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=s.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(s.getMetricsFor(e,!0),u.TRACK_SWITCH)},getCurrentBufferState:function(e){return f(s.getMetricsFor(e,!0),u.BUFFER_STATE)},getCurrentBufferLevel:function(e){var t=f(s.getMetricsFor(e,!0),u.BUFFER_LEVEL);return t?xn.round10(t.level/1e3,-3):0},getCurrentHttpRequest:l,getHttpRequests:c,getCurrentDroppedFrames:function(){return f(s.getMetricsFor(a.a.VIDEO,!0),u.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return f(s.getMetricsFor(e,!0),u.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return f(e?s.getMetricsFor(e,!0):s.getMetricsFor(a.a.VIDEO,!0)||s.getMetricsFor(a.a.AUDIO,!0),u.DVR_INFO)},getCurrentManifestUpdate:function(){return f(s.getMetricsFor(a.a.STREAM),u.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){if(!t)return null;var n={},r=l(e);r&&(n=$n.a.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.a.STREAM)).length-1;r>=0;r--)if((n=t[r]).type===v.a.MPD_TYPE){i=$n.a.parseHttpHeaders(n._responseHeaders);break}var o=i[e.toLowerCase()];return void 0===o?null:o},addRepresentationSwitch:function(e,t,n,r,i){s.addRepresentationSwitch(e,t,n,r,i)},addDVRInfo:function(e,t,n,r){s.addDVRInfo(e,t,n,r)},updateManifestUpdateInfo:function(e){var t=this.getCurrentManifestUpdate();s.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){var t=this.getCurrentManifestUpdate();s.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){var n=this.getCurrentManifestUpdate();s.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){s.addManifestUpdate(a.a.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,r,i){s.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)},addSchedulingInfo:function(e,t){s.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){s.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){s.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){s.addBufferState(e,t,n)},addDroppedFrames:function(e){s.addDroppedFrames(a.a.VIDEO,e)},addPlayList:function(){i&&(s.addPlayList(i),i=null)},addDVBErrors:function(e){s.addDVBErrors(e)},createPlaylistMetrics:function(e,t){(i=new B).start=new Date,i.mstart=e,i.starttype=t},createPlaylistTraceMetrics:function(e,t,i){!0===n&&(n=!1,(r=new k).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(){s.clearAllCurrentMetrics()}},s=s||Qn(o).getInstance({settings:e.settings}),n=!0,r=null,i=null,t}Zn.__dashjs_factory_name="DashMetrics";var Jn=f.a.getSingletonFactory(Zn);function er(){var e,t,n,r,i=this.context,s=Object(l.a)(i).getInstance(),u=Object(_.a)(i).getInstance();function f(e){r=e}function d(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 p(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*r)/1e3}function g(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=p(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.a.VIDEO)||r.getMediaInfoForType(e.getStreamInfo(),a.a.AUDIO),u=r.getVoRepresentations(s)[0],l={start:NaN,end:NaN};if(u)if(u.segmentInfoType===o.a.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.SegmentTimeline,l=s.SegmentTemplate.timescale,c=u.S_asArray,f={start:0,end:0},d=0;for(f.start=g(c[0].t/l,e),i=0,a=c.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 T(){r=0,n=0}function S(){s.off(c.a.UPDATE_TIME_SYNC_OFFSET,v,this),T()}return e={initialize:function(){T(),s.on(c.a.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 d(e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return d(e,t,n,!0)},calcPresentationTimeFromWallTime:p,calcPresentationTimeFromMediaTime:g,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&&(g.spans.push({name:m,line:T,row:c}),T="");var N="style_cea608_"+R.foreground+"_"+R.background;R.underline&&(N+="_underline"),R.italics&&(N+="_italics"),E.hasOwnProperty(N)||(E[N]=JSON.parse(JSON.stringify(R))),S=R,m=N}T+=I.uchar}T.trim().length>0&&g.spans.push({name:m,line:T,row:c}),h=!0,p=A}else h=!1,p=-1,d&&(d.p.push(g),g={start:s,end:u,spans:[]},d.y2=c,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(_.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null)}d&&(d.p.push(g),d.y2=c+1,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(_.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null);var w=[];for(c=0;c<_.length;++c){var C=_[c],D="sub_cea608_"+e++,O=document.createElement("div");O.id=D;var M=n(C);O.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+M;var P=document.createElement("div");P.className="paragraph bodyStyle",P.style.cssText=i(r);var L=document.createElement("div");L.className="cueUniWrapper",L.style.cssText="unicode-bidi: normal; direction: ltr;";for(var F=0;F0){if(0!==f&&U!=B.row){var k=document.createElement("br");k.className="lineBreak",L.appendChild(k)}var G=!1;U===B.row&&(G=!0),U=B.row;var j=E[B.name],Y=document.createElement("span");Y.className="spanPadding "+B.name+" customSpanColor",Y.style.cssText=i(r,j),0!==f&&G?f===x.spans.length-1?Y.textContent=o(B.line):Y.textContent=B.line:x.spans.length>1&&f1&&e.isEmbedded?t=e.id&&e.id===a.a.CC1:1===_.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===_.length&&(t=e.index===s[0].index);return t}(e),t.isFragmented=e.isFragmented,t.isEmbedded=!!e.isEmbedded,t.isTTML=function(e){return e.codec&&e.codec.search(a.a.STPP)>=0||e.mimeType&&e.mimeType.search(a.a.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"}),C.addTextTrack(t)}function k(e){var t=e.chunk;t.mediaInfo.embeddedCaptions&&j(t.bytes,t)}function G(e){m=e}function j(e,s){var l=s.mediaInfo,c=l.type,d=l.mimeType,p=l.codec||d;p?-1!==l.codec.indexOf("application/mp4")?function(e,i,s){var l,c;if("InitializationSegment"===i.segmentType)f=!0,h=r.getMediaTimescaleFromMoov(e);else{if(!f)return;c=r.getSamplesInfo(e),(l=c.sampleList).length>0&&(g=l[0].cts-i.start*h),s.search(a.a.STPP)>=0?function(e,r,i){var s,l;for(o=null!==o?o:K(i),s=0;s0&&C.addCaptions(m,0,s)}(e,l)}}(e,s,p):c===a.a.VIDEO?function(e,t){var a,o;if(t.segmentType===v.a.INIT_SEGMENT_TYPE)0===T&&(T=r.getMediaTimescaleFromMoov(e));else if(t.segmentType===v.a.MEDIA_SEGMENT_TYPE){if(0===T)return void n.warn("CEA-608: No timescale for embeddedTextTrack yet");var s=(o=r.getSamplesInfo(e)).lastSequenceNumber;if(A[0]||A[1]||function(){for(var e,t=0;t<_.length;t++){if(-1===(e=C.getTrackIdxForId(_[t].id)))return void n.warn("CEA-608: data before track is ready.");var r=Y(e);A[t]=new i.a.Cea608Parser(t+1,{newCue:r},null)}}(),T){if(null!==S&&s!==S+o.numSequences)for(a=0;a0){o.cts!==u?l=0:l+=1;var h=H();n.fields[d].push([o.cts+h*T,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),l=0;l=0?t=D:(e.search(a.a.TTML)>=0||e.search(a.a.STPP)>=0)&&(t=O),t}function q(e){_.forEach((function(t){var n=C.getTrackIdxForId(t.id);n>=0&&C.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return t={initialize:function(){F||(_=[],m=null,T=0,A=[],S=null,F=!0,b=pr(P).getInstance(),L.on(c.a.VIDEO_CHUNK_RECEIVED,k,t),L.on(c.a.BUFFER_CLEARED,q,t))},addMediaInfos:function(e,n,r){if(s=s.concat(n),e===a.a.TEXT&&n[0].isFragmented&&!n[0].isEmbedded){u=r,t.buffered=Object(dr.a)(P).create(),p=N.getTracksFor(a.a.TEXT,M.id).filter((function(e){return e.isFragmented}));for(var i=N.getCurrentTrackFor(a.a.TEXT,M.id),o=0;on/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 w(e,t){var n=I.getClientWidth(),r=I.getClientHeight(),i=I.getVideoWidth(),a=I.getVideoHeight(),o=I.getVideoRelativeOffsetTop(),s=I.getVideoRelativeOffsetLeft();if(0!==i&&0!==a){var l=i/a,c=!1;e.isFromCEA608&&(l=3.5/3,c=!0);var d=N.call(this,n,r,i,a,l,c),y=d.w,v=d.h,S=d.x,A=d.y;if(y!=p||v!=g||S!=u||A!=f||t){if(u=S+s,f=A+o,p=y,g=v,m){var R=m.style;R&&(R.left=u+"px",R.top=f+"px",R.width=p+"px",R.height=g+"px",R.zIndex=E&&document[E]||_?T:null,b.trigger(h.a.CAPTION_CONTAINER_RESIZE))}var w=e.activeCues;if(w)for(var C=w.length,D=0;D=0&&i[e]?I.getTextTrack(i[e].kind,i[e].id,i[e].lang,i[e].isTTML,i[e].isEmbedded):null}function P(e){var t=this;if(e!==s){var n=M(s=e);L.call(this,n),y&&(clearInterval(y),y=null),n&&"html"===n.renderingType&&(w.call(this,n,!0),window.ResizeObserver?(S=new window.ResizeObserver((function(){w.call(t,n,!0)}))).observe(I.getElement()):y=setInterval(w.bind(this,n),500))}}function L(e){G.call(this),e&&"html"===e.renderingType?B.call(this):k.call(this)}function F(e,t){if(!e.cues)return!1;for(var n=0;n=t)&&(isNaN(n)||e.endTime<=n)}function U(e,t,n){if(e.cues)for(var r=e.cues,i=r.length-1;i>=0;i--)x(r[i],t,n)&&(r[i].onexit&&r[i].onexit(),e.removeCue(r[i]))}function B(){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=I.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 k(){var e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function G(){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,u=0,f=0,p=0,g=0,m=null,y=null,_=!1,T=2147483647,v=null,void 0!==document.fullscreenElement?E="fullscreenElement":void 0!==document.webkitIsFullScreen?E="webkitIsFullScreen":document.msFullscreenElement?E="msFullscreenElement":document.mozFullScreen&&(E="mozFullScreen"))},getStreamId:function(){return R.id},addTextTrack:function(e){i.push(e)},addCaptions:O,createTracks:function(){i.sort((function(e,t){return e.index-t.index})),m=I.getTTMLRenderingDiv();for(var e,t,n,r,u,l,f=-1,d=0;d=0){b.on(h.a.PLAYBACK_METADATA_LOADED,(function e(){var t=M(f);t&&w.call(this,t,!0),b.off(h.a.PLAYBACK_METADATA_LOADED,e,this)}),this);for(var y=0;y1){var n=e.split(/:/)[1];n&&-1!=n.search(/%/)&&(n=parseInt(n.replace(/%/,""),10)),(e.match(/align/)||e.match(/A/))&&(t.align=n),(e.match(/line/)||e.match(/L/))&&(t.line=n),(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 h=u(d),p=h.cuePoints,g=h.styles,m=c(e,f+1),y=s(p[0].replace(i,"")),E=s(p[1].replace(i,""));!isNaN(y)&&!isNaN(E)&&y>=o&&E>y?""!==m?(o=y,l.push({start:y,end:E,data:m,styles:g})):t.error("Skipping cue due to empty/malformed cue text"):t.error("Skipping cue due to incorrect cue timing")}}return l}},t=Object(d.a)(o).getInstance().getLogger(e),n=/(?:\r\n|\r|\n)/gm,r=/-->/,i=/(^[\s]+|[\s]+$)/g,a=/\s\b/g,e}vr.__dashjs_factory_name="VTTParser";var Tr=f.a.getSingletonFactory(vr);function Sr(){var e,t,n=this.context,r=Object(l.a)(n).getInstance(),i=0;return e={parse:function(e,n,a,o,s){var u,l,f,d="",p=[],g={},m={},y="",E="",_={onOpenTag:function(e,n,i){if(i[" imagetype"]&&!i[" imageType"]&&(r.trigger(h.a.CONFORMANCE_VIOLATION,{level:pe.LEVELS.ERROR,event:pe.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 d="no ttml data to parse",new Error(d);g.data=e,r.trigger(c.a.TTML_TO_PARSE,g);var v=Object(yr.fromXML)(g.data,(function(e){d=e}),_);r.trigger(c.a.TTML_PARSED,{ttmlString:g.data,ttmlDoc:v});var T,S=v.getMediaTimeEvents();for(f=0;fo?o:S[f+1]+n)&&p.push({start:u,end:l,type:"html",cueID:(T=void 0,T="cue_TTML_"+i,i++,T),isd:A,images:s,embeddedImages:m})}if(""!==d)throw t.error(d),new Error(d);return p}},t=Object(d.a)(n).getInstance().getLogger(e),e}Sr.__dashjs_factory_name="TTMLParser";var Ar=f.a.getSingletonFactory(Sr);function br(e){var t,n,r,i,o,s,u,f,d,p,g,m,y,E=this.context,_=e.adapter,v=e.errHandler,T=e.manifestModel,S=e.mediaController,A=e.videoModel,b=e.settings;function I(e){var t=e.tracks,r=e.index,i=e.streamId;!1===b.get().streaming.text.defaultEnabled&&!N()||y?w(i,-1):(f&&t.some((function(e,t){if(S.matchSettings(f,e))return w(i,t),r=t,!0})),p=!1),n[i].lastEnabledIndex=r,u.trigger(h.a.TEXT_TRACKS_ADDED,{enabled:N(),index:r,tracks:t,streamId:i}),m=!0}function R(e){if(!d&&e&&e.newMediaInfo){var t=e.newMediaInfo;t.type===a.a.TEXT&&(f={lang:t.lang,role:t.roles[0],index:t.index,codec:t.codec,accessibility:t.accessibility[0]})}}function N(){var e=!0;return p&&!g&&(e=!1),e}function w(e,t){(p=-1===t)&&S&&S.saveTextSettingsDisabled();var n=C(e);if(n!==t&&i[e]){i[e].setModeForTrackIdx(n,a.a.TEXT_HIDDEN),i[e].setCurrentTrackIdx(t),i[e].setModeForTrackIdx(t,a.a.TEXT_SHOWING);var o=i[e].getCurrentTrackInfo();o&&o.isFragmented&&!o.isEmbedded?function(e,t,n){if(!r[e])return;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(){D(),u.off(c.a.CURRENT_TRACK_CHANGED,R,t),u.off(c.a.TEXT_TRACKS_QUEUE_INITIALIZED,I,t),Object.keys(r).forEach((function(e){r[e].resetEmbedded(),r[e].reset()}))}},f=null,g=!1,m=!1,d=!1,y=!1,o=Tr(E).getInstance(),s=Ar(E).getInstance(),u=Object(l.a)(E).getInstance(),D(),t}br.__dashjs_factory_name="TextController";var Ir=f.a.getClassFactory(br);function Rr(){var e,t,n,r,s,p,m,T,S,A,b,I,R,N,w,C,D,O,P,U,B,k,G,j,Y,H,K,q,V,W,z,X,Q,$,Z,J,ee="You must first call initialize() and set a source before calling this method",te="You must first call initialize() and set a valid source and view before calling this method",ne="You must first call attachView() to set the video element before calling this method",re=this.context,ie=Object(l.a)(re).getInstance(),oe=Object(_.a)(re).getInstance(),se=Object(d.a)(re).getInstance({settings:oe});function ue(){Ie(null),Te(null),r=null,R&&(R.reset(),R=null),N&&(N.reset(),N=null),oe.reset(),C&&(C.reset(),C=null)}function le(){return!!n&&!!W.getElement()}function ce(){return Object(fn.a)()}function fe(){if(!m)throw te;return H.isPaused()}function de(e){var t=G&&G.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,n=K.getCurrentDVRInfo(t);if(!n)return 0;var r=H.getLiveDelay(),i=n.range.start+e;return i>n.range.end-r&&(i=n.range.end-r),i}function he(e){if(!m)throw te;var t=_e().currentTime;if(void 0!==e)t=G.getTimeRelativeToStreamId(t,e);else if(H.getIsDynamic()){var n=G&&G.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,r=K.getCurrentDVRInfo(n);t=null===r||0===t?0:Math.max(0,t-r.range.start)}return t}function pe(){if(!m)throw te;var e=_e().duration;if(H.getIsDynamic()){var t=G&&G.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,n=K.getCurrentDVRInfo(t);e=n?n.range.end-n.range.start:0}return e}function ge(e){Object(M.b)(e,"boolean"),T=e}function me(){O.restoreDefaultUTCTimingSources()}function ye(){return K}function _e(){if(!W.getElement())throw ne;return W.getElement()}function Te(e){if(!s)throw"MediaPlayer not initialized!";W.setElement(e),e&&(Ce(),function(){if(N)return;var e=dashjs.MetricsReporting;if("function"==typeof e){var t=e(re).create();N=t.createMetricsReporting({debug:se,eventBus:ie,mediaElement:_e(),adapter:D,dashMetrics:K,events:c.a,constants:a.a,metricsConstants:u})}}(),function(){if(w)return;var e=dashjs.MssHandler;"function"==typeof e&&(E.a.extend(e.errors),w=e(re).create({eventBus:ie,mediaPlayerModel:O,dashMetrics:K,manifestModel:q,playbackController:H,streamController:G,protectionController:R,baseURLController:U,errHandler:P,events:c.a,constants:a.a,debug:se,initSegmentType:v.a.INIT_SEGMENT_TYPE,BASE64:rr.a,ISOBoxer:ar.a,settings:oe}))}(),G&&G.switchToVideoElement()),m&&Ne(),Me()}function Se(e){if(!p)throw ee;var t=G.getActiveStreamInfo();return t?I.getTracksFor(e,t.id):[]}function be(e,t){var n=-1;e.some((function(e,r){if(e===t)return n=r,!0})),n<0||e.splice(n,1)}function Ie(e){if(!s)throw"MediaPlayer not initialized!";"string"==typeof e&&z.initialize(e),n=e,(p||m)&&Ne(),le()&&Me()}function Re(){if(!p)throw ee;var e=G.getActiveStreamInfo();return e?G.getStreamById(e.id):null}function Ne(){m=!1,p=!1,D.reset(),G.reset(),Y.reset(),H.reset(),S.reset(),I.reset(),Q.reset(),R&&(oe.get().streaming.protection.keepProtectionMediaKeys?R.stop():(R.reset(),R=null,Ce())),j.reset(),V.reset()}function we(){return Ze(re).create({debug:se,errHandler:P,dashMetrics:K,mediaPlayerModel:O,requestModifier:Object(L.a)(re).getInstance(),mssHandler:w,settings:oe})}function Ce(){if(R)return R;var e=dashjs.Protection;if("function"==typeof e){var t=e(re).create();return c.a.extend(e.events),h.a.extend(e.events,{publicOnly:!0}),E.a.extend(e.errors),B||(B=Object(tt.a)(re).getInstance()),(R=t.createProtectionSystem({debug:se,errHandler:P,videoModel:W,capabilities:B,eventBus:ie,events:c.a,BASE64:rr.a,constants:a.a,cmcdModel:V,settings:oe}))&&(R.setLicenseRequestFilters($),R.setLicenseResponseFilters(Z)),R}return null}function De(){if(!s)throw"MediaPlayer not initialized!";if(C)return C;var e=dashjs.OfflineController;if("function"==typeof e){c.a.extend(e.events),h.a.extend(e.events,{publicOnly:!0}),E.a.extend(e.errors);var t=we(),n=ae(re).create();return n.setConfig({manifestModel:q,adapter:D,manifestLoader:t,errHandler:P}),C=e(re).create({debug:se,manifestUpdater:n,baseURLController:U,manifestLoader:t,manifestModel:q,mediaPlayerModel:O,abrController:S,playbackController:H,adapter:D,errHandler:P,dashMetrics:K,timelineConverter:b,segmentBaseController:Q,schemeLoaderFactory:A,eventBus:ie,events:c.a,errors:E.a,constants:a.a,settings:oe,dashConstants:o.a,urlUtils:Object(F.a)(re).getInstance()})}return null}function Oe(e){var t=G&&G.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,n=K.getCurrentDVRInfo(t);return n?e+(n.manifestInfo.availableFrom.getTime()/1e3+n.range.start):0}function Me(){var e;C&&C.resetRecords(),!p&&n&&(p=!0,t.info("Streaming Initialized"),e=we(),G||(G=Ee(re).getInstance()),j||(j=Ir(re).create({errHandler:P,manifestModel:q,adapter:D,mediaController:I,videoModel:W,settings:oe})),k.setConfig({capabilities:B,adapter:D,settings:oe,manifestModel:q,errHandler:P}),k.setCustomCapabilitiesFilters(J),G.setConfig({capabilities:B,capabilitiesFilter:k,manifestLoader:e,manifestModel:q,mediaPlayerModel:O,protectionController:R,textController:j,adapter:D,dashMetrics:K,errHandler:P,timelineConverter:b,videoModel:W,playbackController:H,abrController:S,mediaController:I,settings:oe,baseURLController:U,uriFragmentModel:z,segmentBaseController:Q}),Y.setConfig({settings:oe,playbackController:H,streamController:G,videoModel:W,timelineConverter:b,adapter:D}),H.setConfig({streamController:G,dashMetrics:K,mediaPlayerModel:O,adapter:D,videoModel:W,timelineConverter:b,settings:oe}),S.setConfig({streamController:G,domStorage:X,mediaPlayerModel:O,dashMetrics:K,adapter:D,videoModel:W,settings:oe}),V.setConfig({abrController:S,dashMetrics:K,playbackController:H}),S.initialize(),G.initialize(T,r),j.initialize(),Y.initialize(),V.initialize(),Q.initialize(),"string"==typeof n?G.load(n):G.loadWithManifest(n)),!m&&le()&&(m=!0,t.info("Playback Initialized"))}return e={initialize:function(e,n,r){B||(B=Object(tt.a)(re).getInstance()).setConfig({settings:oe}),P||(P=et(re).getInstance()),B.supportsMediaSource()?(s||(s=!0,b=tr(re).getInstance(),S||(S=tn(re).getInstance()).setConfig({settings:oe}),A||(A=Object(nn.a)(re).getInstance()),H||(H=g(re).getInstance()),I||(I=Ae(re).getInstance()),G||(G=Ee(re).getInstance()),Y||(Y=ve(re).getInstance()),k||(k=rt(re).getInstance()),D=Ln(re).getInstance(),q=ut(re).getInstance(),V=Object(sn.a)(re).getInstance(),K=Jn(re).getInstance({settings:oe}),X=cn(re).getInstance({settings:oe}),D.setConfig({constants:a.a,cea608parser:i.a,errHandler:P,BASE64:rr.a}),U||(U=xe(re).create()),U.setConfig({adapter:D}),Q||(Q=vn(re).getInstance({dashMetrics:K,mediaPlayerModel:O,errHandler:P,baseURLController:U,events:c.a,eventBus:ie,debug:se,boxParser:Object(x.a)(re).getInstance(),requestModifier:Object(L.a)(re).getInstance(),errors:E.a})),I.setConfig({domStorage:X,settings:oe}),me(),ge(void 0===r||r),De()),e&&Te(e),n&&Ie(n),t.info("[dash.js "+ce()+"] MediaPlayer has been initialized")):P.error(new y.a(E.a.CAPABILITY_MEDIASOURCE_ERROR_CODE,E.a.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(B=e.capabilities),e.capabilitiesFilter&&(k=e.capabilitiesFilter),e.streamController&&(G=e.streamController),e.textController&&(j=e.textController),e.gapController&&(Y=e.gapController),e.playbackController&&(H=e.playbackController),e.mediaPlayerModel&&(O=e.mediaPlayerModel),e.abrController&&(S=e.abrController),e.schemeLoaderFactory&&(A=e.schemeLoaderFactory),e.mediaController&&(I=e.mediaController),e.settings&&(oe=e.settings))},on:function(e,t,n,r){ie.on(e,t,n,r)},off:function(e,t,n){ie.off(e,t,n)},extend:function(e,t,n){f.a.extend(e,t,n,re)},attachView:Te,attachSource:Ie,isReady:le,play:function(){if(!m)throw te;(!T||fe()&&m)&&H.play()},isPaused:fe,pause:function(){if(!m)throw te;H.pause()},isSeeking:function(){if(!m)throw te;return H.isSeeking()},isDynamic:function(){if(!m)throw te;return H.getIsDynamic()},seek:function(e){if(!m)throw te;if(Object(M.b)(e,"number"),isNaN(e))throw a.a.BAD_ARGUMENT_ERROR;var t=H.getIsDynamic()?de(e):e;H.seek(t)},setPlaybackRate:function(e){_e().playbackRate=e},getPlaybackRate:function(){return _e().playbackRate},setMute:function(e){Object(M.b)(e,"boolean"),_e().muted=e},isMuted:function(){return _e().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw a.a.BAD_ARGUMENT_ERROR;_e().volume=e},getVolume:function(){return _e().volume},time:he,duration:pe,timeAsUTC:function(){if(!m)throw te;return he()<0?NaN:Oe(he())},durationAsUTC:function(){if(!m)throw te;return Oe(pe())},getActiveStream:Re,getDVRWindowSize:function(){var e=G&&G.hasVideoTrack()?a.a.VIDEO:a.a.AUDIO,t=K.getCurrentDVRInfo(e);return t?t.manifestInfo.dvrWindowSize:0},getDVRSeekOffset:de,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:ce,getDebug:function(){return se},getBufferLength:function(e){var n=[a.a.VIDEO,a.a.AUDIO,a.a.TEXT];if(e){if(-1!==n.indexOf(e)){var r=ye().getCurrentBufferLevel(e);return r||NaN}return t.warn("getBufferLength requested for invalid type"),NaN}var i=n.map((function(e){return Se(e).length>0?ye().getCurrentBufferLevel(e):Number.MAX_VALUE})).reduce((function(e,t){return Math.min(e,t)}));return i===Number.MAX_VALUE?NaN:i},getTTMLRenderingDiv:function(){return W?W.getTTMLRenderingDiv():null},getVideoElement:_e,getSource:function(){if(!n)throw"You must first call attachSource() with a valid source before calling this method";return n},getCurrentLiveLatency:function(){if(!s)throw"MediaPlayer not initialized!";return m?H.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(e){if(!p)throw ee;return S.getTopBitrateInfoFor(e)},setAutoPlay:ge,getAutoPlay:function(){return T},getDashMetrics:ye,getQualityFor:function(e){if(!p)throw ee;if(e===a.a.IMAGE){var t=Re();if(!t)return-1;var n=t.getThumbnailController();return n?n.getCurrentTrackIndex():-1}return S.getQualityFor(e)},setQualityFor:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!p)throw ee;if(e===a.a.IMAGE){var r=Re();if(!r)return;var i=r.getThumbnailController();i&&i.setTrackByIndex(t)}S.setPlaybackQuality(e,G.getActiveStreamInfo(),t,{forceReplace:n})},updatePortalSize:function(){S.setElementSize(),S.setWindowResizeEventCalled(!0)},enableText:function(e){var t=G.getActiveStreamInfo();return!(!t||!j)&&j.enableText(t.id,e)},enableForcedTextStreaming:function(e){return!(!G.getActiveStreamInfo()||!j)&&j.enableForcedTextStreaming(e)},isTextEnabled:function(){var e=G.getActiveStreamInfo();return!(!e||!j)&&j.isTextEnabled(e)},setTextTrack:function(e){if(!m)throw te;var t=G.getActiveStreamInfo();t&&j&&j.setTextTrack(t.id,e)},getBitrateInfoListFor:function(e){if(!p)throw ee;var t=Re();return t?t.getBitrateListFor(e):[]},getStreamsFromManifest:function(e){if(!p)throw ee;return D.getStreamsInfo(e)},getTracksFor:Se,getTracksForTypeFromManifest:function(e,t,n){if(!p)throw ee;return(n=n||D.getStreamsInfo(t,1)[0])?D.getAllMediaInfoForType(n,e,t):[]},getCurrentTrackFor:function(e){if(!p)throw ee;var t=G.getActiveStreamInfo();return I.getCurrentTrackFor(e,t.id)},setInitialMediaSettingsFor:function(e,t){if(!s)throw"MediaPlayer not initialized!";I.setInitialSettings(e,t)},getInitialMediaSettingsFor:function(e){if(!s)throw"MediaPlayer not initialized!";return I.getInitialSettings(e)},setCurrentTrack:function(e){if(!p)throw ee;I.setTrack(e)},addABRCustomRule:function(e,t,n){O.addABRCustomRule(e,t,n)},removeABRCustomRule:function(e){O.removeABRCustomRule(e)},removeAllABRCustomRule:function(){O.removeABRCustomRule()},getAverageThroughput:function(e){var t=S.getThroughputHistory();return t?t.getAverageThroughput(e):0},retrieveManifest:function(e,t){var n=we(),r=this;ie.on(c.a.INTERNAL_MANIFEST_LOADED,(function e(i){i.error?t(null,i.error):t(i.manifest),ie.off(c.a.INTERNAL_MANIFEST_LOADED,e,r),n.reset()}),r),z.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){O.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){O.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){O.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:me,setXHRWithCredentialsForType:function(e,t){O.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return O.getXHRWithCredentialsForType(e)},getProtectionController:function(){return Ce()},attachProtectionController:function(e){R=e},setProtectionData:function(e){r=e,G&&G.setProtectionData(r)},registerLicenseRequestFilter:function(e){$.push(e),R&&R.setLicenseRequestFilters($)},registerLicenseResponseFilter:function(e){Z.push(e),R&&R.setLicenseResponseFilters(Z)},unregisterLicenseRequestFilter:function(e){be($,e),R&&R.setLicenseRequestFilters($)},unregisterLicenseResponseFilter:function(e){be(Z,e),R&&R.setLicenseResponseFilters(Z)},registerCustomCapabilitiesFilter:function(e){J.push(e),k&&k.setCustomCapabilitiesFilters(J)},unregisterCustomCapabilitiesFilter:function(e){be(J,e),k&&k.setCustomCapabilitiesFilters(J)},setCustomInitialTrackSelectionFunction:function(e){I&&I.setCustomInitialTrackSelectionFunction(e)},resetCustomInitialTrackSelectionFunction:function(){I&&I.setCustomInitialTrackSelectionFunction(null)},attachTTMLRenderingDiv:function(e){if(!W.getElement())throw ne;W.setTTMLRenderingDiv(e)},getCurrentTextTrackIndex:function(){var e=G.getActiveStreamInfo();if(e&&j)return j.getCurrentTrackIdx(e.id)},provideThumbnail:function(e,t){if("function"==typeof t)if(e<0)t(null);else{var n=H.getIsDynamic()?de(e):e,r=G.getStreamForTime(n);if(null!==r){var i=r.getThumbnailController();if(i){var a=G.getTimeRelativeToStreamId(n,r.getId());return i.provide(a,t)}t(null)}else t(null)}},getDashAdapter:function(){return D},getOfflineController:function(){return De()},getSettings:function(){return oe.get()},updateSettings:function(e){oe.update(e)},resetSettings:function(){oe.reset()},reset:ue,destroy:function(){ue(),$=[],Z=[],J=[],f.a.deleteSingletonInstances(re)}},t=se.getLogger(e),s=!1,m=!1,p=!1,T=!0,R=null,C=null,r=null,D=null,Q=null,c.a.extend(h.a),O=Kt(re).getInstance(),W=on(re).getInstance(),z=ot(re).getInstance(),$=[],Z=[],J=[],e}Rr.__dashjs_factory_name="MediaPlayer";var Nr=f.a.getClassFactory(Rr);Nr.events=h.a,Nr.errors=E.a,f.a.updateClassFactory(Rr.__dashjs_factory_name,Nr);t.a=Nr},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));function r(){return"4.1.0"}},function(e,t,n){var r,i,o,u,l,c={encode: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},decode:function(e){for(var t=[],n=0;n>18)),n.push(r.charAt(63&a>>12)),n.push(r.charAt(63&a>>6)),n.push(r.charAt(63&a))}return 2==e.length-t?(a=(e[t]<<16)+(e[t+1]<<8),n.push(r.charAt(63&a>>18)),n.push(r.charAt(63&a>>12)),n.push(r.charAt(63&a>>6)),n.push("=")):1==e.length-t&&(a=e[t]<<16,n.push(r.charAt(63&a>>18)),n.push(r.charAt(63&a>>12)),n.push("==")),n.join("")},o=function(){for(var e=[],t=0;t0&&(e.segments=u);return e}(e,n[1])),(r=e).mediaFinishedInformation=E.getMediaFinishedInformation(r),function(e){if(!S())return;var t,n=d.getCurrentManifestUpdate(),r=!1;if(n){for(var i=0;i=s.length?null:s[e]}function w(e){i=!1,l.trigger(c.DATA_UPDATE_COMPLETED,{data:n,currentRepresentation:u,error:e},{streamId:m.id,mediaType:g})}function C(e){u=e}function D(e){if(e.newDuration){var t=A();if(t&&t.adaptation.period)t.adaptation.period.duration=e.newDuration}}return t={getStreamId:function(){return m.id},getType:v,getData:function(){return n},isUpdating:S,updateData:function(e,t,a,o,u){if(T(),i=!0,s=t,C(N(u)),n=e,a!==r.a.VIDEO&&a!==r.a.AUDIO&&(a!==r.a.TEXT||!o))return w(),Promise.resolve();for(var l=[],c=0,f=s.length;c=0}return!1}),(function(e){return String(e)}))}return n}(l),E=n(1);function _(e){return(_="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})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t=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}}();return function(){var n,r=A(e);if(t){var i=A(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return S(this,n)}}function S(e,t){return!t||"object"!==_(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 A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var b=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,I=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&&v(e,t)}(n,e);var t=T(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.call(this,(function(e){for(var t=[c.a.MIN_BUFFER_TIME,c.a.MEDIA_PRESENTATION_DURATION,c.a.MINIMUM_UPDATE_PERIOD,c.a.TIMESHIFT_BUFFER_DEPTH,c.a.MAX_SEGMENT_DURATION,c.a.MAX_SUBSEGMENT_DURATION,c.a.SUGGESTED_PRESENTATION_DELAY,c.a.START,E.a.START_TIME,c.a.DURATION],n=t.length,r=0;r4)return null;var r=[];for(var i in t){var a=n.parseLength(t[i]);if(!a)return null;r.push(a)}return r}),(function(t,n,r,i,a){var o;if(1===i.length)o=[i[0],i[0],i[0],i[0]];else if(2===i.length)o=[i[0],i[1],i[0],i[1]];else if(3===i.length)o=[i[0],i[1],i[2],i[1]];else{if(4!==i.length)return null;o=[i[0],i[1],i[2],i[3]]}var s=r.styleAttrs[e.byName.writingMode.qname];if("lrtb"===s||"lr"===s)o=[o[0],o[3],o[2],o[1]];else if("rltb"===s||"rl"===s)o=[o[0],o[1],o[2],o[3]];else if("tblr"===s)o=[o[3],o[0],o[1],o[2]];else{if("tbrl"!==s&&"tb"!==s)return null;o=[o[3],o[2],o[1],o[0]]}var u=[];for(var l in o)if(0===o[l].value)u[l]=0;else if("%"===o[l].unit)u[l]="0"===l||"2"===l?r.styleAttrs[e.byName.extent.qname].h*o[l].value/100:r.styleAttrs[e.byName.extent.qname].w*o[l].value/100;else if("em"===o[l].unit)u[l]=r.styleAttrs[e.byName.fontSize.qname]*o[l].value;else if("c"===o[l].unit)u[l]=o[l].value/t.cellResolution.h;else{if("px"!==o[l].unit)return null;u[l]="0"===l||"2"===l?o[l].value/t.pxDimensions.h:o[l].value/t.pxDimensions.w}return u})),new r(t.ns_tts,"showBackground","always",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"textAlign","start",["p"],!0,!0,(function(e){return e}),(function(e,t,n,r,i){return"left"===r?"start":"right"===r?"end":r})),new r(t.ns_tts,"textDecoration","none",["span"],!0,!0,(function(e){return e.split(" ")}),null),new r(t.ns_tts,"textOutline","none",["span"],!0,!0,(function(e){if("none"===e)return e;var t={},r=e.split(" ");if(0===r.length||r.length>2)return null;var i=n.parseColor(r[0]);if(t.color=i,null!==i&&r.shift(),1!==r.length)return null;var a=n.parseLength(r[0]);return a?(t.thickness=a,t):null}),(function(t,n,r,i,a){if("none"===i)return i;var o={};if(null===i.color?o.color=r.styleAttrs[e.byName.color.qname]:o.color=i.color,"%"===i.thickness.unit)o.thickness=r.styleAttrs[e.byName.fontSize.qname]*i.thickness.value/100;else if("em"===i.thickness.unit)o.thickness=r.styleAttrs[e.byName.fontSize.qname]*i.thickness.value;else if("c"===i.thickness.unit)o.thickness=i.thickness.value/t.cellResolution.h;else{if("px"!==i.thickness.unit)return null;o.thickness=i.thickness.value/t.pxDimensions.h}return o})),new r(t.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"zIndex","auto",["region"],!1,!0,(function(e){var t;return"auto"===e?t=e:(t=parseInt(e),isNaN(t)&&(t=null)),t}),null),new r(t.ns_ebutts,"linePadding","0c",["p"],!0,!1,n.parseLength,(function(e,t,n,r,i){return"c"===r.unit?r.value/e.cellResolution.h:null})),new r(t.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(e){return e}),null),new r(t.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(e){return e}),null),new r(t.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(e){return"true"===e}),null),new r(t.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(e){return"true"===e}),null)],e.byQName={},e.all)e.byQName[e.all[i].qname]=e.all[i];for(var a in e.byName={},e.all)e.byName[e.all[a].name]=e.all[a]}(t,"undefined"==typeof imscNames?n(47):imscNames,"undefined"==typeof imscUtils?n(65):imscUtils)},function(e,t,n){"use strict";(function(e){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var r=n(77),i=n(78),a=n(66);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()=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("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(r)return G(e).length;t=(""+t).toLowerCase(),r=!0}}function g(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 C(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 w(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(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),n=+n,isNaN(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:E(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(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;if(a%2!=0)throw new TypeError("Invalid hex string");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<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");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;fi)&&(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 v(this,e,t,n);case"ascii":return T(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(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)}};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 M(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 P(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function F(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 x(e,t,n,r,a){return a||F(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,a){return a||F(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||O(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||O(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||O(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 t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||O(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 t||O(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 t||O(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 t||O(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);M(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);M(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||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),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||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return x(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return x(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){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("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=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 j(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(21))},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}y(e,t,a,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,n)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,n,r){var i,a,o,s;if(l(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]),void 0===o)o=a[t]=n,++e._eventsCount;else if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,s=u,console&&console.warn&&console.warn(s)}return e}function d(){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 h(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(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=i[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,c=m(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},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},s.prototype.listenerCount=g,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(t=e.exports=n(67)).Stream=t,t.Readable=t,t.Writable=n(63),t.Duplex=n(30),t.Transform=n(70),t.PassThrough=n(86)},function(e,t,n){"use strict";(function(t,r,i){var a=n(48);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=E;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:a.nextTick;E.WritableState=y;var l=n(42);l.inherits=n(34);var c={deprecate:n(85)},f=n(68),d=n(49).Buffer,h=i.Uint8Array||function(){};var p,g=n(69);function m(){}function y(e,t){s=s||n(30),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(a.nextTick(i,r),a.nextTick(b,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),b(e,t))}(e,n,r,t,i);else{var o=S(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||T(e,n),r?u(v,e,n,o,i):v(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function E(e){if(s=s||n(30),!(p.call(E,this)||this instanceof s))return new E(e);this._writableState=new y(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function _(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function v(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),b(e,t)}function T(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),a=t.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,_(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(_(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),b(e,t)}))}function b(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(A,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(E,f),y.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===E&&(e&&e._writableState instanceof y)}})):p=function(e){return e instanceof this},E.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},E.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,s=!i.objectMode&&(r=e,d.isBuffer(r)||r instanceof h);return s&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=m),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),a.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},E.prototype._writev=null,E.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,b(e,t),n&&(t.finished?a.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(E.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=g.destroy,E.prototype._undestroy=g.undestroy,E.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(26),n(83).setImmediate,n(21))},function(e,t,n){"use strict";var r=n(49).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=d,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){!function(e){var t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,n=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,r=/rgba\(\s*(\d+),\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,i={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};e.parseColor=function(e){var a,o=null,s=i[e.toLowerCase()];return void 0!==s?o=s:null!==(a=t.exec(e))?o=[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),void 0!==a[4]?parseInt(a[4],16):255]:null!==(a=n.exec(e))?o=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),255]:null!==(a=r.exec(e))&&(o=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseInt(a[4])]),o};var a=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%)$/;e.parseLength=function(e){var t,n=null;return null!==(t=a.exec(e))&&(n={value:parseFloat(t[1]),unit:t[2]}),n}}(t)},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t,r){var i=n(48);e.exports=_;var a,o=n(66);_.ReadableState=E;n(61).EventEmitter;var s=function(e,t){return e.listeners(t).length},u=n(68),l=n(49).Buffer,c=t.Uint8Array||function(){};var f=n(42);f.inherits=n(34);var d=n(80),h=void 0;h=d&&d.debuglog?d.debuglog("stream"):function(){};var p,g=n(81),m=n(69);f.inherits(_,u);var y=["error","close","destroy","pause","resume"];function E(e,t){e=e||{};var r=t instanceof(a=a||n(30));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=n(64).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function _(e){if(a=a||n(30),!(this instanceof _))return new _(e);this._readableState=new E(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function v(e,t,n,r,i){var a,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,A(e)}(e,o)):(i||(a=function(e,t){var n;r=t,l.isBuffer(r)||r instanceof c||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):T(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?T(e,o,t,!1):I(e,o)):T(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(h("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(b,e):b(e))}function b(e){h("emit readable"),e.emit("readable"),C(e)}function I(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ea.length?a.length:e;if(o===a.length?i+=a:i+=a.slice(0,e),0===(e-=o)){o===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,o),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(M,t,e))}function M(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function P(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return h("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):A(this),null;if(0===(e=S(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,i=t.needReadable;return h("need readable",i),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},_.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(e,t){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,h("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?c:_;function l(t,r){h("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,h("cleanup"),e.removeListener("close",y),e.removeListener("finish",E),e.removeListener("drain",f),e.removeListener("error",m),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",_),n.removeListener("data",g),d=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){h("onend"),e.end()}a.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;h("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,C(e))}}(n);e.on("drain",f);var d=!1;var p=!1;function g(t){h("ondata"),p=!1,!1!==e.write(t)||p||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==P(a.pipes,e))&&!d&&(h("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function m(t){h("onerror",t),_(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function y(){e.removeListener("finish",E),_()}function E(){h("onfinish"),e.removeListener("close",y),_()}function _(){h("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",m),e.once("close",y),e.once("finish",E),e.emit("pipe",n),a.flowing||(h("pipe resume"),n.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a0&&(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}}],(n=null)&&r(t.prototype,n),i&&r(t,i),e}();var a=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.contentType=t,this.robustness=n};var o=function e(t,n,r,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initDataTypes=["cenc"],t&&t.length&&(this.audioCapabilities=t),n&&n.length&&(this.videoCapabilities=n),this.distinctiveIdentifier=r,this.persistentState=i,this.sessionTypes=a};function s(e){return(s="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})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=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}}();return function(){var n,r=f(e);if(t){var i=f(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return c(this,n)}}function c(e,t){return!t||"object"!==s(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 f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=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&&u(e,t)}(n,e);var t=l(n);function n(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(e=t.call(this)).MEDIA_KEYERR_CODE=100,e.MEDIA_KEYERR_UNKNOWN_CODE=101,e.MEDIA_KEYERR_CLIENT_CODE=102,e.MEDIA_KEYERR_SERVICE_CODE=103,e.MEDIA_KEYERR_OUTPUT_CODE=104,e.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,e.MEDIA_KEYERR_DOMAIN_CODE=106,e.MEDIA_KEY_MESSAGE_ERROR_CODE=107,e.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,e.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,e.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,e.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,e.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,e.KEY_SESSION_CREATED_ERROR_CODE=113,e.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,e.MEDIA_KEYERR_UNKNOWN_MESSAGE="An unspecified error occurred. This value is used for errors that don't match any of the other codes.",e.MEDIA_KEYERR_CLIENT_MESSAGE="The Key System could not be installed or updated.",e.MEDIA_KEYERR_SERVICE_MESSAGE="The message passed into update indicated an error from the license service.",e.MEDIA_KEYERR_OUTPUT_MESSAGE="There is no available output device with the required characteristics for the content protection system.",e.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE="A hardware configuration change caused a content protection error.",e.MEDIA_KEYERR_DOMAIN_MESSAGE="An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.",e.MEDIA_KEY_MESSAGE_ERROR_MESSAGE="Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!",e.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE="DRM: Empty key message from CDM",e.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE="Error updating server certificate -- ",e.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE="DRM: KeyStatusChange error! -- License has expired",e.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE="DRM: No license server URL specified!",e.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE="DRM: KeySystem Access Denied! -- ",e.KEY_SESSION_CREATED_ERROR_MESSAGE="DRM: unable to create session! --",e.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE="DRM: licenser error! --",e}return n}(n(24).a)),h=n(8);var p=function e(t,n,r,i,a,o,s,u){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t,this.method=n,this.responseType=r,this.headers=i,this.withCredentials=a,this.messageType=o,this.sessionId=s,this.data=u};var g=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t,this.headers=n,this.data=r},m=n(5),y=n(14),E=n(1);function _(e){return(_="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})(e)}function v(e){var t,n,r,s,u,l,c,f,v,T,S=(e=e||{}).protectionKeyController,A=e.protectionModel,b=e.eventBus,I=e.events,R=e.debug,N=e.BASE64,w=e.constants,C=[],D=e.cmcdModel,O=e.settings;function M(){if(!(b&&b.hasOwnProperty("on")&&S&&S.hasOwnProperty("getSupportedKeySystemsFromContentProtection")))throw new Error("Missing config parameter(s)")}function P(e,t){var n=i.getPSSHForKeySystem(f,e),r=U(f);if(n){if(L(n))return;try{A.createKeySession(n,r,k(f),t)}catch(e){b.trigger(I.KEY_SESSION_CREATED,{data:null,error:new h.a(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+e.message)})}}else e?A.createKeySession(e,r,k(f),t):b.trigger(I.KEY_SESSION_CREATED,{data:null,error:new h.a(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+"Selected key system is "+(f?f.systemString:null)+". needkey/encrypted event contains no initData corresponding to that key system!")})}function L(e){if(!e)return!1;try{for(var t=A.getAllInitData(),r=0;r0?t.audioRobustness:c,u=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:c,l=k(e),f=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:"optional",d=t&&t.persistentState?t.persistentState:"temporary"===l?"optional":"required";return s.forEach((function(e){e.type===w.AUDIO?n.push(new a(e.codec,i)):e.type===w.VIDEO&&r.push(new a(e.codec,u))})),new o(n,r,f,d,[l])}function k(e){var t=U(e);return t&&t.sessionType?t.sessionType:l}function G(e,t){e=e.sort((function(t,n){return(u&&u[t.ks.systemString]&&u[t.ks.systemString].priority>=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)})),void 0===f?function(e,t){var i,a,o=this,s=[];f=null,r.push(e);for(var u=0;u0&&A.setServerCertificate(N.decodeArray(s.serverCertificate).buffer);for(var u=0;u=200&&e.status<=299){var t=new g(e.responseURL,y.a.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),e.response);q(T,t).then((function(){var n=c.getLicenseMessage(t.data,l,r);null!==n?(j(R),A.updateKeySession(o,n)):x(e,R,l,r)}))}else x(e,R,l,r)},k=function(e){j(R,new h.a(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+l+' update, XHR aborted. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},G=function(e){j(R,new h.a(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+l+' update, XHR error. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},Y=f.getLicenseRequestFromMessage(a),H=c.getHTTPMethod(r),K=c.getResponseType(l,r),V=u&&!isNaN(u.httpTimeout)?u.httpTimeout:8e3,W=o.getSessionID()||null,z=new p(w,H,K,P,L,r,W,Y),X=isNaN(O.get().streaming.retryAttempts[m.a.LICENSE])?3:O.get().streaming.retryAttempts[m.a.LICENSE];q(v,z).then((function(){!function e(t,r,i,a,o,s){var u=new XMLHttpRequest;if(O.get().streaming.cmcd&&O.get().streaming.cmcd.enabled){if(O.get().streaming.cmcd.mode===E.a.CMCD_MODE_QUERY){var l=D.getQueryParameter({url:t.url,type:m.a.LICENSE});l&&(t.url=y.a.addAditionalQueryParameterToUrl(t.url,[l]))}}u.open(t.method,t.url,!0),u.responseType=t.responseType,u.withCredentials=t.withCredentials,i>0&&(u.timeout=i);for(var c in t.headers)u.setRequestHeader(c,t.headers[c]);if(O.get().streaming.cmcd&&O.get().streaming.cmcd.enabled){if(O.get().streaming.cmcd.mode===E.a.CMCD_MODE_HEADER){var f=D.getHeaderParameters({url:t.url,type:m.a.LICENSE});if(f)for(var d in f){var h=f[d];h&&u.setRequestHeader(d,h)}}}var p=function(){r--;var n=isNaN(O.get().streaming.retryIntervals[m.a.LICENSE])?1e3:O.get().streaming.retryIntervals[m.a.LICENSE];setTimeout((function(){e(t,r,i,a,o,s)}),n)};u.onload=function(){this.status>=200&&this.status<=299||r<=0?a(this):(n.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+r),p())},u.ontimeout=u.onerror=function(){r<=0?s(this):(n.warn("License request network request failed . Retrying it... Pending retries: "+r),p())},u.onabort=function(){o(this)},b.trigger(I.LICENSE_REQUEST_SENDING,{url:t.url,headers:t.headers,payload:t.data,sessionId:t.sessionId}),u.send(t.data)}(z,X,V,B,k,G)}))}else j(R,new h.a(d.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,d.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE))}else j(R,new h.a(d.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,d.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function K(e,t){if(n.debug("DRM: onNeedKey"),"cenc"===e.key.initDataType)if(0===s.length&&(n.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(t=void 0===t?1:t+1)<5))C.push(setTimeout((function(){K(e,t)}),500));else{var r=e.key.initData;if(ArrayBuffer.isView(r)&&(r=r.buffer),f){var a=i.getPSSHForKeySystem(f,r);if(a&&L(a))return}n.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(r)));var o=S.getSupportedKeySystems(r,u);0!==o.length?G(o,!1):n.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!")}else n.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+e.key.initDataType)}function q(e,t){return e?e.reduce((function(e,n){return e.then((function(){return n(t)}))}),Promise.resolve()):Promise.resolve()}return t={initializeForMedia:function(e){if(!e)throw new Error("mediaInfo can not be null or undefined");M(),b.on(I.INTERNAL_KEY_MESSAGE,H,this),b.on(I.INTERNAL_KEY_STATUS_CHANGED,Y,this),s.push(e);var t=S.getSupportedKeySystemsFromContentProtection(e.contentProtection);t&&t.length>0&&G(t,!0)},clearMediaInfoArrayByStreamId:function(e){s=s.filter((function(t){return t.streamInfo.id!==e}))},createKeySession:P,loadKeySession:F,removeKeySession:function(e){M(),A.removeKeySession(e)},closeKeySession:function(e){M(),A.closeKeySession(e)},setServerCertificate:function(e){M(),A.setServerCertificate(e)},setMediaElement:x,setSessionType:function(e){l=e},setRobustnessLevel:function(e){c=e},setProtectionData:function(e){u=e,S.setProtectionData(e)},getSupportedKeySystemsFromContentProtection:function(e){return M(),S.getSupportedKeySystemsFromContentProtection(e)},getKeySystems:function(){return S?S.getKeySystems():[]},setKeySystems:function(e){S&&S.setKeySystems(e)},setLicenseRequestFilters:function(e){v=e},setLicenseResponseFilters:function(e){T=e},stop:function(){A&&A.stop()},reset:function(){M(),v=[],T=[],b.off(I.INTERNAL_KEY_MESSAGE,H,this),b.off(I.INTERNAL_KEY_STATUS_CHANGED,Y,this),x(null),f=void 0,A&&(A.reset(),A=null),C.forEach((function(e){return clearTimeout(e)})),C=[],s=[]}},n=R.getLogger(t),r=[],s=[],l="temporary",c="",v=[],T=[],t}v.__dashjs_factory_name="ProtectionController";var T=dashjs.FactoryMaker.getClassFactory(v);var S=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;n0){var a=i.contentProtection.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===C}));if(a&&a.length>0)for(var o=0;o%CUSTOMDATA%'.replace("%CUSTOMDATA%",e),i=[],a=0;a0&&(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(e,t,r,i){var a={session:e,initData:t,sessionId:i,handleEvent:function(e){switch(e.type){case"keystatuseschange":c.trigger(f.KEY_STATUSES_CHANGED,{data:this}),e.target.keyStatuses.forEach((function(){var e=y(arguments);switch(e.status){case"expired":c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,{error:new h.a(d.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,d.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)});break;default: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 ae(this,t,void 0,e.messageType)})}},getSessionID:function(){return e.sessionId},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){var t=!1;return e.keyStatuses.forEach((function(){var e=y(arguments);"usable"===e.status&&(t=!0)})),t},getSessionType:function(){return r}};return e.addEventListener("keystatuseschange",a),e.addEventListener("message",a),e.closed.then((function(){m(a),n.debug("DRM: Session closed. SessionID = "+a.getSessionID()),c.trigger(f.KEY_SESSION_CLOSED,{data:a.getSessionID()})})),o.push(a),a}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&&(l=s.ksConfiguration.videoCapabilities[0]),null===l&&s.ksConfiguration.audioCapabilities&&s.ksConfiguration.audioCapabilities.length>0&&(l=s.ksConfiguration.audioCapabilities[0]),null===l)throw new Error("Can not create sessions for unknown content types.");var c=l.contentType,f=a.createSession(c,new Uint8Array(e),o?new Uint8Array(o):null),m=function(e,t){return{session:e,initData:t,getSessionID:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(e){switch(e.type){case y.error:p.trigger(g.KEY_ERROR,{error:new h.a(d.MEDIA_KEYERR_CODE,"KeyError",this)});break;case y.message:var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;p.trigger(g.INTERNAL_KEY_MESSAGE,{data:new ae(this,t,e.destinationURL)});break;case y.ready:n.debug("DRM: Key added."),p.trigger(g.KEY_ADDED);break;case y.close:n.debug("DRM: Session closed. SessionID = "+this.getSessionID()),p.trigger(g.KEY_SESSION_CLOSED,{data:this.getSessionID()})}}}}(f,e);f.addEventListener(y.error,m),f.addEventListener(y.message,m),f.addEventListener(y.ready,m),f.addEventListener(y.close,m),u.push(m),n.debug("DRM: Session created. SessionID = "+m.getSessionID()),p.trigger(g.KEY_SESSION_CREATED,{data:m})},updateKeySession:function(e,t){var n=e.session;c.isClearKey(i)?n.update(new Uint8Array(t.toJWK())):n.update(new Uint8Array(t)),p.trigger(g.KEY_SESSION_UPDATED)},closeKeySession:_,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:E,reset:E},n=m.getLogger(t),r=null,i=null,a=null,s=null,u=[],c=$(f).getInstance(),l={handleEvent:function(e){switch(e.type){case y.needkey:if(e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;p.trigger(g.NEED_KEY,{key:new ie(t,"cenc")})}}}},t}le.__dashjs_factory_name="ProtectionModel_3Feb2014";var ce=dashjs.FactoryMaker.getClassFactory(le);function fe(e){e=e||{};var t,n,r,i,a,s,u,l,c,f=this.context,p=e.eventBus,g=e.events,m=e.debug,y=e.api,E=e.errHandler;function _(){r&&S();for(var e=0;e0&&(t=s.shift(),u.push(t),t.sessionID=e.sessionId,p.trigger(g.KEY_SESSION_CREATED,{data:t})):s.length>0&&(t=s.shift(),u.push(t),0!==s.length&&E.error(new h.a(d.MEDIA_KEY_MESSAGE_ERROR_CODE,d.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){var o=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=o,p.trigger(g.INTERNAL_KEY_MESSAGE,{data:new ae(t,o,e.defaultURL)})}else n.warn("No session token found for key message")}}},t}fe.__dashjs_factory_name="ProtectionModel_01b";var de=dashjs.FactoryMaker.getClassFactory(fe),he=[{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"}],pe=[{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 ge(){var e,t=this.context;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})}var t}function p(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={initialise:function(){r.on(u.MANIFEST_UPDATED,c,t),r.on(u.SERVICE_LOCATION_BLACKLIST_CHANGED,f,t),r.on(u.METRIC_ADDED,h,t),r.on(u.METRIC_UPDATED,h,t),r.on(u.PLAYBACK_ERROR,p,t),r.on(a.a.BECAME_REPORTING_PLAYER,d,t)},reset:function(){r.off(u.MANIFEST_UPDATED,c,t),r.off(u.SERVICE_LOCATION_BLACKLIST_CHANGED,f,t),r.off(u.METRIC_ADDED,h,t),r.off(u.METRIC_UPDATED,h,t),r.off(u.PLAYBACK_ERROR,p,t),r.off(a.a.BECAME_REPORTING_PLAYER,d,t)}}}o.__dashjs_factory_name="DVBErrorsTranslator";var s=dashjs.FactoryMaker.getSingletonFactory(o),u=n(45);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&&r.status<300?t&&t():n&&n())};l.push(r);try{r.open("GET",e),r.onloadend=i,r.onerror=i,r.send()}catch(e){r.onerror()}}(r="".concat(o,"?").concat(r),null,(function(){a=!1}))}))},initialize:function(e,t){var n;if(s=t,!(o=e.dvb_reportingUrl))throw new Error("required parameter missing (dvb:reportingUrl)");i||((n=e.dvb_probability)&&(1e3===n||n/1e3>=r.random())&&(a=!0),i=!0)},reset:function(){f()}},n=d(u).getInstance(),r=p(u).getInstance(),f(),t}g.__dashjs_factory_name="DVBReporting";var m=dashjs.FactoryMaker.getClassFactory(g);function y(e){e=e||{};var t,n={"urn:dvb:dash:reporting:2014":m},r=this.context,i=e.debug?e.debug.getLogger(t):{},a=e.metricsConstants;return t={create:function(e,t){var o;try{(o=n[e.schemeIdUri](r).create({metricsConstants:a})).initialize(e,t)}catch(t){o=null,i.error("ReportingFactory: could not create Reporting with schemeIdUri ".concat(e.schemeIdUri," (").concat(t.message,")"))}return o},register:function(e,t){n[e]=t},unregister:function(e){delete n[e]}}}y.__dashjs_factory_name="ReportingFactory";var E=dashjs.FactoryMaker.getSingletonFactory(y);function _(e){var t=[],n=E(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 v=dashjs.FactoryMaker.getClassFactory(_);function T(){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}}}T.__dashjs_factory_name="HandlerHelpers";var S=dashjs.FactoryMaker.getSingletonFactory(T);function A(e){var t,n,r,i,a;e=e||{};var o=this.context,s=S(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.level=c.end)return null;var h="regionID"in c&&""!==c.regionID?c.regionID:l;if(null!==u&&h!==i.id&&(!("contents"in c)||"contents"in c&&0===c.contents.length||""!==h))return null;var p=new a(c);for(var g in c.sets)t=c.sets[g].end||(p.styleAttrs[c.sets[g].qname]=c.sets[g].value);var m,y={};for(var E in p.styleAttrs)if(y[E]=!0,E===n.byName.writingMode.qname&&!(n.byName.direction.qname in p.styleAttrs)){var _=p.styleAttrs[E];"lrtb"===_||"lr"===_?p.styleAttrs[n.byName.direction.qname]="ltr":"rltb"!==_&&"rl"!==_||(p.styleAttrs[n.byName.direction.qname]="rtl")}if(null!==u)for(var v in n.all){var T=n.all[v];if(T.qname===n.byName.textDecoration.qname){var S=u.styleAttrs[T.qname],A=p.styleAttrs[T.qname],b=[];void 0===A?b=S:-1===A.indexOf("none")?((-1===A.indexOf("noUnderline")&&-1!==S.indexOf("underline")||-1!==A.indexOf("underline"))&&b.push("underline"),(-1===A.indexOf("noLineThrough")&&-1!==S.indexOf("lineThrough")||-1!==A.indexOf("lineThrough"))&&b.push("lineThrough"),(-1===A.indexOf("noOverline")&&-1!==S.indexOf("overline")||-1!==A.indexOf("overline"))&&b.push("overline")):b.push("none"),p.styleAttrs[T.qname]=b}else T.inherit&&T.qname in u.styleAttrs&&!(T.qname in p.styleAttrs)&&(p.styleAttrs[T.qname]=u.styleAttrs[T.qname])}for(var I in n.all){var R=n.all[I];R.qname in p.styleAttrs||("region"===p.kind||!1===R.inherit&&null!==R.initial)&&(p.styleAttrs[R.qname]=R.parse(R.initial),y[R.qname]=!0)}for(var N in n.all){var w=n.all[N];if(w.qname in y&&null!==w.compute){var C=w.compute(e,u,p,p.styleAttrs[w.qname],d);null!==C?p.styleAttrs[w.qname]=C:o(f,"Style '"+w.qname+"' on element '"+p.kind+"' cannot be computed")}}if("none"===p.styleAttrs[n.byName.display.qname])return null;for(var D in null===u?m=null===s?[]:[s]:"contents"in c&&(m=c.contents),m){var O=r(e,t,i,s,p,h,m[D],f,d);null!==O&&p.contents.push(O.element)}for(var M in p.styleAttrs){-1===n.byQName[M].applies.indexOf(p.kind)&&delete p.styleAttrs[M]}if("span"===p.kind&&p.text&&"default"===p.space){var P=p.text.replace(/\s+/g," ");p.text=P}if("p"===p.kind){var L=[];!function e(t,n){if("contents"in t)for(var r in t.contents)e(t.contents[r],n);else n.push(t)}(p,L);for(var F=0,x="after_br",U=0;;)if("after_br"===x)F>=L.length||"br"===L[F].kind?(x="before_br",U=F,F--):("preserve"!==L[F].space&&(L[F].text=L[F].text.replace(/^\s+/g,"")),L[F].text.length>0?(x="looking_br",F++):L.splice(F,1));else if("before_br"===x)if(F<0||"br"===L[F].kind){if(x="after_br",(F=U+1)>=L.length)break}else if("preserve"!==L[F].space&&(L[F].text=L[F].text.replace(/\s+$/g,"")),L[F].text.length>0){if(x="after_br",(F=U+1)>=L.length)break}else L.splice(F,1),F--;else F>=L.length||"br"===L[F].kind?(x="before_br",U=F,F--):F++;!function e(t){if("br"===t.kind)return!1;if("text"in t)return 0===t.text.length;if("contents"in t){for(var n=t.contents.length;n--;)e(t.contents[n])&&t.contents.splice(n,1);return 0===t.contents.length}}(p)}return"div"===p.kind&&n.byName.backgroundImage.qname in p.styleAttrs||"br"===p.kind||"contents"in p&&p.contents.length>0||"span"===p.kind&&null!==p.text||"region"===p.kind&&"always"===p.styleAttrs[n.byName.showBackground.qname]?{region_id:h,element:p}:null}function i(e){this.contents=[],this.aspectRatio=e.aspectRatio}function a(e){for(var t in this.kind=e.kind||"region",e.id&&(this.id=e.id),this.styleAttrs={},e.styleAttrs)this.styleAttrs[t]=e.styleAttrs[t];"text"in e?this.text=e.text:"br"!==e.kind&&(this.contents=[]),"space"in e&&(this.space=e.space)}function o(e,t){if(e&&e.error&&e.error(t))throw t}e.generateISD=function(e,t,n){var a=new i(e),o={};for(var s in e.head.layout.regions){var u=r(e,t,e.head.layout.regions[s],e.body,null,"",e.head.layout.regions[s],n,o);null!==u&&a.contents.push(u.element)}return a}}(t,"undefined"==typeof imscNames?n(47):imscNames,"undefined"==typeof imscStyles?n(59):imscStyles)},function(e,t,n){!function(e,t,n,r,i){function a(e,t,n,r){var i=r&&"seq"===r.timeContainer,o=0;r&&(o=i&&n?n.end:r.begin),t.begin=t.explicit_begin?t.explicit_begin+o:o;var s=t.begin,u=null;for(var l in t.sets)a(e,t.sets[l],u,t),s="seq"===t.timeContainer?t.sets[l].end:Math.max(s,t.sets[l].end),u=t.sets[l];if("contents"in t)for(var c in t.contents)a(e,t.contents[c],u,t),s="seq"===t.timeContainer?t.contents[c].end:Math.max(s,t.contents[c].end),u=t.contents[c];else s=i?t.begin:Number.POSITIVE_INFINITY;null!==t.explicit_end&&null!==t.explicit_dur?t.end=Math.min(t.begin+t.explicit_dur,o+t.explicit_end):null===t.explicit_end&&null!==t.explicit_dur?t.end=t.begin+t.explicit_dur:null!==t.explicit_end&&null===t.explicit_dur?t.end=o+t.explicit_end:t.end=s,delete t.explicit_begin,delete t.explicit_dur,delete t.explicit_end,e._registerEvent(t)}function o(e){this.node=e}function s(){this.events=[],this.head=null,this.body=null}function u(){this.styling=null,this.layout=null}function l(){this.styles={}}function c(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function f(){this.regions={}}function d(e){this.kind=e}function h(e){this.id=e}function p(e){this.regionID=e}function g(e){this.styleAttrs=e}function m(e){this.sets=e}function y(e){this.contents=e}function E(e,t,n){this.explicit_begin=e,this.explicit_end=t,this.explicit_dur=n}function _(){d.call(this,"body")}function v(){d.call(this,"div")}function T(){d.call(this,"p")}function S(){d.call(this,"span")}function A(){d.call(this,"span")}function b(){d.call(this,"br")}function I(){}function R(){}function N(e){return e&&"xml:id"in e.attributes&&e.attributes["xml:id"].value||null}function w(e){return e&&"style"in e.attributes?e.attributes.style.value.split(" "):[]}function C(e,t){var n={};if(null!==e)for(var i in e.attributes){var a=e.attributes[i].uri+" "+e.attributes[i].local,o=r.byQName[a];if(void 0!==o){var s=o.parse(e.attributes[i].value);null!==s?(n[a]=s,o===r.byName.zIndex&&F(t,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):x(t,"Cannot parse styling attribute "+a+" --\x3e "+e.attributes[i].value)}}return n}function D(e,t,n){for(var r in e.attributes)if(e.attributes[r].uri===t&&e.attributes[r].local===n)return e.attributes[r].value;return null}function O(e,t,n){var r,i=null;return null!==(r=/^(\d+(?:\.\d+)?)f$/.exec(n))?null!==t&&(i=parseFloat(r[1])/t):null!==(r=/^(\d+(?:\.\d+)?)t$/.exec(n))?null!==e&&(i=parseFloat(r[1])/e):null!==(r=/^(\d+(?:\.\d+)?)ms$/.exec(n))?i=parseFloat(r[1])/1e3:null!==(r=/^(\d+(?:\.\d+)?)s$/.exec(n))?i=parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)h$/.exec(n))?i=3600*parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)m$/.exec(n))?i=60*parseFloat(r[1]):null!==(r=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/.exec(n))?i=3600*parseInt(r[1])+60*parseInt(r[2])+parseFloat(r[3]):null!==(r=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/.exec(n))&&null!==t&&(i=3600*parseInt(r[1])+60*parseInt(r[2])+parseInt(r[3])+(null===r[4]?0:parseInt(r[4])/t)),i}function M(e,t,n){for(;t.styleRefs.length>0;){var r=t.styleRefs.pop();r in e.styles?(M(e,e.styles[r],n),L(e.styles[r].styleAttrs,t.styleAttrs)):x(n,"Non-existant style id referenced")}}function P(e,t,n,r){for(var i=t.length-1;i>=0;i--){var a=t[i];a in e.styles?L(e.styles[a].styleAttrs,n):x(r,"Non-existant style id referenced")}}function L(e,t){for(var n in e)n in t||(t[n]=e[n])}function F(e,t){if(e&&e.warn&&e.warn(t))throw t}function x(e,t){if(e&&e.error&&e.error(t))throw t}function U(e,t){throw e&&e.fatal&&e.fatal(t),t}function B(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,r,i){var d=t.parser(!0,{xmlns:!0}),h=[],p=[],g=[],m=0,y=null;d.onclosetag=function(e){if(h[0]instanceof l)for(var t in h[0].styles)M(h[0],h[0].styles[t],r);else if(h[0]instanceof T||h[0]instanceof S){if(h[0].contents.length>1){var a,s=[h[0].contents[0]];for(a=1;a0&&i&&"onCloseTag"in i&&i.onCloseTag());g.shift(),p.shift(),h.shift()},d.ontext=function(e){if(void 0===h[0]);else if(h[0]instanceof S||h[0]instanceof T){var t=new A;t.initFromText(y,h[0],e,g[0],r),h[0].contents.push(t)}else h[0]instanceof o&&m>0&&i&&"onText"in i&&i.onText(e)},d.onopentag=function(e){var t=e.attributes["xml:space"];t?g.unshift(t.value):0===g.length?g.unshift("default"):g.unshift(g[0]);var a=e.attributes["xml:lang"];if(a?p.unshift(a.value):0===p.length?p.unshift(""):p.unshift(p[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==y&&U(r,"Two elements at ("+this.line+","+this.column+")"),(y=new s).initFromNode(e,r),h.unshift(y);else if("head"===e.local)h[0]instanceof s||U(r,"Parent of element is not at ("+this.line+","+this.column+")"),null!==y.head&&U("Second element at ("+this.line+","+this.column+")"),y.head=new u,h.unshift(y.head);else if("styling"===e.local)h[0]instanceof u||U(r,"Parent of element is not at ("+this.line+","+this.column+")"),null!==y.head.styling&&U("Second element at ("+this.line+","+this.column+")"),y.head.styling=new l,h.unshift(y.head.styling);else if("style"===e.local){var d;h[0]instanceof l?((d=new c).initFromNode(e,r),d.id?y.head.styling.styles[d.id]=d:x(r,"