leted",i.arg i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg) n="executing" var u=d(e,t,i) if("normal"===u.type){if(n=i.done?"completed":"suspendedYield",u.arg===h)continue return{value:u.arg,done:i.done}}"throw"===u.type&&(n="completed",i.method="throw",i.arg=u.arg)}}}function S(e,t){var i=t.method,n=e.iterator[i] if(void 0===n)return t.delegate=null,"throw"===i&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==i&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+i+"' method")),h var r=d(n,e.iterator,t.arg) if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,h var a=r.arg return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]} 1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{} t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function I(e){if(e){var t=e[s] if(t)return t.call(e) if("function"==typeof e.next)return e if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var a=this.tryEntries[r],s=a.completion if("root"===a.tryLoc)return n("end") if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc") if(o&&u){if(this.prev=0;--n){var r=this.tryEntries[n] if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t] if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),C(i),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t] if(i.tryLoc===e){var n=i.completion if("throw"===n.type){var r=n.arg C(i)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:I(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),h}},e}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t,i,n,r,a,s){try{var o=e[a](s),u=o.value}catch(e){i(e) return}o.done?t(u):Promise.resolve(u).then(n,r)}function s(e){return function(){var t=this,i=arguments return new Promise((function(n,r){var s=e.apply(t,i) function o(e){a(s,n,r,o,u,"next",e)}function u(e){a(s,n,r,o,u,"throw",e)}o(void 0)}))}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var i=0;ie.length)&&(t=e.length) for(var i=0,n=new Array(t);i=400&&n.statusCode<=599){var a=r if(t)if(x.TextDecoder){var s=function(e){void 0===e&&(e="") return e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),n=i[0],r=i[1] return"charset"===n.trim()?r.trim():e}),"utf-8")}(n.headers&&n.headers["content-type"]) try{a=new TextDecoder(s).decode(r)}catch(e){}}else a=String.fromCharCode.apply(null,new Uint8Array(r)) e({cause:a})}else e(null,r)}} K.httpHandler=H ;/** * @license * slighly modified parse-headers 2.0.2 * Copyright (c) 2014 David Björklund * Available under the MIT license * */var q=function(e){var t={} if(!e)return t e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim() void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})) return t},W=K,G=K K.XMLHttpRequest=x.XMLHttpRequest||function(){} K.XDomainRequest="withCredentials"in new K.XMLHttpRequest?K.XMLHttpRequest:x.XDomainRequest !function(e,t){for(var i=0;i0&&(l=setTimeout((function(){if(!o){o=!0 u.abort("timeout") var e=new Error("XMLHttpRequest timeout") e.code="ETIMEDOUT" r(e)}}),e.timeout)) if(u.setRequestHeader)for(s in p)p.hasOwnProperty(s)&&u.setRequestHeader(s,p[s]) else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1 return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object") "responseType"in e&&(u.responseType=e.responseType) "beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u) u.send(h||null) return u}W.default=G var Y=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.") e.prototype=t return new e}}() function Q(e,t){this.name="ParsingError" this.code=e.code this.message=t||e.message}Q.prototype=Y(Error.prototype) Q.prototype.constructor=Q Q.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}} function $(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/) return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function J(){this.values=Y(null)}J.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n=0&&t<=100){this.set(e,t) return!0}return!1}} function Z(e,t,i,n){var r=n?e.split(n):[e] for(var a in r)if("string"==typeof r[a]){var s=r[a].split(i) if(2===s.length){t(s[0],s[1])}}}function ee(e,t,i){var n=e function r(){var t=$(e) if(null===t)throw new Q(Q.Errors.BadTimeStamp,"Malformed timestamp: "+n) e=e.replace(/^[^\sa-zA-Z-]+/,"") return t}function a(){e=e.replace(/^\s+/,"")}a() t.startTime=r() a() if("--\x3e"!==e.substr(0,3))throw new Q(Q.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n) e=e.substr(3) a() t.endTime=r() a() !function(e,t){var n=new J Z(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region) break}break case"vertical":n.alt(e,t,["rl","lr"]) break case"line":var a=t.split(","),s=a[0] n.integer(e,s) n.percent(e,s)&&n.set("snapToLines",!1) n.alt(e,s,["auto"]) 2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]) break case"position":a=t.split(",") n.percent(e,a[0]) 2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]) break case"size":n.percent(e,t) break case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/) t.region=n.get("region",null) t.vertical=n.get("vertical","") try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start") t.snapToLines=n.get("snapToLines",!0) t.size=n.get("size",100) try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}var te=L.createElement&&L.createElement("textarea"),ie={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ne={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},re={v:"title",lang:"lang"},ae={rt:"ruby"} function se(e,t){function i(){if(!t)return null var e=t.match(/^([^<]*)(<[^>]*>?)?/) return function(e){t=t.substr(e.length) return e}(e[1]?e[1]:e[2])}function n(e){te.innerHTML=e e=te.textContent te.textContent="" return e}function r(e,t){return!ae[t.localName]||ae[t.localName]===e.localName}function a(t,i){var n=ie[t] if(!n)return null var r=e.document.createElement(n),a=re[t] a&&i&&(r[a]=i.trim()) return r}for(var s,o=e.document.createElement("div"),u=o,l=[];null!==(s=i());)if("<"!==s[0])u.appendChild(e.document.createTextNode(n(s))) else{if("/"===s[1]){if(l.length&&l[l.length-1]===s.substr(2).replace(">","")){l.pop() u=u.parentNode}continue}var c,d=$(s.substr(1,s.length-2)) if(d){c=e.document.createProcessingInstruction("timestamp",d) u.appendChild(c) continue}var h=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/) if(!h)continue if(!(c=a(h[1],h[3])))continue if(!r(u,c))continue if(h[2]){var p=h[2].split(".") p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e if(ne.hasOwnProperty(i)){var n=t?"background-color":"color",r=ne[i] c.style[n]=r}})) c.className=p.join(" ")}l.push(h[1]) u.appendChild(c) u=c}return o}var oe=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]] function ue(e){for(var t=0;t=i[0]&&e<=i[1])return!0}return!1}function le(e){var t=[],i="" if(!e||!e.childNodes)return"ltr" function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null var t=e.pop(),i=t.textContent||t.innerText if(i){var a=i.match(/^.*(\n|\r)/) if(a){e.length=0 return a[0]}return i}if("ruby"===t.tagName)return r(e) if(t.childNodes){n(e,t) return r(e)}}n(t,e) for(;i=r(t);)for(var a=0;ae.left&&this.tope.top} he.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right} he.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right case"+y":return this.tope.bottom}} he.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)} he.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}} he.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0 return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}} function pe(e,t,i,n){var r=new he(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1 for(var t=e.track,i=t.textTrackList,n=0,r=0;rd){c=c<0?-1:1 c*=Math.ceil(d/l)*l}if(s<0){c+=""===a.vertical?i.height:i.width o=o.reverse()}r.move(h,c)}else{var p=r.lineHeight/i.height*100 switch(a.lineAlign){case"center":s-=p/2 break case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")}) break case"rl":t.applyStyles({left:t.formatStyle(s,"%")}) break case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"] r=new he(t)}var f=function(e,t){for(var r,a=new he(e),s=1,o=0;ou){r=new he(e) s=u}e=new he(a)}return r||a}(r,o) t.move(f.toCSSCompatValues(i))}function fe(){}fe.StringDecoder=function(){return{decode:function(e){if(!e)return"" if("string"!=typeof e)throw new Error("Error - expected string data.") return decodeURIComponent(encodeURIComponent(e))}}} fe.convertCueToDOMTree=function(e,t){return e&&t?se(e,t):null} fe.processCues=function(e,t,i){if(!e||!t||!i)return null for(;i.firstChild;)i.removeChild(i.firstChild) var n=e.document.createElement("div") n.style.position="absolute" n.style.left="0" n.style.right="0" n.style.top="0" n.style.bottom="0" n.style.margin="1.5%" i.appendChild(n) if(function(e){for(var t=0;t100)throw new Error("Position must be between 0 and 100.") p=e this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=ye(e) if(t){f=t this.hasBeenReset=!0}else console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.") m=e this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=ye(e) if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.") g=t this.hasBeenReset=!0}}}) this.displayState=void 0}_e.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)} var be=_e,Te={"":!0,up:!0} function ke(e){return"number"==typeof e&&e>=0&&e<=100}var Se=function(){var e=100,t=3,i=0,n=100,r=0,a=100,s="" Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!ke(t))throw new Error("Width must be between 0 and 100.") e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.") t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!ke(e))throw new Error("RegionAnchorX must be between 0 and 100.") n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!ke(e))throw new Error("RegionAnchorY must be between 0 and 100.") i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!ke(e))throw new Error("ViewportAnchorY must be between 0 and 100.") a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!ke(e))throw new Error("ViewportAnchorX must be between 0 and 100.") r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Te[e.toLowerCase()]&&e.toLowerCase()}(e) !1===t?console.warn("Scroll: an invalid or illegal string was specified."):s=t}}})},Ee=w((function(e){var t=e.exports={WebVTT:me,VTTCue:be,VTTRegion:Se} x.vttjs=t x.WebVTT=t.WebVTT var i=t.VTTCue,n=t.VTTRegion,r=x.VTTCue,a=x.VTTRegion t.shim=function(){x.VTTCue=i x.VTTRegion=n} t.restore=function(){x.VTTCue=r x.VTTRegion=a} x.VTTCue||t.shim()})),Ce=(Ee.WebVTT,Ee.VTTCue,Ee.VTTRegion,w((function(e){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1 if(Reflect.construct.sham)return!1 if("function"==typeof Proxy)return!0 try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))) return!0}catch(e){return!1}} e.exports.default=e.exports,e.exports.__esModule=!0}))) C(Ce) var we=w((function(e){function t(i,n,r){if(Ce()){e.exports=t=Reflect.construct e.exports.default=e.exports,e.exports.__esModule=!0}else{e.exports=t=function(e,t,i){var n=[null] n.push.apply(n,t) var r=new(Function.bind.apply(e,n)) i&&U(r,i.prototype) return r} e.exports.default=e.exports,e.exports.__esModule=!0}return t.apply(null,arguments)}e.exports=t e.exports.default=e.exports,e.exports.__esModule=!0})),Ie=C(we),Pe=C(w((function(e){e.exports=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)} e.exports.default=e.exports,e.exports.__esModule=!0}))),xe=w((function(e,t){i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){i=i||{} e=e.trim() if(!(t=t.trim())){if(!i.alwaysNormalize)return e var r=s.parseURL(e) if(!r)throw new Error("Error trying to parse base URL.") r.path=s.normalizePath(r.path) return s.buildURLFromParts(r)}var a=s.parseURL(t) if(!a)throw new Error("Error trying to parse relative URL.") if(a.scheme){if(!i.alwaysNormalize)return t a.path=s.normalizePath(a.path) return s.buildURLFromParts(a)}var o=s.parseURL(e) if(!o)throw new Error("Error trying to parse base URL.") if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path) o.netLoc=u[1] o.path=u[2]}o.netLoc&&!o.path&&(o.path="/") var l={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment} if(!a.netLoc){l.netLoc=o.netLoc if("/"!==a.path[0])if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path l.path=s.normalizePath(d)}else{l.path=o.path if(!a.params){l.params=o.params a.query||(l.query=o.query)}}}null===l.path&&(l.path=i.alwaysNormalize?s.normalizePath(a.path):a.path) return s.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e) return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){e=e.split("").reverse().join("").replace(r,"") for(;e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s var i,n,r,a,s})),Ae="http://example.com",Oe=function(){function e(){this.listeners={}}var t=e.prototype 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) this.listeners[e]=this.listeners[e].slice(0) this.listeners[e].splice(i,1) return i>-1} t.trigger=function(e){var t=this.listeners[e] if(t)if(2===arguments.length)for(var i=t.length,n=0;n-1;t=this.buffer.indexOf("\n")){this.trigger("data",this.buffer.substring(0,t)) this.buffer=this.buffer.substring(t+1)}} return t}(Oe),Re=String.fromCharCode(9),Me=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={} t[1]&&(i.length=parseInt(t[1],10)) t[2]&&(i.offset=parseInt(t[2],10)) return i},Ne=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)if(""!==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},Ue=function(e){B(t,e) function t(){var t;(t=e.call(this)||this).customParsers=[] t.tagMappers=[] return t}var i=t.prototype i.push=function(e){var t,i,n=this if(0!==(e=e.trim()).length)if("#"===e[0]){this.tagMappers.reduce((function(t,i){var n=i(e) return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r0&&(s.duration=e.duration) if(0===e.duration){s.duration=.01 this.trigger("info",{message:"updating zero segment duration to a small value"})}this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI)if("com.apple.streamingkeydelivery"!==e.attributes.KEYFORMAT)if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"!==e.attributes.KEYFORMAT){e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}) n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI} void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else{if(-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)){this.trigger("warn",{message:"invalid key method provided for Widevine"}) return}"SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}) if("data:text/plain;base64,"!==e.attributes.URI.substring(0,23)){this.trigger("warn",{message:"invalid key URI provided for Widevine"}) return}if(!e.attributes.KEYID||"0x"!==e.attributes.KEYID.substring(0,2)){this.trigger("warn",{message:"invalid key ID provided for Widevine"}) return}this.manifest.contentProtection=this.manifest.contentProtection||{} this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:Le(e.attributes.URI.split(",")[1])}}else{this.manifest.contentProtection=this.manifest.contentProtection||{} this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes}}else this.trigger("warn",{message:"ignoring key declaration without URI"}) else n=null else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){if(isFinite(e.number)){this.manifest.discontinuitySequence=e.number c=e.number}else this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={} e.uri&&(i.uri=e.uri) e.byterange&&(i.byterange=e.byterange) n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a this.manifest.mediaGroups=this.manifest.mediaGroups||l if(e.attributes){s.attributes||(s.attributes={}) R(s.attributes,e.attributes)}else this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){this.manifest.mediaGroups=this.manifest.mediaGroups||l if(e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE] i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{} t=i[e.attributes["GROUP-ID"]];(p={default:/yes/i.test(e.attributes.DEFAULT)}).default?p.autoselect=!0:p.autoselect=/yes/i.test(e.attributes.AUTOSELECT) e.attributes.LANGUAGE&&(p.language=e.attributes.LANGUAGE) e.attributes.URI&&(p.uri=e.attributes.URI) e.attributes["INSTREAM-ID"]&&(p.instreamId=e.attributes["INSTREAM-ID"]) e.attributes.CHARACTERISTICS&&(p.characteristics=e.attributes.CHARACTERISTICS) e.attributes.FORCED&&(p.forced=/yes/i.test(e.attributes.FORCED)) t[e.attributes.NAME]=p}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1 s.discontinuity=!0 this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){if(void 0===this.manifest.dateTimeString){this.manifest.dateTimeString=e.dateTimeString this.manifest.dateTimeObject=e.dateTimeObject}s.dateTimeString=e.dateTimeString s.dateTimeObject=e.dateTimeObject},targetduration:function(){if(!isFinite(e.duration)||e.duration<0)this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}) else{this.manifest.targetDuration=e.duration Fe.call(this,this.manifest)}},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=Be(e.attributes) this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this o=!0 var i=this.manifest.segments.length,n=Be(e.attributes) s.parts=s.parts||[] s.parts.push(n) if(n.byterange){n.byterange.hasOwnProperty("offset")||(n.byterange.offset=h) h=n.byterange.offset+n.byterange.length}var r=s.parts.length-1 this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]) this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=Be(e.attributes) if(!t.hasOwnProperty("canBlockReload")){t.canBlockReload=!1 this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})}Fe.call(this,this.manifest) t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=Be(e.attributes),n=i.type&&"PART"===i.type s.preloadHints=s.preloadHints||[] s.preloadHints.push(i) if(i.byterange&&!i.byterange.hasOwnProperty("offset")){i.byterange.offset=n?h:0 n&&(h=i.byterange.offset+i.byterange.length)}var r=s.preloadHints.length-1 this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]) if(i.type)for(var a=0;a