PageSourceSearch

https://yukadd.jp/assets/js/libs/hls.min.js

js yukadd.jp collected 2026-10-07 02:01:49 UTC 202,136 bytes, 1 lines download raw bytes

1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Hls=e():t.Hls=e()}(this,function(){return r=[function(t,e,r){"use strict";function i(){}function a(n){var s=self.console[n];return s?function(){for(var t,e,r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];i[0]&&(i[0]=(t=n,e=i[0],"["+t+"] > "+e)),s.apply(self.console,i)}:i}r.d(e,"a",function(){return l}),r.d(e,"b",function(){return d});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s={trace:i,debug:i,log:i,warn:i,info:i,error:i},o=s,l=function(t){if(!0===t||"object"===(void 0===t?"undefined":n(t))){!function(e){for(var t=arguments.length,r=Array(1<t?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach(function(t){o[t]=e[t]?e[t].bind(e):a(t)})}(t,"debug","log","info","warn","error");try{o.log()}catch(t){o=s}}else o=s},d=o
vendor: 3,286 bytes, line 1
1},function(t,e,r){"use strict";e.a={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_SWITCH:"hlsLevelSwitch",LEVEL_SWITCHING:"hlsLevelSwitching",LEVEL_SWITCHED:"hlsLevelSwitched",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCH:"hlsAudioTrackSwitch",AUDIO_TRACK_SWITCHING:"hlsAudioTrackSwitching",AUDIO_TRACK_SWITCHED:"hlsAudioTrackSwitched",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",SUBTITLE_TRACKS_UPDATED:"hlsSubtitleTracksUpdated",SUBTITLE_TRACK_SWITCH:"hlsSubtitleTrackSwitch",SUBTITLE_TRACK_LOADING:"hlsSubtitleTrackLoading",SUBTITLE_TRACK_LOADED:"hlsSubtitleTrackLoaded",SUBTITLE_FRAG_PROCESSED:"hlsSubtitleFragProcessed",INIT_PTS_FOUND:"hlsInitPtsFound",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_DECRYPTED:"hlsFragDecrypted",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},function(t,e,r){"use strict";r.d(e,"b",function(){return i}),r.d(e,"a",function(){return a});var i={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",MUX_ERROR:"muxError",OTHER_ERROR:"otherError"},a={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",REMUX_ALLOC_ERROR:"remuxAllocError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",BUFFER_NUDGE_ON_STALL:"bufferNudgeOnStall",INTERNAL_EXCEPTION:"internalException"}},function(t,e,r){"use strict";function 
1o(){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function")}o.isHeader=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},o.isFooter=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},o.getID3Data=function(t,e){for(var r=e,i=0;o.isHeader(t,e);)i=(i+=10)+o._readSize(t,e+6),o.isFooter(t,e+10)&&(i+=10),e+=i;if(0<i)return t.subarray(r,r+i)},o._readSize=function(t,e){var r=0,r=(127&t[e])<<21;return(r=(r|=(127&t[e+1])<<14)|(127&t[e+2])<<7)|127&t[e+3]},o.getTimeStamp=function(t){for(var e=o.getID3Frames(t),r=0;r<e.length;r++){var i=e[r];if(o.isTimeStampFrame(i))return o._readTimeStamp(i)}},o.isTimeStampFrame=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},o._getFrameData=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=o._readSize(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},o.getID3Frames=function(t){for(var e=0,r=[];o.isHeader(t,e);){for(var i=o._readSize(t,e+6),a=(e+=10)+i;e+8<a;){var n=o._getFrameData(t.subarray(e)),s=o._decodeFrame(n);s&&r.push(s),e+=n.size+10}o.isFooter(t,e)&&(e+=10)}return r},o._decodeFrame=function(t){return"PRIV"===t.type?o._decodePrivFrame(t):"T"===t.type[0]?o._decodeTextFrame(t):"W"===t.type[0]?o._decodeURLFrame(t):void 0},o._readTimeStamp=function(t){var e;if(8===t.data.byteLength)return e=1&(t=new Uint8Array(t.data))[3],t=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7],t/=45,e&&(t+=47721858.84),Math.round(t)},o._decodePrivFrame=function(t){var e,r;if(!(t.size<2))return e=o._utf8ArrayToStr(t.data),r=new Uint8Array(t.data.subarray(e.length+1)),{key:t.type,info:e,data:r.buffer}},o._decodeTextFrame=function(t){var e,r;if(!(t.size<2))return"TXXX"===t.type?(e=1,e+=(r=o._utf8ArrayToStr(t.data.subarray(1))).length+1,e=o._utf8ArrayToStr(t.data.subarray(e)),{key:t.type,info:r,data:e}):(r=o._utf8ArrayToStr(t.data.subarray(1)),{key:t.type,data:r})},o._decodeURLFrame=function(t){var e,r;return"WXXX"===t.type?t.size<2?void 0:(e=1,e+=(r=o._utf8ArrayToStr(t.data.subarray(1))).length+1,e=o._utf8ArrayToStr(t.data.subarray(e)),{key:t.type,info:r,data:e}):(r=o._utf8ArrayToStr(t.data),{key:t.type,data:r})},o._utf8ArrayToStr=function(t){for(var e,r=void 0,i="",a=0,n=t.length;a<n;){var s=t[a++];switch(s>>4){case 0:return i;case 1:case 2:case 3:case 4:case 5:case 6:case 7:i+=String.fromCharCode(s);break;case 12:case 13:r=t[a++],i+=String.fromCharCode((31&s)<<6|63&r);break;
1case 14:r=t[a++],e=t[a++],i+=String.fromCharCode((15&s)<<12|(63&r)<<6|(63&e)<<0)}}return i},e.a=o},function(t,e){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function l(t){return"function"==typeof t}function d(t){return"object"==typeof t&&null!==t}function u(t){return void 0===t}((t.exports=r).EventEmitter=r).prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,i,a,n,s;if(this._events||(this._events={}),"error"===t&&(!this._events.error||d(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var o=new Error('Uncaught, unspecified "error" event. ('+e+")");throw o.context=e,o}if(u(r=this._events[t]))return!1;if(l(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(d(r))for(a=Array.prototype.slice.call(arguments,1),i=(s=r.slice()).length,n=0;n<i;n++)s[n].apply(this,a);return!0},r.prototype.on=r.prototype.addListener=function(t,e){if(l(e))return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,l(e.listener)?e.listener:e),this._events[t]?d(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,d(this._events[t])&&!this._events[t].warned&&(e=u(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&0<e&&this._events[t].length>e&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace)&&console.trace(),this;throw TypeError("listener must be a function")},r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}var i;if(l(e))return i=!1,r.listener=e,this.on(t,r),this;throw TypeError("listener must be a function")},r.prototype.removeListener=function(t,e){var r,i,a,n;if(!l(e))throw TypeError("listener must be a function");if(this._events&&this._events[t])if(a=(r=this._events[t]).length,i=-1,r===e||l(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(d(r)){for(n=a;0<n--;)if(r[n]===e||r[n].listener&&r[n].listener===e){i=n;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(this._events)if(this._events.removeListener)if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);this.removeAllListeners("removeListener"),this._events={}}else{if(l(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);delete this._events[t]}else 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t];return this},r.prototype.listeners=function(t){return this._events&&this._events[t]?l(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){t=this._events[t];if(l(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,r){var i,n,a,s,o;i=/^((?:[^\/;?#]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/;?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,o={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=this.parseURL(t);if(a)return i.path=o.normalizePath(i.path),o.buildURLFromParts(i);throw new Error("Error trying to parse base URL.")}i=this.parseURL(e);if(!i)throw new Error("Error trying to parse relative URL.");if(i.scheme)return r.alwaysNormalize?(i.path=o.normalizePath(i.path),o.buildURLFromParts(i)):e;var a=this.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");
vendor: 38,155 bytes, line 1
1!a.netLoc&&a.path&&"/"!==a.path[0]&&(e=n.exec(a.path),a.netLoc=e[1],a.path=e[2]),a.netLoc&&!a.path&&(a.path="/");t={scheme:a.scheme,netLoc:i.netLoc,path:null,params:i.params,query:i.query,fragment:i.fragment};return i.netLoc||(t.netLoc=a.netLoc,"/"===i.path[0])||(i.path?(e=(e=a.path).substring(0,e.lastIndexOf("/")+1)+i.path,t.path=o.normalizePath(e)):(t.path=a.path,i.params||(t.params=a.params,i.query)||(t.query=a.query))),null===t.path&&(t.path=r.alwaysNormalize?o.normalizePath(i.path):i.path),o.buildURLFromParts(t)},parseURL:function(t){t=i.exec(t);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(a,"");t.length!==(t=t.replace(s,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=o},function(C,I,t){"use strict";function a(t,e){return 255===t[e]&&240==(246&t[e+1])}function o(t,e){return 1&t[e+1]?7:9}function l(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function f(t,e){return e+1<t.length&&a(t,e)}function p(t,e,r,i,a){var n,s,o,l,d,u;t.samplerate||(e=e,r=r,i=i,a=a,o=navigator.userAgent.toLowerCase(),l=a,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],u=1+((192&r[i+2])>>>6),i=(n=(60&r[i+2])>>>2)>d.length-1?void e.trigger(Event.ERROR,{type:H.b.MEDIA_ERROR,details:H.a.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+n}):(e=(1&r[i+2])<<2,e|=(192&r[i+3])>>>6,K.b.log("manifest codec:"+a+",ADTS data:type:"+u+",sampleingIndex:"+n+"["+d[n]+"Hz],channelConfig:"+e),r=/firefox/i.test(o)?6<=n?(u=5,s=new Array(4),n-3):(u=2,s=new Array(2),n):-1!==o.indexOf("android")?(u=2,s=new Array(2),n):(u=5,s=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&6<=n?n-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(6<=n&&1==e||/vivaldi/i.test(o))||!a&&1==e)&&(u=2,s=new Array(2)),n)),s[0]=u<<3,s[0]|=(14&n)>>1,s[1]|=(1&n)<<7,s[1]|=e<<3,5===u&&(s[1]|=(14&r)>>1,s[2]=(1&r)<<7,s[2]|=8,s[3]=0),{config:s,samplerate:d[n],channelCount:e,codec:"mp4a.40."+u,manifestCodec:l}),t.config=i.config,t.samplerate=i.samplerate,t.channelCount=i.channelCount,t.codec=i.codec,t.manifestCodec=i.manifestCodec,K.b.log("parsed codec:"+t.codec+",rate:"+i.samplerate+",nb channel:"+i.channelCount))}function c(t){return 9216e4/t}function g(t,e,r,i,a){var n,i=function(t,e,r,i,a){var n=t.length,s=o(t,e),t=l(t,e);if(0<(t-=s)&&e+s+t<=n)return{headerLength:s,frameLength:t,stamp:r+i*a}}(e,r,i,a,c(t.samplerate));if(i)return a=i.stamp,n=i.headerLength,i=i.frameLength,e={unit:e.subarray(r+n,r+n+i),pts:a,dts:a},t.samples.push(e),t.len+=i,{sample:e,length:i+n}}{var j=t(1),H=t(2);O.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)};var x,P=O,x=(D.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},D),M=D,x=(k.prototype.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),i=0;i<4;i++)r[i]=e.getUint32(4*i);return r},k.prototype.initTable=function(){for(var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],s=r[3],r=this.invSubMix,o=r[0],l=r[1],d=r[2],u=r[3],h=new Uint32Array(256),c=0,f=0,p=0,p=0;p<256;p++)h[p]=p<128?p<<1:p<<1^283;for(p=0;p<256;p++){var g=f^f<<1^f<<2^f<<3^f<<4,y=(t[c]=g=g>>>8^255&g^99,h[e[g]=c]),m=h[y],v=h[m],b=257*h[g]^16843008*g;i[c]=b<<24|b>>>8,a[c]=b<<16|b>>>16,n[c]=b<<8|b>>>24,s[c]=b,o[g]=(b=16843009*v^65537*m^257*y^16843008*c)<<24|b>>>8,l[g]=b<<16|b>>>16,d[g]=b<<8|b>>>24,u[g]=b,c?(c=y^h[h[h[v^y]]],f^=h[h[f]]):c=f=1}},k.prototype.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,i=0;i<e.length&&r;)r=e[i]===this.key[i],i++;if(!r){this.key=e;var a=this.keySize=e.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);for(var n=this.ksRows=4*(a+6+1),s=void 0,o=void 0,l=this.keySchedule=new Uint32Array(n),d=this.invKeySchedule=new Uint32Array(n),u=this.sBox,h=this.rcon,t=this.invSubMix,c=t[0],f=t[1],p=t[2],g=t[3],y=void 0,m=void 0,s=0;s<n;s++)s<a?y=l[s]=e[s]:(m=y,s%a==0?(m=u[(m=m<<8|m>>>24)>>>24]<<24|u[m>>>16&255]<<16|u[m>>>8&255]<<8|u[255&m],m^=h[s/a|0]<<24):6<a&&s%a==4&&(m=u[m>>>24]<<24|u[m>>>16&255]<<16|u[m>>>8&255]<<8|u[255&m]),l[s]=y=(l[s-a]^m)>>>0);for(o=0;o<n;o++)s=n-o,m=3&o?l[s]:l[s-4],d[o]=o<4||s<=4?m:c[u[m>>>24]]^f[u[m>>>16&255]]^p[u[m>>>8&255]]^g[u[255&m]],d[o]=d[o]>>>0}},k.prototype.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},k.prototype.decrypt=function(t,e,r){for(var i,a,n,s,o,l,d=this.keySize+6,u=this.invKeySchedule,h=this.invSBox,c=this.invSubMix,f=c[0],p=c[1],g=c[2],y=c[3],c=this.uint8ArrayToUint32Array_(r),m=c[0],v=c[1],b=c[2],T=c[3],E=new Int32Array(t),R=new Int32Array(E.length),S=void 0,A=void 0,w=void 0,_=void 0,L=void 0,k=void 0,D=void 0,O=void 0,C=this.networkToHostOrderSwap;e<E.length;){for(n=C(E[e]),s=C(E[e+1]),o=C(E[e+2]),l=C(E[e+3]),L=n^u[0],k=l^u[1],D=o^u[2],O=s^u[3],i=4,a=1;a<d;a++)S=f[L>>>24]^p[k>>16&255]^g[D>>8&255]^y[255&O]^u[i],A=f[k>>>24]^p[D>>16&255]^g[O>>8&255]^y[255&L]^u[i+1],w=f[D>>>24]^p[O>>16&255]^g[L>>8&255]^y[255&k]^u[i+2],_=f[O>>>24]^p[L>>16&255]^g[k>>8&255]^y[255&D]^u[i+3],L=S,k=A,D=w,O=_,i+=4;S=h[L>>>24]<<24^h[k>>16&255]<<16^h[D>>8&255]<<8^h[255&O]^u[i],A=h[k>>>24]<<24^h[D>>16&255]<<16^h[O>>8&255]<<8^h[255&L]^u[i+1],w=h[D>>>24]<<24^h[O>>16&255]<<16^h[L>>8&255]<<8^h[255&k]^u[i+2],_=h[O>>>24]<<24^h[L>>16&255]<<16^h[k>>8&255]<<8^h[255&D]^u[i+3],i+=3,R[e]=C(S^m),R[e+1]=C(_^v),R[e+2]=C(w^b),R[e+3]=C(A^T),m=n,v=s,b=o,T=l,e+=4}return R.buffer},k.prototype.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},k),N=k,K=t(0),x=(L.prototype.isSync=function(){return this.disableWebCrypto&&this.config.enableSoftwareAES},L.prototype.decrypt=function(e,r,i,a){var t,n,s=this;this.disableWebCrypto&&this.config.enableSoftwareAES?(this.logEnabled&&(K.b.log("JS AES decrypt"),this.logEnabled=!1),(t=this.decryptor)||(this.decryptor=t=new N),t.expandKey(r),a(t.decrypt(e,0,i))):(this.logEnabled&&(K.b.log("WebCrypto AES decrypt"),this.logEnabled=!1),n=this.subtle,this.key!==r&&(this.key=r,this.fastAesKey=new M(n,r)),this.fastAesKey.expandKey().then(function(t){new P(n,i).decrypt(e,t).catch(function(t){s.onWebCryptoError(t,e,r,i,a)}).then(function(t){a(t)})}).catch(function(t){s.onWebCryptoError(t,e,r,i,a)}))},L.prototype.onWebCryptoError=function(t,e,r,i,a){this.config.enableSoftwareAES?(K.b.log("WebCrypto Error, disable WebCrypto API"),this.disableWebCrypto=!0,this.logEnabled=!0,this.decrypt(e,r,i,a)):(K.b.error("decrypting error : "+t.message),this.observer.trigger(Event.ERROR,{type:H.b.MEDIA_ERROR,details:H.a.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))},L.prototype.destroy=function(){var t=this.decryptor;t&&(t.destroy(),this.decryptor=void 0)},L),y=L,m=t(3),U=(_.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/adts",type:"audio",id:0,sequenceNumber:0,isAAC:!0,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},_.prototype.resetTimeStamp=function(){},_.probe=function(t){var e,r,i=m.a.getID3Data(t,0);if(i&&void 0!==m.a.getTimeStamp(i))for(e=i.length,r=Math.min(t.length-1,e+100);e<r;e++)if(function(t,e){if(e+1<t.length&&a(t,e)){var r=o(t,e),e=e+(r=e+5<t.length?l(t,e):r);if(e===t.length||e+1<t.length&&a(t,e))return 1}}(t,e))return K.b.log("ADTS sync word found !"),!0;return!1},_.prototype.append=function(t,e,r,i){for(var a=this._audioTrack,n=m.a.getID3Data(t,0),s=90*m.a.getTimeStamp(n),o=0,l=s,d=t.length,u=n.length,h=[{pts:l,dts:l,data:n}];u<d-1;)if(f(t,u)&&u+5<d){p(a,this.observer,t,u,a.manifestCodec);var c=g(a,t,u,s,o);if(!c){K.b.log("Unable to parse AAC frame");break}u+=c.length,l=c.sample.pts,o++}else m.a.isHeader(t,u)?(n=m.a.getID3Data(t,u),h.push({pts:l,dts:l,data:n}),u+=n.length):u++;this.remuxer.remux(a,{samples:[]},{samples:h,inputTimeScale:9e4},{samples:[]},e,r,i)},_.prototype.destroy=function(){},_),n=Math.pow(2,32)-1}w.prototype.resetTimeStamp=function(t){this.initPTS=t},w.prototype.resetInitSegment=function(t,e,r,i){var a,n;t&&t.byteLength?(n={},(a=this.initData=w.parseInitSegment(t)).audio&&a.video?n.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:i?t:null}:(a.audio&&(n.audio={container:"audio/mp4",codec:e,initSegment:i?t:null}),a.video&&(n.video={container:"video/mp4",codec:r,initSegment:i?t:null})),this.observer.trigger(j.a.FRAG_PARSING_INIT_SEGMENT,{tracks:n})):(e&&(this.audioCodec=e),r&&(this.videoCodec=r))},w.probe=function(t){return 8<=t.length&&0<=["moof","ftyp","styp"].indexOf(w.bin2str(t.subarray(4,8)))},w.bin2str=function(t){return String.fromCharCode.apply(null,t)},w.readUint32=function(t,e){t.data&&(e+=t.start,t=t.data);t=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return t<0?4294967296+t:t},w.writeUint32=function(t,e,r){t.data&&(e+=t.start,t=t.data),t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r},w.findBox=function(t,e){var r,i,a,n,s,o=[];if(t.data?(n=t.start,i=t.end,t=t.data):(n=0,i=t.byteLength),!e.length)return null;for(r=n;r<i;)s=1<(s=w.readUint32(t,r))?r+s:i,w.bin2str(t.subarray(r+4,r+8))===e[0]&&(1===e.length?o.push({data:t,start:r+8,end:s}):(a=w.findBox({data:t,start:r+8,end:s},e.slice(1))).length&&(o=o.concat(a))),r=s;return o},w.parseInitSegment=function(t){var a=[];return w.findBox(t,["moov","trak"]).forEach(function(t){var e,r,i=w.findBox(t,["tkhd"])[0];i&&(r=i.data[i.start],i=w.readUint32(i,0===r?12:20),e=w.findBox(t,["mdia","mdhd"])[0])&&(r=e.data[e.start],e=w.readUint32(e,0===r?12:20),r=w.findBox(t,["mdia","hdlr"])[0])&&(t={soun:"audio",vide:"video"}[w.bin2str(r.data.subarray(r.start+8,r.start+12))])&&(a[i]={timescale:e,type:t},a[t]={timescale:e,id:i})}),a},w.getStartDTS=function(r,t){t=w.findBox(t,["moof","traf"]),t=[].concat.apply([],t.map(function(e){return w.findBox(e,["tfhd"]).map(function(t){t=w.readUint32(t,4),t=r[t].timescale||9e4;return w.findBox(e,["tfdt"]).map(function(t){var e=t.data[t.start],r=w.readUint32(t,4);return r=1===e?(r*=Math.pow(2,32))+w.readUint32(t,8):r})[0]/t})})),t=Math.min.apply(null,t);return isFinite(t)?t:0},w.offsetStartDTS=function(r,t,a){w.findBox(t,["moof","traf"]).map(function(e){return w.findBox(e,["tfhd"]).map(function(t){var t=w.readUint32(t,4),i=r[t].timescale||9e4;w.findBox(e,["tfdt"]).map(function(t){var e=t.data[t.start],r=w.readUint32(t,4);0===e?w.writeUint32(t,4,r-a*i):(r=(r=(r*=Math.pow(2,32))+w.readUint32(t,8))-a*i,e=Math.floor(r/(1+n)),r=Math.floor(r%(1+n)),w.writeUint32(t,4,e),w.writeUint32(t,8,r))})})})},w.prototype.append=function(t,e,r,i){var a,n=this.initData,s=(n||(this.resetInitSegment(t,this.audioCodec,this.videoCodec),n=this.initData),this.initPTS);void 0===s&&(a=w.getStartDTS(n,t),this.initPTS=s=a-e,this.observer.trigger(j.a.INIT_PTS_FOUND,{initPTS:s})),w.offsetStartDTS(n,t,s),a=w.getStartDTS(n,t),this.remuxer.remux(n.audio,n.video,null,null,a,r,i,t)},w.prototype.destroy=function(){};var B=w,d={BitratesMap:[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],SamplingRateMap:[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],appendFrame:function(t,e,r,i,a){if(!(r+24>e.length)){var n=this.parseHeader(e,r);if(n&&r+n.frameLength<=e.length)return i=i+a*(10368e4/n.sampleRate),a={unit:e.subarray(r,r+n.frameLength),pts:i,dts:i},t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(a),t.len+=n.frameLength,{sample:a,length:n.frameLength}}},parseHeader:function(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,a=t[e+2]>>4&15,n=t[e+2]>>2&3,s=!!(2&t[e+2]);if(1!=r&&0!=a&&15!=a&&3!=n)return a=1e3*d.BitratesMap[14*(3==r?3-i:3==i?3:4)+a-1],s=s?1:0,{sampleRate:n=d.SamplingRateMap[3*(3==r?0:2==r?1:2)+n],channelCount:t[e+3]>>6==3?1:2,frameLength:3==i?(3==r?12:6)*a/n+s<<2:(3==r?144:72)*a/n+s|0}},isHeaderPattern:function(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])},isHeader:function(t,e){return!!(e+1<t.length&&this.isHeaderPattern(t,e))},probe:function(t,e){if(e+1<t.length&&this.isHeaderPattern(t,e)){var r=this.parseHeader(t,e),i=4,e=e+(i=r&&r.frameLength?r.frameLength:i);if(e===t.length||e+1<t.length&&this.isHeaderPattern(t,e))return!0}return!1}},v=d;A.prototype.loadWord=function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,i=new Uint8Array(4),e=Math.min(4,e);if(0===e)throw new Error("no bytes available");i.set(t.subarray(r,r+e)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*e,this.bytesAvailable-=e},A.prototype.skipBits=function(t){var e;this.bitsAvailable>t||(t=(t-=this.bitsAvailable)-((e=t>>3)>>3),this.bytesAvailable-=e,this.loadWord()),this.word<<=t,this.bitsAvailable-=t},A.prototype.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return 32<t&&K.b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,0<this.bitsAvailable?this.word<<=e:0<this.bytesAvailable&&this.loadWord(),0<(e=t-e)&&this.bitsAvailable?r<<e|this.readBits(e):r},A.prototype.skipLZ=function(){for(var t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},A.prototype.skipUEG=function(){this.skipBits(1+this.skipLZ())},A.prototype.skipEG=function(){this.skipBits(1+this.skipLZ())},A.prototype.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},A.prototype.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},A.prototype.readBoolean=function(){return 1===this.readBits(1)},A.prototype.readUByte=function(){return this.readBits(8)},A.prototype.readUShort=function(){return this.readBits(16)},A.prototype.readUInt=function(){return this.readBits(32)},A.prototype.skipScalingList=function(t){for(var e=8,r=8,i=0;i<t;i++)e=0===(r=0!==r?(e+this.readEG()+256)%256:r)?e:r},A.prototype.readSPS=function(){var t,e,r,i=0,a=0,n=0,s=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),d=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),c=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);if(o(),g=o(),l(5),h(3),o(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){var g=d();if(3===g&&h(1),f(),f(),h(1),u())for(e=3!==g?8:12,r=0;r<e;r++)u()&&p(r<6?16:64)}f();var g=d();if(0===g)d();else if(1===g)for(h(1),c(),c(),t=d(),r=0;r<t;r++)c();f(),h(1),g=d(),f=d(),0===(l=l(1))&&h(1),h(1),u()&&(i=d(),a=d(),n=d(),s=d());var y=[1,1];if(u()&&u())switch(o()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(g+1)-2*i-2*a),height:(2-l)*(f+1)*16-(l?2:4)*(n+s),pixelRatio:y}},A.prototype.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()};var R=A;E.prototype.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.decryptdata.key.buffer,this.decryptdata.iv.buffer,e)},E.prototype.decryptAacSample=function(e,r,i,a){var n=e[r].unit,t=n.subarray(16,n.length-n.length%16),t=t.buffer.slice(t.byteOffset,t.byteOffset+t.length),s=this;this.decryptBuffer(t,function(t){t=new Uint8Array(t),n.set(t,16),a||s.decryptAacSamples(e,r+1,i)})},E.prototype.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)){var i=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,i),!i)return}}},E.prototype.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,a=32;a<=t.length-16;a+=160,i+=16)r.set(t.subarray(a,a+16),i);return r},E.prototype.getAvcDecryptedUnit=function(t,e){e=new Uint8Array(e);for(var r=0,i=32;i<=t.length-16;i+=160,r+=16)t.set(e.subarray(r,r+16),i);return t},E.prototype.decryptAvcSample=function(e,r,i,a,n,s){var o=this.discardEPB(n.data),t=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(t.buffer,function(t){n.data=l.getAvcDecryptedUnit(o,t),s||l.decryptAvcSamples(e,r,i+1,a)})},E.prototype.decryptAvcSamples=function(t,e,r,i){for(;;e++,r=0){if(e>=t.length)return void i();for(var a=t[e].units;!(r>=a.length);r++){var n=a[r];if(!(n.length<=48||1!==n.type&&5!==n.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,i,n,s),!s)return}}}};var G=E;T.prototype.setDecryptData=function(t){null!=t&&null!=t.key&&"SAMPLE-AES"===t.method?this.sampleAes=new G(this.observer,this.config,t,this.discardEPB):this.sampleAes=null},T.probe=function(t){return 564<=t.length&&71===t[0]&&71===t[188]&&71===t[376]},T.prototype.resetInitSegment=function(t,e,r,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0,dropped:0},this._audioTrack={container:"video/mp2t",type:"audio",id:-1,inputTimeScale:9e4,duration:i,sequenceNumber:0,samples:[],len:0,isAAC:!0},this._id3Track={type:"id3",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=r,this._duration=i},T.prototype.resetTimeStamp=function(){},T.prototype.append=function(t,e,r,i){var a,n,s,o,l,d=t.length,u=!1,h=(this.contiguous=r,this.pmtParsed),c=this._avcTrack,f=this._audioTrack,p=this._id3Track,g=c.id,y=f.id,m=p.id,v=this._pmtId,b=c.pesData,T=f.pesData,E=p.pesData,R=this._parsePAT,S=this._parsePMT,A=this._parsePES,w=this._parseAVCPES.bind(this),_=this._parseAACPES.bind(this),L=this._parseMPEGPES.bind(this),k=this._parseID3PES.bind(this);for(d-=d%188,a=0;a<d;a+=188)if(71===t[a]){if(n=!!(64&t[a+1]),s=((31&t[a+1])<<8)+t[a+2],1<(48&t[a+3])>>4){if((o=a+5+t[a+4])===a+188)continue}else o=a+4;switch(s){case g:n&&(b&&(l=A(b))&&w(l,!1),b={data:[],size:0}),b&&(b.data.push(t.subarray(o,a+188)),b.size+=a+188-o);break;case y:n&&(T&&(l=A(T))&&(f.isAAC?_:L)(l),T={data:[],size:0}),T&&(T.data.push(t.subarray(o,a+188)),T.size+=a+188-o);break;case m:n&&(E&&(l=A(E))&&k(l),E={data:[],size:0}),E&&(E.data.push(t.subarray(o,a+188)),E.size+=a+188-o);break;case 0:n&&(o+=t[o]+1),v=this._pmtId=R(t,o);break;case v:n&&(o+=t[o]+1);var D=S(t,o,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,null!=this.sampleAes);0<(g=D.avc)&&(c.id=g),0<(y=D.audio)&&(f.id=y,f.isAAC=D.isAAC),0<(m=D.id3)&&(p.id=m),u&&!h&&(K.b.log("reparse from beginning"),u=!1,a=-188),h=this.pmtParsed=!0;break;case 17:case 8191:break;default:u=!0}}else this.observer.trigger(j.a.ERROR,{type:H.b.MEDIA_ERROR,details:H.a.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b&&(l=A(b))?(w(l,!0),c.pesData=null):c.pesData=b,T&&(l=A(T))?((f.isAAC?_:L)(l),f.pesData=null):(T&&T.size&&K.b.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=T),E&&(l=A(E))?(k(l),p.pesData=null):p.pesData=E,null==this.sampleAes?this.remuxer.remux(f,c,p,this._txtTrack,e,r,i):this.decryptAndRemux(f,c,p,this._txtTrack,e,r,i)},T.prototype.decryptAndRemux=function(t,e,r,i,a,n,s){var o;t.samples&&t.isAAC?(o=this).sampleAes.decryptAacSamples(t.samples,0,function(){o.decryptAndRemuxAvc(t,e,r,i,a,n,s)}):this.decryptAndRemuxAvc(t,e,r,i,a,n,s)},T.prototype.decryptAndRemuxAvc=function(t,e,r,i,a,n,s){var o;e.samples?(o=this).sampleAes.decryptAvcSamples(e.samples,0,0,function(){o.remuxer.remux(t,e,r,i,a,n,s)}):this.remuxer.remux(t,e,r,i,a,n,s)},T.prototype.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0},T.prototype._parsePAT=function(t,e){return(31&t[e+10])<<8|t[e+11]},T.prototype._parsePMT=function(t,e,r,i){var a,n={audio:-1,avc:-1,id3:-1,isAAC:!0},s=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<s;){switch(a=(31&t[e+1])<<8|t[e+2],t[e]){case 207:if(!i){K.b.log("unkown stream type:"+t[e]);break}case 15:-1===n.audio&&(n.audio=a);break;case 21:-1===n.id3&&(n.id3=a);break;case 219:if(!i){K.b.log("unkown stream type:"+t[e]);break}case 27:-1===n.avc&&(n.avc=a);break;case 3:case 4:r?-1===n.audio&&(n.audio=a,n.isAAC=!1):K.b.log("MPEG audio found, not supported in this browser for now");break;case 36:K.b.warn("HEVC stream type found, not supported for now");break;default:K.b.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}return n},T.prototype._parsePES=function(t){var e,r,i,a,n,s=0,o=t.data;if(!t||0===t.size)return null;for(;o[0].length<19&&1<o.length;){var l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]),l.set(o[1],o[0].length),o[0]=l,o.splice(1,1)}if(1!==((c=o[0])[0]<<16)+(c[1]<<8)+c[2])return null;if((e=(c[4]<<8)+c[5])&&e>t.size-6)return null;192&(r=c[7])&&(4294967295<(i=536870912*(14&c[9])+4194304*(255&c[10])+16384*(254&c[11])+128*(255&c[12])+(254&c[13])/2)&&(i-=8589934592),64&r?(4294967295<(a=536870912*(14&c[14])+4194304*(255&c[15])+16384*(254&c[16])+128*(255&c[17])+(254&c[18])/2)&&(a-=8589934592),54e5<i-a&&(K.b.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a)):a=i),r=c[8],t.size-=n=r+9;for(var d=new Uint8Array(t.size),u=0,h=o.length;u<h;u++){var c,f=(c=o[u]).byteLength;if(n){if(f<n){n-=f;continue}c=c.subarray(n),f-=n,n=0}d.set(c,s),s+=f}return e&&(e-=r+3),{data:d,pts:i,dts:a,len:e}},T.prototype.pushAccesUnit=function(t,e){var r,i;t.units.length&&t.frame&&(i=(r=e.samples).length,!this.config.forceKeyFrameOnDiscontinuity||!0===t.key||e.sps&&(i||this.contiguous)?(t.id=i,r.push(t)):e.dropped++),t.debug.length&&K.b.log(t.pts+"/"+t.dts+":"+t.debug)},T.prototype._parseAVCPES=function(c,t){function f(t,e,r,i){return{key:t,pts:e,dts:r,units:[],debug:i}}var p,g,y,m=this,v=this._avcTrack,e=this._parseAVCNALu(c.data),b=this.avcSample,T=!1,E=this.pushAccesUnit.bind(this);c.data=null,b&&e.length&&(E(b,v),b=this.avcSample=f(!1,c.pts,c.dts,"")),e.forEach(function(t){switch(t.type){case 1:g=!0,b.frame=!0;var e=t.data;T&&4<e.length&&(2!==(e=new R(e).readSliceType())&&4!==e&&7!==e&&9!==e||(b.key=!0));break;case 5:g=!0,(b=b||(m.avcSample=f(!0,c.pts,c.dts,""))).key=!0,b.frame=!0;break;case 6:g=!0,(p=new R(m.discardEPB(t.data))).readUByte();for(var r=0,i=0,a=!1,n=0;!a&&1<p.bytesAvailable;){for(r=0;r+=n=p.readUByte(),255===n;);for(i=0;i+=n=p.readUByte(),255===n;);if(4===r&&0!==p.bytesAvailable){if(a=!0,181===p.readUByte()&&49===p.readUShort()&&1195456820===p.readUInt()&&3===p.readUByte()){var s=p.readUByte(),o=31&s,l=[s,p.readUByte()];for(y=0;y<o;y++)l.push(p.readUByte()),l.push(p.readUByte()),l.push(p.readUByte());m._insertSampleInOrder(m._txtTrack.samples,{type:3,pts:c.pts,bytes:l})}}else if(i<p.bytesAvailable)for(y=0;y<i;y++)p.readUByte()}break;case 7:if(T=g=!0,!v.sps){var e=(p=new R(t.data)).readSPS(),d=(v.width=e.width,v.height=e.height,v.pixelRatio=e.pixelRatio,v.sps=[t.data],v.duration=m._duration,t.data.subarray(1,4)),u="avc1.";for(y=0;y<3;y++){var h=d[y].toString(16);u+=h=h.length<2?"0"+h:h}v.codec=u}break;case 8:g=!0,v.pps||(v.pps=[t.data]);break;case 9:g=!1,b&&E(b,v),b=m.avcSample=f(!1,c.pts,c.dts,"");break;case 12:g=!1;break;default:g=!1,b&&(b.debug+="unknown NAL "+t.type+" ")}b&&g&&b.units.push(t)}),t&&b&&(E(b,v),this.avcSample=null)},T.prototype._insertSampleInOrder=function(t,e){var r=t.length;if(0<r){if(e.pts>=t[r-1].pts)t.push(e);else for(var i=r-1;0<=i;i--)if(e.pts<t[i].pts){t.splice(i,0,e);break}}else t.push(e)},T.prototype._getLastNalUnit=function(){var t,e=this.avcSample,r=void 0;return r=(e=e&&0!==e.units.length?e:(t=this._avcTrack.samples)[t.length-1])?(t=e.units)[t.length-1]:r},T.prototype._parseAVCNALu=function(t){var e,r,i,a,n,s,o,l,d=0,u=t.byteLength,h=this._avcTrack,c=h.naluState||0,f=c,p=[],g=-1;for(-1===c&&(a=31&t[g=0],c=0,d=1);d<u;)e=t[d++],c=c?1!==c?e?1===e?(0<=g?(i={data:t.subarray(g,d-c-1),type:a},p.push(i)):(n=this._getLastNalUnit())&&(f&&d<=4-f&&n.state&&(n.data=n.data.subarray(0,n.data.byteLength-f)),0<(r=d-c-1))&&((s=new Uint8Array(n.data.byteLength+r)).set(n.data,0),s.set(t.subarray(0,r),n.data.byteLength),n.data=s),d<u?(a=31&t[g=d],0):-1):0:3:e?0:2:e?0:1;return 0<=g&&0<=c&&(i={data:t.subarray(g,u),type:a,state:c},p.push(i)),0===p.length&&(o=this._getLastNalUnit())&&((l=new Uint8Array(o.data.byteLength+t.byteLength)).set(o.data,0),l.set(t,o.data.byteLength),o.data=l),h.naluState=c,p},T.prototype.discardEPB=function(t){for(var e=t.byteLength,r=[],i=1;i<e-2;)0===t[i]&&0===t[i+1]&&3===t[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return t;for(var a=e-r.length,n=new Uint8Array(a),s=0,i=0;i<a;s++,i++)s===r[0]&&(s++,r.shift()),n[i]=t[s];return n},T.prototype._parseAACPES=function(t){var e,r,i,a,n=this._audioTrack,s=t.data,o=t.pts,t=this.aacOverFlow,l=this.aacLastPTS;for(t&&((u=new Uint8Array(t.byteLength+s.byteLength)).set(t,0),u.set(s,t.byteLength),s=u),r=0,a=s.length;r<a-1&&!f(s,r);r++);if(r){var d,u=r<a-1?(d="AAC PES did not start with ADTS header,offset:"+r,!1):(d="no ADTS header found in AAC PES",!0);if(K.b.warn("parsing error:"+d),this.observer.trigger(j.a.ERROR,{type:H.b.MEDIA_ERROR,details:H.a.FRAG_PARSING_ERROR,fatal:u,reason:d}),u)return}for(p(n,this.observer,s,r,this.audioCodec),e=0,d=c(n.samplerate),t&&l&&(u=l+d,1<Math.abs(u-o))&&(K.b.log("AAC: align PTS for overlapping frames by "+Math.round((u-o)/90)),o=u);r<a;)if(f(s,r)&&r+5<a){var h=g(n,s,r,o,e);if(!h)break;r+=h.length,i=h.sample.pts,e++}else r++;t=r<a?s.subarray(r,a):null,this.aacOverFlow=t,this.aacLastPTS=i},T.prototype._parseMPEGPES=function(t){for(var e=t.data,r=e.length,i=0,a=0,n=t.pts;a<r;)if(v.isHeader(e,a)){var s=v.appendFrame(this._audioTrack,e,a,n,i);if(!s)break;a+=s.length,i++}else a++},T.prototype._parseID3PES=function(t){this._id3Track.samples.push(t)};var W=T;i.prototype.resetInitSegment=function(t,e,r,i){this._audioTrack={container:"audio/mpeg",type:"audio",id:-1,sequenceNumber:0,isAAC:!1,samples:[],len:0,manifestCodec:e,duration:i,inputTimeScale:9e4}},i.prototype.resetTimeStamp=function(){},i.probe=function(t){var e,r,i=m.a.getID3Data(t,0);if(i&&void 0!==m.a.getTimeStamp(i))for(e=i.length,r=Math.min(t.length-1,e+100);e<r;e++)if(v.probe(t,e))return K.b.log("MPEG Audio sync word found !"),!0;return!1},i.prototype.append=function(t,e,r,i){for(var a=m.a.getID3Data(t,0),n=90*m.a.getTimeStamp(a),s=a.length,o=t.length,l=0,d=0,u=this._audioTrack,h=[{pts:n,dts:n,data:a}];s<o;)if(v.isHeader(t,s)){var c=v.appendFrame(u,t,s,n,l);if(!c)break;s+=c.length,d=c.sample.pts,l++}else m.a.isHeader(t,s)?(a=m.a.getID3Data(t,s),h.push({pts:d,dts:d,data:a}),s+=a.length):s++;this.remuxer.remux(u,{samples:[]},{samples:h,inputTimeScale:9e4},{samples:[]},e,r,i)},i.prototype.destroy=function(){};var z=i;r.getSilentFrame=function(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===e)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null};var F=r,s=Math.pow(2,32)-1;b.init=function(){for(var t in b.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]})b.types.hasOwnProperty(t)&&(b.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var e=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e=(b.HDLR_TYPES={video:e,audio:r},new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])),r=new Uint8Array([0,0,0,0,0,0,0,0]),r=(b.STTS=b.STSC=b.STCO=r,b.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),b.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),b.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),b.STSD=new Uint8Array([0,0,0,0,0,0,0,1]),new Uint8Array([105,115,111,109])),i=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);b.FTYP=b.box(b.types.ftyp,r,a,r,i),b.DINF=b.box(b.types.dinf,b.box(b.types.dref,e))},b.box=function(t){for(var e,r=Array.prototype.slice.call(arguments,1),i=8,a=r.length,n=a;a--;)i+=r[a].byteLength;for((e=new Uint8Array(i))[0]=i>>24&255,e[1]=i>>16&255,e[2]=i>>8&255,e[3]=255&i,e.set(t,4),a=0,i=8;a<n;a++)e.set(r[a],i),i+=r[a].byteLength;return e},b.hdlr=function(t){return b.box(b.types.hdlr,b.HDLR_TYPES[t])},b.mdat=function(t){return b.box(b.types.mdat,t)},b.mdhd=function(t,e){e*=t;var r=Math.floor(e/(1+s)),e=Math.floor(e%(1+s));return b.box(b.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,e>>24,e>>16&255,e>>8&255,255&e,85,196,0,0]))},b.mdia=function(t){return b.box(b.types.mdia,b.mdhd(t.timescale,t.duration),b.hdlr(t.type),b.minf(t))},b.mfhd=function(t){return b.box(b.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},b.minf=function(t){return"audio"===t.type?b.box(b.types.minf,b.box(b.types.smhd,b.SMHD),b.DINF,b.stbl(t)):b.box(b.types.minf,b.box(b.types.vmhd,b.VMHD),b.DINF,b.stbl(t))},b.moof=function(t,e,r){return b.box(b.types.moof,b.mfhd(t),b.traf(r,e))},b.moov=function(t){for(var e=t.length,r=[];e--;)r[e]=b.trak(t[e]);return b.box.apply(null,[b.types.moov,b.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(b.mvex(t)))},b.mvex=function(t){for(var e=t.length,r=[];e--;)r[e]=b.trex(t[e]);return b.box.apply(null,[b.types.mvex].concat(r))},b.mvhd=function(t,e){e*=t;var r=Math.floor(e/(1+s)),e=Math.floor(e%(1+s)),t=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,e>>24,e>>16&255,e>>8&255,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return b.box(b.types.mvhd,t)},b.sdtp=function(t){for(var e,r=t.samples||[],i=new Uint8Array(4+r.length),a=0;a<r.length;a++)e=r[a].flags,i[a+4]=e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy;return b.box(b.types.sdtp,i)},b.stbl=function(t){return b.box(b.types.stbl,b.stsd(t),b.box(b.types.stts,b.STTS),b.box(b.types.stsc,b.STSC),b.box(b.types.stsz,b.STSZ),b.box(b.types.stco,b.STCO))},b.avc1=function(t){for(var e,r,i=[],a=[],n=0;n<t.sps.length;n++)r=(e=t.sps[n]).byteLength,i.push(r>>>8&255),i.push(255&r),i=i.concat(Array.prototype.slice.call(e));for(n=0;n<t.pps.length;n++)r=(e=t.pps[n]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(e));var s=b.box(b.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(a))),o=t.width,l=t.height,d=t.pixelRatio[0],u=t.pixelRatio[1];return b.box(b.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,b.box(b.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),b.box(b.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,u>>24,u>>16&255,u>>8&255,255&u])))},b.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},b.mp4a=function(t){var e=t.samplerate;return b.box(b.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]),b.box(b.types.esds,b.esds(t)))},b.mp3=function(t){var e=t.samplerate;return b.box(b.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0]))},b.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?b.box(b.types.stsd,b.STSD,b.mp4a(t)):b.box(b.types.stsd,b.STSD,b.mp3(t)):b.box(b.types.stsd,b.STSD,b.avc1(t))},b.tkhd=function(t){var e=t.id,r=t.duration*t.timescale,i=t.width,t=t.height,a=Math.floor(r/(1+s)),r=Math.floor(r%(1+s));return b.box(b.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,t>>8&255,255&t,0,0]))},b.traf=function(t,e){var r=b.sdtp(t),i=t.id,a=Math.floor(e/(1+s)),e=Math.floor(e%(1+s));return b.box(b.types.traf,b.box(b.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),b.box(b.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,e>>24,e>>16&255,e>>8&255,255&e])),b.trun(t,r.length+16+20+8+16+8+8),r)},b.trak=function(t){return t.duration=t.duration||4294967295,b.box(b.types.trak,b.tkhd(t),b.mdia(t))},b.trex=function(t){t=t.id;return b.box(b.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},b.trun=function(t,e){var r,i,a,n,s,o=t.samples||[],l=o.length,t=12+16*l,d=new Uint8Array(t);for(d.set([0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,(e+=8+t)>>>24&255,e>>>16&255,e>>>8&255,255&e],0),r=0;r<l;r++)i=(s=o[r]).duration,a=s.size,n=s.flags,s=s.cts,d.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,61440&n.degradPrio,15&n.degradPrio,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12+16*r);return b.box(b.types.trun,d)},b.initSegment=function(t){b.types||b.init();var t=b.moov(t),e=new Uint8Array(b.FTYP.byteLength+t.byteLength);return e.set(b.FTYP),e.set(t,b.FTYP.byteLength),e};var V=b;h.prototype.destroy=function(){},h.prototype.resetTimeStamp=function(t){this._initPTS=this._initDTS=t},h.prototype.resetInitSegment=function(){this.ISGenerated=!1},h.prototype.remux=function(t,e,r,i,a,n,s){var o,l;this.ISGenerated||this.generateIS(t,e,a),this.ISGenerated&&(t.samples.length?(t.timescale||(K.b.warn("regenerate InitSegment as audio detected"),this.generateIS(t,e,a)),l=this.remuxAudio(t,a,n,s),e.samples.length&&(o=void 0,l&&(o=l.endPTS-l.startPTS),e.timescale||(K.b.warn("regenerate InitSegment as video detected"),this.generateIS(t,e,a)),this.remuxVideo(e,a,n,o,s))):(l=void 0,(l=e.samples.length?this.remuxVideo(e,a,n,s):l)&&t.codec&&this.remuxEmptyAudio(t,a,n,l))),r.samples.length&&this.remuxID3(r,a),i.samples.length&&this.remuxText(i,a),this.observer.trigger(j.a.FRAG_PARSED)},h.prototype.generateIS=function(t,e,r){var i,a,n=this.observer,s=t.samples,o=e.samples,l=this.typeSupported,d="audio/mp4",u={},h={tracks:u},c=void 0===this._initPTS;c&&(i=a=1/0),t.config&&s.length&&(t.timescale=t.samplerate,K.b.log("audio sampling rate : "+t.samplerate),t.isAAC||(l.mpeg?(d="audio/mpeg",t.codec=""):l.mp3&&(t.codec="mp3")),u.audio={container:d,codec:t.codec,initSegment:!t.isAAC&&l.mpeg?new Uint8Array:V.initSegment([t]),metadata:{channelCount:t.channelCount}},c)&&(i=a=s[0].pts-t.inputTimeScale*r),e.sps&&e.pps&&o.length&&(d=e.inputTimeScale,e.timescale=d,u.video={container:"video/mp4",codec:e.codec,initSegment:V.initSegment([e]),metadata:{width:e.width,height:e.height}},c)&&(i=Math.min(i,o[0].pts-d*r),a=Math.min(a,o[0].dts-d*r),this.observer.trigger(j.a.INIT_PTS_FOUND,{initPTS:i})),Object.keys(u).length?(n.trigger(j.a.FRAG_PARSING_INIT_SEGMENT,h),this.ISGenerated=!0,c&&(this._initPTS=i,this._initDTS=a)):n.trigger(j.a.ERROR,{type:H.b.MEDIA_ERROR,details:H.a.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})},h.prototype.remuxVideo=function(t,e,r,i,a){var n,s,o=8,l=t.timescale,d=t.samples,u=[],h=d.length,c=this._PTSNormalize,f=this._initDTS,p=this.nextAvcDts,g=this.isSafari,y=(g&&(r|=d.length&&p&&(a&&Math.abs(e-p/l)<.1||Math.abs(d[0].pts-p-f)<l/5)),r||(p=e*l),d.forEach(function(t){t.pts=c(t.pts-f,p),t.dts=c(t.dts-f,p)}),d.sort(function(t,e){var r=t.dts-e.dts,i=t.pts-e.pts;return r||i||t.id-e.id}),d.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0));if(y<0){K.b.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(y/90)+" ms to overcome this issue");for(var m=0;m<d.length;m++)d[m].dts+=y}var a=d[0],v=Math.max(a.dts,0),b=Math.max(a.pts,0),e=Math.round((v-p)/90);r&&e&&(1<e?K.b.log("AVC:"+e+" ms hole between fragments detected,filling it"):e<-1&&K.b.log("AVC:"+-e+" ms overlapping between fragments detected"),v=p,d[0].dts=v,b=Math.max(b-e,p),d[0].pts=b,K.b.log("Video/PTS/DTS adjusted: "+Math.round(b/90)+"/"+Math.round(v/90)+",delta:"+e+" ms")),a=d[d.length-1],r=Math.max(a.dts,0),e=Math.max(a.pts,0,r),g&&(n=Math.round((r-v)/(d.length-1)));for(var T=0,E=0,R=0;R<h;R++){for(var S=d[R],A=S.units,w=A.length,_=0,L=0;L<w;L++)_+=A[L].data.length;E+=_,T+=w,S.length=_,S.dts=g?v+R*n:Math.max(S.dts,v),S.pts=Math.max(S.pts,S.dts)}a=E+4*T+8;try{s=new Uint8Array(a)}catch(t){return void this.observer.trigger(j.a.ERROR,{type:H.b.MUX_ERROR,details:H.a.REMUX_ALLOC_ER
1ROR,fatal:!1,bytes:a,reason:"fail allocating video mdat "+a})}var k=new DataView(s.buffer);k.setUint32(0,a),s.set(V.types.mdat,4);for(var D=0;D<h;D++){for(var O,C,I,x=d[D],M=x.units,N=0,U=void 0,P=0,B=M.length;P<B;P++){var F=M[P],G=F.data,F=F.data.byteLength;k.setUint32(o,F),o+=4,s.set(G,o),o+=F,N+=4+F}U=g?Math.max(0,n*Math.round((x.pts-x.dts)/n)):(D<h-1?n=d[D+1].dts-x.dts:(C=this.config,O=x.dts-d[0<D?D-1:D].dts,C.stretchShortVideoTrack&&(I=C.maxBufferHole,C=C.maxSeekHole,Math.floor(Math.min(I,C)*l)<(I=(i?b+i*l:this.nextAudioPts)-x.pts))?((n=I-O)<0&&(n=O),K.b.log("It is approximately "+I/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=O),Math.round(x.pts-x.dts)),u.push({size:N,duration:n,cts:U,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:x.key?2:1,isNonSync:x.key?0:1}})}this.nextAvcDts=r+n;a=t.dropped,t.len=0,t.nbNalu=0,t.dropped=0,u.length&&-1<navigator.userAgent.toLowerCase().indexOf("chrome")&&((r=u[0].flags).dependsOn=2,r.isNonSync=0),t.samples=u,r=V.moof(t.sequenceNumber++,v,t),t.samples=[],r={data1:r,data2:s,startPTS:b/l,endPTS:(e+n)/l,startDTS:v/l,endDTS:this.nextAvcDts/l,type:"video",nb:u.length,dropped:a};return this.observer.trigger(j.a.FRAG_PARSING_DATA,r),r},h.prototype.remuxAudio=function(t,e,r,i){var a,n,s,o,l=t.inputTimeScale,d=l/t.timescale,u=(t.isAAC?1024:1152)*d,h=this._PTSNormalize,c=this._initDTS,f=!t.isAAC&&this.typeSupported.mpeg,p=t.samples,g=[],y=this.nextAudioPts;if((r|=p.length&&y&&(i&&Math.abs(e-y/l)<.1||Math.abs(p[0].pts-y-c)<20*u))||(y=e*l),p.forEach(function(t){t.pts=t.dts=h(t.pts-c,y)}),p.sort(function(t,e){return t.pts-e.pts}),i&&t.isAAC)for(var m=0,v=y;m<p.length;){var b=p[m],T=b.pts-v,E=Math.abs(1e3*T/l);if(T<=-u)K.b.warn("Dropping 1 audio frame @ "+(v/l).toFixed(3)+"s due to "+E+" ms overlap."),p.splice(m,1),t.len-=b.unit.length;else{if(u<=T&&E<1e4&&v){var R=Math.round(T/u);K.b.warn("Injecting "+R+" audio frame @ "+(v/l).toFixed(3)+"s due to "+Math.round(1e3*T/l)+" ms gap.");for(var S=0;S<R;S++){var A,w=Math.max(v,0);(A=F.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(K.b.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),A=b.unit.subarray()),p.splice(m,0,{unit:A,pts:w,dts:w}),t.len+=A.length,v+=u,m++}}else Math.abs(T);b.pts=b.dts=v,v+=u,m++}}for(var _=0,L=p.length;_<L;_++){var k=p[_],D=k.unit,k=k.pts;if(void 0!==o)a.duration=Math.round((k-o)/d);else{var O=Math.round(1e3*(k-y)/l),C=0;if(r&&t.isAAC&&O){if(0<O&&O<1e4)C=Math.round((k-y)/u),K.b.log(O+" ms hole between AAC samples detected,filling it"),0<C&&(A=(A=F.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||D.subarray(),t.len+=C*A.length);else if(O<-12){K.b.log("drop overlapping AAC sample, expected/parsed/delta:"+(y/l).toFixed(3)+"s/"+(k/l).toFixed(3)+"s/"+-O+"ms"),t.len-=D.byteLength;continue}k=y}if(s=Math.max(0,k),!(0<t.len))return;var O=f?t.len:t.len+8,I=f?0:8;try{n=new Uint8Array(O)}catch(t){return void this.observer.trigger(j.a.ERROR,{type:H.b.MUX_ERROR,details:H.a.REMUX_ALLOC_ERROR,fatal:!1,bytes:O,reason:"fail allocating audio mdat "+O})}f||(new DataView(n.buffer).setUint32(0,O),n.set(V.types.mdat,4));for(var x=0;x<C;x++)(A=F.getSilentFrame(t.manifestCodec||t.codec,t.channelCount))||(K.b.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),A=D.subarray()),n.set(A,I),I+=A.byteLength,a={size:A.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},g.push(a)}n.set(D,I);O=D.byteLength;I+=O,g.push(a={size:O,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}}),o=k}var P,e=0,i=g.length;return 2<=i&&(e=g[i-2].duration,a.duration=e),i?(this.nextAudioPts=y=o+d*e,t.len=0,t.samples=g,e=f?new Uint8Array:V.moof(t.sequenceNumber++,s/d,t),t.samples=[],P=y/l,this.observer.trigger(j.a.FRAG_PARSING_DATA,e={data1:e,data2:n,startPTS:e=s/l,endPTS:P,startDTS:e,endDTS:P,type:"audio",nb:i}),e):null},h.prototype.remuxEmptyAudio=function(t,e,r,i){var a=t.inputTimeScale,n=t.samplerate||a,s=this.nextAudioPts,o=(void 0!==s?s:i.startDTS*a)+this._initDTS,s=i.endDTS*a+this._initDTS,l=1024*(a/n),d=Math.ceil((s-o)/l),u=F.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(K.b.warn("remux empty Audio"),u){for(var h=[],c=0;c<d;c++){var f=o+c*l;h.push({unit:u,pts:f,dts:f}),t.len+=u.length}t.samples=h,this.remuxAudio(t,e,r)}else K.b.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!")},h.prototype.remuxID3=function(t,e){var r,i=t.samples.length,a=t.inputTimeScale,n=this._initPTS,s=this._initDTS;if(i){for(var o=0;o<i;o++)(r=t.samples[o]).pts=(r.pts-n)/a,r.dts=(r.dts-s)/a;this.observer.trigger(j.a.FRAG_PARSING_METADATA,{samples:t.samples})}t.samples=[]},h.prototype.remuxText=function(t,e){t.samples.sort(function(t,e){return t.pts-e.pts});var r,i=t.samples.length,a=t.inputTimeScale,n=this._initPTS;if(i){for(var s=0;s<i;s++)(r=t.samples[s]).pts=(r.pts-n)/a;this.observer.trigger(j.a.FRAG_PARSING_USERDATA,{samples:t.samples})}t.samples=[]},h.prototype._PTSNormalize=function(t,e){var r;if(void 0!==e)for(r=e<t?-8589934592:8589934592;4294967296<Math.abs(t-e);)t+=r;return t};var S=h;e.prototype.destroy=function(){},e.prototype.resetTimeStamp=function(){},e.prototype.resetInitSegment=function(){},e.prototype.remux=function(t,e,r,i,a,n,s,o){var l=this.observer,d="";t&&(d+="audio"),e&&(d+="video"),l.trigger(j.a.FRAG_PARSING_DATA,{data1:o,startPTS:a,startDTS:a,type:d,nb:1,dropped:0}),l.trigger(j.a.FRAG_PARSED)};var X=e;function u(t,e,r,i){if(!(this instanceof u))throw new TypeError("Cannot call a class as a function");
1this.observer=t,this.typeSupported=e,this.config=r,this.vendor=i}function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.observer=t}function h(t,e,r,i){if(!(this instanceof h))throw new TypeError("Cannot call a class as a function");this.observer=t,this.config=e,this.typeSupported=r;t=navigator.userAgent;this.isSafari=i&&-1<i.indexOf("Apple")&&t&&!t.match("CriOS"),this.ISGenerated=!1}function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function")}function r(){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function")}function i(t,e,r){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.observer=t,this.config=r,this.remuxer=e}function T(t,e,r,i){if(!(this instanceof T))throw new TypeError("Cannot call a class as a function");this.observer=t,this.config=r,this.typeSupported=i,this.remuxer=e,this.sampleAes=null}function E(t,e,r,i){if(!(this instanceof E))throw new TypeError("Cannot call a class as a function");this.decryptdata=r,this.discardEPB=i,this.decrypter=new y(t,e)}function A(t){if(!(this instanceof A))throw new TypeError("Cannot call a class as a function");this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}function w(t,e){if(!(this instanceof w))throw new TypeError("Cannot call a class as a function");this.observer=t,this.remuxer=e}function _(t,e,r){if(!(this instanceof _))throw new TypeError("Cannot call a class as a function");this.observer=t,this.config=r,this.remuxer=e}function L(t,e){if(!(this instanceof L))throw new TypeError("Cannot call a class as a function");this.observer=t,this.config=e,this.logEnabled=!0;try{var r=crypto||self.crypto;this.subtle=r.subtle||r.webkitSubtle}catch(t){}this.disableWebCrypto=!this.subtle}function k(){if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}function D(t,e){if(!(this instanceof D))throw new TypeError("Cannot call a class as a function");this.subtle=t,this.key=e}function O(t,e){if(!(this instanceof O))throw new TypeError("Cannot call a class as a function");this.subtle=t,this.aesIV=e}u.prototype.destroy=function(){var t=this.demuxer;t&&t.destroy()},u.prototype.push=function(t,r,i,a,n,s,o,l,d,u,h,c){if(0<t.byteLength&&null!=r&&null!=r.key&&"AES-128"===r.method){var e=this.decrypter;null==e&&(e=this.decrypter=new y(this.observer,this.config));var f,p=this;try{f=performance.now()}catch(t){f=Date.now()}e.decrypt(t,r.key.buffer,r.iv.buffer,function(t){var e;try{e=performance.now()}catch(t){e=Date.now()}p.observer.trigger(j.a.FRAG_DECRYPTED,{stats:{tstart:f,tdecrypt:e}}),p.pushDecrypted(new Uint8Array(t),r,new Uint8Array(i),a,n,s,o,l,d,u,h,c)})}else this.pushDecrypted(new Uint8Array(t),r,new Uint8Array(i),a,n,s,o,l,d,u,h,c)},u.prototype.pushDecrypted=function(t,e,r,i,a,n,s,o,l,d,u,h){if(!(E=this.demuxer)||s&&!this.probe(t)){for(var c=this.observer,f=this.typeSupported,p=this.config,g=[{demux:U,remux:S},{demux:z,remux:S},{demux:W,remux:S},{demux:B,remux:X}],y=0,m=g.length;y<m;y++){var v=g[y],b=v.demux.probe;if(b(t)){var T=this.remuxer=new v.remux(c,p,f,this.vendor),E=new v.demux(c,T,p,f);this.probe=b;break}}if(!E)return void c.trigger(j.a.ERROR,{type:H.b.MEDIA_ERROR,details:H.a.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});this.demuxer=E}var R=this.remuxer;(s||o)&&(E.resetInitSegment(r,i,a,d),R.resetInitSegment()),s&&(E.resetTimeStamp(h),R.resetTimeStamp(h)),"function"==typeof E.setDecryptData&&E.setDecryptData(e),E.append(t,n,l,u)},I.a=u},function(M,N,t){"use strict";function U(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B(t,e,r){var i=t[e],t=t[r],a=t.startPTS;isNaN(a)?t.start=e<r?i.start+i.duration:Math.max(i.start-t.duration,0):e<r?(i.duration=a-i.start,i.duration<0&&T.b.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!")):(t.duration=i.start-a,t.duration<0&&T.b.warn("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!"))}function G(t,e,r,i,a,n){isNaN(e.startPTS)||(l=Math.abs(e.startPTS-r),isNaN(e.deltaPTS)?e.deltaPTS=l:e.deltaPTS=Math.max(l,e.deltaPTS),r=Math.min(r,e.startPTS),i=Math.max(i,e.endPTS),a=Math.min(a,e.startDTS),n=Math.max(n,e.endDTS));var s,o,l=r-e.start,a=(e.start=e.startPTS=r,e.endPTS=i,e.startDTS=a,e.endDTS=n,e.duration=i-r,e.sn);if(!t||a<t.startSN||a>t.endSN)return 0;for(n=a-t.startSN,(s=t.fragments)[n]=e,o=n;0<o;o--)B(s,o,o-1);for(o=n;o<s.length-1;o++)B(s,o,o+1);return t.PTSKnown=!0,l}function j(t,e){var r,i=Math.max(t.startSN,e.startSN)-e.startSN,a=Math.min(t.endSN,e.endSN)-e.startSN,n=e.startSN-t.startSN,s=t.fragments,o=e.fragments,l=0;if(a<i)return e.PTSKnown=!1;for(var d=i;d<=a;d++){var u=s[n+d],h=o[d];h&&u&&(l=u.cc-h.cc,isNaN(u.startPTS)||(h.start=h.startPTS=u.startPTS,h.endPTS=u.endPTS,h.duration=u.duration,h.backtracked=u.backtracked,h.dropped=u.dropped,r=h))}if(l)for(T.b.log("discontinuity sliding from playlist, take drift into account"),d=0;d<o.length;d++)o[d].cc+=l;if(r)G(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS);else if(0<=n&&n<s.length)for(var c=s[n].start,d=0;d<o.length;d++)o[d].start+=c;e.PTSKnown=t.PTSKnown}function H(){this.window=window,this.state="INITIAL",this.buffer="",this.decoder=new xt,this.regionList=[]}function K(){this.values=Object.create(null)}function V(t,e,r,i){var a,n,s=i?t.split(i):[t];for(a in s)"string"==typeof s[a]&&2===(n=s[a].split(r)).length&&e(n[0],n[1])}function W(r,t,n){function e(){var t=(t=(t=r).match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/))?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):59<t[1]?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null;function e(t,e,r,i){return 3600*(0|t)+60*(0|e)+(0|r)+(0|i)/1e3}if(null===t)throw new Error("Malformed timestamp: "+o);return r=r.replace(/^[^\sa-zA-Z-]+/,""),t}function i(){r=r.replace(/^\s+/,"")}var a,s,o=r;if(i(),t.startTime=e(),i(),"--\x3e"!==r.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+o);r=r.substr(3),i(),t.endTime=e(),i(),a=r,t=t,s=new K,V(a,function(t,e){switch(t){case"region":for(var r=n.length-1;0<=r;r--)if(n[r].id===e){s.set(t,n[r].region);break}break;case"vertical":s.alt(t,e,["rl","lr"]);break;case"line":var i=e.split(","),a=i[0];s.integer(t,a),s.percent(t,a)&&s.set("snapToLines",!1),s.alt(t,a,["auto"]),2===i.length&&s.alt("lineAlign",i[1],["start",he,"end"]);break;case"position":i=e.split(","),s.percent(t,i[0]),2===i.length&&s.alt("positionAlign",i[1],["start",he,"end","line-left","line-right","auto"]);break;case"size":s.percent(t,e);break;case"align":s.alt(t,e,["start",he,"end","left","right"])}},/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical",""),"auto"===(a=s.get("line","auto"))&&-1===ue.line&&(a=-1),t.line=a,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",he),"auto"===(a=s.get("position","auto"))&&50===ue.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}function z(t){return t.replace(/<br(?: \/)?>/gi,"\n")}function X(t,e,r,i){for(var a,n,s,o,l,d=window.VTTCue||window.TextTrackCue,u=0;u<i.rows.length;u++)if(s=!0,o=0,l="",!(a=i.rows[u]).isEmpty()){for(var h=0;h<a.chars.length;h++)a.chars[h].uchar.match(/\s/)&&s?o++:(l+=a.chars[h].uchar,s=!1);(a.cueStartTime=e)===r&&(r+=1e-4),n=new d(e,r,z(l.trim())),16<=o?o--:o++,navigator.userAgent.match(/Firefox\//)?n.line=u+1:n.line=7<u?u-2:u+1,n.align="left",n.position=Math.max(0,Math.min(100,o/32*100+(navigator.userAgent.match(/Firefox\//)?50:0))),t.addCue(n)}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){if(t&&t.cues)for(;0<t.cues.length;)t.removeCue(t.cues[0])}Object.defineProperty(N,"__esModule",{value:!0});var Y={},e=(t.d(Y,"newCue",function(){return X}),t(5)),q=t.n(e),v=t(1),b=t(2),T=t(0),Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};y.prototype.destroy=function(){this.unregisterListeners()},y.prototype.isEventHandler=function(){return"object"===Q(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent},y.prototype.registerListeners=function(){this.isEventHandler()&&this.handledEvents.forEac
1h(function(t){if("hlsEventGeneric"===t)throw new Error("Forbidden event name: "+t);this.hls.on(t,this.onEvent)},this)},y.prototype.unregisterListeners=function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){this.hls.off(t,this.onEvent)},this)},y.prototype.onEvent=function(t,e){this.onEventGeneric(t,e)},y.prototype.onEventGeneric=function(t,e){try{!function(t,e){var r="on"+t.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,e)}.call(this,t,e).call()}catch(e){T.b.error("internal error happened while processing "+t+":"+e.message),this.hls.trigger(v.a.ERROR,{type:b.b.OTHER_ERROR,details:b.a.INTERNAL_EXCEPTION,fatal:!1,event:t,err:e})}};var a=y,J=/^(\d+)x(\d+)$/,$=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g;g.prototype.decimalInteger=function(t){t=parseInt(this[t],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},g.prototype.hexadecimalInteger=function(t){if(this[t]){for(var e=(1&(e=(this[t]||"0x").slice(2)).length?"0":"")+e,r=new Uint8Array(e.length/2),i=0;i<e.length/2;i++)r[i]=parseInt(e.slice(2*i,2*i+2),16);return r}return null},g.prototype.hexadecimalIntegerAsNumber=function(t){t=parseInt(this[t],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},g.prototype.decimalFloatingPoint=function(t){return parseFloat(this[t])},g.prototype.enumeratedString=function(t){return this[t]},g.prototype.decimalResolution=function(t){t=J.exec(this[t]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},g.parseAttrList=function(t){var e,r={};for($.lastIndex=0;null!==(e=$.exec(t));){var i=e[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[e[1]]=i}return r};var E=g,e=function(t,e,r){return e&&le(t.prototype,e),r&&le(t,r),t},Z=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,tt=/#EXT-X-MEDIA:(.*)/g,et=new RegExp([/#EXTINF:(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/|(?!#)(\S+)/.source,/|#EXT-X-BYTERANGE:*(.+)/.source,/|#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/|#.*/.source].join(""),"g"),rt=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,it=(e(oe,[{key:"uri",get:function(){return!this._uri&&this.reluri&&(this._uri=q.a.buildAbsoluteURL(this.baseuri,this.reluri,{alwaysNormalize:!0})),this._uri}}]),oe),at=(p.prototype.createInitializationVector=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e},p.prototype.fragmentDecryptdataFromLevelkey=function(t,e){var r=t;return t&&t.method&&t.uri&&!t.iv&&((r=new it).method=t.method,r.baseuri=t.baseuri,r.reluri=t.reluri,r.iv=this.createInitializationVector(e)),r},p.prototype.cloneObj=function(t){return JSON.parse(JSON.stringify(t))},e(p,[{key:"url",get:function(){return!this._url&&this.relurl&&(this._url=q.a.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url},set:function(t){this._url=t}},{key:"programDateTime",get:function(){return!this._programDateTime&&this.rawProgramDateTime&&(this._programDateTime=new Date(Date.parse(this.rawProgramDateTime))),this._programDateTime}},{key:"byteRange",get:function(){var t,e,r;return this._byteRange||(t=this._byteRange=[],this.rawByteRange&&(1===(e=this.rawByteRange.split("@",2)).length?(r=this.lastByteRangeEndOffset,t[0]=r||0):t[0]=parseInt(e[1]),t[1]=parseInt(e[0])+t[0])),this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"decryptdata",get:function(){return this._decryptdata||(this._decryptdata=this.fragmentDecryptdataFromLevelkey(this.levelkey,this.sn)),this._decryptdata}}]),p),nt=function(e){function r(t){U(this,r);t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,e.call(this,t,v.a.MANIFEST_LOADING,v.a.LEVEL_LOADING,v.a.AUDIO_TRACK_LOADING,v.a.SUBTITLE_TRACK_LOADING));return t.loaders={},t}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){for(var t in this.loaders){t=this.loaders[t];t&&t.destroy()}this.loaders={},a.prototype.destroy.call(this)},r.prototype.onManifestLoading=function(t){this.load(t.url,{type:"manifest"})},r.prototype.onLevelLoading=function(t){this.load(t.url,{type:"level",level:t.level,id:t.id})},r.prototype.onAudioTrackLoading=function(t){this.load(t.url,{type:"audioTrack",id:t.id})},r.prototype.onSubtitleTrackLoading=function(t){this.load(t.url,{type:"subtitleTrack",id:t.id})},r.prototype.load=function(t,e){var r=this.loaders[e.type];if(r){var i=r.context;if(i&&i.url===t)return void T.b.trace("playlist request ongoing");T.b.warn("abort previous loader for type:"+e.type),r.abort()}var i=this.hls.config,a=void 0,n=void 0,s=void 0,o=void 0,i=("manifest"===e.type?(a=i.manifestLoadingMaxRetry,n=i.manifestLoadingTimeOut,s=i.manifestLoadingRetryDelay,o=i.manifestLoadingMaxRetryTimeout):(a=i.levelLoadingMaxRetry,n=i.levelLoadingTimeOut,s=i.levelLoadingRetryDelay,o=i.levelLoadingMaxRetryTimeout,T.b.log("loading playlist for "+e.type+" "+(e.level||e.id))),r=this.loaders[e.type]=e.loader=new(void 0!==i.pLoader?i.pLoader:i.loader)(i),e.url=t,e.responseType="",{timeout:n,maxRetry:a,retryDelay:s,maxRetryDelay:o}),t={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};r.load(e,i,t)},r.prototype.resolve=function(t,e){return q.a.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},r.prototype.parseMasterPlaylist=function(t,e){var r=[];for(Z.lastIndex=0;null!=(n=Z.exec(t));){var i={},a=i.attrs=new E(n[1]),n=(i.url=this.resolve(n[2],e),a.decimalResolution("RESOLUTION"));if(n&&(i.width=n.width,i.height=n.height),i.bitrate=a.decimalInteger("AVERAGE-BANDWIDTH")||a.decimalInteger("BANDWIDTH"),i.name=a.NAME,s=a.CODECS)for(var s=s.split(/[ ,]+/),o=0;o<s.length;o++){var l=s[o];-1!==l.indexOf("avc1")?i.videoCodec=this.avc1toavcoti(l):-1!==l.indexOf("hvc1")?i.videoCodec=l:i.audioCodec=l}r.push(i)}return r},r.prototype.parseMasterPlaylistMedia=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,a=[],n=0;for(tt.lastIndex=0;null!=(o=tt.exec(t));){var s={},o=new E(o[1]);o.TYPE===r&&(s.groupId=o["GROUP-ID"],s.name=o.NAME,s.type=r,s.default="YES"===o.DEFAULT,s.autoselect="YES"===o.AUTOSELECT,s.forced="YES"===o.FORCED,o.URI&&(s.url=this.resolve(o.URI,e)),s.lang=o.LANGUAGE,s.name||(s.name=s.lang),i&&(s.audioCodec=i),s.id=n++,a.push(s))}return a},r.prototype.avc1toavcoti=function(t){var e,r=t.split(".");return 2<r.length?(e=r.shift()+".",e=(e+=parseInt(r.shift()).toString(16))+("000"+parseInt(r.shift()).toString(16)).substr(-4)):e=t,e},r.prototype.parseLevelPlaylist=function(t,e,r,i){var a,n,s=0,o=0,l={type:null,version:null,url:e,fragments:[],live:!0,startSN:0},d=new it,u=0,h=null,c=new at;for(et.lastIndex=0;null!==(a=et.exec(t));){var f=a[1];if(f){c.duration=parseFloat(f);var p=(" "+a[2]).slice(1);c.title=p||null,c.tagList.push(p?["INF",f,p]:["INF",f])}else if(a[3])isNaN(c.duration)||(p=s++,c.type=i,c.start=o,c.levelkey=d,c.sn=p,c.level=r,c.cc=u,c.baseurl=e,c.relurl=(" "+a[3]).slice(1),l.fragments.push(c),o+=(h=c).duration,c=new at);else if(a[4])c.rawByteRange=(" "+a[4]).slice(1),h&&(f=h.byteRangeEndOffset)&&(c.lastByteRangeEndOffset=f);else if(a[5])c.rawProgramDateTime=(" "+a[5]).slice(1),c.tagList.push(["PROGRAM-DATE-TIME",c.rawProgramDateTime]);else{for(a=a[0].match(rt),n=1;n<a.length&&void 0===a[n];n++);var g=(" "+a[n+1]).slice(1),y=(" "+a[n+2]).slice(1);switch(a[n]){case"#":c.tagList.push(y?[g,y]:[g]);break;case"PLAYLIST-TYPE":l.type=g.toUpperCase();break;case"MEDIA-SEQUENCE":s=l.startSN=parseInt(g);break;case"TARGETDURATION":l.targetduration=parseFloat(g);break;case"VERSION":l.version=parseInt(g);break;case"EXTM3U":break;case"ENDLIST":l.live=!1;break;case"DIS":u++,c.tagList.push(["DIS"]);break;case"DISCONTINUITY-SEQ":u=parseInt(g);break;case"KEY":var m=new E(g),v=m.enumeratedString("METHOD"),b=m.URI,m=m.hexadecimalInteger("IV");v&&(d=new it,b)&&0<=["AES-128","SAMPLE-AES"].indexOf(v)&&(d.method=v,d.baseuri=e,d.reluri=b,d.key=null,d.iv=m);break;case"START":v=new E(g).decimalFloatingPoint("TIME-OFFSET");isNaN(v)||(l.startTimeOffset=v);break;case"MAP":b=new E(g);c.relurl=b.URI,c.rawByteRange=b.BYTERANGE,c.baseurl=e,c.level=r,c.type=i,c.sn="initSegment",l.initSegment=c,c=new at;break;
1default:T.b.warn("line parsed but not handled: "+a)}}}return(c=h)&&!c.relurl&&(l.fragments.pop(),o-=c.duration),l.totalduration=o,l.averagetargetduration=o/l.fragments.length,l.endSN=s-1,l},r.prototype.loadsuccess=function(t,e,r){var i,a,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,s=t.data,t=t.url,o=r.type,l=r.id,d=r.level,u=this.hls;(this.loaders[o]=void 0)!==t&&0!==t.indexOf("data:")||(t=r.url),e.tload=performance.now(),0===s.indexOf("#EXTM3U")?0<s.indexOf("#EXTINF:")?(r="audioTrack"!==o&&"subtitleTrack"!==o,i=isNaN(d)?isNaN(l)?0:l:d,(i=this.parseLevelPlaylist(s,t,i,"audioTrack"===o?"audio":"subtitleTrack"===o?"subtitle":"main")).tload=e.tload,"manifest"===o&&u.trigger(v.a.MANIFEST_LOADED,{levels:[{url:t,details:i}],audioTracks:[],url:t,stats:e,networkDetails:n}),e.tparsed=performance.now(),i.targetduration?r?u.trigger(v.a.LEVEL_LOADED,{details:i,level:d||0,id:l||0,stats:e,networkDetails:n}):"audioTrack"===o?u.trigger(v.a.AUDIO_TRACK_LOADED,{details:i,id:l,stats:e,networkDetails:n}):"subtitleTrack"===o&&u.trigger(v.a.SUBTITLE_TRACK_LOADED,{details:i,id:l,stats:e,networkDetails:n}):u.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t,reason:"invalid targetduration",networkDetails:n})):(r=this.parseMasterPlaylist(s,t)).length?(d=this.parseMasterPlaylistMedia(s,t,"AUDIO",r[0].audioCodec),o=this.parseMasterPlaylistMedia(s,t,"SUBTITLES"),d.length&&(a=!1,d.forEach(function(t){t.url||(a=!0)}),!1===a)&&r[0].audioCodec&&!r[0].attrs.AUDIO&&(T.b.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),d.unshift({type:"main",name:"main"})),u.trigger(v.a.MANIFEST_LOADED,{levels:r,audioTracks:d,subtitles:o,url:t,stats:e,networkDetails:n})):u.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t,reason:"no level found in manifest",networkDetails:n}):u.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.MANIFEST_PARSING_ERROR,fatal:!0,url:t,reason:"no EXTM3U delimiter",networkDetails:n})},r.prototype.loaderror=function(t,e){var r,i,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.loader;switch(e.type){case"manifest":r=b.a.MANIFEST_LOAD_ERROR,i=!0;break;case"level":r=b.a.LEVEL_LOAD_ERROR,i=!1;break;case"audioTrack":r=b.a.AUDIO_TRACK_LOAD_ERROR,i=!1}n&&(n.abort(),this.loaders[e.type]=void 0),this.hls.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:r,fatal:i,url:n.url,loader:n,response:t,context:e,networkDetails:a})},r.prototype.loadtimeout=function(t,e){var r,i,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=e.loader;switch(e.type){case"manifest":r=b.a.MANIFEST_LOAD_TIMEOUT,i=!0;break;case"level":r=b.a.LEVEL_LOAD_TIMEOUT,i=!1;break;case"audioTrack":r=b.a.AUDIO_TRACK_LOAD_TIMEOUT,i=!1}n&&(n.abort(),this.loaders[e.type]=void 0),this.hls.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:r,fatal:i,url:n.url,loader:n,context:e,networkDetails:a})},r}(a),st=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,e.call(this,t,v.a.FRAG_LOADING))).loaders={},t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){var t,e=this.loaders;for(t in e){var r=e[t];r&&r.destroy()}this.loaders={},a.prototype.destroy.call(this)},r.prototype.onFragLoading=function(t){var t=t.frag,e=t.type,r=this.loaders[e],i=this.hls.config,e=(t.loaded=0,r&&(T.b.warn("abort previous fragment loader for type:"+e),r.abort()),r=this.loaders[e]=t.loader=new(void 0!==i.fLoader?i.fLoader:i.loader)(i),void 0),e={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1},a=t.byteRangeStartOffset,t=t.byteRangeEndOffset;isNaN(a)||isNaN(t)||(e.rangeStart=a,e.rangeEnd=t),a={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout},t={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},r.load(e,a,t)},r.prototype.loadsuccess=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,t=t.data,r=r.frag;r.loader=void 0,this.loaders[r.type]=void 0,this.hls.trigger(v.a.FRAG_LOADED,{payload:t,frag:r,stats:e,networkDetails:i}
1)},r.prototype.loaderror=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t,networkDetails:r})},r.prototype.loadtimeout=function(t,e){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=e.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag,networkDetails:r})},r.prototype.loadprogress=function(t,e,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,e=e.frag;e.loaded=t.loaded,this.hls.trigger(v.a.FRAG_LOAD_PROGRESS,{frag:e,stats:t,networkDetails:i})},r}(a),ot=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,e.call(this,t,v.a.KEY_LOADING))).loaders={},t.decryptkey=null,t.decrypturl=null,t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){for(var t in this.loaders){t=this.loaders[t];t&&t.destroy()}this.loaders={},a.prototype.destroy.call(this)},r.prototype.onKeyLoading=function(t){var e,r,t=t.frag,i=t.type,a=this.loaders[i],n=t.decryptdata,s=n.uri;s!==this.decrypturl||null===this.decryptkey?(e=this.hls.config,a&&(T.b.warn("abort previous key loader for type:"+i),a.abort()),t.loader=this.loaders[i]=new e.loader(e),this.decrypturl=s,a=void(this.decryptkey=null),r=i=void 0,a={url:s,frag:t,responseType:"arraybuffer"},i={timeout:e.fragLoadingTimeOut,maxRetry:e.fragLoadingMaxRetry,retryDelay:e.fragLoadingRetryDelay,maxRetryDelay:e.fragLoadingMaxRetryTimeout},r={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},t.loader.load(a,i,r)):this.decryptkey&&(n.key=this.decryptkey,this.hls.trigger(v.a.KEY_LOADED,{frag:t}))},r.prototype.loadsuccess=function(t,e,r){r=r.frag;this.decryptkey=r.decryptdata.key=new Uint8Array(t.data),r.loader=void 0,this.loaders[r.type]=void 0,this.hls.trigger(v.a.KEY_LOADED,{frag:r})},r.prototype.loaderror=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},r.prototype.loadtimeout=function(t,e){var r=e.frag,i=r.loader;i&&i.abort(),this.loaders[e.type]=void 0,this.hls.trigger(v.a.ERROR,{type:b.b.NETWORK_ERROR,details:b.a.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},r}(a),R={search:function(t,e){for(var r=0,i=t.length-1;r<=i;){var a,n,s=e(n=t[a=(r+i)/2|0]);if(0<s)r=1+a;else{if(!(s<0))return n;i=a-1}}return null}},S={isBuffered:function(t,e){if(t)for(var r=t.buffered,i=0;i<r.length;i++)if(e>=r.start(i)&&e<=r.end(i))return!0;return!1},bufferInfo:function(t,e,r){if(t){for(var i=t.buffered,a=[],n=0;n<i.length;n++)a.push({start:i.start(n),end:i.end(n)});return this.bufferedInfo(a,e,r)}return{len:0,start:e,end:e,nextStart:void 0}},bufferedInfo:function(t,e,r){var i,a,n,s,o,l=[];for(t.sort(function(t,e){return t.start-e.start||e.end-t.end}),o=0;o<t.length;o++){var d,u=l.length;u&&(d=l[u-1].end,t[o].start-d<r)?t[o].end>d&&(l[u-1].end=t[o].end):l.push(t[o])}for(i=o=0,a=n=e;o<l.length;o++){var h=l[o].start,c=l[o].end;if(h<=e+r&&e<c)a=h,i=(n=c)-e;else if(e+r<h){s=h;break}}return{len:i,start:a,end:n,nextStart:s}}},lt=t(6),e=t(4),dt=t.n(e),e=t(8),ut=t.n(e);f.prototype.destroy=function(){var t=this.w,t=(t?(t.removeEventListener("message",this.onwmsg),t.terminate(),this.w=null):(t=this.demuxer)&&(t.destroy(),this.demuxer=null),this.observer);t&&(t.removeAllListeners(),this.observer=null)},f.prototype.push=function(t,e,r,i,a,n,s,o){var l=this.w,d=isNaN(a.startDTS)?a.start:a.startDTS,u=a.decryptdata,h=this.frag,c=!(h&&a.cc===h.cc),f=!(h&&a.level===h.level),h=h&&a.sn===h.sn+1,h=!f&&h;c&&T.b.log(this.id+":discontinuity detected"),f&&T.b.log(this.id+":switch detected"),this.frag=a,l?l.postMessage({cmd:"demux",data:t,decryptdata:u,initSegment:e,audioCodec:r,videoCodec:i,timeOffset:d,discontinuity:c,trackSwitch:f,contiguous:h,duration:n,accurateTimeOff
1set:s,defaultInitPTS:o},[t]):(a=this.demuxer)&&a.push(t,u,e,r,i,d,c,f,h,n,s,o)},f.prototype.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":URL.revokeObjectURL(this.w.objectURL);break;case v.a.FRAG_PARSING_DATA:e.data.data1=new Uint8Array(e.data1),e.data2&&(e.data.data2=new Uint8Array(e.data2));default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}};var ht=f,ct={toString:function(t){for(var e="",r=t.length,i=0;i<r;i++)e+="["+t.start(i).toFixed(3)+","+t.end(i).toFixed(3)+"]";return e}},ft=function(t,e,r){return e&&se(t.prototype,e),r&&se(t,r),t},pt="STOPPED",l="IDLE",gt="KEY_LOADING",yt="FRAG_LOADING",mt="FRAG_LOADING_WAITING_RETRY",vt="WAITING_LEVEL",d="PARSING",bt="PARSED",Tt="BUFFER_FLUSHING",Et="ENDED",u="ERROR",Rt=function(r){function i(t){var e;if(this instanceof i)return(e=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,r.call(this,t,v.a.MEDIA_ATTACHED,v.a.MEDIA_DETACHING,v.a.MANIFEST_LOADING,v.a.MANIFEST_PARSED,v.a.LEVEL_LOADED,v.a.KEY_LOADED,v.a.FRAG_LOADED,v.a.FRAG_LOAD_EMERGENCY_ABORTED,v.a.FRAG_PARSING_INIT_SEGMENT,v.a.FRAG_PARSING_DATA,v.a.FRAG_PARSED,v.a.ERROR,v.a.AUDIO_TRACK_SWITCHING,v.a.AUDIO_TRACK_SWITCHED,v.a.BUFFER_CREATED,v.a.BUFFER_APPENDED,v.a.BUFFER_FLUSHED))).config=t.config,e.audioCodecSwap=!1,e.ticks=0,e._state=pt,e.ontick=e.tick.bind(e),e;throw new TypeError("Cannot call a class as a function")}var t=i,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i.prototype.destroy=function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),a.prototype.destroy.call(this),this.state=pt},i.prototype.startLoad=function(t){var e,r,i;this.levels?(e=this.lastCurrentTime,r=this.hls,this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.level=-1,this.fragLoadError=0,this.startFragRequested||(-1===(i=r.startLevel)&&(this.bitrateTest=!(i=0)),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1),0<e&&-1===t&&(T.b.log("override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=l,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()):(this.forceStartLoad=!0,this.state=pt)},i.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=pt,this.forceStartLoad=!1},i.prototype.tick=function(){1==++this.ticks&&(this.doTick(),1<this.ticks&&setTimeout(this.tick,1),this.ticks=0)},i.prototype.doTick=function(){switch(this.state){case u:break;case Tt:this.fragLoadError=0;break;case l:this._doTickIdle();break;case vt:var t=this.levels[this.level];t&&t.details&&(this.state=l);break;case mt:var t=performance.now(),e=this.retryDate;(!e||e<=t||this.media&&this.media.seeking)&&(T.b.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=l)}this._checkBuffer(),this._checkFragmentChanged()},i.prototype._doTickIdle=function(){var t=this.hls,e=t.config,r=this.media;if(void 0===this.levelLastLoaded||r||!this.startFragRequested&&e.startFragPrefetch){var i=this.loadedmetadata?r.currentTime:this.nextLoadPosition,a=t.nextLoadLevel,n=this.levels[a];if(n){var s=n.bitrate,o=void 0,o=s?Math.max(8*e.maxBufferSize/s,e.maxBufferLength):e.maxBufferLength,s=(o=Math.min(o,e.maxMaxBufferLength),S.bufferInfo(this.mediaBuffer||r,i,e.maxBufferHole)),e=s.len;if(!(o<=e)){T.b.trace("buffer length of "+e.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),this.level=t.nextLoadLevel=a;o=n.details;if(void 0===o||o.live&&this.levelLastLoaded!==a)this.state=vt;else{t=this.fragPrevious;if(!o.live&&t&&t.sn===o.endSN&&e&&!s.nextStart)if(Math.min(r.duration,t.start+t.duration)-Math.max(s.end,t.start)<=Math.max(.2,t.duration))return n={},this.altAudio&&(n.type="video"),this.hls.trigger(v.a.BUFFER_EOS,n),void(this.state=Et);this._fetchPayloadOrEos(i,s,o)}}}}},i.prototype._fetchPayloadOrEos=function(t,e,r){var i=this.fragPrevious,a=this.level,n=r.fragments,s=n.length;if(0!==s){var o=n[0].start,l=n[s-1].start+n[s-1].duration,e=e.end,d=void 0;if(r.initSegment&&!r.initSegment.data)d=r.initSegment;else if(r.live){var u=this.config.initialLiveManifestSize;if(s<u)return void T.b.warn("Can not start playback of a level, reason: not enough fragments "+s+" < "+u);if(null===(d=this._ensureFragmentAtLivePoint(r,e,o,l,i,n,s)))return}else e<o&&(d=n[0]);(d=d||this._findFragment(o,i,s,n,e,l,r))&&this._loadFragmentOrKey(d,a,r,t,e)}},i.prototype._ensureFragmentAtLivePoint=function(t,e,r,i,a,n,s){var o=this.hls.config,l=this.media,d=void 0,u=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*t.targetduration;return e<Math.max(r-o.maxFragLookUpTolerance,i-u)&&(o=this.liveSyncPosition=this.computeLivePosition(r,t),T.b.log("buffer end: "+e.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+o.toFixed(3)),e=o,l&&l.readyState&&l.duration>o&&(l.currentTime=o),this.nextLoadPosition=o),t.PTSKnown&&i<e&&l&&l.readyState?null:(this.startFragRequested&&!t.PTSKnown&&(a&&((u=a.sn+1)>=t.startSN&&u<=t.endSN&&(r=n[u-t.startSN],a.cc===r.cc)&&T.b.log("live playlist, switching playlist, load frag with next SN: "+(d=r).sn),d||(d=R.search(n,function(t){return a.cc-t.cc}))&&T.b.log("live playlist, switching playlist, load frag with same CC: "+d.sn)),d||(d=n[Math.min(s-1,Math.round(s/2))],T.b.log("live playlist, switching playlist, unknown, load middle frag : "+d.sn))),d)},i.prototype._findFragment=function(t,e,r,i,a,n,s){function o(t){var e=Math.min(h,t.duration);return t.start+t.duration-e<=a?1:t.start-e>a&&t.start?-1:0}var l=this.hls.config,d=void 0,u=void 0,h=l.maxFragLookUpTolerance,c=e?i[e.sn-i[0].sn+1]:void 0;return(u=a<n?(n-h<a&&(h=0),c&&!o(c)?c:R.search(i,o)):i[r-1])&&(n=(d=u).sn-s.startSN,c=e&&d.level===e.level,r=i[n-1],u=i[1+n],e)&&d.sn===e.sn&&(c&&!
1d.backtracked?d.sn<s.endSN?(i=e.deltaPTS)&&i>l.maxBufferHole&&e.dropped&&n?(d=r,T.b.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),e.loadCounter--):T.b.log("SN just loaded, load next one: "+(d=u).sn):d=null:d.backtracked&&(u&&u.backtracked?(T.b.warn("Already backtracked from fragment "+u.sn+", will not backtrack to fragment "+d.sn+". Loading fragment "+u.sn),d=u):(T.b.warn("Loaded fragment with dropped frames, backtracking 1 segment to find a keyframe"),d.dropped=0,r?(r.loadCounter&&r.loadCounter--,(d=r).backtracked=!0):n&&(d=null)))),d},i.prototype._loadFragmentOrKey=function(t,e,r,i,a){var n=this.hls,s=n.config;if(t.decryptdata&&null!=t.decryptdata.uri&&null==t.decryptdata.key)T.b.log("Loading key for "+t.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+e),this.state=gt,n.trigger(v.a.KEY_LOADING,{frag:t});else{if(T.b.log("Loading "+t.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+e+", currentTime:"+i.toFixed(3)+",bufferEnd:"+a.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,t.loadCounter){t.loadCounter++;r=s.fragLoadingLoopThreshold;if(t.loadCounter>r&&Math.abs(this.fragLoadIdx-t.loadIdx)<r)return void n.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:t})}else t.loadCounter=1;t.loadIdx=this.fragLoadIdx,this.fragCurrent=t,this.startFragRequested=!0,isNaN(t.sn)||(this.nextLoadPosition=t.start+t.duration),t.autoLevel=n.autoLevelEnabled,t.bitrateTest=this.bitrateTest,n.trigger(v.a.FRAG_LOADING,{frag:t}),this.demuxer||(this.demuxer=new ht(n,"main")),this.state=yt}},i.prototype.getBufferedFrag=function(e){return R.search(this._bufferedFrags,function(t){return e<t.startPTS?-1:e>t.endPTS?1:0})},i.prototype.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.endPTS+.5):null},i.prototype._checkFragmentChanged=function(){var t,e,r=this.media;r&&r.readyState&&!1===r.seeking&&((e=r.currentTime)>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),S.isBuffered(r,e)?t=this.getBufferedFrag(e):S.isBuffered(r,e+.1)&&(t=this.getBufferedFrag(e+.1)),t)&&((r=t)!==this.fragPlaying&&(this.hls.trigger(v.a.FRAG_CHANGED,{frag:r}),e=r.level,this.fragPlaying&&this.fragPlaying.level===e||this.hls.trigger(v.a.LEVEL_SWITCHED,{level:e}),this.fragPlaying=r))},i.prototype.immediateLevelSwitch=function(){T.b.log("immediateLevelSwitch"),this.immediateSwitch||(this.immediateSwitch=!0,t=void 0,(e=this.media)?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t);var t,e=this.fragCurrent;e&&e.loader&&e.loader.abort(),this.fragCurrent=null,void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},i.prototype.immediateLevelSwitchEnd=function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,S.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())},i.prototype.nextLevelSwitch=function(){var t,e,r,i,a=this.media;a&&a.readyState&&(t=i=r=void 0,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,(i=this.getBufferedFrag(a.currentTime))&&1<i.startPTS&&this.flushMainBuffer(0,i.startPTS-1),r=!a.paused&&(i=this.hls.nextLoadLevel,i=this.levels[i],e=this.fragLastKbps)&&this.fragCurrent?this.fragCurrent.duration*i.bitrate/(1e3*e)+1:0,t=(t=this.getBufferedFrag(a.currentTime+r))&&this.followingBufferedFrag(t))&&((i=this.fragCurrent)&&i.loader&&i.loader.abort(),this.fragCurrent=null,this.flushMainBuffer(t.maxStartPTS,Number.POSITIVE_INFINITY))},i.prototype.flushMainBuffer=function(t,e){this.state=Tt;t={startOffset:t,endOffset:e};this.altAudio&&(t.type="video"),this.hls.trigger(v.a.BUFFER_FLUSHING,t)},i.prototype.onMediaAttached=function(t){t=this.media=this.mediaBuffer=t.media,this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended),t=this.config;this.levels&&t.autoStartLoad&&this.hls.startLoad(t.startPosition)},i.prototype.onMediaDetaching=function(){var t=this.media,e=(t&&t.ended&&(T.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),this.levels);
1e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0,t.backtracked=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("seeked",this.onvseeked),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},i.prototype.onMediaSeeking=function(){var t,e,r,i=this.media,a=i?i.currentTime:void 0,n=this.config,s=(isNaN(a)||T.b.log("media seeking to "+a.toFixed(3)),this.mediaBuffer||i),s=S.bufferInfo(s,a,this.config.maxBufferHole);this.state===yt?(t=this.fragCurrent,0===s.len&&t&&(r=n.maxFragLookUpTolerance,e=t.start-r,r=t.start+t.duration+r,a<e||r<a?(t.loader&&(T.b.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=l):T.b.log("seeking outside of buffer but within currently loaded fragment range"))):this.state===Et&&(0===s.len&&(this.fragPrevious=0),this.state=l),i&&(this.lastCurrentTime=a),this.state!==yt&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*n.fragLoadingLoopThreshold),this.loadedmetadata||(this.nextLoadPosition=this.startPosition=a),this.tick()},i.prototype.onMediaSeeked=function(){var t=this.media,t=t?t.currentTime:void 0;isNaN(t)||T.b.log("media seeked to "+t.toFixed(3)),this.tick()},i.prototype.onMediaEnded=function(){T.b.log("media ended"),this.startPosition=this.lastCurrentTime=0},i.prototype.onManifestLoading=function(){T.b.log("trigger BUFFER_RESET"),this.hls.trigger(v.a.BUFFER_RESET),this._bufferedFrags=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0},i.prototype.onManifestParsed=function(t){var e,r=!1,i=!1,t=(t.levels.forEach(function(t){(e=t.audioCodec)&&(-1!==e.indexOf("mp4a.40.2")&&(r=!0),-1!==e.indexOf("mp4a.40.5"))&&(i=!0)}),this.audioCodecSwitch=r&&i,this.audioCodecSwitch&&T.b.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startLevelLoaded=!1,this.startFragRequested=!1,this.config);(t.autoStartLoad||this.forceStartLoad)&&this.hls.startLoad(t.startPosition)},i.prototype.onLevelLoaded=function(t){var e,r=t.details,t=t.level,i=this.levels[t],a=r.totalduration,n=0;T.b.log("level "+t+" loaded ["+r.startSN+","+r.endSN+"],duration:"+a),this.levelLastLoaded=t,r.live?(e=i.details)&&0<r.fragments.length?(j(e,r),n=r.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(n,e),r.PTSKnown?T.b.log("live playlist sliding:"+n.toFixed(3)):T.b.log("live playlist - outdated PTS, unknown sliding")):(r.PTSKnown=!1,T.b.log("live playlist - first load, unknown sliding")):r.PTSKnown=!1,i.details=r,this.hls.trigger(v.a.LEVEL_UPDATED,{details:r,level:t}),!1===this.startFragRequested&&(-1!==this.startPosition&&-1!==this.lastCurrentTime||(e=r.startTimeOffset,isNaN(e)?r.live?(this.startPosition=this.computeLivePosition(n,r),T.b.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(e<0&&(T.b.log("negative start time offset "+e+", count from end of last fragment"),e=n+a+e),T.b.log("start time offset found in playlist, adjust startPosition to "+e),this.startPosition=e),this.lastCurrentTime=this.startPosition),this.nextLoadPosition=this.startPosition),this.state===vt&&(this.state=l),this.tick()},i.prototype.onKeyLoaded=function(){this.state===gt&&(this.state=l,this.tick())},i.prototype.onFragLoaded=function(t){var e,r,i,a,n,s=this.fragCurrent,o=t.frag;this.state===yt&&s&&"main"===o.type&&o.level===s.level&&o.sn===s.sn&&(a=t.stats,n=(e=this.levels[s.level]).details,T.b.log("Loaded  "+s.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+s.level),this.bitrateTest=!1,this.stats=a,!0===o.bitrateTest&&this.hls.nextLoadLevel?(this.state=l,this.startFragRequested=!1,a.tparsed=a.tbuffered=performance.now(),this.hls.trigger(v.a.FRAG_BUFFERED,{stats:a,frag:s,id:"main"}),this.tick()):"initSegment"===o.sn?(this.state=l,a.tparsed=a.tbuffered=performance.now(),n.initSegment.data=t.payload,this.hls.trigger(v.a.FRAG_BUFFERED,{stats:a,frag:s,id:"main"}),this.tick()):(this.state=d,o=n.totalduration,a=s.level,i=s.sn,r=this.config.defaultAudioCodec||e.audioCodec,this.audioCodecSwap&&(T.b.log("swapping playlist audio codec"),r=(r=void 0===r?this.lastAudioCodec:r)&&(-1!==r.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingBuffering=!0,this.appended=!1,T.b.log("Parsing "+i+" of ["+n.startSN+" ,"+n.endSN+"],level "+a+", cc "+s.cc),i=(i=this.demuxer)||(this.demuxer=new ht(this.hls,"main")),a=!((a=this.media)&&a.seeking)&&(n.PTSKnown||!n.live),n=n.initSegment?n.initSegment.data:[],i.push(t.payload,n,r,e.videoCodec,s,o,a,void 0))),this.fragLoadError=0},i.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;if(e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===d){var i,a,n=t.tracks;for(i in n.audio&&this.altAudio&&delete n.audio,(a=n.audio)&&(r=this.levels[this.level].audioCodec,e=navigator.userAgent.toLowerCase(),r&&this.audioCodecSwap&&(T.b.log("swapping playlist audio codec"),r=-1!==r.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&-1===e.indexOf("firefox")&&(r="mp4a.40.5"),-1!==e.indexOf("android")&&"audio/mpeg"!==a.container&&T.b.log("Android: force audio codec to "+(r="mp4a.40.2")),a.levelCodec=r,a.id=t.id),(
1a=n.video)&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=t.id),this.hls.trigger(v.a.BUFFER_CODECS,n),n){a=n[i],T.b.log("main track:"+i+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var s=a.initSegment;s&&(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(v.a.BUFFER_APPENDING,{type:i,data:s,parent:"main",content:"initSegment"}))}this.tick()}},i.prototype.onFragParsingData=function(e){var r=this,t=this.fragCurrent,i=e.frag;if(t&&"main"===e.id&&i.sn===t.sn&&i.level===t.level&&("audio"!==e.type||!this.altAudio)&&this.state===d){var i=this.levels[this.level],a=t;if(isNaN(e.endPTS)&&(e.endPTS=e.startPTS+t.duration,e.endDTS=e.startDTS+t.duration),T.b.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0)),"video"===e.type)if(a.dropped=e.dropped,a.dropped){if(!a.backtracked)return T.b.warn("missing video frame(s), backtracking fragment"),a.backtracked=!0,this.nextLoadPosition=e.startPTS,this.state=l,this.fragPrevious=a,void this.tick();T.b.warn("Already backtracked on this fragment, appending with the gap")}else a.backtracked=!1;var t=G(i.details,a,e.startPTS,e.endPTS,e.startDTS,e.endDTS),n=this.hls;n.trigger(v.a.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:t,type:e.type,start:e.startPTS,end:e.endPTS}),[e.data1,e.data2].forEach(function(t){t&&t.length&&r.state===d&&(r.appended=!0,r.pendingBuffering=!0,n.trigger(v.a.BUFFER_APPENDING,{type:e.type,data:t,parent:"main",content:"data"}))}),this.tick()}},i.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"main"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===d&&(this.stats.tparsed=performance.now(),this.state=bt,this._checkAppendedParsed())},i.prototype.onAudioTrackSwitching=function(t){var e=!!t.url,t=t.id;e||(this.mediaBuffer!==this.media&&(T.b.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media,(e=this.fragCurrent).loader&&(T.b.log("switching to main audio track, cancel main fragment load"),e.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=l),(e=this.hls).trigger(v.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),e.trigger(v.a.AUDIO_TRACK_SWITCHED,{id:t}),this.altAudio=!1)},i.prototype.onAudioTrackSwitched=function(t){var e,t=t.id,t=!!this.hls.audioTracks[t].url;t&&(e=this.videoBuffer)&&this.mediaBuffer!==e&&(T.b.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e),this.altAudio=t,this.tick()},i.prototype.onBufferCreated=function(t){var e,r=t.tracks,i=void 0,a=void 0,n=!1;for(e in r){var s=r[e];"main"===s.id?(i=s,"video"===(a=e)&&(this.videoBuffer=r[e].buffer)):n=!0}n&&i?(T.b.log("alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media},i.prototype.onBufferAppended=function(t){var e;"main"!==t.parent||(e=this.state)!==d&&e!==bt||(this.pendingBuffering=0<t.pending,this._checkAppendedParsed())},i.prototype._checkAppendedParsed=function(){var t,e,r;this.state!==bt||this.appended&&this.pendingBuffering||((t=this.fragCurrent)&&(e=this.mediaBuffer||this.media,T.b.log("main buffered : "+ct.toString(e.buffered)),(r=this._bufferedFrags.filter(function(t){return S.isBuffered(e,(t.startPTS+t.endPTS)/2)})).push(t),this._bufferedFrags=r.sort(function(t,e){return t.startPTS-e.startPTS}),this.fragPrevious=t,(r=this.stats).tbuffered=performance.now(),this.fragLastKbps=Math.round(8*r.total/(r.tbuffered-r.tfirst)),this.hls.trigger(v.a.FRAG_BUFFERED,{stats:r,frag:t,id:"main"}),this.state=l),this.tick())},i.prototype.onError=function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var r,i,a=this.media,n=a&&S.isBuffered(a,a.currentTime)&&S.isBuffered(a,a.currentTime+.5);switch(t.details){case b.a.FRAG_LOAD_ERROR:case b.a.FRAG_LOAD_TIMEOUT:case b.a.KEY_LOAD_ERROR:case b.a.KEY_LOAD_TIMEOUT:t.fatal||((i=this.fragLoadError)?i++:i=1,i<=(r=this.config).fragLoadingMaxRetry||n||e.autoLevel&&e.level?(this.fragLoadError=i,e.loadCounter=0,i=Math.min(Math.pow(2,i-1)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout),T.b.warn("mediaController: frag loading failed, retry in "+i+" ms"),this.retryDate=performance.now()+i,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.state=mt):(T.b.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=u));break;case b.a.FRAG_LOOP_LOADING_ERROR:t.fatal||(n?(this._reduceMaxBufferLength(e.duration),this.state=l):e.autoLevel&&0!==e.level||(t.fatal=!0,this.state=u));break;case b.a.LEVEL_LOAD_ERROR:case b.a.LEVEL_LOAD_TIMEOUT:this.state!==u&&(t.fatal?(this.state=u,T.b.warn("streamController: "+t.details+",switch to "+this.state+" state ...")):t.levelRetry||this.state!==vt||(this.state=l));break;case b.a.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==d&&this.state!==bt||(n?(this._reduceMaxBufferLength(this.config.maxBufferLength),this.state=l):(T.b.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.flushMainBuffer(0,Number.POSITIVE_INFINITY)))}}},i.prototype._reduceMaxBufferLength=function(t){var e=this.config;e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,T.b.warn("main:reduce max buffer length to "+e.maxMaxBufferLength+"s"),this.fragLoadIdx+=2*e.fragLoadingLoopThreshold)},i.prototype._checkBuffer=function(){var t,e,r,i,a,n,s,o,l=this.media,d=this.config;l&&l.readyState&&(t=l.currentTime,r=(s=this.mediaBuffer||l).buffered,!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,e=l.seeking?t:this.startPosition,s=S.isBuffered(s,e),r=r.start(0),(t!==e||!s&&Math.abs(e-r)<d.maxSeekHole)&&(T.b.log("target start position:"+e),s||T.b.log("target start position not buffered, seek to buffered.start(0) "+(e=r)),T.b.log("adjust currentTime from "+t+" to "+e),l.currentTime=e)):this.immediateSwitch?this.immediateLevelSwitchEnd():(s=S.bufferInfo(l,t,0),r=!(l.paused||l.ended||0===l.buffered.length),t!==this.lastCurrentTime?(this.stallReported&&(T.b.warn("playback not stuck anymore @"+t+", after "+Math.round(performance.now()-this.stalled)+"ms"),this.stallReported=!1),this.stalled=void 0,this.nudgeRetry=0):r&&(e=performance.now(),r=this.hls,this.stalled?(i=e-this.stalled,a=s.len,n=this.nudgeRetry||0,a<=.5&&i>1e3*d.lowBufferWatchdogPeriod?(this.stallReported||(this.stallReported=!0,T.b.warn("playback stalling in low buffer @"+t),r.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:a}
1)),o=(s=s.nextStart)-t,s&&o<d.maxSeekHole&&0<o&&(this.nudgeRetry=++n,o=n*d.nudgeOffset,T.b.log("adjust currentTime from "+l.currentTime+" to next buffered @ "+s+" + nudge "+o),l.currentTime=s+o,this.stalled=void 0,r.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:s+o-t}))):.5<a&&i>1e3*d.highBufferWatchdogPeriod&&(this.stallReported||(this.stallReported=!0,T.b.warn("playback stalling in high buffer @"+t),r.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_STALLED_ERROR,fatal:!1,buffer:a})),this.stalled=void 0,this.nudgeRetry=++n,n<d.nudgeMaxRetry?(o=(s=l.currentTime)+n*d.nudgeOffset,T.b.log("adjust currentTime from "+s+" to "+o),l.currentTime=o,r.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_NUDGE_ON_STALL,fatal:!1})):(T.b.error("still stuck in high buffer @"+t+" after "+d.nudgeMaxRetry+", raise fatal error"),r.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_STALLED_ERROR,fatal:!0})))):(this.stalled=e,this.stallReported=!1))))},i.prototype.onFragLoadEmergencyAborted=function(){this.state=l,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},i.prototype.onBufferFlushed=function(){var e=this.mediaBuffer||this.media;this._bufferedFrags=this._bufferedFrags.filter(function(t){return S.isBuffered(e,(t.startPTS+t.endPTS)/2)}),this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=l,this.fragPrevious=null},i.prototype.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},i.prototype.computeLivePosition=function(t,e){var r=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*e.targetduration;return t+Math.max(0,e.totalduration-r)},ft(i,[{key:"state",set:function(t){var e;this.state!==t&&(e=this.state,this._state=t,T.b.log("main stream:"+e+"->"+t),this.hls.trigger(v.a.STREAM_STATE_TRANSITION,{previousState:e,nextState:t}))},get:function(){return this._state}},{key:"currentLevel",get:function(){var t=this.media;if(t){t=this.getBufferedFrag(t.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;return t?this.followingBufferedFrag(this.getBufferedFrag(t.currentTime)):null}},{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(t){this._liveSyncPosition=t}}]),i}(a),St=function(t,e,r){return e&&ne(t.prototype,e),r&&ne(t,r),t},At=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,e.call(this,t,v.a.MANIFEST_LOADED,v.a.LEVEL_LOADED,v.a.FRAG_LOADED,v.a.ERROR))).ontick=t.tick.bind(t),t._manualLevel=-1,t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){this.cleanTimer(),this._manualLevel=-1},r.prototype.cleanTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},r.prototype.startLoad=function(){this.canload=!0;var t=this._levels;t&&t.forEach(function(t){t.loadError=0;var e=t.details;e&&e.live&&(t.details=void 0)}),this.timer&&this.tick()},r.prototype.stopLoad=function(){this.canload=!1},r.prototype.onManifestLoaded=function(t){function r(t,e){return MediaSource.isTypeSupported(t+"/mp4;codecs="+e)}var e,i=[],a=[],n={},s=!1,o=!1,l=this.hls,d=/chrome|firefox/.test(navigator.userAgent.toLowerCase());if(t.levels.forEach(function(t){t.videoCodec&&(s=!0),d&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0),(t.audioCodec||t.attrs&&t.attrs.AUDIO)&&(o=!0);var e=n[t.bitrate];void 0===e?(n[t.bitrate]=i.length,t.url=[t.url],t.urlId=0,i.push(t)):i[e].url.push(t.url)}
1),s&&o?i.forEach(function(t){t.videoCodec&&a.push(t)}):a=i,(a=a.filter(function(t){var e=t.audioCodec,t=t.videoCodec;return(!e||r("audio",e))&&(!t||r("video",t))})).length){e=a[0].bitrate,a.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=a;for(var u=0;u<a.length;u++)if(a[u].bitrate===e){this._firstLevel=u,T.b.log("manifest loaded,"+a.length+" level(s) found, first bitrate:"+e);break}l.trigger(v.a.MANIFEST_PARSED,{levels:a,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:s,altAudio:0<t.audioTracks.length})}else l.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:l.url,reason:"no level with compatible codecs found in manifest"})},r.prototype.setLevelInternal=function(t){var e,r=this._levels,i=this.hls;0<=t&&t<r.length?(this.cleanTimer(),this._level!==t&&(T.b.log("switching to level "+t),(e=r[this._level=t]).level=t,i.trigger(v.a.LEVEL_SWITCH,e),i.trigger(v.a.LEVEL_SWITCHING,e)),(r=(e=r[t]).details)&&!0!==r.live||(r=e.urlId,i.trigger(v.a.LEVEL_LOADING,{url:e.url[r],level:t,id:r}))):i.trigger(v.a.ERROR,{type:b.b.OTHER_ERROR,details:b.a.LEVEL_SWITCH_ERROR,level:t,fatal:!1,reason:"invalid level idx"})},r.prototype.onError=function(t){if(t.fatal)t.type===b.b.NETWORK_ERROR&&this.cleanTimer();else{var e,r=t.details,i=this.hls,a=void 0,n=void 0,s=!1;switch(r){case b.a.FRAG_LOAD_ERROR:case b.a.FRAG_LOAD_TIMEOUT:case b.a.FRAG_LOOP_LOADING_ERROR:case b.a.KEY_LOAD_ERROR:case b.a.KEY_LOAD_TIMEOUT:a=t.frag.level;break;case b.a.LEVEL_LOAD_ERROR:case b.a.LEVEL_LOAD_TIMEOUT:a=t.context.level,s=!0;break;case b.a.REMUX_ALLOC_ERROR:a=t.level}void 0!==a&&((n=this._levels[a]).loadError?n.loadError++:n.loadError=1,1<(e=n.url.length)&&n.loadError<e?(n.urlId=(n.urlId+1)%e,n.details=void 0,T.b.warn("level controller,"+r+" for level "+a+": switching to redundant stream id "+n.urlId)):-1===this._manualLevel&&a?(T.b.warn("level controller,"+r+": switch-down for next fragment"),i.nextAutoLevel=Math.max(0,a-1)):n&&n.details&&n.details.live?(T.b.warn("level controller,"+r+" on live stream, discard"),s&&(this._level=void 0)):r!==b.a.LEVEL_LOAD_ERROR&&r!==b.a.LEVEL_LOAD_TIMEOUT||((e=i.media)&&S.isBuffered(e,e.currentTime)&&S.isBuffered(e,e.currentTime+.5)?(n=i.config.levelLoadingRetryDelay,T.b.warn("level controller,"+r+", but media buffered, retry in "+n+"ms"),this.timer=setTimeout(this.ontick,n),t.levelRetry=!0):(T.b.error("cannot recover "+r+" error"),this._level=void 0,this.cleanTimer(),t.fatal=!0)))}},r.prototype.onFragLoaded=function(t){var t=t.frag;t&&"main"===t.type&&(t=this._levels[t.level])&&(t.loadError=0)},r.prototype.onLevelLoaded=function(t){var e,r,i=t.level;i===this._level&&((i=this._levels[i]).loadError=0,(e=t.details).live?(r=1e3*(e.averagetargetduration||e.targetduration),(i=i.details)&&e.endSN===i.endSN&&(r/=2,T.b.log("same live playlist, reload twice faster")),r-=performance.now()-t.stats.trequest,r=Math.max(1e3,Math.round(r)),T.b.log("live playlist, reload in "+r+" ms"),this.timer=setTimeout(this.ontick,r)):this.timer=null)},r.prototype.tick=function(){var t,e,r=this._level;void 0!==r&&this.canload&&(t=this._levels[r])&&t.url&&(e=t.urlId,this.hls.trigger(v.a.LEVEL_LOADING,{url:t.url[e],level:r,id:e}))},St(r,[{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this._level},set:function(t){var e=this._levels;e&&e.length>t&&(this._level===t&&void 0!==e[t].details||this.setLevelInternal(t))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(t){this._manualLevel=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){var t;return void 0===this._startLevel?void 0!==(t=this.hls.config.startLevel)?t:this._firstLevel:this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this._manualLevel?this._manualLevel:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this._manualLevel&&(this.hls.nextAutoLevel=t)}}]),r}(a),wt=t(3),_t=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}
1(this,e.call(this,t,v.a.MEDIA_ATTACHED,v.a.MEDIA_DETACHING,v.a.FRAG_PARSING_METADATA))).id3Track=void 0,t.media=void 0,t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){a.prototype.destroy.call(this)},r.prototype.onMediaAttached=function(t){this.media=t.media,this.media&&(this.id3Track=this.media.addTextTrack("metadata","id3"),this.id3Track.mode="hidden")},r.prototype.onMediaDetaching=function(){this.media=void 0},r.prototype.onFragParsingMetadata=function(t){for(var e=t.frag,r=t.samples,i=window.WebKitDataCue||window.VTTCue||window.TextTrackCue,a=0;a<r.length;a++){var n=wt.a.getID3Frames(r[a].data);if(n){var s=r[a].pts,o=a<r.length-1?r[a+1].pts:e.endPTS;s===o&&(o+=1e-4);for(var l=0;l<n.length;l++){var d,u=n[l];wt.a.isTimeStampFrame(u)||((d=new i(s,o,"")).value=u,this.id3Track.addCue(d))}}}},r}(a);i.prototype.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},i.prototype.getTotalWeight=function(){return this.totalWeight_},i.prototype.getEstimate=function(){var t;return this.alpha_?(t=1-Math.pow(this.alpha_,this.totalWeight_),this.estimate_/t):this.estimate_};var Lt=i;c.prototype.sample=function(t,e){e=8e3*e/(t=Math.max(t,this.minDelayMs_)),t/=1e3;this.fast_.sample(t,e),this.slow_.sample(t,e)},c.prototype.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},c.prototype.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},c.prototype.destroy=function(){};var kt=c,Dt=function(t,e,r){return e&&ae(t.prototype,e),r&&ae(t,r),t},e=function(r){function i(t){var e;if(this instanceof i)return(e=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,r.call(this,t,v.a.FRAG_LOADING,v.a.FRAG_LOADED,v.a.FRAG_BUFFERED,v.a.ERROR))).lastLoadedFragLevel=0,e._nextAutoLevel=-1,e.hls=t,e.timer=null,e._bwEstimator=null,e.onCheck=e._abandonRulesCheck.bind(e),e;throw new TypeError("Cannot call a class as a function")}var t=i,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i.prototype.destroy=function(){this.clearTimer(),a.prototype.destroy.call(this)},i.prototype.onFragLoading=function(t){var e,r,i,a,n=t.frag;"main"===n.type&&(this.timer||(this.timer=setInterval(this.onCheck,100)),this._bwEstimator||(e=this.hls,t=t.frag.level,t=e.levels[t].details.live,r=e.config,a=i=void 0,a=t?(i=r.abrEwmaFastLive,r.abrEwmaSlowLive):(i=r.abrEwmaFastVoD,r.abrEwmaSlowVoD),this._bwEstimator=new kt(e,a,i,r.abrEwmaDefaultEstimate)),this.fragCurrent=n)},i.prototype._abandonRulesCheck=function(){var t=this.hls,e=t.media,r=this.fragCurrent,i=r.loader,a=t.minAutoLevel;if(!i||i.stats&&i.stats.aborted)T.b.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer();else{var n=i.stats;if(e&&n&&(!e.paused&&0!==e.playbackRate||!e.readyState)&&r.autoLevel&&r.level){var s=performance.now()-n.trequest,o=Math.abs(e.playbackRate);if(s>500*r.duration/o){var l=t.levels,d=Math.max(1,n.bw?n.bw/8:1e3*n.loaded/s),u=l[r.level],u=u.realBitrate?Math.max(u.realBitrate,u.bitrate):u.bitrate,u=n.total||Math.max(n.loaded,Math.round(r.duration*u/8)),h=e.currentTime,u=(u-n.loaded)/d,c=(S.bufferInfo(e,h,t.config.maxBufferHole).end-h)/o;if(c<2*r.duration/o&&c<u){for(var f=void 0,p=void 0,p=r.level-1;a<p;p--){var g=l[p].realBitrate?Math.max(l[p].realBitrate,l[p].bitrate):l[p].bitrate;if((f=r.duration*g/(6.4*d))<c)break}
1f<u&&(T.b.warn("loading too slow, abort fragment loading and switch to level "+p+":fragLoadedDelay["+p+"]<fragLoadedDelay["+(r.level-1)+"];bufferStarvationDelay:"+f.toFixed(1)+"<"+u.toFixed(1)+":"+c.toFixed(1)),t.nextLoadLevel=p,this._bwEstimator.sample(s,n.loaded),i.abort(),this.clearTimer(),t.trigger(v.a.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,stats:n}))}}}}},i.prototype.onFragLoaded=function(t){var e,r,i=t.frag;"main"!==i.type||isNaN(i.sn)||(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate&&(e=((i=this.hls.levels[i.level]).loaded?i.loaded.bytes:0)+t.stats.loaded,r=(i.loaded?i.loaded.duration:0)+t.frag.duration,i.loaded={bytes:e,duration:r},i.realBitrate=Math.round(8*e/r)),t.frag.bitrateTest&&((i=t.stats).tparsed=i.tbuffered=i.tload,this.onFragBuffered(t)))},i.prototype.onFragBuffered=function(t){var e,r=t.stats,t=t.frag;!0===r.aborted||1!==t.loadCounter||"main"!==t.type||isNaN(t.sn)||t.bitrateTest&&r.tload!==r.tbuffered||(e=r.tparsed-r.trequest,T.b.log("latency/loading/parsing/append/kbps:"+Math.round(r.tfirst-r.trequest)+"/"+Math.round(r.tload-r.tfirst)+"/"+Math.round(r.tparsed-r.tload)+"/"+Math.round(r.tbuffered-r.tparsed)+"/"+Math.round(8*r.loaded/(r.tbuffered-r.trequest))),this._bwEstimator.sample(e,r.loaded),r.bwEstimate=this._bwEstimator.getEstimate(),t.bitrateTest?this.bitrateTestDelay=e/1e3:this.bitrateTestDelay=0)},i.prototype.onError=function(t){switch(t.details){case b.a.FRAG_LOAD_ERROR:case b.a.FRAG_LOAD_TIMEOUT:this.clearTimer()}},i.prototype.clearTimer=function(){clearInterval(this.timer),this.timer=null},i.prototype._findBestLevel=function(t,e,r,i,a,n,s,o,l){for(var d=a;i<=d;d--){var u=l[d].details,h=u?u.totalduration/u.fragments.length:e,u=!!u&&u.live,c=d<=t?s*r:o*r,f=l[d].realBitrate?Math.max(l[d].realBitrate,l[d].bitrate):l[d].bitrate,p=f*h/c;if(T.b.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+d+"/"+Math.round(c)+"/"+f+"/"+h+"/"+n+"/"+p),f<c&&(!p||u&&!this.bitrateTestDelay||p<n))return d}return-1},Dt(i,[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this._bwEstimator;return-1===t||e&&e.canEstimate()?(e=this._nextABRAutoLevel,-1!==t?Math.min(t,e):e):t},set:function(t){this._nextAutoLevel=t}},{key:"_nextABRAutoLevel",get:function(){var t=this.hls,e=t.maxAutoLevel,r=t.levels,i=t.config,a=t.minAutoLevel,t=t.media,n=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,o=t?t.currentTime:0,l=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,d=this._bwEstimator?this._bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,t=(S.bufferInfo(t,o,i.maxBufferHole).end-o)/l,o=this._findBestLevel(n,s,d,a,e,t,i.abrBandWidthFactor,i.abrBandWidthUpFactor,r);if(0<=o)return o;T.b.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var u,l=s?Math.min(s,i.maxStarvationDelay):i.maxStarvationDelay,h=i.abrBandWidthFactor,c=i.abrBandWidthUpFactor;return 0==t&&(u=this.bitrateTestDelay)&&(l=(s?Math.min(s,i.maxLoadingDelay):i.maxLoadingDelay)-u,T.b.trace("bitrate test took "+Math.round(1e3*u)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*l)+" ms"),h=c=1),o=this._findBestLevel(n,s,d,a,e,t+l,h,c,r),Math.max(o,0)}}]),i}(a),t=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,e.call(this,t,v.a.MEDIA_ATTACHING,v.a.MEDIA_DETACHING,v.a.MANIFEST_PARSED,v.a.BUFFER_RESET,v.a.BUFFER_APPENDING,v.a.BUFFER_CODECS,v.a.BUFFER_EOS,v.a.BUFFER_FLUSHING,v.a.LEVEL_PTS_UPDATED,v.a.LEVEL_UPDATED)))._msDuration=null,t._levelDuration=null,t.onsbue=t.onSBUpdateEnd.bind(t),t.onsbe=t.onSBUpdateError.bind(t),t.pendingTracks={},t.tracks={},t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){a.prototype.destroy.call(this)},r.prototype.onLevelPtsUpdated=function(t){var e=t.type,r=this.tracks.audio;if("audio"===e&&r&&"audio/mpeg"===r.container){e=this.sourceBuffer.audio;if(.1<Math.abs(e.timestampOffset-t.start)){r=e.updating;try{e.abort()}catch(t){r=!0,T.b.warn("can not abort audio buffer: "+t)}r?this.audioTimestampOffset=t.start:(T.b.warn("change mpeg audio timestamp offset from "+e.timestampOffset+" to "+t.start),e.timestampOffset=t.start)}}},r.prototype.onManifestParsed=function(t){var e=t.audio,r=t.video||t.levels.length&&t.audio,i=0;t.altAudio&&(e||r)&&T.b.log((i=(e?1:0)+(r?1:0))+" sourceBuffer(s) expected"),this.sourceBufferNb=i},r.prototype.onMediaAttaching=function(t){var e,t=this.media=t.media;t&&(e=this.mediaSource=new MediaSource,this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),e.addEventListener("sourceopen",this.onmso),e.addEventListener("sourceended",this.onmse),e.addEventListener("sourceclose",this.onmsc),t.src=URL.createObjectURL(e))},r.prototype.onMediaDetaching=function(){T.b.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){T.b.warn("onMediaDetaching:"+t.message+" while calling endOfStream")}t.removeEventListener("sourceopen",this.onmso),t.removeEventListener("sourceended",this.onmse),t.removeEventListener("sourceclose",this.onmsc),this.media&&(URL.revokeObjectURL(this.media.src),this.media.removeAttribute("src"),this.media.load()),this.mediaSource=null,this.media=null,this.pendingTracks={},this.tracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(v.a.MEDIA_DETACHED)},r.prototype.onMediaSourceOpen=function(){T.b.log("media source opened"),this.hls.trigger(v.a.MEDIA_ATTA
1CHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()},r.prototype.checkPendingTracks=function(){var t=this.pendingTracks,e=Object.keys(t).length;e&&(this.sourceBufferNb<=e||0===this.sourceBufferNb)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())},r.prototype.onMediaSourceClose=function(){T.b.log("media source closed")},r.prototype.onMediaSourceEnded=function(){T.b.log("media source ended")},r.prototype.onSBUpdateEnd=function(){this.audioTimestampOffset&&(t=this.sourceBuffer.audio,T.b.warn("change mpeg audio timestamp offset from "+t.timestampOffset+" to "+this.audioTimestampOffset),t.timestampOffset=this.audioTimestampOffset,delete this.audioTimestampOffset),this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1;var r=this.parent,t=this.segments.reduce(function(t,e){return e.parent===r?t+1:t},0);this.hls.trigger(v.a.BUFFER_APPENDED,{parent:r,pending:t}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()},r.prototype.onSBUpdateError=function(t){T.b.error("sourceBuffer error:",t),this.hls.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_APPENDING_ERROR,fatal:!1})},r.prototype.onBufferReset=function(){var t,e=this.sourceBuffer;for(t in e){var r=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0},r.prototype.onBufferCodecs=function(t){if(0===Object.keys(this.sourceBuffer).length){for(var e in t)this.pendingTracks[e]=t[e];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks()}},r.prototype.createSourceBuffers=function(t){var e,r=this.sourceBuffer,i=this.mediaSource;for(e in t)if(!r[e]){var a=t[e],n=a.levelCodec||a.codec,s=a.container+";codecs="+n;T.b.log("creating sourceBuffer("+s+")");try{var o=r[e]=i.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe),this.tracks[e]={codec:n,container:a.container},a.buffer=o}catch(t){T.b.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:s})}}this.hls.trigger(v.a.BUFFER_CREATED,{tracks:t})},r.prototype.onBufferAppending=function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())},r.prototype.onBufferAppendFail=function(t){T.b.error("sourceBuffer error:",t.event),this.hls.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.BUFFER_APPENDING_ERROR,fatal:!1})},r.prototype.onBufferEos=function(t){var e,r=this.sourceBuffer,i=t.type;for(e in r)i&&e!==i||r[e].ended||(r[e].ended=!0,T.b.log(e+" sourceBuffer now EOS"));this.checkEos()},r.prototype.checkEos=function(){var t=this.sourceBuffer,e=this.mediaSource;if(e&&"open"===e.readyState){for(var r in t){r=t[r];if(!r.ended)return;if(r.updating)return void(this._needsEos=!0)}T.b.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment");try{e.endOfStream()}catch(t){T.b.warn("exception while calling mediaSource.endOfStream()")}}this._needsEos=!1},r.prototype.onBufferFlushing=function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()},r.prototype.onLevelUpdated=function(t){t=t.details;0!==t.fragments.length&&(this._levelDuration=t.totalduration+t.fragments[0].start,this.updateMediaElementDuration())},r.prototype.updateMediaElementDuration=function(){var t=this.media,e=this.mediaSource,r=this.sourceBuffer,i=this._levelDuration;if(null!==i&&t&&e&&r&&0!==t.readyState&&"open"===e.readyState){for(var a in r)if(r[a].updating)return;null===this._msDuration&&(this._msDuration=e.duration);t=t.duration;(i>this._msDuration&&t<i||t===1/0||isNaN(t))&&(T.b.log("Updating mediasource duration to "+i.toFixed(3)),this._msDuration=e.duration=i)}},r.prototype.doFlush=function(){for(;this.flushRange.length;){var t=this.flushRange[0];if(!this.flushBuffer(t.start,t.end,t.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var e=0,r=this.sourceBuffer;try{for(var i in r)e+=r[i].buffered.length}catch(t){T.b.error("error while accessing sourceBuffer.buffered")}this.appended=e,this.hls.trigger(v.a.BUFFER_FLUSHED)}},r.prototype.doAppending=function(){var t=this.hls,e=this.sourceBuffer,r=this.segments;if(Object.keys(e).length)if(this.media.error)this.segments=[],T.b.error("trying to append although a media error occured, flush segment and abort");else if(!this.appending&&r&&r.length){var i=r.shift();try{var a=e[i.type];a?a.updating?r.unshift(i):(a.ended=!1,this.parent=i.parent,a.appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(e){T.b.error("error while trying to append buffer:"+e.message),r.unshift(i);a={type:b.b.MEDIA_ERROR,parent:i.parent};22===e.code?(this.segments=[],a.details=b.a.BUFFER_FULL_ERROR,a.fatal=!1,t.trigger(v.a.ERROR,a)):(this.appendError?this.appendError++:this.appendError=1,a.details=b.a.BUFFER_APPEND_ERROR,this.appendError>t.config.appendErrorMaxRetry?(T.b.log("fail "+t.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],a.fatal=!0):a.fatal=!1,t.trigger(v.a.ERROR,a))}}},r.prototype.flushBuffer=function(t,e,r){var i,a,n,s,o,l,d=this.sourceBuffer;if(Object.keys(d).length){if(T.b.log("flushBuffer,pos/start/end: "+this.media.currentTime.toFixed(3)+"/"+t+"/"+e),this.flushBufferCounter<this.appended){for(var u in d)if(!r||u===r){if((i=d[u]).ended=!1,i.updating)return T.b.warn("cannot flush, sb updating in progress"),!1;try{for(a=0;a<i.buffered.length;a++)if(n=i.buffered.start(a),s=i.buffered.end(a),l=-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&e===Number.POSITIVE_INFINITY?(o=t,e):(o=Math.max(n,t),Math.min(s,e)),.5<Math.min(l,s)-o)return this.flushBufferCounter++,T.b.log("flush "+u+" ["+o+","+l+"], of ["+n+","+s+"], pos:"+this.media.currentTime),i.remove(o,l),!1}catch(t){T.b.warn("exception while accessing sourcebuffer, it might have been removed from MediaSource")}}}else T.b.warn("abort flushing too many retries");T.b.log("buffer flushed")}return!0},r}(a),Ot=function(t,e,r){return e&&ie(t.prototype,e),r&&ie(t,r),t},Ct=function(r){function a(t){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");var e=this,t=r.call(this,t,v.a.FPS_DROP_LEVEL_CAPPING,v.a.MEDIA_ATTA
1CHING,v.a.MANIFEST_PARSED);if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}var t=a,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a.prototype.destroy=function(){this.hls.config.capLevelToPlayerSize&&(this.media=this.restrictedLevels=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer)&&(this.timer=clearInterval(this.timer))},a.prototype.onFpsDropLevelCapping=function(t){a.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},a.prototype.onMediaAttaching=function(t){this.media=t.media instanceof HTMLVideoElement?t.media:null},a.prototype.onManifestParsed=function(t){var e=this.hls;this.restrictedLevels=[],e.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=t.levels,e.firstLevel=this.getMaxLevel(t.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},a.prototype.detectPlayerSize=function(){var t,e;this.media&&(t=this.levels?this.levels.length:0)&&((e=this.hls).autoLevelCapping=this.getMaxLevel(t-1),e.autoLevelCapping>this.autoLevelCapping&&e.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping)},a.prototype.getMaxLevel=function(r){var t,i=this;return this.levels?(t=this.levels.filter(function(t,e){return a.isLevelAllowed(e,i.restrictedLevels)&&e<=r}),a.getMaxLevelByMediaSize(t,this.mediaWidth,this.mediaHeight)):-1},a.isLevelAllowed=function(t){return-1===(1<arguments.length&&void 0!==arguments[1]?arguments[1]:[]).indexOf(t)},a.getMaxLevelByMediaSize=function(t,e,r){if(!t||!t.length)return-1;for(var i,a=t.length-1,n=0;n<t.length;n+=1){var s=t[n];if((s.width>=e||s.height>=r)&&(!(i=t[n+1])||s.width!==i.width||s.height!==i.height)){a=n;break}}return a},Ot(a,[{key:"mediaWidth",get:function(){var t=void 0,e=this.media;return e&&(t=e.width||e.clientWidth||e.offsetWidth,t*=a.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0,e=this.media;return e&&(t=e.height||e.clientHeight||e.offsetHeight,t*=a.contentScaleFactor),t}}],[{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}}]),a}(a),It=function(r){function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");var e=this,t=r.call(this,t,v.a.MEDIA_ATTACHING);if(e)return!t||"object"!=typeof t&&"function"!=typeof t?e:t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}var t=i,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i.prototype.destroy=function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1},i.prototype.onMediaAttaching=function(t){var e=this.hls.config;e.capLevelOnFPSDrop&&("function"==typeof(this.video=t.media instanceof HTMLVideoElement?t.media:null).getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),e.fpsDroppedMonitoringPeriod))},i.prototype.checkFPS=function(t,e,r){var i,a,n,s,o=performance.now();e&&(this.lastTime&&(s=o-this.lastTime,i=r-this.lastDroppedFrames,a=e-this.lastDecodedFrames,s=1e3*i/s,(n=this.hls).trigger(v.a.FPS_DROP,{currentDropped:i,currentDecoded:a,totalDroppedFrames:r}),0<s)&&i>n.config.fpsDroppedMonitoringThreshold*a&&(s=n.currentLevel,T.b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),0<s)&&(-1===n.autoLevelCapping||n.autoLevelCapping>=s)&&(n.trigger(v.a.FPS_DROP_LEVEL_CAPPING,{level:--s,droppedLevel:n.currentLevel}),n.autoLevelCapping=s,n.streamController.nextLevelSwitch()),this.lastTime=o,this.lastDroppedFrames=r,this.lastDecodedFrames=e)},i.prototype.checkFPSInterval=function(){var t,e=this.video;e&&(this.isVideoPlaybackQualityAvailable?(t=e.getVideoPlaybackQuality(),this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)):this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount))},i}(a);r.prototype.destroy=function(){this.abort(),this.loader=null},r.prototype.abort=function(){var t=this.loader;t&&4!==t.readyState&&(this.stats.aborted=!0,t.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null},r.prototype.load=function(t,e,r){this.context=t,this.config=e,this.callbacks=r,this.stats={trequest:performance.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()},r.prototype.loadInternal=function(){var t=this.context,e="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest,r=this.stats,i=(r.tfirst=0,r.loaded=0,this.xhrSetup);try{if(i)try{i(e,t.url)}catch(r){e.open("GET",t.url,!0),i(e,t.url)}e.readyState||e.open("GET",t.url,!0)}catch(r){return void this.callbacks.onError({code:e.status,text:r.message},t,e)}t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.on
1progress=this.loadprogress.bind(this),e.responseType=t.responseType,this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),e.send()},r.prototype.readystatechange=function(t){var e,r,t=t.currentTarget,i=t.readyState,a=this.stats,n=this.context,s=this.config;!a.aborted&&2<=i&&(window.clearTimeout(this.requestTimeout),0===a.tfirst&&(a.tfirst=Math.max(performance.now(),a.trequest)),4===i?200<=(i=t.status)&&i<300?(a.tload=Math.max(a.tfirst,performance.now()),r=e=void 0,r="arraybuffer"===n.responseType?(e=t.response).byteLength:(e=t.responseText).length,a.loaded=a.total=r,r={url:t.responseURL,data:e},this.callbacks.onSuccess(r,a,n,t)):a.retry>=s.maxRetry||400<=i&&i<499?(T.b.error(i+" while loading "+n.url),this.callbacks.onError({code:i,text:t.statusText},n,t)):(T.b.warn(i+" while loading "+n.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),a.retry++):this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),s.timeout))},r.prototype.loadtimeout=function(){T.b.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context,null)},r.prototype.loadprogress=function(t){var e=t.currentTarget,r=this.stats,t=(r.loaded=t.loaded,t.lengthComputable&&(r.total=t.total),this.callbacks.onProgress);t&&t(r,this.context,null,e)};function xt(){return{decode:function(t){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}}var Pt,Ft,Mt=r,Nt=function(t,e,r){return e&&re(t.prototype,e),r&&re(t,r),t},Ut=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,e.call(this,t,v.a.MANIFEST_LOADING,v.a.MANIFEST_LOADED,v.a.AUDIO_TRACK_LOADED,v.a.ERROR))).ticks=0,t.ontick=t.tick.bind(t),t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype.destroy=function(){this.cleanTimer(),a.prototype.destroy.call(this)},r.prototype.cleanTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},r.prototype.tick=function(){1==++this.ticks&&(this.doTick(),1<this.ticks&&setTimeout(this.tick,1),this.ticks=0)},r.prototype.doTick=function(){this.updateTrack(this.trackId)},r.prototype.onError=function(t){t.fatal&&t.type===b.b.NETWORK_ERROR&&this.cleanTimer()},r.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},r.prototype.onManifestLoaded=function(t){var e=this,t=t.audioTracks||[],r=!1,i=(this.tracks=t,this.hls.trigger(v.a.AUDIO_TRACKS_UPDATED,{audioTracks:t}),0);t.forEach(function(t){t.default&&!r?(e.audioTrack=i,r=!0):i++}),!1===r&&t.length&&(T.b.log("no default audio track defined, use first audio track as default"),this.audioTrack=0)},r.prototype.onAudioTrackLoaded=function(t){t.id<this.tracks.length&&(T.b.log("audioTrack "+t.id+" loaded"),this.tracks[t.id].details=t.details,t.details.live&&!this.timer&&(this.timer=setInterval(this.ontick,1e3*t.details.targetduration)),!t.details.live)&&this.timer&&this.cleanTimer()},r.prototype.setAudioTrackInternal=function(t){var e,r,i,a;0<=t&&t<this.tracks.length&&(this.cleanTimer(),this.trackId=t,T.b.log("switching to audioTrack "+t),e=this.tracks[t],r=this.hls,a=e.type,i=e.url,r.trigger(v.a.AUDIO_TRACK_SWITCH,a={id:t,type:a,url:i}),r.trigger(v.a.AUDIO_TRACK_SWITCHING,a),a=e.details,!i||void 0!==a&&!0!==a.live||(T.b.log("(re)loading playlist for audioTrack "+t),r.trigger(v.a.AUDIO_TRACK_LOADING,{url:i,id:t})))},r.prototype.updateTrack=function(t){var e,r;0<=t&&t<this.tracks.length&&(this.cleanTimer(),this.trackId=t,T.b.log("updating audioTrack "+t),e=(r=this.tracks[t]).url,r=r.details,!e||void 0!==r&&!0!==r.live||(T.b.log("(re)loading playlist for audioTrack "+t),this.hls.trigger(v.a.AUDIO_TRACK_LOADING,{url:e,id:t}
1)))},Nt(r,[{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.trackId===t&&void 0!==this.tracks[t].details||this.setAudioTrackInternal(t)}}]),r}(a),Bt=function(t,e,r){return e&&ee(t.prototype,e),r&&ee(t,r),t},Gt="STOPPED",jt="STARTING",A="IDLE",Ht="PAUSED",Kt="KEY_LOADING",Vt="FRAG_LOADING",Wt="FRAG_LOADING_WAITING_RETRY",zt="WAITING_TRACK",h="PARSING",n="PARSED",Xt="BUFFER_FLUSHING",Yt="ENDED",qt="ERROR",Qt="WAITING_INIT_PTS",Jt=function(r){function i(t){var e;if(this instanceof i)return(e=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,r.call(this,t,v.a.MEDIA_ATTACHED,v.a.MEDIA_DETACHING,v.a.AUDIO_TRACKS_UPDATED,v.a.AUDIO_TRACK_SWITCHING,v.a.AUDIO_TRACK_LOADED,v.a.KEY_LOADED,v.a.FRAG_LOADED,v.a.FRAG_PARSING_INIT_SEGMENT,v.a.FRAG_PARSING_DATA,v.a.FRAG_PARSED,v.a.ERROR,v.a.BUFFER_CREATED,v.a.BUFFER_APPENDED,v.a.BUFFER_FLUSHED,v.a.INIT_PTS_FOUND))).config=t.config,e.audioCodecSwap=!1,e.ticks=0,e._state=Gt,e.ontick=e.tick.bind(e),e.initPTS=[],e.waitingFragment=null,e.videoTrackCC=null,e;throw new TypeError("Cannot call a class as a function")}var t=i,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i.prototype.destroy=function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),a.prototype.destroy.call(this),this.state=Gt},i.prototype.onInitPtsFound=function(t){var e=t.id,r=t.frag.cc,t=t.initPTS;"main"===e&&(this.initPTS[r]=t,this.videoTrackCC=r,T.b.log("InitPTS for cc:"+r+" found from video track:"+t),this.state===Qt)&&this.tick()},i.prototype.startLoad=function(t){var e;this.tracks?(e=this.lastCurrentTime,this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),(this.fragLoadError=0)<e&&-1===t?(T.b.log("audio:override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=A):(this.lastCurrentTime=this.startPosition||t,this.state=jt),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()):(this.startPosition=t,this.state=Gt)},i.prototype.stopLoad=function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=Gt},i.prototype.tick=function(){1==++this.ticks&&(this.doTick(),1<this.ticks&&setTimeout(this.tick,1),this.ticks=0)},i.prototype.doTick=function(){var t,e,r,i=this.hls,a=i.config;switch(this.state){case qt:case Ht:case Xt:break;case jt:this.state=zt,this.loadedmetadata=!1;break;case A:var n=this.tracks;if(n&&(this.media||!this.startFragRequested&&a.startFragPrefetch)){if(this.loadedmetadata)t=this.media.currentTime;else if(void 0===(t=this.nextLoadPosition))break;var s=this.mediaBuffer||this.media,o=S.bufferInfo(s,t,a.maxBufferHole),l=o.len,d=o.end,u=this.fragPrevious,h=a.maxMaxBufferLength,c=this.audioSwitch,f=this.trackId;if((l<h||c)&&f<n.length){if(void 0===(l=n[f].details)){this.state=zt;break}if(!c&&!l.live&&u&&u.sn===l.endSN&&(!this.media.seeking||this.media.duration-d<u.duration/2)){this.hls.trigger(v.a.BUFFER_EOS,{type:"audio"}),this.state=Yt;break}var h=l.fragments,n=h.length,p=h[0].start,g=h[n-1].start+h[n-1].duration,y=void 0;if(c)if(l.live&&!l.PTSKnown)T.b.log("switching audiotrack, live stream, unknown PTS,load first fragment"),d=0;else if(d=t,l.PTSKnown&&t<p){if(!(o.end>p||o.nextStart))return;T.b.log("alt audio track ahead of main track, seek to start of alt audio track"),this.media.currentTime=p+.05}if(l.initSegment&&!l.initSegment.data)y=l.initSegment;else if(d<=p){y=h[0];if(null!==this.videoTrackCC&&y.cc!==this.videoTrackCC&&(r=this.videoTrackCC,y=R.search(h,function(t){return t.cc<r?1:t.cc>r?-1:0})),l.live&&y.loadIdx&&y.loadIdx===this.fragLoadIdx)return c=o.nextStart||p,T.b.log("no alt audio available @currentTime:"+this.media.currentTime+", seeking @"+(c+.05)),void(this.media.currentTime=c+.05)}else{var o=void 0,m=a.maxFragLookUpTolerance,p=u?h[u.sn-h[0].sn+1]:void 0,c=function(t){var e=Math.min(m,t.duration);return t.start+t.duration-e<=d?1:t.start-e>d&&t.start?-1:0};(o=d<g?(g-m<d&&(m=0),p&&!c(p)?p:R.search(h,c)):h[n-1])&&((y=o).start,u)&&y.level===u.level&&y.sn===u.sn&&(y.sn<l.endSN?(y=h[y.sn+1-l.startSN],T.b.log("SN just loaded, load next one: "+y.sn)):y=null)}if(y)if(y.decryptdata&&null!=y.decryptdata.uri&&null==y.decryptdata.key)T.b.log("Loading key for "+y.sn+" of ["+l.startSN+" ,"+l.endSN+"],track "+f),this.state=Kt,i.trigger(v.a.KEY_LOADING,{frag:y});else{if(T.b.log("Loading "+y.sn+", cc: "+y.cc+" of ["+l.startSN+" ,"+l.endSN+"],track "+f+", currentTime:"+t+",bufferEnd:"+d.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,y.loadCounter){y.loadCounter++;g=a.fragLoadingLoopThreshold;if(y.loadCounter>g&&Math.abs(this.fragLoadIdx-y.loadIdx)<g)return void i.trigger(v.a.ERROR,{type:b.b.MEDIA_ERROR,details:b.a.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:y})}else y.loadCounter=1;y.loadIdx=this.fragLoadIdx,this.fragCurrent=y,this.startFragRequested=!0,isNaN(y.sn)||(this.nextLoadPosition=y.start+y.duration),i.trigger(v.a.FRAG_LOADING,{frag:y}),this.state=Vt}}}break;case zt:(e=this.tracks[this.trackId])&&e.details&&(this.state=A);break;case Wt:p=performance.now(),c=this.retryDate,n=(s=this.media)&&s.seeking;(!c||c<=p||n)&&(T.b.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=A);break;case Qt:o=this.videoTrackCC;void 0!==this.initPTS[o]&&((u=this.waitingFragment)?o!==(h=u.frag.cc)?(e=this.tracks[this.trackId]).details&&e.details.live&&(T.b.w
vendor: 4,501 bytes, line 1
1arn("Waiting fragment CC ("+h+") does not match video track CC ("+o+")"),this.waitingFragment=null,this.state=A):(this.state=Vt,this.onFragLoaded(this.waitingFragment),this.waitingFragment=null):this.state=A)}},i.prototype.onMediaAttached=function(t){t=this.media=this.mediaBuffer=t.media,this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended),t=this.config;this.tracks&&t.autoStartLoad&&this.startLoad(t.startPosition)},i.prototype.onMediaDetaching=function(){var t=this.media,e=(t&&t.ended&&(T.b.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),this.tracks);e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.stopLoad()},i.prototype.onMediaSeeking=function(){this.state===Yt&&(this.state=A),this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()},i.prototype.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},i.prototype.onAudioTracksUpdated=function(t){T.b.log("audio tracks updated"),this.tracks=t.audioTracks},i.prototype.onAudioTrackSwitching=function(t){var e=!!t.url;this.trackId=t.id,this.fragCurrent=null,this.state=Ht,this.waitingFragment=null,e?this.timer||(this.timer=setInterval(this.ontick,100)):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),e&&(this.audioSwitch=!0,this.state=A,void 0!==this.fragLoadIdx)&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()},i.prototype.onAudioTrackLoaded=function(t){var e=t.details,t=t.id,r=this.tracks[t],i=e.totalduration,a=0;T.b.log("track "+t+" loaded ["+e.startSN+","+e.endSN+"],duration:"+i),e.live?(t=r.details)&&0<e.fragments.length?(j(t,e),a=e.fragments[0].start,e.PTSKnown?T.b.log("live audio playlist sliding:"+a.toFixed(3)):T.b.log("live audio playlist - outdated PTS, unknown sliding")):(e.PTSKnown=!1,T.b.log("live audio playlist - first load, unknown sliding")):e.PTSKnown=!1,r.details=e,this.startFragRequested||(-1===this.startPosition&&(i=e.startTimeOffset,isNaN(i)?this.startPosition=0:(T.b.log("start time offset found in playlist, adjust startPosition to "+i),this.startPosition=i)),this.nextLoadPosition=this.startPosition),this.state===zt&&(this.state=A),this.tick()},i.prototype.onKeyLoaded=function(){this.state===Kt&&(this.state=A,this.tick())},i.prototype.onFragLoaded=function(t){var e,r,i,a,n,s,o,l=this.fragCurrent,d=t.frag;this.state===Vt&&l&&"audio"===d.type&&d.level===l.level&&d.sn===l.sn&&(r=(e=(d=this.tracks[this.trackId]).details).totalduration,i=l.level,a=l.sn,n=l.cc,d=this.config.defaultAudioCodec||d.audioCodec||"mp4a.40.2",s=this.stats=t.stats,"initSegment"===a?(this.state=A,s.tparsed=s.tbuffered=performance.now(),e.initSegment.data=t.payload,this.hls.trigger(v.a.FRAG_BUFFERED,{stats:s,frag:l,id:"audio"}),this.tick()):(this.state=h,this.appended=!1,this.demuxer||(this.demuxer=new ht(this.hls,"audio")),s=this.initPTS[n],o=e.initSegment?e.initSegment.data:[],e.initSegment||void 0!==s?(this.pendingBuffering=!0,T.b.log("Demuxing "+a+" of ["+e.startSN+" ,"+e.endSN+"],track "+i),this.demuxer.push(t.payload,o,d,null,l,r,!1,s)):(T.b.log("unknown video PTS for continuity counter "+n+", waiting for video PTS before demuxing audio frag "+a+" of ["+e.startSN+" ,"+e.endSN+"],track "+i),this.waitingFragment=t,this.state=Qt))),this.fragLoadError=0},i.prototype.onFragParsingInitSegment=function(t){var e=this.fragCurrent,r=t.frag;e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===h&&(r=void 0,(e=t.tracks).video&&delete e.video,r=e.audio)&&(r.levelCodec=r.codec,r.id=t.id,this.hls.trigger(v.a.BUFFER_CODECS,e),T.b.log("audio track:audio,container:"+r.container+",codecs[level/parsed]=["+r.levelCodec+"/"+r.codec+"]"),(t=r.initSegment)&&(e={type:"audio",data:t,parent:"audio",content:"initSegment"},this.audioSwitch?this.pendingData=[e]:(this.appended=!0,this.pendingBuffering=!0,this.hls.trigger(v.a.BUFFER_APPENDING,e))),this.tick())},i.prototype.onFragParsingData=function(e){var t,r,i,a,n=this,s=this.fragCurrent,o=e.frag;s&&"audio"===e.id&&"audio"===e.type&&o.sn===s.sn&&o.level===s.level&&this.state===h&&
1(o=this.trackId,i=this.tracks[o],t=this.hls,isNaN(e.endPTS)&&(e.endPTS=e.startPTS+s.duration,e.endDTS=e.startDTS+s.duration),T.b.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),G(i.details,s,e.startPTS,e.endPTS),i=this.audioSwitch,s=this.media,r=!1,i&&s&&(s.readyState?(i=s.currentTime,T.b.log("switching audio track : currentTime:"+i),i>=e.startPTS&&(T.b.log("switching audio track : flushing all audio"),this.state=Xt,t.trigger(v.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),this.audioSwitch=!(r=!0),t.trigger(v.a.AUDIO_TRACK_SWITCHED,{id:o}))):(this.audioSwitch=!1,t.trigger(v.a.AUDIO_TRACK_SWITCHED,{id:o}))),a=this.pendingData,this.audioSwitch||([e.data1,e.data2].forEach(function(t){t&&t.length&&a.push({type:e.type,data:t,parent:"audio",content:"data"})}),!r&&a.length&&(a.forEach(function(t){n.state===h&&(n.pendingBuffering=!0,n.hls.trigger(v.a.BUFFER_APPENDING,t))}),this.pendingData=[],this.appended=!0)),this.tick())},i.prototype.onFragParsed=function(t){var e=this.fragCurrent,r=t.frag;e&&"audio"===t.id&&r.sn===e.sn&&r.level===e.level&&this.state===h&&(this.stats.tparsed=performance.now(),this.state=n,this._checkAppendedParsed())},i.prototype.onBufferCreated=function(t){t=t.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0)},i.prototype.onBufferAppended=function(t){var e;"audio"!==t.parent||(e=this.state)!==h&&e!==n||(this.pendingBuffering=0<t.pending,this._checkAppendedParsed())},i.prototype._checkAppendedParsed=function(){var t,e,r;this.state!==n||this.appended&&this.pendingBuffering||(t=this.fragCurrent,r=this.stats,e=this.hls,t&&(this.fragPrevious=t,r.tbuffered=performance.now(),e.trigger(v.a.FRAG_BUFFERED,{stats:r,frag:t,id:"audio"}),r=this.mediaBuffer||this.media,T.b.log("audio buffered : "+ct.toString(r.buffered)),this.audioSwitch&&this.appended&&(this.audioSwitch=!1,e.trigger(v.a.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.state=A),this.tick())},i.prototype.onError=function(t){var e,r,i=t.frag;if(!i||"audio"===i.type)switch(t.details){case b.a.FRAG_LOAD_ERROR:case b.a.FRAG_LOAD_TIMEOUT:t.fatal||((e=this.fragLoadError)?e++:e=1,e<=(r=this.config).fragLoadingMaxRetry?(this.fragLoadError=e,i.loadCounter=0,e=Math.min(Math.pow(2,e-1)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout),T.b.warn("audioStreamController: frag loading failed, retry in "+e+" ms"),this.retryDate=performance.now()+e,this.state=Wt):(T.b.error("audioStreamController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.state=qt));break;case b.a.FRAG_LOOP_LOADING_ERROR:case b.a.AUDIO_TRACK_LOAD_ERROR:case b.a.AUDIO_TRACK_LOAD_TIMEOUT:case b.a.KEY_LOAD_ERROR:case b.a.KEY_LOAD_TIMEOUT:this.state!==qt&&(this.state=t.fatal?qt:A,T.b.warn("audioStreamController: "+t.details+" while loading frag,switch to "+this.state+" state ..."));break;case b.a.BUFFER_FULL_ERROR:"audio"!==t.parent||this.state!==h&&this.state!==n||(r=this.mediaBuffer,e=this.media.currentTime,r&&S.isBuffered(r,e)&&S.isBuffered(r,e+.5)?((r=this.config).maxMaxBufferLength>=r.maxBufferLength&&(r.maxMaxBufferLength/=2,T.b.warn("audio:reduce max buffer length to "+r.maxMaxBufferLength+"s"),this.fragLoadIdx+=2*r.fragLoadingLoopThreshold),this.state=A):(T.b.warn("buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,this.state=Xt,this.hls.trigger(v.a.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"})))}},i.prototype.onBufferFlushed=function(){var e=this,t=this.pendingData;t&&t.length?(T.b.log("appending pending audio data on Buffer Flushed"),t.forEach(function(t){e.hls.trigger(v.a.BUFFER_APPENDING,t)}),this.appended=!0,this.pendingData=[],this.state=n):(this.state=A,this.fragPrevious=null,this.tick())},Bt(i,[{key:"state",set:function(t){var e;this.state!==t&&(e=this.state,this._state=t,T.b.log("audio stream:"+e+"->"+t))},get:function(){return this._state}}]),i}(a),$t="undefined"!=typeof window&&window.VTTCue?window.VTTCue:(Pt={"":!0,lr:!0,rl:!0},Ft={start:!0,middle:!0,end:!0,left:!0,right:!0},te.prototype.getCueAsHTML=function(){return window.WebVTT.convertCueToDOMTree(window,this.text)},te);function Zt(t){return"string"==typeof t&&!!Ft[t.toLowerCase()]&&t.toLowerCase()}function w(t){for(var e=1;e<arguments.length;e++){var r,i=arguments[e];for(r in i)t[r]=i[r]}return t}function te(t,e,r){var i=this,a=function(){if("undefined"!=typeof navigator)return/MSIE\s8\.0/.test(navigator.userAgent)}(),n={},s=(a?i=document.createElement("custom"):n.enumerable=!0,i.hasBeenReset=!1,""),o=!1,l=t,d=e,u=r,h=null,c="",f=!0,p="auto",g="start",y=50,m="middle",v=50,b="middle";if(Object.defineProperty(i,"id",w({},n,{get:function(){return s},set:function(t){s=""+t}})),Object.defineProperty(i,"pauseOnExit",w({},n,{get:function(){return o}
1,set:function(t){o=!!t}})),Object.defineProperty(i,"startTime",w({},n,{get:function(){return l},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");l=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"endTime",w({},n,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"text",w({},n,{get:function(){return u},set:function(t){u=""+t,this.hasBeenReset=!0}})),Object.defineProperty(i,"region",w({},n,{get:function(){return h},set:function(t){h=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"vertical",w({},n,{get:function(){return c},set:function(t){t="string"==typeof(t=t)&&!!Pt[t.toLowerCase()]&&t.toLowerCase();if(!1===t)throw new SyntaxError("An invalid or illegal string was specified.");c=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"snapToLines",w({},n,{get:function(){return f},set:function(t){f=!!t,this.hasBeenReset=!0}})),Object.defineProperty(i,"line",w({},n,{get:function(){return p},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");p=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"lineAlign",w({},n,{get:function(){return g},set:function(t){t=Zt(t);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");g=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"position",w({},n,{get:function(){return y},set:function(t){if(t<0||100<t)throw new Error("Position must be between 0 and 100.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"positionAlign",w({},n,{get:function(){return m},set:function(t){t=Zt(t);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"size",w({},n,{get:function(){return v},set:function(t){if(t<0||100<t)throw new Error("Size must be between 0 and 100.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(i,"align",w({},n,{get:function(){return b},set:function(t){t=Zt(t);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),i.displayState=void 0,a)return i}function ee(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function re(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function r(t){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}function ie(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function ae(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function c(t,e,r,i){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.hls=t,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
1=new Lt(e),this.fast_=new Lt(r)}function i(t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}function ne(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function se(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function f(r,t){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.hls=r,this.id=t;var a=this.observer=new dt.a,e=r.config,i=(a.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.emit.apply(a,[t,t].concat(r))},a.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];a.removeListener.apply(a,[t].concat(r))},function(t,e){(e=e||{}).frag=this.frag,e.id=this.id,r.trigger(t,e)}.bind(this)),i=(a.on(v.a.FRAG_DECRYPTED,i),a.on(v.a.FRAG_PARSING_INIT_SEGMENT,i),a.on(v.a.FRAG_PARSING_DATA,i),a.on(v.a.FRAG_PARSED,i),a.on(v.a.ERROR,i),a.on(v.a.FRAG_PARSING_METADATA,i),a.on(v.a.FRAG_PARSING_USERDATA,i),a.on(v.a.INIT_PTS_FOUND,i),{mp4:MediaSource.isTypeSupported("video/mp4"),mpeg:MediaSource.isTypeSupported("audio/mpeg"),mp3:MediaSource.isTypeSupported('audio/mp4; codecs="mp3"')}),n=navigator.vendor;if(e.enableWorker&&"undefined"!=typeof Worker){T.b.log("demuxing in webworker");var s=void 0;try{s=this.w=ut()(9),this.onwmsg=this.onWorkerMessage.bind(this),s.addEventListener("message",this.onwmsg),s.onerror=function(t){r.trigger(v.a.ERROR,{type:b.b.OTHER_ERROR,details:b.a.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},s.postMessage({cmd:"init",typeSupported:i,vendor:n,id:t,config:JSON.stringify(e)})}catch(t){T.b.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),s&&URL.revokeObjectURL(s.objectURL),this.demuxer=new lt.a(a,i,e,n),this.w=void 0}}else this.demuxer=new lt.a(a,i,e,n)}function p(){U(this,p),this._url=null,this._byteRange=null,this._decryptdata=null,this.tagList=[]}function oe(){U(this,oe),this.method=null,this.key=null,this.iv=null,this._uri=null}function le(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function g(t){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");for(var e in t="string"==typeof t?g.parseAttrList(t):t)t.hasOwnProperty(e)&&(this[e]=t[e])}function y(t){var e=this,r=y;if(!(e instanceof r))throw new TypeError("Cannot call a class as a function");this.hls=t,this.onEvent=this.onEvent.bind(this);for(var i=arguments.length,a=Array(1<i?i-1:0),n=1;n<i;n++)a[n-1]=arguments[n];this.handledEvents=a,this.useGenericHandler=!0,this.registerListeners()}K.prototype={set:function(t,e){this.get(t)||""===e||(this.values[t]=e)},get:function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},has:function(t){return t in this.values},alt:function(t,e,r){for(var i=0;i<r.length;++i)if(e===r[i]){this.set(t,e);break}},integer:function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},percent:function(t,e){return!!(e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(e=parseFloat(e))&&e<=100)&&(this.set(t,e),!0)}};function de(t){var e=t;return fe.hasOwnProperty(t)&&(e=fe[t]),String.fromCharCode(e)}function m(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e}var ue=new $t(0,0,0),he="middle"===ue.align?"middle":"center",ce=(H.prototype={parse:function(t){function e(){for(var t=0,e=z(e=i.buffer);t<e.length&&"\r"!==e[t]&&"\n"!==e[t];)++t;var r=e.substr(0,t);return"\r"===e[t]&&++t,"\n"===e[t]&&++t,i.buffer=e.substr(t),r}var i=this;t&&(i.buffer+=i.decoder.decode(t,{stream:!0}));try{if("INITIAL"===i.state){if(!/\r\n|\n/.test(i.buffer))return this;var r,a=(r=e()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var n=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;switch(n?n=!1:r=e(),i.state){case"HEADER":/:/.test(r)?V(r,function(t,e){"Region"===t&&console.log("parse region",e)},/:/):r||(i.state="ID");continue;case"NOTE":r||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){i.state="NOTE";break}if(!r)continue;if(i.cue=new $t(0,0,""),i.state="CUE",-1===r.indexOf("--\x3e")){i.cue.id=r;continue}case"CUE":try{W(r,i.cue,i.regionList)}catch(t){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":var s=-1!==r.indexOf("--\x3e");
vendor: 6,055 bytes, line 1
1if(!r||s&&(n=!0)){i.oncue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}i.cue.text&&(i.cue.text+="\n"),i.cue.text+=r;continue;case"BADCUE":r||(i.state="ID");continue}}}catch(t){"CUETEXT"===i.state&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state="INITIAL"===i.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),!t.cue&&"HEADER"!==t.state||(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state)throw new Error("Malformed WebVTT signature.")}catch(t){throw t}return t.onflush&&t.onflush(),this}},H),fe={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_=100,pe={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ge={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ye={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},me={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ve=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(t){this.time=t},log:function(t,e){var r=this.verboseFilter[t];this.verboseLevel>=r&&console.log(this.time+" ["+t+"] "+e)}},be=(P.prototype.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},P.prototype.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],r=0;r<e.length;r++){var i=e[r];t.hasOwnProperty(i)&&(this[i]=t[i])}},P.prototype.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},P.prototype.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},P.prototype.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},P.prototype.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},P),Te=(x.prototype.reset=function(){this.uchar=" ",this.penState.reset()},x.prototype.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},x.prototype.setPenState=function(t){this.penState.copy(t)},x.prototype.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},x.prototype.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},x.prototype.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},x),Ee=(I.prototype.equals=function(t){for(var e=!0,r=0;r<_;r++)if(!this.chars[r].equals(t.chars[r])){e=!1;break}return e},I.prototype.copy=function(t){for(var e=0;e<_;e++)this.chars[e].copy(t.chars[e])},I.prototype.isEmpty=function(){for(var t=!0,e=0;e<_;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},I.prototype.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(L.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>_&&(L.log("ERROR","Too large cursor position "+this.pos),this.pos=_)},I.prototype.moveCursor=function(t){var e=this.pos+t;if(1<t)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)},I.prototype.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},I.prototype.insertChar=function(t){144<=t&&this.backSpace();var e=de(t);this.pos>=_?L.log("ERROR","Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},I.prototype.clearFromPos=function(t){for(var e=t;e<_;e++)this.chars[e].reset()},I.prototype.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},I.prototype.clearToEndOfRow=function(){this.clearFromPos(this.pos)},I.prototype.getTextString=function(){for(var t=[],e=!0,r=0;r<_;r++){var i=this.chars[r].uchar;" "!==i&&(e=!1),t.push(i)}return e?"":t.join("")},I.prototype.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},I),Re=(C.prototype.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},C.prototype.equals=function(t){for(var e=!0,r=0;r<15;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},C.prototype.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},C.prototype.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},C.prototype.backSpace=function(){this.rows[this.currRow].backSpace()},C.prototype.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},C.prototype.insertChar=function(t){this.rows[this.currRow].insertChar(t)},C.prototype.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},C.prototype.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},C.prototype.setCursor=function(t){L.log("INFO","setCursor: "+t),this.rows[this.currRow].setCursor(t)},C.prototype.setPAC=function(t){L.log("INFO","pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<15;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var n=a.rows[i].cueStartTime;if(n&&n<L.time)for(var s=0;s<this.nrRollUpRows;s++)this.rows[e-this.nrRollUpRows+s+1].copy(a.rows[i+s])}}this.currRow=e;
1var o,n=this.rows[this.currRow],n=(null!==t.indent&&(o=t.indent,o=Math.max(o-1,0),n.setCursor(t.indent),t.color=n.chars[o].penState.foreground),{foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1});this.setPen(n)},C.prototype.setBkgData=function(t){L.log("INFO","bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},C.prototype.setRollUpRows=function(t){this.nrRollUpRows=t},C.prototype.rollUp=function(){var t;null===this.nrRollUpRows?L.log("DEBUG","roll_up but nrRollUpRows not set yet"):(L.log("TEXT",this.getDisplayText()),t=this.currRow+1-this.nrRollUpRows,(t=this.rows.splice(t,1)[0]).clear(),this.rows.splice(this.currRow,0,t),L.log("INFO","Rolling up"))},C.prototype.getDisplayText=function(t){t=t||!1;for(var e=[],r="",i=0;i<15;i++){var a=this.rows[i].getTextString();a&&e.push(t?"Row "+(i+1)+": '"+a+"'":a.trim())}return r=0<e.length?t?"["+e.join(" | ")+"]":e.join("\n"):r},C.prototype.getTextAndFormat=function(){return this.rows},C),Se=(O.prototype.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},O.prototype.getHandler=function(){return this.outputFilter},O.prototype.setHandler=function(t){this.outputFilter=t},O.prototype.setPAC=function(t){this.writeScreen.setPAC(t)},O.prototype.setBkgData=function(t){this.writeScreen.setBkgData(t)},O.prototype.setMode=function(t){t!==this.mode&&(this.mode=t,L.log("INFO","MODE="+t),"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=t)},O.prototype.insertChars=function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";L.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(L.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},O.prototype.ccRCL=function(){L.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},O.prototype.ccBS=function(){L.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory)&&this.outputDataUpdate()},O.prototype.ccAOF=function(){},O.prototype.ccAON=function(){},O.prototype.ccDER=function(){L.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},O.prototype.ccRU=function(t){L.log("INFO","RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},O.prototype.ccFON=function(){L.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},O.prototype.ccRDC=function(){L.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},O.prototype.ccTR=function(){L.log("INFO","TR"),this.setMode("MODE_TEXT")},O.prototype.ccRTD=function(){L.log("INFO","RTD"),this.setMode("MODE_TEXT")},O.prototype.ccEDM=function(){L.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},O.prototype.ccCR=function(){L.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},O.prototype.ccENM=function(){L.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},O.prototype.ccEOC=function(){var t;L.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode&&(t=this.displayedMemory,this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,L.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())),this.outputDataUpdate()},O.prototype.ccTO=function(t){L.log("INFO","TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},O.prototype.ccMIDROW=function(t){var e={flash:!1};e.underline=t%2==1,e.italics=46<=t,e.italics?e.foreground="white":(t=Math.floor(t/2)-16,e.foreground=["white","green","blue","cyan","red","yellow","magenta"][t]),L.log("INFO","MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},O.prototype.outputDataUpdate=function(){var t=L.time;null!==t&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(t,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},O.prototype.cueSplitAtTime=function(t){!this.outputFilter||this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t)},O);D.prototype.getHandler=function(t){return this.channels[t].getHandler()},D.prototype.setHandler=function(t,e){this.channels[t].setHandler(e)},D.prototype.addData=function(t,e){var r,i,a,n=!1;this.lastTime=t,L.setTime(t);for(var s=0;s<e.length;s+=2)i=127&e[s],a=127&e[s+1],0!=i||0!=a?(L.log("DATA","["+m([e[s],e[s+1]])+"] -> ("+m([i,a])+")"),!(r=(r=(r=(r=this.parseCmd(i,a))||this.parseMidrow(i,a))||this.parsePAC(i,a))||this.parseBackgroun
1dAttributes(i,a))&&(n=this.parseChars(i,a))&&(this.currChNr&&0<=this.currChNr?this.channels[this.currChNr-1].insertChars(n):L.log("WARNING","No channel found yet. TEXT-MODE?")),r?this.dataCounters.cmd+=2:n?this.dataCounters.char+=2:(this.dataCounters.other+=2,L.log("WARNING","Couldn't parse cleaned data "+m([i,a])+" orig: "+m([e[s],e[s+1]])))):this.dataCounters.padding+=2},D.prototype.parseCmd=function(t,e){var r,i;return((20===t||28===t)&&32<=e&&e<=47||(23===t||31===t)&&33<=e&&e<=35)&&(t===this.lastCmdA&&e===this.lastCmdB?(this.lastCmdA=null,this.lastCmdB=null,L.log("DEBUG","Repeated command ("+m([t,e])+") is dropped")):(i=this.channels[(r=20===t||23===t?1:2)-1],20===t||28===t?32===e?i.ccRCL():33===e?i.ccBS():34===e?i.ccAOF():35===e?i.ccAON():36===e?i.ccDER():37===e?i.ccRU(2):38===e?i.ccRU(3):39===e?i.ccRU(4):40===e?i.ccFON():41===e?i.ccRDC():42===e?i.ccTR():43===e?i.ccRTD():44===e?i.ccEDM():45===e?i.ccCR():46===e?i.ccENM():47===e&&i.ccEOC():i.ccTO(e-32),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=r),!0)},D.prototype.parseMidrow=function(t,e){var r;return(17===t||25===t)&&32<=e&&e<=47&&((r=17===t?1:2)!==this.currChNr?(L.log("ERROR","Mismatch channel in midrow parsing"),!1):(this.channels[r-1].ccMIDROW(e),L.log("DEBUG","MIDROW ("+m([t,e])+")"),!0))},D.prototype.parsePAC=function(t,e){var r,i=null;return((17<=t&&t<=23||25<=t&&t<=31)&&64<=e&&e<=127||(16===t||24===t)&&64<=e&&e<=95)&&(t===this.lastCmdA&&e===this.lastCmdB?(this.lastCmdA=null,this.lastCmdB=null):(i=t<=23?1:2,r=this.interpretPAC((64<=e&&e<=95?1==i?pe:ye:1==i?ge:me)[t],e),this.channels[i-1].setPAC(r),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=i),!0)},D.prototype.interpretPAC=function(t,e){t={color:null,italics:!1,indent:null,underline:!1,row:t};return t.underline=1==(1&(e=95<e?e-96:e-64)),e<=13?t.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(e/2)]:e<=15?(t.italics=!0,t.color="white"):t.indent=4*Math.floor((e-16)/2),t},D.prototype.parseChars=function(t,e){var r,i=null,a=null,n=null;return 17<=(n=25<=t?(i=2,t-8):(i=1,t))&&n<=19?(r=e,L.log("INFO","Special char '"+de(r=17===n?e+80:18===n?e+112:e+144)+"' in channel "+i),a=[r]):32<=t&&t<=127&&(a=0===e?[t]:[t,e]),a&&(n=m(a),L.log("DEBUG","Char codes =  "+n.join(",")),this.lastCmdA=null,this.lastCmdB=null),a},D.prototype.parseBackgroundAttributes=function(t,e){var r,i;return!(!((16===t||24===t)&&32<=e&&e<=47)&&!((23===t||31===t)&&45<=e&&e<=47)||(r={},16===t||24===t?(i=Math.floor((e-32)/2),r.background=ve[i],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0)),this.channels[(t<24?1:2)-1].setBkgData(r),this.lastCmdA=null,this.lastCmdB=null))},D.prototype.reset=function(){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].reset();this.lastCmdA=null,this.lastCmdB=null},D.prototype.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].cueSplitAtTime(t)};function Ae(t,e,r){return t.substr(r||0,e.length)===e}function we(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()}var _e=D,Le={parse:function(t,n,o,l,e,r){var t=String.fromCharCode.apply(null,new Uint8Array(t)).trim().replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s="00:00.000",d=0,u=0,h=0,c=[],f=void 0,p=!0,g=new ce;g.oncue=function(t){var e=o[l],r=o.ccOffset;if(e&&e.new)if(void 0!==u)r=o.ccOffset=e.start;else{var i=o,a=h,n=i[e=l],s=i[n.prevCC];if(!s||!s.new&&n.new)i.ccOffset=i.presentationOffset=n.start,n.new=!1;else{for(;s&&s.new;)i.ccOffset+=n.start-s.start,n.new=!1,s=i[(n=s).prevCC];i.presentationOffset=a}}h&&(r=h+o.ccOffset-o.presentationOffset),t.startTime+=r-u,t.endTime+=r-u,t.id=we(t.startTime)+we(t.endTime)+we(t.text),t.text=decodeURIComponent(escape(t.text)),0<t.endTime&&c.push(t)},g.onparsingerror=function(t){f=t},g.onflush=function(){f&&r?r(f):e(c)},t.forEach(function(e){if(p){if(Ae(e,"X-TIMESTAMP-MAP=")){p=!1,e.substr(16).split(",").forEach(function(t){Ae(t,"LOCAL:")?s=t.substr(6):Ae(t,"MPEGTS:")&&(d=parseInt(t.substr(7)))});try{d-=n=n<0?n+8589934592:n,t=s,r=parseInt(t.substr(-3)),i=parseInt(t.substr(-6,2)),a=parseInt(t.substr(-9,2)),t=9<t.length?parseInt(t.substr(0,t.indexOf(":"))):0,u=(isNaN(r)||isNaN(i)||isNaN(a)||isNaN(t)?-1:(r=r+1e3*i+6e4*a)+36e5*t)/1e3,h=d/9e4,-1===u&&(f=new Error("Malformed X-TIMESTAMP-MAP: "+e))}catch(t){f=new Error("Malformed X-TIMESTAMP-MAP: "+e)}return}""===e&&(p=!1)}var t,r,i,a;g.parse(e+"\n")}),g.flush()}},ke=function(r){function i(t){var e,a,n;if(this instanceof i)return(e=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}
1(this,r.call(this,t,v.a.MEDIA_ATTACHING,v.a.MEDIA_DETACHING,v.a.FRAG_PARSING_USERDATA,v.a.MANIFEST_LOADING,v.a.MANIFEST_LOADED,v.a.FRAG_LOADED,v.a.LEVEL_SWITCHING,v.a.INIT_PTS_FOUND))).hls=t,e.config=t.config,e.enabled=!0,e.Cues=t.config.cueHandler,e.textTracks=[],e.tracks=[],e.unparsedVttFrags=[],e.initPTS=void 0,e.cueRanges=[],e.config.enableCEA708Captions&&(n=function(t,e){var r=null;try{r=new window.Event("addtrack")}catch(t){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)},(a=e).cea608Parser=new _e(0,{newCue:function(t,e,r){var i;a.textTrack1||((i=a.getExistingTrack("1"))?(a.textTrack1=i,o(a.textTrack1),n(a.textTrack1,a.media)):(i=a.createTextTrack("captions",a.config.captionsTextTrack1Label,a.config.captionsTextTrack1LanguageCode))&&(i.textTrack1=!0,a.textTrack1=i)),a.addCues("textTrack1",t,e,r)}},{newCue:function(t,e,r){var i;a.textTrack2||((i=a.getExistingTrack("2"))?(a.textTrack2=i,o(a.textTrack2),n(a.textTrack2,a.media)):(i=a.createTextTrack("captions",a.config.captionsTextTrack2Label,a.config.captionsTextTrack1LanguageCode))&&(i.textTrack2=!0,a.textTrack2=i)),a.addCues("textTrack2",t,e,r)}})),e;throw new TypeError("Cannot call a class as a function")}var t=i,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i.prototype.addCues=function(t,e,r,i){for(var a,n,s=this.cueRanges,o=!1,l=s.length;l--;){var d=s[l],u=(a=d[0],u=d[1],n=e,Math.min(u,r)-Math.max(a,n));if(0<=u&&(d[0]=Math.min(d[0],e),d[1]=Math.max(d[1],r),o=!0,.5<u/(r-e)))return}o||s.push([e,r]),this.Cues.newCue(this[t],e,r,i)},i.prototype.onInitPtsFound=function(t){var e=this;void 0===this.initPTS&&(this.initPTS=t.initPTS),this.unparsedVttFrags.length&&(this.unparsedVttFrags.forEach(function(t){e.onFragLoaded(t)}),this.unparsedVttFrags=[])},i.prototype.getExistingTrack=function(t){var e=this.media;if(e)for(var r=0;r<e.textTracks.length;r++){var i=e.textTracks[r];if(!0===i["textTrack"+t])return i}return null},i.prototype.createTextTrack=function(t,e,r){var i=this.media;if(i)return i.addTextTrack(t,e,r)},i.prototype.destroy=function(){a.prototype.destroy.call(this)},i.prototype.onMediaAttaching=function(t){this.media=t.media},i.prototype.onMediaDetaching=function(){o(this.textTrack1),o(this.textTrack2)},i.prototype.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0};var t=this.media;if(t){var e=t.textTracks;if(e)for(var r=0;r<e.length;r++)o(e[r])}},i.prototype.onManifestLoaded=function(t){var n,s=this;this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=void 0,this.cueRanges=[],this.config.enableWebVTT&&(this.tracks=t.subtitles||[],n=this.media?this.media.textTracks:[],this.tracks.forEach(function(t,e){var r,i,a=void 0;e<n.length&&(e=n[e],i=t,!(r=e)||r.label!==i.name||r.textTrack1||r.textTrack2||(a=e)),(a=a||s.createTextTrack("subtitles",t.name,t.lang)).mode=t.default?"showing":"hidden",s.textTracks.push(a)}))},i.prototype.onLevelSwitching=function(){this.enabled="NONE"!==this.hls.currentLevel.closedCaptions},i.prototype.onFragLoaded=function(t){var e,r,a,n,s=t.frag,i=t.payload;"main"===s.type?((e=s.sn)!==this.lastSn+1&&(r=this.cea608Parser)&&r.reset(),this.lastSn=e):"subtitle"===s.type&&(i.byteLength?void 0===this.initPTS?this.unparsedVttFrags.push(t):((r=this.vttCCs)[s.cc]||(r[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),a=this.textTracks,n=this.hls,Le.parse(i,this.initPTS,r,s.cc,function(t){var i=a[s.trackId];t.forEach(function(e){if(!i.cues.getCueById(e.id))try{i.addCue(e)}catch(t){var r=new window.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,i.addCue(r)}}),n.trigger(v.a.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(t){T.b.log("Failed to parse VTT cue: "+t),n.trigger(v.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s})})):this.hls.trigger(v.a.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s}))},i.prototype.onFragParsingUserdata=function(t){if(this.enabled&&this.config.enableCEA708Captions)for(var e=0;e<t.samples.length;e++){var r=this.extractCea608Data(t.samples[e].bytes);this.cea608Parser.addData(t.samples[e].pts,r)}},i.prototype.extractCea608Data=function(t){for(var e,r,i,a=31&t[0],n=2,s=[],o=0;o<a;o++)e=t[n++],r=127&t[n++],i=127&t[n++],0==r&&0==i||0!=(4&e)&&0==(3&e)&&(s.push(r),s.push(i));return s},i}(a),De=function(t,e,r){return e&&Ie(t.prototype,e),r&&Ie(t,r),t},Oe=function(e){function r(t){if(this instanceof r)return(t=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}
1(this,e.call(this,t,v.a.MEDIA_ATTACHED,v.a.MEDIA_DETACHING,v.a.MANIFEST_LOADING,v.a.MANIFEST_LOADED,v.a.SUBTITLE_TRACK_LOADED))).tracks=[],t.trackId=-1,t.media=void 0,t;throw new TypeError("Cannot call a class as a function")}var t=r,i=e;if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function, not "+typeof i);return t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i&&(Object.setPrototypeOf?Object.setPrototypeOf(t,i):t.__proto__=i),r.prototype._onTextTracksChanged=function(){if(this.media){for(var t=-1,e=function(t){for(var e=[],r=0;r<t.length;r++)"subtitles"===t[r].kind&&e.push(t[r]);return e}(this.media.textTracks),r=0;r<e.length;r++)"showing"===e[r].mode&&(t=r);this.subtitleTrack=t}},r.prototype.destroy=function(){a.prototype.destroy.call(this)},r.prototype.onMediaAttached=function(t){var e=this;this.media=t.media,this.media&&(this.trackChangeListener=this._onTextTracksChanged.bind(this),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.subtitlePollingInterval=setInterval(function(){e.trackChangeListener()},500):this.media.textTracks.addEventListener("change",this.trackChangeListener))},r.prototype.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),this.media=void 0)},r.prototype.onManifestLoading=function(){this.tracks=[],this.trackId=-1},r.prototype.onManifestLoaded=function(t){var e=this,t=t.subtitles||[];this.tracks=t,this.trackId=-1,this.hls.trigger(v.a.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:t}),t.forEach(function(t){t.default&&(e.subtitleTrack=t.id)})},r.prototype.onTick=function(){var t,e=this.trackId,r=this.tracks[e];!r||void 0!==(t=r.details)&&!0!==t.live||(T.b.log("(re)loading playlist for subtitle track "+e),this.hls.trigger(v.a.SUBTITLE_TRACK_LOADING,{url:r.url,id:e}))},r.prototype.onSubtitleTrackLoaded=function(t){var e=this;t.id<this.tracks.length&&(T.b.log("subtitle track "+t.id+" loaded"),this.tracks[t.id].details=t.details,t.details.live&&!this.timer&&(this.timer=setInterval(function(){e.onTick()},1e3*t.details.targetduration,this)),!t.details.live)&&this.timer&&(clearInterval(this.timer),this.timer=null)},r.prototype.setSubtitleTrackInternal=function(t){var e,r;0<=t&&t<this.tracks.length&&(this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=t,T.b.log("switching to subtitle track "+t),e=this.tracks[t],this.hls.trigger(v.a.SUBTITLE_TRACK_SWITCH,{id:t}),void 0!==(r=e.details)&&!0!==r.live||(T.b.log("(re)loading playlist for subtitle track "+t),this.hls.trigger(v.a.SUBTITLE_TRACK_LOADING,{url:e.url,id:t})))},De(r,[{key:"subtitleTracks",get:function(){return this.tracks}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.trackId!==t&&this.setSubtitleTrackInternal(t)}}]),r}(a),Ce=function(r){function i(t){var e;if(this instanceof i)return(e=function(t,e){if(t)return!e||"object"!=typeof e&&"function"!=typeof e?t:e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,r.call(this,t,v.a.ERROR,v.a.SUBTITLE_TRACKS_UPDATED,v.a.SUBTITLE_TRACK_SWITCH,v.a.SUBTITLE_TRACK_LOADED,v.a.SUBTITLE_FRAG_PROCESSED))).config=t.config,e.vttFragSNsProcessed={},e.vttFragQueues=void 0,e.currentlyProcessing=null,e.currentTrackId=-1,e;throw new TypeError("Cannot call a class as a function")}var t=i,e=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i.prototype.destroy=function(){a.prototype.destroy.call(this)},i.prototype.clearVttFragQueues=function(){var e=this;this.vttFragQueues={},this.tracks.forEach(function(t){e.vttFragQueues[t.id]=[]})},i.prototype.nextFrag=function(){var t;null===this.currentlyProcessing&&-1<this.currentTrackId&&this.vttFragQueues[this.currentTrackId].length&&(t=this.currentlyProcessing=this.vttFragQueues[this.currentTrackId].shift(),this.hls.trigger(v.a.FRAG_LOADING,{frag:t}))},i.prototype.onSubtitleFragProcessed=function(t){t.success&&this.vttFragSNsProcessed[t.frag.trackId].push(t.frag.sn),this.currentlyProcessing=null,this.nextFrag()},i.prototype.onError=function(t){t=t.frag;t&&"subtitle"!==t.type||this.currentlyProcessing&&(this.currentlyProcessing=null,this.nextFrag())}
1,i.prototype.onSubtitleTracksUpdated=function(t){var e=this;T.b.log("subtitle tracks updated"),this.tracks=t.subtitleTracks,this.clearVttFragQueues(),this.vttFragSNsProcessed={},this.tracks.forEach(function(t){e.vttFragSNsProcessed[t.id]=[]})},i.prototype.onSubtitleTrackSwitch=function(t){this.currentTrackId=t.id,this.clearVttFragQueues()},i.prototype.onSubtitleTrackLoaded=function(r){var i=this.vttFragSNsProcessed[r.id],a=this.vttFragQueues[r.id],n=this.currentlyProcessing?this.currentlyProcessing.sn:-1;r.details.fragments.forEach(function(t){var e;-1<i.indexOf(t.sn)||t.sn===n||(e=t,a.some(function(t){return t.sn===e.sn}))||(t.trackId=r.id,a.push(t))}),this.nextFrag()},i}(a),k={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,lowBufferWatchdogPeriod:.5,highBufferWatchdogPeriod:3,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Mt,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,fetchSetup:void 0,abrController:e,bufferController:t,capLevelController:Ct,fpsController:It,stretchShortVideoTrack:!1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0};function Ie(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function D(t,e,r){s(this,D),this.field=t||1,this.outputs=[e,r],this.channels=[new Se(1,e),new Se(2,r)],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}}function O(t,e){s(this,O),this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new Re,this.nonDisplayedMemory=new Re,this.lastOutputScreen=new Re,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}function C(){s(this,C),this.rows=[];for(var t=0;t<15;t++)this.rows.push(new Ee);this.currRow=14,this.nrRollUpRows=null,this.reset()}function I(){s(this,I),this.chars=[];for(var t=0;t<_;t++)this.chars.push(new Te);this.pos=0,this.currPenState=new be}function x(t,e,r,i,a,n){s(this,x),this.uchar=t||" ",this.penState=new be(e,r,i,a,n)}function P(t,e,r,i,a){s(this,P),this.foreground=t||"white",this.underline=e||!1,this.italics=r||!1,this.background=i||"black",this.flash=a||!1}k.subtitleStreamController=Ce,k.subtitleTrackController=Oe,k.timelineController=ke,k.cueHandler=Y,k.enableCEA708Captions=!0,k.enableWebVTT=!0,k.captionsTextTrack1Label="English",k.captionsTextTrack1LanguageCode="en",k.captionsTextTrack2Label="Spanish",k.captionsTextTrack2LanguageCode="es",k.audioStreamController=Jt,k.audioTrackController=Ut;Mt=function(t,e,r){return e&&xe(t.prototype,e),r&&xe(t,r),t},F.isSupported=function(){var t=window.MediaSource=window.MediaSource||window.WebKitMediaSource,e=window.SourceBuffer=window.SourceBuffer||window.WebKitSourceBuffer,t=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),e=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return t&&e},Mt(F,null,[{key:"version",get:function(){return"0.7.11"}},{key:"Events",get:function(){return v.a}},{key:"ErrorTypes",get:function(){return b.b}},{key:"ErrorDetails",get:function(){return b.a}},{key:"DefaultConfig",get:function(){return F.defaultConfig||k},set:function(t){F.defaultConfig=t}}]),F.prototype.destroy=function(){T.b.log("destroy"),this.trigger(v.a.DESTROYING),this.detachMedia(),this.coreComponents.c
1oncat(this.networkControllers).forEach(function(t){t.destroy()}),this.url=null,this.observer.removeAllListeners(),this._autoLevelCapping=-1},F.prototype.attachMedia=function(t){T.b.log("attachMedia"),this.media=t,this.trigger(v.a.MEDIA_ATTACHING,{media:t})},F.prototype.detachMedia=function(){T.b.log("detachMedia"),this.trigger(v.a.MEDIA_DETACHING),this.media=null},F.prototype.loadSource=function(t){t=q.a.buildAbsoluteURL(window.location.href,t,{alwaysNormalize:!0}),T.b.log("loadSource:"+t),this.url=t,this.trigger(v.a.MANIFEST_LOADING,{url:t})},F.prototype.startLoad=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:-1;T.b.log("startLoad("+e+")"),this.networkControllers.forEach(function(t){t.startLoad(e)})},F.prototype.stopLoad=function(){T.b.log("stopLoad"),this.networkControllers.forEach(function(t){t.stopLoad()})},F.prototype.swapAudioCodec=function(){T.b.log("swapAudioCodec"),this.streamController.swapAudioCodec()},F.prototype.recoverMediaError=function(){T.b.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)},Mt(F,[{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){T.b.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){T.b.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){T.b.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){T.b.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){T.b.log("set startLevel:"+t);-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){T.b.log("set autoLevelCapping:"+t),this._autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){for(var t=this.levels,e=this.config.minAutoBitrate,r=t?t.length:0,i=0;i<r;i++)if((t[i].realBitrate?Math.max(t[i].realBitrate,t[i].bitrate):t[i].bitrate)>e)return i;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}}]),e=F;function F(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=this,i=F;if(!(r instanceof i))throw new TypeError("Cannot call a class as a function");var a,n=F.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(a in n)a in t||(t[a]=n[a]);if(void 0!==t.liveMaxLatencyDurationCount&&t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(t.liveMaxLatencyDuration<=t.liveSyncDuration||void 0===t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');Object(T.a)(t.debug),this.config=t,this._autoLevelCapping=-1;var s=this.observer=new dt.a,r=(s.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];s.emit.apply(s,[t,t].concat(r))},s.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];s.removeListener.apply(s,[t].concat(r))},this.on=s.on.bind(s),this.off=s.off.bind(s),this.trigger=s.trigger.bind(s),this.abrController=new t.abrController(this)),i=new t.bufferController(this),o=new t.capLevelController(this),l=new t.fpsController(this),d=new nt(this),u=new st(this),h=new ot(this),c=new _t(this),f=[this.levelController=new At(this),this.streamController=new Rt(this)],p=t.audioStreamController,g=(p&&f.push(new p(this)),this.networkControllers=f,[d,u,h,r,i,o,l,c]);(p=t.audioTrackController)&&(f=new p(this),this.audioTrackController=f,g.push(f)),(p=t.subtitleTrackController)&&(d=new p(this),this.subtitleTrackController=d,g.push(d)),[t.subtitleStreamController,t.timelineController].forEach(function(t){t&&g.push(new t(e))}),this.coreComponents=g}function xe(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}N.default=e},function(t,e,a){function n(t,e){for(var r=[e],i=[],a={};r.length;){var n=r.pop();!a[n]&&t[n]&&(a[n]=!0,i.push(n),n=function(t){var e=[],r=t.toString();if(t=r.match(/^function\s?\(\w+,\s*\w+,\s*(\w+)\)/))for(var i,t=t[1],a=new RegExp("(\\\\n|\\W)"+(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")+"\\((/\\*.*?\\*/)?s?.*?([\\.|\\-|\\w|/|@]+).*?\\)","g");i=a.exec(r);)e.push(i[3]);return e}(t[n]),r=r.concat(n))}return i}t.exports=function(t,e){var r=a.m,i=(e=e||{}).all?Object.keys(r):n(r,t),t="("+function(r){function i(t){var e;return(a[t]||(e=a[t]={i:t,l:!1,exports:{}},r[t].call(e.exports,e,e.exports,i),e.l=!0,e)).exports}var a={},t=(i.m=r,i.c=a,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i.oe=function(t){throw console.error(t),t},i(i.s=ENTRY_MODULE));return t.default||t}.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+i.map(function(t){return JSON.stringify(t)+": "+r[t].toString()}).join(",")+"})(self);",i=new window.Blob([t],{type:"text/javascript"});return e.bare?i:(t=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(i),(e=new window.Worker(t)).objectURL=t,e)}},function(t,e,r){"use strict";
1Object.defineProperty(e,"__esModule",{value:!0});var s=r(6),o=r(1),l=r(0),i=r(4),d=r.n(i);e.default=function(i){function a(t,e){i.postMessage({event:t,data:e})}var n=new d.a;n.trigger=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.emit.apply(n,[t,t].concat(r))},n.off=function(t){for(var e=arguments.length,r=Array(1<e?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];n.removeListener.apply(n,[t].concat(r))};i.addEventListener("message",function(t){var e=t.data;switch(e.cmd){case"init":var r=JSON.parse(e.config);i.demuxer=new s.a(n,e.typeSupported,r,e.vendor);try{Object(l.a)(!0===r.debug)}catch(t){console.warn("demuxerWorker: unable to enable logs")}a("init",null);break;case"demux":i.demuxer.push(e.data,e.decryptdata,e.initSegment,e.audioCodec,e.videoCodec,e.timeOffset,e.discontinuity,e.trackSwitch,e.contiguous,e.duration,e.accurateTimeOffset,e.defaultInitPTS)}}),n.on(o.a.FRAG_DECRYPTED,a),n.on(o.a.FRAG_PARSING_INIT_SEGMENT,a),n.on(o.a.FRAG_PARSED,a),n.on(o.a.ERROR,a),n.on(o.a.FRAG_PARSING_METADATA,a),n.on(o.a.FRAG_PARSING_USERDATA,a),n.on(o.a.INIT_PTS_FOUND,a),n.on(o.a.FRAG_PARSING_DATA,function(t,e){var r=[],t={event:t,data:e};e.data1&&(t.data1=e.data1.buffer,r.push(e.data1.buffer),delete e.data1),e.data2&&(t.data2=e.data2.buffer,r.push(e.data2.buffer),delete e.data2),i.postMessage(t,r)})}}],a={},i.m=r,i.c=a,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/hls.js/dist/",i(i.s=7).default;function i(t){var e;return(a[t]||(e=a[t]={i:t,l:!1,exports:{}},r[t].call(e.exports,e,e.exports,i),e.l=!0,e)).exports}var r,a});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.