This repository has been archived on 2024-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
negromate_origins/web/static/js/videojs/video.min.js

28 lines
457 KiB
JavaScript
Raw Normal View History

2018-10-12 23:00:20 +02:00
/**
* @license
* Video.js 7.7.4 <http://videojs.com/>
2018-10-12 23:00:20 +02:00
* Copyright Brightcove, Inc. <https://www.brightcove.com/>
* Available under Apache License Version 2.0
* <https://github.com/videojs/video.js/blob/master/LICENSE>
*
* Includes vtt.js <https://github.com/mozilla/vtt.js>
* Available under Apache License Version 2.0
* <https://github.com/mozilla/vtt.js/blob/master/LICENSE>
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("global/window"),require("global/document")):"function"==typeof define&&define.amd?define(["global/window","global/document"],t):(e=e||self).videojs=t(e.window,e.document)}(this,function(y,h){"use strict";y=y&&y.hasOwnProperty("default")?y.default:y,h=h&&h.hasOwnProperty("default")?h.default:h;var d="7.7.4",l=[],e=function(o,u){return function(e,t,i){var n=u.levels[t],r=new RegExp("^("+n+")$");if("log"!==e&&i.unshift(e.toUpperCase()+":"),i.unshift(o+":"),l){l.push([].concat(i));var s=l.length-1e3;l.splice(0,0<s?s:0)}if(y.console){var a=y.console[e];a||"debug"!==e||(a=y.console.info||y.console.log),a&&n&&r.test(e)&&a[Array.isArray(i)?"apply":"call"](y.console,i)}}};var p=function t(i){function n(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];r("log",s,t)}var r,s="info";return r=e(i,n),n.createLogger=function(e){return t(i+": "+e)},n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},n.level=function(e){if("string"==typeof e){if(!n.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');s=e}return s},(n.history=function(){return l?[].concat(l):[]}).filter=function(t){return(l||[]).filter(function(e){return new RegExp(".*"+t+".*").test(e[0])})},n.history.clear=function(){l&&(l.length=0)},n.history.disable=function(){null!==l&&(l.length=0,l=null)},n.history.enable=function(){null===l&&(l=[])},n.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("error",s,t)},n.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("warn",s,t)},n.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r("debug",s,t)},n}("VIDEOJS"),f=p.createLogger;function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t.apply(this,arguments)}e.exports=t}),i=Object.prototype.toString,s=function(e){return o(e)?Object.keys(e):[]};function a(t,i){s(t).forEach(function(e){return i(t[e],e)})}function m(i){for(var e=arguments.length,t=new Array(1<e?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return Object.assign?r.apply(void 0,[i].concat(t)):(t.forEach(function(e){e&&a(e,function(e,t){i[t]=e})}),i)}function o(e){return!!e&&"object"==typeof e}function u(e){return o(e)&&"[object Object]"===i.call(e)&&e.constructor===Object}function n(e,t){if(!e||!t)return"";if("function"!=typeof y.getComputedStyle)return"";var i=y.getComputedStyle(e);return i?i.getPropertyValue(t)||i[t]:""}function c(e){return"string"==typeof e&&Boolean(e.trim())}function g(e){if(0<=e.indexOf(" "))throw new Error("class has illegal whitespace characters")}function v(){return h===y.document}function _(e){return o(e)&&1===e.nodeType}function b(){try{return y.parent!==y.self}catch(e){return!0}}function T(n){return function(e,t){if(!c(e))return h[n](null);c(t)&&(t=h.querySelector(t));var i=_(t)?t:h;return i[n]&&i[n](e)}}function S(e,i,t,n){void 0===e&&(e="div"),void 0===i&&(i={}),void 0===t&&(t={});var r=h.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(p.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."),r.setAttribute(e,t)):"textContent"===e?k(r,t):r[e]!==t&&(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),n&&V(r,n),r}function k(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function C(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function E(e,t){return g(t),e.classList?e.classList.contains(t):function(e){return new RegExp("(^|\\s)"+e
/**
* @license
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
* Copyright (c) 2014 David Björklund
* Available under the MIT license
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
*/,$t=Object.prototype.toString;var Qt=function(e){var r={};return e&&e.trim().split("\n").forEach(function(e){var t=e.indexOf(":"),i=e.slice(0,t).trim().toLowerCase(),n=e.slice(t+1).trim();"undefined"==typeof r[i]?r[i]=n:Array.isArray(r[i])?r[i].push(n):r[i]=[r[i],n]}),r},Jt=ti,Zt=ti;function ei(e,t,i){var n=e;return Yt(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=r({},t,{uri:e}),n.callback=i,n}function ti(e,t,i){return ii(t=ei(e,t,i))}function ii(n){if("undefined"==typeof n.callback)throw new Error("callback argument missing");var r=!1,s=function(e,t,i){r||(r=!0,n.callback(e,t,i))};function t(e){return clearTimeout(o),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,s(e,m)}function e(){if(!a){var e;clearTimeout(o),e=n.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var t=m,i=null;return 0!==e?(t={body:function(){var e=void 0;if(e=u.response?u.response:u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),f)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:e,method:c,headers:{},url:l,rawRequest:u},u.getAllResponseHeaders&&(t.headers=Qt(u.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),s(i,t,t.body)}}var i,a,o,u=n.xhr||null,l=(u=u||(n.cors||n.useXDR?new ti.XDomainRequest:new ti.XMLHttpRequest)).url=n.uri||n.url,c=u.method=n.method||"GET",h=n.body||n.data,d=u.headers=n.headers||{},p=!!n.sync,f=!1,m={body:void 0,headers:{},statusCode:0,method:c,url:l,rawRequest:u};if("json"in n&&!1!==n.json&&(f=!0,d.accept||d.Accept||(d.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(d["content-type"]||d["Content-Type"]||(d["Content-Type"]="application/json"),h=JSON.stringify(!0===n.json?h:n.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(e,0)},u.onload=e,u.onerror=t,u.onprogress=function(){},u.onabort=function(){a=!0},u.ontimeout=t,u.open(c,l,!p,n.username,n.password),p||(u.withCredentials=!!n.withCredentials),!p&&0<n.timeout&&(o=setTimeout(function(){if(!a){a=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",t(e)}},n.timeout)),u.setRequestHeader)for(i in d)d.hasOwnProperty(i)&&u.setRequestHeader(i,d[i]);else if(n.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(u.responseType=n.responseType),"beforeSend"in n&&"function"==typeof n.beforeSend&&n.beforeSend(u),u.send(h||null),u}ti.XMLHttpRequest=y.XMLHttpRequest||function(){},ti.XDomainRequest="withCredentials"in new ti.XMLHttpRequest?ti.XMLHttpRequest:y.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],function(n){ti["delete"===n?"del":n]=function(e,t,i){return(t=ei(e,t,i)).method=n.toUpperCase(),ii(t)}}),Jt.default=Zt;function ni(e,t){var i=new y.WebVTT.Parser(y,y.vttjs,y.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),0<n.length&&(y.console&&y.console.groupCollapsed&&y.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach(function(e){return p.error(e)}),y.console&&y.console.groupEnd&&y.console.groupEnd()),i.flush()}function ri(e,n){var t={uri:e},i=Nt(e);i&&(t.cors=i),Jt(t,ge(this,function(e,t,i){if(e)return p.error(e,t);n.loaded_=!0,"function"!=typeof y.WebVTT?n.tech_&&n.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return ni(i,n);p.error("vttjs failed to load, stopping trying to process "+n.src)}):ni(i,n)}))}var si=function(l){function e(e){var t;if(void 0===e&&(e={}),!e.tech)throw new Error("A tech was not provided.");var i=Re(e,{kind:zt[e.kind]||"subtitles",language:e.language||e.srclang||""}),n=Gt[i.mode]||"disabled",r=i.default;"metadata"!==i.kind&&"chapters"!==i.kind||(n="hidden"),(t=l.call(this,i)||this)
/*! @name m3u8-parser @version 4.4.0 @license Apache-2.0 */function us(){return(us=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function ls(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}function cs(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n}var hs=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e].splice(i,1),-1<i},t.trigger=function(e,t){var i,n,r,s=this.listeners[e];if(s)if(2===arguments.length)for(n=s.length,i=0;i<n;++i)s[i].call(this,t);else for(r=Array.prototype.slice.call(arguments,1),n=s.length,i=0;i<n;++i)s[i].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(t){this.on("data",function(e){t.push(e)})},e}(),ds=function(t){function e(){var e;return(e=t.call(this)||this).buffer="",e}return ls(e,t),e.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},e}(hs),ps=function(t){function e(){var e;return(e=t.call(this)||this).customParsers=[],e.tagMappers=[],e}ls(e,t);var i=e.prototype;return i.push=function(n){var u,l,c=this;0!==(n=n.trim()).length&&("#"===n[0]?this.tagMappers.reduce(function(e,t){var i=t(n);return i===n?e:e.concat([i])},[n]).forEach(function(e){for(var t=0;t<c.customParsers.length;t++)if(c.customParsers[t].call(c,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),u=/^#EXTM3U/.exec(e))c.trigger("data",{type:"tag",tagType:"m3u"});else{if(u=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return l={type:"tag",tagType:"inf"},u[1]&&(l.duration=parseFloat(u[1])),u[2]&&(l.title=u[2]),void c.trigger("data",l);if(u=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return l={type:"tag",tagType:"targetduration"},u[1]&&(l.duration=parseInt(u[1],10)),void c.trigger("data",l);if(u=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return l={type:"tag",tagType:"totalduration"},u[1]&&(l.duration=parseInt(u[1],10)),void c.trigger("data",l);if(u=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return l={type:"tag",tagType:"version"},u[1]&&(l.version=parseInt(u[1],10)),void c.trigger("data",l);if(u=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return l={type:"tag",tagType:"media-sequence"},u[1]&&(l.number=parseInt(u[1],10)),void c.trigger("data",l);if(u=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return l={type:"tag",tagType:"discontinuity-sequence"},u[1]&&(l.number=parseInt(u[1],10)),void c.trigger("data",l);if(u=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return l={type:"tag",tagType:"playlist-type"},u[1]&&(l.playlistType=u[1]),void c.trigger("data",l);if(u=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return l={type:"tag",tagType:"byterange"},u[1]&&(l.length=parseInt(u[1],10)),u[2]&&(l.offset=parseInt(u[2],10)),void c.trigger("data",l);if(u=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return l={type:"tag",tagType:"allow-cache"},u[1]&&(l.allowed=!/NO/.test(u[1])),void c.trigger("data",l);if(u=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(l={type:"tag",tagType:"map"},u[1]){var i=cs(u[1]);if(i.URI&&(l.uri=i.URI),i.BYTERANGE){var n=i.BYTERANGE.split("@"),r=n[0],s=n[1];l.byterange={},r&&(l.byterange.length=parseInt(r,10)),s&&(l.byterange.offset=parseInt(s,10))}}c.trigger("data",l)}else if(u=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(l={type:"tag",tagType:"stream-inf"},u[1]){if(l.attributes=cs(u[1]),l.attributes.RESOLUTION){var a=l.attributes.RESOLUTION.split("x"),o={};a[0]&&(o.width=parseInt(a[0],10)),a[1]&&(o.height=parseInt(a[1],10)),l.attributes.RESOLUTION=o}l.attr
/*! @name mpd-parser @version 0.8.1 @license Apache-2.0 */function Es(e,t){return/^[a-z]+:/i.test(t)?t:(/\/\//i.test(e)||(e=Ws.buildAbsoluteURL(y.location.href,e)),Ws.buildAbsoluteURL(e,t))}function ws(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,s=e.range,a=void 0===s?"":s,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:Es(i||"",r)};if(a||u){var c=(a||u).split("-"),h=parseInt(c[0],10),d=parseInt(c[1],10);l.byterange={length:d-h+1,offset:h}}return l}function Ls(e){var t=e.type,i=void 0===t?"static":t,n=e.duration,r=e.timescale,s=void 0===r?1:r,a=e.sourceDuration,o=zs[i](e),u=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(o.start,o.end).map(function(o){return function(e,t){var i=o.duration,n=o.timescale,r=void 0===n?1:n,s=o.periodIndex,a=o.startNumber;return{number:(void 0===a?1:a)+e,duration:i/r,timeline:s,time:t*i}}}(e));if("static"===i){var l=u.length-1;u[l].duration=a-n/s*l}return u}function Ps(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,s=e.timescale,a=void 0===s?1:s,o=e.indexRange,u=void 0===o?"":o,l=e.duration;if(!t)throw new Error(Ss);var c=ws({baseUrl:t,source:n.sourceURL,range:n.range}),h=ws({baseUrl:t,source:t,indexRange:u});if(h.map=c,l){var d=Ls(e);d.length&&(h.duration=d[0].duration,h.timeline=d[0].timeline)}else r&&(h.duration=r/a,h.timeline=0);return h.number=0,[h]}function As(e,t,i){for(var n=e.sidx.map?e.sidx.map:null,r=e.sidx.duration,s=e.timeline||0,a=e.sidx.byterange,o=a.offset+a.length,u=t.timescale,l=t.references.filter(function(e){return 1!==e.referenceType}),c=[],h=o+t.firstOffset,d=0;d<l.length;d++){var p=t.references[d],f=p.referencedSize,m=p.subsegmentDuration,g=Ps({baseUrl:i,timescale:u,timeline:s,periodIndex:s,duration:m,sourceDuration:r,indexRange:h+"-"+(h+f-1)})[0];n&&(g.map=n),c.push(g),h+=f}return e.segments=c,e}function Is(e){return function(t){return Object.keys(t).map(function(e){return t[e]})}(e.reduce(function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");e[n]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):e[n]=t;return e},{})).map(function(e){return e.discontinuityStarts=function(e,n){return e.reduce(function(e,t,i){return t[n]&&e.push(i),e},[])}(e.segments,"discontinuity"),e})}function xs(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e){var n=e[i];if(n.sidx){var r=n.sidx.uri+"-"+(a=n.sidx.byterange,void 0,o=a.offset+a.length-1,a.offset+"-"+o),s=t[r]&&t[r].sidx;n.sidx&&s&&As(n,s,n.sidx.resolvedUri)}}var a,o;return e}function Os(e){var t,i=e.attributes,n=e.segments,r=e.sidx,s={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===(i.type||"static"),timeline:i.periodIndex,resolvedUri:"",targetDuration:i.duration,segments:n,mediaSequence:n.length?n[0].number:1};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s}function Ds(e,t){var i;if(void 0===t&&(t={}),!e.length)return{};var n=e[0].attributes,r=n.sourceDuration,s=n.minimumUpdatePeriod,a=void 0===s?0:s,o=Is(e.filter(function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video"===t.contentType})).map(Os),u=Is(e.filter(function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio"===t.contentType})),l=e.filter(function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType}),c={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:r,playlists:xs(o,t),minimumUpdatePeriod:1e3*a};return u.length&&(c.mediaGroups.AUDIO.audio=function(e,a){var o;void 0===a&&(a={});var t=e.reduce(function(e,t){var i=t.attributes.role&&t.attributes.role.value||"",n=t.attributes.lang||"",r="main";if(n){var s=i?" ("+i+")":"";r=t.attributes.lang+s}return e[r]&&e[r].playlists[0].attributes.BANDWIDTH>t.attributes.bandwidth|
/**
* @videojs/http-streaming
* @version 1.11.2
* @copyright 2019 Brightcove, Inc
* @license Apache-2.0
*/
var Ao=function(e,t,i){return t&&Io(e.prototype,t),i&&Io(e,i),e};function Io(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function xo(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function Oo(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function Do(r,s){["AUDIO","SUBTITLES"].forEach(function(e){for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var n=r.mediaGroups[e][t][i];s(n,e,t,i)}})}function Ro(e,t){var i=jo(e,{}),n=i.playlists[t.uri];if(!n)return null;if(n.segments&&t.segments&&n.segments.length===t.segments.length&&n.endList===t.endList&&n.mediaSequence===t.mediaSequence)return null;var r=jo(n,t);n.segments&&(r.segments=function(e,t,i){var n=t.slice();i=i||0;for(var r=Math.min(e.length,t.length+i),s=i;s<r;s++)n[s-i]=jo(e[s],n[s-i]);return n}(n.segments,t.segments,t.mediaSequence-n.mediaSequence)),r.segments.forEach(function(e){!function(e,t){e.resolvedUri||(e.resolvedUri=wo(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=wo(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=wo(t,e.map.uri))}(e,r.resolvedUri)});for(var s=0;s<i.playlists.length;s++)i.playlists[s].uri===t.uri&&(i.playlists[s]=r);return i.playlists[t.uri]=r,i}function Uo(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];(e.playlists[i.uri]=i).resolvedUri=wo(e.uri,i.uri),i.id=t,i.attributes||(i.attributes={},Fo.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))}}function Mo(t){Do(t,function(e){e.uri&&(e.resolvedUri=wo(t.uri,e.uri))})}function No(e,t){var i=e.segments[e.segments.length-1];return t&&i&&i.duration?1e3*i.duration:500*(e.targetDuration||10)}var Bo=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,r=!1,s=void 0;try{for(var a,o=e[Symbol.iterator]();!(n=(a=o.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){r=!0,s=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw s}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},jo=rs.mergeOptions,Fo=rs.log,Ho=(xo(Vo,rs.EventTarget),Ao(Vo,[{key:"playlistRequestError",value:function(e,t,i){this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+t+".",responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}},{key:"haveMetadata",value:function(e,t){var i=this;this.request=null,this.state="HAVE_METADATA";var n=new ys;this.customTagParsers.forEach(function(e){return n.addParser(e)}),this.customTagMappers.forEach(function(e){return n.addTagMapper(e)}),n.push(e.responseText),n.end(),n.manifest.uri=t,n.manifest.attributes=n.manifest.attributes||{};var r=Ro(this.master,n.manifest);this.targetDuration=n.manifest.targetDuration,r?(this.master=r,this.media_=this.master.playlists[n.manifest.uri]):this.trigger("playlistunchanged"),this.media().endList||(y.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=y.setTimeout(function(){i.trigger("mediaupdatetimeout")},No(this.media(),!!r))),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest(),y.clearTimeout(this.mediaUpdateTimeout),y.clearTimeout(this.finalRenditionTimeout)}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(i,e){var n=this;if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof i){if(!this.master.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.master.playlist