mirror of
https://github.com/friendica/friendica
synced 2024-11-15 06:13:54 +00:00
2 lines
85 KiB
JavaScript
2 lines
85 KiB
JavaScript
!function(){"use strict";var e=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e}({}),t=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),r=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e}({}),i=function(){function e(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}(),n=function(){function e(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}();function a(e,t,r){return Uint8Array.prototype.slice?e.slice(t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))}var s=function(){function e(){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.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r},t.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],n=r[1],a=r[2],s=r[3],o=this.invSubMix,u=o[0],d=o[1],c=o[2],h=o[3],l=new Uint32Array(256),f=0,p=0,m=0;for(m=0;m<256;m++)l[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,e[f]=v,t[v]=f;var y=l[f],g=l[y],S=l[g],b=257*l[v]^16843008*v;i[f]=b<<24|b>>>8,n[f]=b<<16|b>>>16,a[f]=b<<8|b>>>24,s[f]=b,b=16843009*S^65537*g^257*y^16843008*f,u[v]=b<<24|b>>>8,d[v]=b<<16|b>>>16,c[v]=b<<8|b>>>24,h[v]=b,f?(f=y^l[l[l[S^y]]],p^=l[l[p]]):f=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i<t.length&&r;)r=t[i]===this.key[i],i++;if(!r){this.key=t;var n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var a,s,o,u,d=this.ksRows=4*(n+6+1),c=this.keySchedule=new Uint32Array(d),h=this.invKeySchedule=new Uint32Array(d),l=this.sBox,f=this.rcon,p=this.invSubMix,m=p[0],v=p[1],y=p[2],g=p[3];for(a=0;a<d;a++)a<n?o=c[a]=t[a]:(u=o,a%n==0?(u=l[(u=u<<8|u>>>24)>>>24]<<24|l[u>>>16&255]<<16|l[u>>>8&255]<<8|l[255&u],u^=f[a/n|0]<<24):n>6&&a%n==4&&(u=l[u>>>24]<<24|l[u>>>16&255]<<16|l[u>>>8&255]<<8|l[255&u]),c[a]=o=(c[a-n]^u)>>>0);for(s=0;s<d;s++)a=d-s,u=3&s?c[a]:c[a-4],h[s]=s<4||a<=4?u:m[l[u>>>24]]^v[l[u>>>16&255]]^y[l[u>>>8&255]]^g[l[255&u]],h[s]=h[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,r){for(var i,n,a,s,o,u,d,c,h,l,f,p,m,v,y=this.keySize+6,g=this.invKeySchedule,S=this.invSBox,b=this.invSubMix,T=b[0],E=b[1],A=b[2],x=b[3],R=this.uint8ArrayToUint32Array_(r),_=R[0],w=R[1],k=R[2],D=R[3],P=new Int32Array(e),I=new Int32Array(P.length),C=this.networkToHostOrderSwap;t<P.length;){for(h=C(P[t]),l=C(P[t+1]),f=C(P[t+2]),p=C(P[t+3]),o=h^g[0],u=p^g[1],d=f^g[2],c=l^g[3],m=4,v=1;v<y;v++)i=T[o>>>24]^E[u>>16&255]^A[d>>8&255]^x[255&c]^g[m],n=T[u>>>24]^E[d>>16&255]^A[c>>8&255]^x[255&o]^g[m+1],a=T[d>>>24]^E[c>>16&255]^A[o>>8&255]^x[255&u]^g[m+2],s=T[c>>>24]^E[o>>16&255]^A[u>>8&255]^x[255&d]^g[m+3],o=i,u=n,d=a,c=s,m+=4;i=S[o>>>24]<<24^S[u>>16&255]<<16^S[d>>8&255]<<8^S[255&c]^g[m],n=S[u>>>24]<<24^S[d>>16&255]<<16^S[c>>8&255]<<8^S[255&o]^g[m+1],a=S[d>>>24]<<24^S[c>>16&255]<<16^S[o>>8&255]<<8^S[255&u]^g[m+2],s=S[c>>>24]<<24^S[o>>16&255]<<16^S[u>>8&255]<<8^S[255&d]^g[m+3],I[t]=C(i^_),I[t+1]=C(s^w),I[t+2]=C(a^k),I[t+3]=C(n^D),_=h,w=l,k=f,D=p,t+=4}return I.buffer},e}(),o=function(){},u={trace:o,debug:o,log:o,warn:o,info:o,error:o},d=u;function c(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach((function(t){d[t]=e[t]?e[t].bind(e):function(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):o}(t)}))}var h=d,l=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},f=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=p},p=Number.MAX_SAFE_INTEGER||9007199254740991;function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){g(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function g(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},S.apply(this,arguments)}function b(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,T(e,t)}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}function E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A,x,R,_,w;A=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,x=/^(?=([^\/?#]*))\1([^]*)$/,R=/(?:\/|^)\.(?=\/)/g,_=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,w={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var i=w.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=w.normalizePath(i.path),w.buildURLFromParts(i)}var n=w.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=w.normalizePath(n.path),w.buildURLFromParts(n)):t;var a=w.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var s=x.exec(a.path);a.netLoc=s[1],a.path=s[2]}a.netLoc&&!a.path&&(a.path="/");var o={scheme:a.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(o.netLoc=a.netLoc,"/"!==n.path[0]))if(n.path){var u=a.path,d=u.substring(0,u.lastIndexOf("/")+1)+n.path;o.path=w.normalizePath(d)}else o.path=a.path,n.params||(o.params=a.params,n.query||(o.query=a.query));return null===o.path&&(o.path=r.alwaysNormalize?w.normalizePath(n.path):n.path),w.buildURLFromParts(o)},parseURL:function(e){var t=A.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(R,"");e.length!==(e=e.replace(_,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};var k,D="audio",P="video",I=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},C=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},O=function(e,t){for(var r=t,i=0;I(e,t);){i+=10,i+=U(e,t+6),C(e,t+10)&&(i+=10),t+=i}if(i>0)return e.subarray(r,r+i)},U=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},L=function(e,t){return I(e,t)&&U(e,t+6)+10<=e.length-t},M=function(e){for(var t=V(e),r=0;r<t.length;r++){var i=t[r];if(F(i))return j(i)}},F=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},N=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=U(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}},V=function(e){for(var t=0,r=[];I(e,t);){for(var i=U(e,t+6),n=(t+=10)+i;t+8<n;){var a=N(e.subarray(t)),s=G(a);s&&r.push(s),t+=a.size+10}C(e,t)&&(t+=10)}return r},G=function(e){return"PRIV"===e.type?B(e):"W"===e.type[0]?Y(e):K(e)},B=function(e){if(!(e.size<2)){var t=z(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}},K=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=z(e.data.subarray(t),!0);t+=r.length+1;var i=z(e.data.subarray(t));return{key:e.type,info:r,data:i}}var n=z(e.data.subarray(1));return{key:e.type,data:n}}},Y=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=z(e.data.subarray(t),!0);t+=r.length+1;var i=z(e.data.subarray(t));return{key:e.type,info:r,data:i}}var n=z(e.data);return{key:e.type,data:n}},j=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},z=function(e,t){void 0===t&&(t=!1);var r=H();if(r){var i=r.decode(e);if(t){var n=i.indexOf("\0");return-1!==n?i.substring(0,n):i}return i.replace(/\0/g,"")}for(var a,s,o,u=e.length,d="",c=0;c<u;){if(0===(a=e[c++])&&t)return d;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:d+=String.fromCharCode(a);break;case 12:case 13:s=e[c++],d+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[c++],o=e[c++],d+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return d};function H(){if(!navigator.userAgent.includes("PlayStation 4"))return k||void 0===self.TextDecoder||(k=new self.TextDecoder("utf-8")),k}var W=function(e){for(var t="",r=0;r<e.length;r++){var i=e[r].toString(16);i.length<2&&(i="0"+i),t+=i}return t},X=Math.pow(2,32)-1,q=[].push,Z={video:1,audio:2,id3:3,text:4};function J(e){return String.fromCharCode.apply(null,e)}function Q(e,t){var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function $(e,t){var r=te(e,t);return r<0?4294967296+r:r}function ee(e,t){var r=$(e,t);return r*=Math.pow(2,32),r+=$(e,t+4)}function te(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function re(e,t,r){e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function ie(e,t){var r=[];if(!t.length)return r;for(var i=e.byteLength,n=0;n<i;){var a=$(e,n),s=a>1?n+a:i;if(J(e.subarray(n+4,n+8))===t[0])if(1===t.length)r.push(e.subarray(n+8,s));else{var o=ie(e.subarray(n+8,s),t.slice(1));o.length&&q.apply(r,o)}n=s}return r}function ne(e){var t=[],r=e[0],i=8,n=$(e,i);i+=4;var a=0,s=0;0===r?(a=$(e,i),s=$(e,i+4),i+=8):(a=ee(e,i),s=ee(e,i+8),i+=16),i+=2;var o=e.length+s,u=Q(e,i);i+=2;for(var d=0;d<u;d++){var c=i,l=$(e,c);c+=4;var f=2147483647&l;if(1===(2147483648&l)>>>31)return h.warn("SIDX has hierarchical references (not supported)"),null;var p=$(e,c);c+=4,t.push({referenceSize:f,subsegmentDuration:p,info:{duration:p/n,start:o,end:o+f-1}}),o+=f,i=c+=4}return{earliestPresentationTime:a,timescale:n,version:r,referencesCount:u,references:t}}function ae(e){for(var t=[],r=ie(e,["moov","trak"]),i=0;i<r.length;i++){var n=r[i],a=ie(n,["tkhd"])[0];if(a){var s=a[0],o=$(a,0===s?12:20),u=ie(n,["mdia","mdhd"])[0];if(u){var d=$(u,0===(s=u[0])?12:20),c=ie(n,["mdia","hdlr"])[0];if(c){var h=J(c.subarray(8,12)),l={soun:D,vide:P}[h];if(l){var f=se(ie(n,["mdia","minf","stbl","stsd"])[0]);t[o]={timescale:d,type:l},t[l]=v({timescale:d,id:o},f)}}}}}return ie(e,["moov","mvex","trex"]).forEach((function(e){var r=$(e,4),i=t[r];i&&(i.default={duration:$(e,12),flags:$(e,20)})})),t}function se(e){var t=e.subarray(8),r=t.subarray(86),i=J(t.subarray(4,8)),n=i,a="enca"===i||"encv"===i;if(a){var s=ie(t,[i])[0];ie(s.subarray("enca"===i?28:78),["sinf"]).forEach((function(e){var t=ie(e,["schm"])[0];if(t){var r=J(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var i=ie(e,["frma"])[0];i&&(n=J(i))}}}))}switch(n){case"avc1":case"avc2":case"avc3":case"avc4":var o=ie(r,["avcC"])[0];n+="."+ue(o[1])+ue(o[2])+ue(o[3]);break;case"mp4a":var u=ie(t,[i])[0],d=ie(u.subarray(28),["esds"])[0];if(d&&d.length>12){var c=4;if(3!==d[c++])break;c=oe(d,c),c+=2;var h=d[c++];if(128&h&&(c+=2),64&h&&(c+=d[c++]),4!==d[c++])break;c=oe(d,c);var l=d[c++];if(64!==l)break;if(n+="."+ue(l),c+=12,5!==d[c++])break;c=oe(d,c);var f=d[c++],p=(248&f)>>3;31===p&&(p+=1+((7&f)<<3)+((224&d[c])>>5)),n+="."+p}break;case"hvc1":case"hev1":var m=ie(r,["hvcC"])[0],v=m[1],y=["","A","B","C"][v>>6],g=31&v,S=$(m,2),b=(32&v)>>5?"H":"L",T=m[12],E=m.subarray(6,12);n+="."+y+g,n+="."+S.toString(16).toUpperCase(),n+="."+b+T;for(var A="",x=E.length;x--;){var R=E[x];if(R||A)A="."+R.toString(16).toUpperCase()+A}n+=A;break;case"dvh1":case"dvhe":var _=ie(r,["dvcC"])[0],w=_[2]>>1&127,k=_[2]<<5&32|_[3]>>3&31;n+="."+de(w)+"."+de(k);break;case"vp09":var D=ie(r,["vpcC"])[0],P=D[4],I=D[5],C=D[6]>>4&15;n+="."+de(P)+"."+de(I)+"."+de(C);break;case"av01":var O=ie(r,["av1C"])[0],U=O[1]>>>5,L=31&O[1],M=O[2]>>>7?"H":"M",F=(64&O[2])>>6,N=(32&O[2])>>5,V=2===U&&F?N?12:10:F?10:8,G=(16&O[2])>>4,B=(8&O[2])>>3,K=(4&O[2])>>2,Y=3&O[2];n+="."+U+"."+de(L)+M+"."+de(V)+"."+G+"."+B+K+Y+"."+de(1)+"."+de(1)+"."+de(1)+".0"}return{codec:n,encrypted:a}}function oe(e,t){for(var r=t+5;128&e[t++]&&t<r;);return t}function ue(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function de(e){return(e<10?"0":"")+e}function ce(e,t){if(!e||!t)return e;var r=t.keyId;r&&t.isCommonEncryption&&ie(e,["moov","trak"]).forEach((function(e){var t=ie(e,["mdia","minf","stbl","stsd"])[0].subarray(8),i=ie(t,["enca"]),n=i.length>0;n||(i=ie(t,["encv"])),i.forEach((function(e){ie(n?e.subarray(28):e.subarray(78),["sinf"]).forEach((function(e){var t=function(e){var t=ie(e,["schm"])[0];if(t){var r=J(t.subarray(4,8));if("cbcs"===r||"cenc"===r)return ie(e,["schi","tenc"])[0]}return null}(e);if(t){var i=t.subarray(8,24);i.some((function(e){return 0!==e}))||(h.log("[eme] Patching keyId in 'enc"+(n?"a":"v")+">sinf>>tenc' box: "+W(i)+" -> "+W(r)),t.set(r,8))}}))}))}));return e}function he(e){var t=$(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var i=0,n=$(e,4),a=0;a<n;a++){if(256&t)i+=$(e,r),r+=4;512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4)}return i}function le(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function fe(e,t){var r=[],i=t.samples,n=t.timescale,a=t.id,s=!1;return ie(i,["moof"]).map((function(o){var u=o.byteOffset-8;ie(o,["traf"]).map((function(o){var d=ie(o,["tfdt"]).map((function(e){var t=e[0],r=$(e,4);return 1===t&&(r*=Math.pow(2,32),r+=$(e,8)),r/n}))[0];return void 0!==d&&(e=d),ie(o,["tfhd"]).map((function(d){var c=$(d,4),h=16777215&$(d,0),l=0,f=0!=(16&h),p=0,m=0!=(32&h),v=8;c===a&&(0!=(1&h)&&(v+=8),0!=(2&h)&&(v+=4),0!=(8&h)&&(l=$(d,v),v+=4),f&&(p=$(d,v),v+=4),m&&(v+=4),"video"===t.type&&(s=function(e){if(!e)return!1;var t=e.indexOf("."),r=t<0?e:e.substring(0,t);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(t.codec)),ie(o,["trun"]).map((function(a){var o=a[0],d=16777215&$(a,0),c=0!=(1&d),h=0,f=0!=(4&d),m=0!=(256&d),v=0,y=0!=(512&d),g=0,S=0!=(1024&d),b=0!=(2048&d),T=0,E=$(a,4),A=8;c&&(h=$(a,A),A+=4),f&&(A+=4);for(var x=h+u,R=0;R<E;R++){if(m?(v=$(a,A),A+=4):v=l,y?(g=$(a,A),A+=4):g=p,S&&(A+=4),b&&(T=0===o?$(a,A):te(a,A),A+=4),t.type===P)for(var _=0;_<g;){var w=$(i,x);if(pe(s,i[x+=4]))me(i.subarray(x,x+w),s?2:1,e+T/n,r);x+=w,_+=w+4}e+=v/n}})))}))}))})),r}function pe(e,t){if(e){var r=t>>1&63;return 39===r||40===r}return 6===(31&t)}function me(e,t,r,i){var n=ve(e),a=0;a+=t;for(var s=0,o=0,u=0;a<n.length;){s=0;do{if(a>=n.length)break;s+=u=n[a++]}while(255===u);o=0;do{if(a>=n.length)break;o+=u=n[a++]}while(255===u);var d=n.length-a,c=a;if(o<d)a+=o;else if(o>d){h.error("Malformed SEI payload. "+o+" is too small, only "+d+" bytes left to parse.");break}if(4===s){if(181===n[c++]){var l=Q(n,c);if(c+=2,49===l){var f=$(n,c);if(c+=4,1195456820===f){var p=n[c++];if(3===p){var m=n[c++],v=64&m,y=v?2+3*(31&m):0,g=new Uint8Array(y);if(v){g[0]=m;for(var S=1;S<y;S++)g[S]=n[c++]}i.push({type:p,payloadType:s,pts:r,bytes:g})}}}}}else if(5===s&&o>16){for(var b=[],T=0;T<16;T++){var E=n[c++].toString(16);b.push(1==E.length?"0"+E:E),3!==T&&5!==T&&7!==T&&9!==T||b.push("-")}for(var A=o-16,x=new Uint8Array(A),R=0;R<A;R++)x[R]=n[c++];i.push({payloadType:s,pts:r,uuid:b.join(""),userData:z(x),userDataBytes:x})}}}function ve(e){for(var t=e.byteLength,r=[],i=1;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return e;var n=t-r.length,a=new Uint8Array(n),s=0;for(i=0;i<n;s++,i++)s===r[0]&&(s++,r.shift()),a[i]=e[s];return a}var ye=function(){function e(e,t){var r=(void 0===t?{}:t).removePKCS7Padding,i=void 0===r||r;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=i,i)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}var t=e.prototype;return t.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},t.isSync=function(){return this.useSoftware},t.flush=function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var r,i,n,s=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(i=(r=s).byteLength,(n=i&&new DataView(r.buffer).getUint8(i-1))?a(r,0,i-n):r):s},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,r){var i=this;return this.useSoftware?new Promise((function(n,a){i.softwareDecrypt(new Uint8Array(e),t,r);var s=i.flush();s?n(s.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,r)},t.softwareDecrypt=function(e,t,r){var i=this.currentIV,n=this.currentResult,o=this.remainderData;this.logOnce("JS AES decrypt"),o&&(e=le(o,e),this.remainderData=null);var u=this.getValidChunk(e);if(!u.length)return null;i&&(r=i);var d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new s),d.expandKey(t);var c=n;return this.currentResult=d.decrypt(u.buffer,0,r),this.currentIV=a(u,-16).buffer,c||null},t.webCryptoDecrypt=function(e,t,r){var a=this;if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,r));this.key=t,this.fastAesKey=new n(this.subtle,t)}return this.fastAesKey.expandKey().then((function(t){return a.subtle?(a.logOnce("WebCrypto AES decrypt"),new i(a.subtle,new Uint8Array(r)).decrypt(e.buffer,t)):Promise.reject(new Error("web crypto not initialized"))})).catch((function(i){return h.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+i.name+": "+i.message),a.onWebCryptoError(e,t,r)}))},t.onWebCryptoError=function(e,t,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r);var i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},t.getValidChunk=function(e){var t=e,r=e.length-e.length%16;return r!==e.length&&(t=a(e,0,r),this.remainderData=a(e,r)),t},t.logOnce=function(e){this.logEnabled&&(h.log("[decrypter]: "+e),this.logEnabled=!1)},e}(),ge="org.id3",Se="https://aomedia.org/emsg/ID3";function be(e,t){return void 0===e&&(e=""),void 0===t&&(t=9e4),{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}var Te=function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},t.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,r){},t.demux=function(e,t){this.cachedData&&(e=le(this.cachedData,e),this.cachedData=null);var r,i=O(e,0),n=i?i.length:0,s=this._audioTrack,o=this._id3Track,u=i?M(i):void 0,d=e.length;for((null===this.basePTS||0===this.frameIndex&&l(u))&&(this.basePTS=Ee(u,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ge,duration:Number.POSITIVE_INFINITY});n<d;){if(this.canParse(e,n)){var c=this.appendFrame(s,e,n);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r=n+=c.length):n=d}else L(e,n)?(i=O(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ge,duration:Number.POSITIVE_INFINITY}),r=n+=i.length):n++;if(n===d&&r!==d){var h=a(e,r);this.cachedData?this.cachedData=le(this.cachedData,h):this.cachedData=h}}return{audioTrack:s,videoTrack:be(),id3Track:o,textTrack:be()}},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:be(),id3Track:this._id3Track,textTrack:be()}},t.destroy=function(){},e}(),Ee=function(e,t,r){return l(e)?90*e:9e4*t+(r?9e4*r.baseTime/r.timescale:0)};function Ae(e,t){return 255===e[t]&&240==(246&e[t+1])}function xe(e,t){return 1&e[t+1]?7:9}function Re(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function _e(e,t){return t+1<e.length&&Ae(e,t)}function we(e,t){if(_e(e,t)){var r=xe(e,t);if(t+r>=e.length)return!1;var i=Re(e,t);if(i<=r)return!1;var n=t+i;return n===e.length||_e(e,n)}return!1}function ke(i,n,a,s,o){if(!i.samplerate){var u=function(i,n,a,s){var o,u,d,c,l=navigator.userAgent.toLowerCase(),f=s,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&n[a+2])>>>6);var m=(60&n[a+2])>>>2;if(!(m>p.length-1))return d=(1&n[a+2])<<2,d|=(192&n[a+3])>>>6,h.log("manifest codec:"+s+", ADTS type:"+o+", samplingIndex:"+m),/firefox/i.test(l)?m>=6?(o=5,c=new Array(4),u=m-3):(o=2,c=new Array(2),u=m):-1!==l.indexOf("android")?(o=2,c=new Array(2),u=m):(o=5,c=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&m>=6?u=m-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(m>=6&&1===d||/vivaldi/i.test(l))||!s&&1===d)&&(o=2,c=new Array(2)),u=m)),c[0]=o<<3,c[0]|=(14&m)>>1,c[1]|=(1&m)<<7,c[1]|=d<<3,5===o&&(c[1]|=(14&u)>>1,c[2]=(1&u)<<7,c[2]|=8,c[3]=0),{config:c,samplerate:p[m],channelCount:d,codec:"mp4a.40."+o,manifestCodec:f};var v=new Error("invalid ADTS sampling index:"+m);i.emit(e.ERROR,e.ERROR,{type:t.MEDIA_ERROR,details:r.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message})}(n,a,s,o);if(!u)return;i.config=u.config,i.samplerate=u.samplerate,i.channelCount=u.channelCount,i.codec=u.codec,i.manifestCodec=u.manifestCodec,h.log("parsed codec:"+i.codec+", rate:"+u.samplerate+", channels:"+u.channelCount)}}function De(e){return 9216e4/e}function Pe(e,t,r,i,n){var a,s=i+n*De(e.samplerate),o=function(e,t){var r=xe(e,t);if(t+r<=e.length){var i=Re(e,t)-r;if(i>0)return{headerLength:r,frameLength:i}}}(t,r);if(o){var u=o.frameLength,d=o.headerLength,c=d+u,h=Math.max(0,r+c-t.length);h?(a=new Uint8Array(c-d)).set(t.subarray(r+d,t.length),0):a=t.subarray(r+d,r+c);var l={unit:a,pts:s};return h||e.samples.push(l),{sample:l,length:c,missing:h}}var f=t.length-r;return(a=new Uint8Array(f)).set(t.subarray(r,t.length),0),{sample:{unit:a,pts:s},length:f,missing:-1}}var Ie=null,Ce=[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],Oe=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Ue=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Le=[0,1,1,4];function Me(e,t,r,i,n){if(!(r+24>t.length)){var a=Fe(t,r);if(a&&r+a.frameLength<=t.length){var s=i+n*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(r,r+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function Fe(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,n=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==r&&0!==n&&15!==n&&3!==a){var s=e[t+2]>>1&1,o=e[t+3]>>6,u=1e3*Ce[14*(3===r?3-i:3===i?3:4)+n-1],d=Oe[3*(3===r?0:2===r?1:2)+a],c=3===o?1:2,h=Ue[r][i],l=Le[i],f=8*h*l,p=Math.floor(h*u/d+s)*l;if(null===Ie){var m=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ie=m?parseInt(m[1]):0}return!!Ie&&Ie<=87&&2===i&&u>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:c,frameLength:p,samplesPerFrame:f}}}function Ne(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Ve(e,t){return t+1<e.length&&Ne(e,t)}function Ge(e,t){if(t+1<e.length&&Ne(e,t)){var r=Fe(e,t),i=4;null!=r&&r.frameLength&&(i=r.frameLength);var n=t+i;return n===e.length||Ve(e,n)}return!1}var Be=function(e){function t(t,r){var i;return(i=e.call(this)||this).observer=void 0,i.config=void 0,i.observer=t,i.config=r,i}b(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,n){e.prototype.resetInitSegment.call(this,t,r,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=O(e,0),r=(null==t?void 0:t.length)||0;if(Ge(e,r))return!1;for(var i=e.length;r<i;r++)if(we(e,r))return h.log("ADTS sync word found !"),!0;return!1},r.canParse=function(e,t){return function(e,t){return function(e,t){return t+5<e.length}(e,t)&&Ae(e,t)&&Re(e,t)<=e.length-t}(e,t)},r.appendFrame=function(e,t,r){ke(e,this.observer,t,r,e.manifestCodec);var i=Pe(e,t,r,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i},t}(Te),Ke=/\/emsg[-/]ID3/i,Ye=function(){function e(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}var t=e.prototype;return t.resetTimeStamp=function(){},t.resetInitSegment=function(e,t,r,i){var n=this.videoTrack=be("video",1),a=this.audioTrack=be("audio",1),s=this.txtTrack=be("text",1);if(this.id3Track=be("id3",1),this.timeOffset=0,null!=e&&e.byteLength){var o=ae(e);if(o.video){var u=o.video,d=u.id,c=u.timescale,h=u.codec;n.id=d,n.timescale=s.timescale=c,n.codec=h}if(o.audio){var l=o.audio,f=l.id,p=l.timescale,m=l.codec;a.id=f,a.timescale=p,a.codec=m}s.id=Z.text,n.sampleDuration=0,n.duration=a.duration=i}},t.resetContiguity=function(){this.remainderData=null},e.probe=function(e){return function(e){for(var t=e.byteLength,r=0;r<t;){var i=$(e,r);if(i>8&&109===e[r+4]&&111===e[r+5]&&111===e[r+6]&&102===e[r+7])return!0;r=i>1?r+i:t}return!1}(e)},t.demux=function(e,t){this.timeOffset=t;var r=e,i=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=le(this.remainderData,e));var s=function(e){var t={valid:null,remainder:null},r=ie(e,["moof"]);if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=a(e,0,i.byteOffset-8),t.remainder=a(e,i.byteOffset-8),t}(r);this.remainderData=s.remainder,i.samples=s.valid||new Uint8Array}else i.samples=r;var o=this.extractID3Track(i,t);return n.samples=fe(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}},t.flush=function(){var e=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var i=this.extractID3Track(t,this.timeOffset);return r.samples=fe(e,t),{videoTrack:t,audioTrack:be(),id3Track:i,textTrack:be()}},t.extractID3Track=function(e,t){var r=this.id3Track;if(e.samples.length){var i=ie(e.samples,["emsg"]);i&&i.forEach((function(e){var i=function(e){var t=e[0],r="",i="",n=0,a=0,s=0,o=0,u=0,d=0;if(0===t){for(;"\0"!==J(e.subarray(d,d+1));)r+=J(e.subarray(d,d+1)),d+=1;for(r+=J(e.subarray(d,d+1)),d+=1;"\0"!==J(e.subarray(d,d+1));)i+=J(e.subarray(d,d+1)),d+=1;i+=J(e.subarray(d,d+1)),d+=1,n=$(e,12),a=$(e,16),o=$(e,20),u=$(e,24),d=28}else if(1===t){n=$(e,d+=4);var c=$(e,d+=4),l=$(e,d+=4);for(d+=4,s=Math.pow(2,32)*c+l,f(s)||(s=Number.MAX_SAFE_INTEGER,h.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=$(e,d),u=$(e,d+=4),d+=4;"\0"!==J(e.subarray(d,d+1));)r+=J(e.subarray(d,d+1)),d+=1;for(r+=J(e.subarray(d,d+1)),d+=1;"\0"!==J(e.subarray(d,d+1));)i+=J(e.subarray(d,d+1)),d+=1;i+=J(e.subarray(d,d+1)),d+=1}return{schemeIdUri:r,value:i,timeScale:n,presentationTime:s,presentationTimeDelta:a,eventDuration:o,id:u,payload:e.subarray(d,e.byteLength)}}(e);if(Ke.test(i.schemeIdUri)){var n=l(i.presentationTime)?i.presentationTime/i.timeScale:t+i.presentationTimeDelta/i.timeScale,a=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;a<=.001&&(a=Number.POSITIVE_INFINITY);var s=i.payload;r.samples.push({data:s,len:s.byteLength,dts:n,pts:n,type:Se,duration:a})}}))}return r},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},t.destroy=function(){},e}(),je=function(e,t){var r=0,i=5;t+=i;for(var n=new Uint32Array(1),a=new Uint32Array(1),s=new Uint8Array(1);i>0;){s[0]=e[t];var o=Math.min(i,8),u=8-o;a[0]=4278190080>>>24+u<<u,n[0]=(s[0]&a[0])>>u,r=r?r<<o|n[0]:n[0],t+=1,i-=o}return r},ze=function(e){function t(t){var r;return(r=e.call(this)||this).observer=void 0,r.observer=t,r}b(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,n){e.prototype.resetInitSegment.call(this,t,r,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},r.canParse=function(e,t){return t+64<e.length},r.appendFrame=function(e,t,r){var i=He(e,t,r,this.basePTS,this.frameIndex);if(-1!==i)return{sample:e.samples[e.samples.length-1],length:i,missing:0}},t.probe=function(e){if(!e)return!1;var t=O(e,0);if(!t)return!1;var r=t.length;return 11===e[r]&&119===e[r+1]&&void 0!==M(t)&&je(e,r)<16},t}(Te);function He(e,t,r,i,n){if(r+8>t.length)return-1;if(11!==t[r]||119!==t[r+1])return-1;var a=t[r+4]>>6;if(a>=3)return-1;var s=[48e3,44100,32e3][a],o=63&t[r+4],u=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+a];if(r+u>t.length)return-1;var d=t[r+6]>>5,c=0;2===d?c+=2:(1&d&&1!==d&&(c+=2),4&d&&(c+=2));var h=(t[r+6]<<8|t[r+7])>>12-c&1,l=[2,1,2,3,3,4,4,5][d]+h,f=t[r+5]>>3,p=7&t[r+5],m=new Uint8Array([a<<6|f<<1|p>>2,(3&p)<<6|d<<3|h<<2|o>>4,o<<4&224]),v=i+n*(1536/s*9e4),y=t.subarray(r,r+u);return e.config=m,e.channelCount=l,e.samplerate=s,e.samples.push({unit:y,pts:v}),u}var We=function(){function e(){this.VideoSample=null}var t=e.prototype;return t.createVideoSample=function(e,t,r,i){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:i,length:0}},t.getLastNalUnit=function(e){var t,r,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){var n=i.units;r=n[n.length-1]}return r},t.pushAccessUnit=function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,i=r.length;if(!i)return void t.dropped++;var n=r[i-1];e.pts=n.pts,e.dts=n.dts}t.samples.push(e)}e.debug.length&&h.log(e.pts+"/"+e.dts+":"+e.debug)},e}(),Xe=function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");i.set(e.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},t.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;if(e>32&&h.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,r=8,i=0;i<e;i++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r},t.readSPS=function(){var e,t,r,i=0,n=0,a=0,s=0,o=this.readUByte.bind(this),u=this.readBits.bind(this),d=this.readUEG.bind(this),c=this.readBoolean.bind(this),h=this.skipBits.bind(this),l=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var m=o();if(u(5),h(3),o(),f(),100===m||110===m||122===m||244===m||44===m||83===m||86===m||118===m||128===m){var v=d();if(3===v&&h(1),f(),f(),h(1),c())for(t=3!==v?8:12,r=0;r<t;r++)c()&&p(r<6?16:64)}f();var y=d();if(0===y)d();else if(1===y)for(h(1),l(),l(),e=d(),r=0;r<e;r++)l();f(),h(1);var g=d(),S=d(),b=u(1);0===b&&h(1),h(1),c()&&(i=d(),n=d(),a=d(),s=d());var T=[1,1];if(c()&&c())switch(o()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:T=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(g+1)-2*i-2*n),height:(2-b)*(S+1)*16-(b?2:4)*(a+s),pixelRatio:T}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}(),qe=function(e){function t(){return e.apply(this,arguments)||this}b(t,e);var r=t.prototype;return r.parseAVCPES=function(e,t,r,i,n){var a,s=this,o=this.parseAVCNALu(e,r.data),u=this.VideoSample,d=!1;r.data=null,u&&o.length&&!e.audFound&&(this.pushAccessUnit(u,e),u=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),o.forEach((function(i){var o;switch(i.type){case 1:var c=!1;a=!0;var h,l=i.data;if(d&&l.length>4){var f=new Xe(l).readSliceType();2!==f&&4!==f&&7!==f&&9!==f||(c=!0)}if(c)null!=(h=u)&&h.frame&&!u.key&&(s.pushAccessUnit(u,e),u=s.VideoSample=null);u||(u=s.VideoSample=s.createVideoSample(!0,r.pts,r.dts,"")),u.frame=!0,u.key=c;break;case 5:a=!0,null!=(o=u)&&o.frame&&!u.key&&(s.pushAccessUnit(u,e),u=s.VideoSample=null),u||(u=s.VideoSample=s.createVideoSample(!0,r.pts,r.dts,"")),u.key=!0,u.frame=!0;break;case 6:a=!0,me(i.data,1,r.pts,t.samples);break;case 7:var p,m;a=!0,d=!0;var v=i.data,y=new Xe(v).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||(null==(p=e.pixelRatio)?void 0:p[0])!==y.pixelRatio[0]||(null==(m=e.pixelRatio)?void 0:m[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[v],e.duration=n;for(var g=v.subarray(1,4),S="avc1.",b=0;b<3;b++){var T=g[b].toString(16);T.length<2&&(T="0"+T),S+=T}e.codec=S}break;case 8:a=!0,e.pps=[i.data];break;case 9:a=!0,e.audFound=!0,u&&s.pushAccessUnit(u,e),u=s.VideoSample=s.createVideoSample(!1,r.pts,r.dts,"");break;case 12:a=!0;break;default:a=!1,u&&(u.debug+="unknown NAL "+i.type+" ")}u&&a&&u.units.push(i)})),i&&u&&(this.pushAccessUnit(u,e),this.VideoSample=null)},r.parseAVCNALu=function(e,t){var r,i,n=t.byteLength,a=e.naluState||0,s=a,o=[],u=0,d=-1,c=0;for(-1===a&&(d=0,c=31&t[0],a=0,u=1);u<n;)if(r=t[u++],a)if(1!==a)if(r)if(1===r){if(i=u-a-1,d>=0){var h={data:t.subarray(d,i),type:c};o.push(h)}else{var l=this.getLastNalUnit(e.samples);l&&(s&&u<=4-s&&l.state&&(l.data=l.data.subarray(0,l.data.byteLength-s)),i>0&&(l.data=le(l.data,t.subarray(0,i)),l.state=0))}u<n?(d=u,c=31&t[u],a=0):a=-1}else a=0;else a=3;else a=r?0:2;else a=r?0:1;if(d>=0&&a>=0){var f={data:t.subarray(d,n),type:c,state:a};o.push(f)}if(0===o.length){var p=this.getLastNalUnit(e.samples);p&&(p.data=le(p.data,t))}return e.naluState=a,o},t}(We),Ze=function(){function e(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new ye(t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},t.decryptAacSample=function(e,t,r){var i=this,n=e[t].unit;if(!(n.length<=16)){var a=n.subarray(16,n.length-n.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(s).then((function(a){var s=new Uint8Array(a);n.set(s,16),i.decrypter.isSync()||i.decryptAacSamples(e,t+1,r)}))}},t.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,r),!this.decrypter.isSync()))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,n=32;n<e.length-16;n+=160,i+=16)r.set(e.subarray(n,n+16),i);return r},t.getAvcDecryptedUnit=function(e,t){for(var r=new Uint8Array(t),i=0,n=32;n<e.length-16;n+=160,i+=16)e.set(r.subarray(i,i+16),n);return e},t.decryptAvcSample=function(e,t,r,i,n){var a=this,s=ve(n.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){n.data=a.getAvcDecryptedUnit(s,o),a.decrypter.isSync()||a.decryptAvcSamples(e,t,r+1,i)}))},t.decryptAvcSamples=function(e,t,r,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void i();for(var n=e[t].units;!(r>=n.length);r++){var a=n[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,r,i,a),this.decrypter.isSync())))return}}},e}(),Je=188,Qe=function(){function e(e,t,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.videoParser=new qe}e.probe=function(t){var r=e.syncOffset(t);return r>0&&h.warn("MPEG2-TS detected but first sync word found @ offset "+r),-1!==r},e.syncOffset=function(e){for(var t=e.length,r=Math.min(940,t-Je)+1,i=0;i<r;){for(var n=!1,a=-1,s=0,o=i;o<t;o+=Je){if(71!==e[o]||t-o!==Je&&71!==e[o+Je]){if(s)return-1;break}if(s++,-1===a&&0!==(a=o)&&(r=Math.min(a+18612,e.length-Je)+1),n||(n=0===$e(e,o)),n&&s>1&&(0===a&&s>2||o+Je>r))return a}i++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Z[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,r,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=i,this._duration=n},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._videoTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null},t.demux=function(t,r,i,n){var a;void 0===i&&(i=!1),void 0===n&&(n=!1),i||(this.sampleAes=null);var s=this._videoTrack,o=this._audioTrack,u=this._id3Track,d=this._txtTrack,c=s.pid,l=s.pesData,f=o.pid,p=u.pid,m=o.pesData,v=u.pesData,y=null,g=this.pmtParsed,S=this._pmtId,b=t.length;if(this.remainderData&&(b=(t=le(this.remainderData,t)).length,this.remainderData=null),b<Je&&!n)return this.remainderData=t,{audioTrack:o,videoTrack:s,id3Track:u,textTrack:d};var T=Math.max(0,e.syncOffset(t));(b-=(b-T)%Je)<t.byteLength&&!n&&(this.remainderData=new Uint8Array(t.buffer,b,t.buffer.byteLength-b));for(var E=0,A=T;A<b;A+=Je)if(71===t[A]){var x=!!(64&t[A+1]),R=$e(t,A),_=void 0;if((48&t[A+3])>>4>1){if((_=A+5+t[A+4])===A+Je)continue}else _=A+4;switch(R){case c:x&&(l&&(a=nt(l))&&this.videoParser.parseAVCPES(s,d,a,!1,this._duration),l={data:[],size:0}),l&&(l.data.push(t.subarray(_,A+Je)),l.size+=A+Je-_);break;case f:if(x){if(m&&(a=nt(m)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,a);break;case"mp3":this.parseMPEGPES(o,a);break;case"ac3":this.parseAC3PES(o,a)}m={data:[],size:0}}m&&(m.data.push(t.subarray(_,A+Je)),m.size+=A+Je-_);break;case p:x&&(v&&(a=nt(v))&&this.parseID3PES(u,a),v={data:[],size:0}),v&&(v.data.push(t.subarray(_,A+Je)),v.size+=A+Je-_);break;case 0:x&&(_+=t[_]+1),S=this._pmtId=et(t,_);break;case S:x&&(_+=t[_]+1);var w=tt(t,_,this.typeSupported,i,this.observer);(c=w.videoPid)>0&&(s.pid=c,s.segmentCodec=w.segmentVideoCodec),(f=w.audioPid)>0&&(o.pid=f,o.segmentCodec=w.segmentAudioCodec),(p=w.id3Pid)>0&&(u.pid=p),null===y||g||(h.warn("MPEG-TS PMT found at "+A+" after unknown PID '"+y+"'. Backtracking to sync byte @"+T+" to parse all TS packets."),y=null,A=T-188),g=this.pmtParsed=!0;break;case 17:case 8191:break;default:y=R}}else E++;E>0&&rt(this.observer,new Error("Found "+E+" TS packet/s that do not start with 0x47")),s.pesData=l,o.pesData=m,u.pesData=v;var k={audioTrack:o,videoTrack:s,id3Track:u,textTrack:d};return n&&this.extractRemainingSamples(k),k},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,r=e.audioTrack,i=e.videoTrack,n=e.id3Track,a=e.textTrack,s=i.pesData,o=r.pesData,u=n.pesData;if(s&&(t=nt(s))?(this.videoParser.parseAVCPES(i,a,t,!0,this._duration),i.pesData=null):i.pesData=s,o&&(t=nt(o))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,t);break;case"mp3":this.parseMPEGPES(r,t);break;case"ac3":this.parseAC3PES(r,t)}r.pesData=null}else null!=o&&o.size&&h.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=o;u&&(t=nt(u))?(this.parseID3PES(n,t),n.pesData=null):n.pesData=u},t.demuxSampleAes=function(e,t,r){var i=this.demux(e,r,!0,!this.config.progressive),n=this.sampleAes=new Ze(this.observer,this.config,t);return this.decrypt(i,n)},t.decrypt=function(e,t){return new Promise((function(r){var i=e.audioTrack,n=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(function(){n.samples?t.decryptAvcSamples(n.samples,0,0,(function(){r(e)})):r(e)})):n.samples&&t.decryptAvcSamples(n.samples,0,0,(function(){r(e)}))}))},t.destroy=function(){this._duration=0},t.parseAACPES=function(e,t){var r,i,n,a=0,s=this.aacOverFlow,o=t.data;if(s){this.aacOverFlow=null;var u=s.missing,d=s.sample.unit.byteLength;if(-1===u)o=le(s.sample.unit,o);else{var c=d-u;s.sample.unit.set(o.subarray(0,u),c),e.samples.push(s.sample),a=s.missing}}for(r=a,i=o.length;r<i-1&&!_e(o,r);r++);if(r!==a){var l,f=r<i-1;if(l=f?"AAC PES did not start with ADTS header,offset:"+r:"No ADTS header found in AAC PES",rt(this.observer,new Error(l),f),!f)return}if(ke(e,this.observer,o,r,this.audioCodec),void 0!==t.pts)n=t.pts;else{if(!s)return void h.warn("[tsdemuxer]: AAC PES unknown PTS");var p=De(e.samplerate);n=s.sample.pts+p}for(var m,v=0;r<i;){if(r+=(m=Pe(e,o,r,n,v)).length,m.missing){this.aacOverFlow=m;break}for(v++;r<i-1&&!_e(o,r);r++);}},t.parseMPEGPES=function(e,t){var r=t.data,i=r.length,n=0,a=0,s=t.pts;if(void 0!==s)for(;a<i;)if(Ve(r,a)){var o=Me(e,r,a,s,n);if(!o)break;a+=o.length,n++}else a++;else h.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseAC3PES=function(e,t){var r=t.data,i=t.pts;if(void 0!==i)for(var n,a=r.length,s=0,o=0;o<a&&(n=He(e,r,o,i,s++))>0;)o+=n;else h.warn("[tsdemuxer]: AC3 PES unknown PTS")},t.parseID3PES=function(e,t){if(void 0!==t.pts){var r=S({},t,{type:this._videoTrack?Se:ge,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}else h.warn("[tsdemuxer]: ID3 PES unknown PTS")},e}();function $e(e,t){return((31&e[t+1])<<8)+e[t+2]}function et(e,t){return(31&e[t+10])<<8|e[t+11]}function tt(e,t,r,i,n){var a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},s=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<s;){var o=$e(e,t),u=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!i){it("ADTS AAC");break}case 15:-1===a.audioPid&&(a.audioPid=o);break;case 21:-1===a.id3Pid&&(a.id3Pid=o);break;case 219:if(!i){it("H.264");break}case 27:-1===a.videoPid&&(a.videoPid=o,a.segmentVideoCodec="avc");break;case 3:case 4:r.mpeg||r.mp3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="mp3"):h.log("MPEG audio found, not supported in this browser");break;case 193:if(!i){it("AC-3");break}case 129:r.ac3?-1===a.audioPid&&(a.audioPid=o,a.segmentAudioCodec="ac3"):h.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===a.audioPid&&u>0)for(var d=t+5,c=u;c>2;){if(106===e[d])!0!==r.ac3?h.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3");var l=e[d+1]+2;d+=l,c-=l}break;case 194:case 135:return rt(n,new Error("Unsupported EC-3 in M2TS found")),a;case 36:return rt(n,new Error("Unsupported HEVC in M2TS found")),a}t+=u+5}return a}function rt(i,n,a){h.warn("parsing error: "+n.message),i.emit(e.ERROR,e.ERROR,{type:t.MEDIA_ERROR,details:r.FRAG_PARSING_ERROR,fatal:!1,levelRetry:a,error:n,reason:n.message})}function it(e){h.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function nt(e){var t,r,i,n,a,s=0,o=e.data;if(!e||0===e.size)return null;for(;o[0].length<19&&o.length>1;)o[0]=le(o[0],o[1]),o.splice(1,1);if(1===((t=o[0])[0]<<16)+(t[1]<<8)+t[2]){if((r=(t[4]<<8)+t[5])&&r>e.size-6)return null;var u=t[7];192&u&&(n=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&u?n-(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(h.warn(Math.round((n-a)/9e4)+"s delta between PTS and DTS, align them"),n=a):a=n);var d=(i=t[8])+9;if(e.size<=d)return null;e.size-=d;for(var c=new Uint8Array(e.size),l=0,f=o.length;l<f;l++){var p=(t=o[l]).byteLength;if(d){if(d>p){d-=p;continue}t=t.subarray(d),p-=d,d=0}c.set(t,s),s+=p}return r&&(r-=i+3),{data:c,pts:n,dts:a,len:r}}return null}var at=function(e){function t(){return e.apply(this,arguments)||this}b(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,n){e.prototype.resetInitSegment.call(this,t,r,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=O(e,0),r=(null==t?void 0:t.length)||0;if(t&&11===e[r]&&119===e[r+1]&&void 0!==M(t)&&je(e,r)<=16)return!1;for(var i=e.length;r<i;r++)if(Ge(e,r))return h.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(e,t){return function(e,t){return Ne(e,t)&&4<=e.length-t}(e,t)},r.appendFrame=function(e,t,r){if(null!==this.basePTS)return Me(e,t,r,this.basePTS,this.frameIndex)},t}(Te),st=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)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===t)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===t)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===t)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===t)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])}},e}(),ot=Math.pow(2,32)-1,ut=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=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]),i=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.HDLR_TYPES={video:r,audio:i};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,u,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))},e.box=function(e){for(var t=8,r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(var a=i.length,s=a;a--;)t+=i[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a<s;a++)o.set(i[a],t),t+=i[a].byteLength;return o},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,r){r*=t;var i=Math.floor(r/(ot+1)),n=Math.floor(r%(ot+1));return e.box(e.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,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))},e.moov=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,r){r*=t;var i=Math.floor(r/(ot+1)),n=Math.floor(r%(ot+1)),a=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,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,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 e.box(e.types.mvhd,a)},e.sdtp=function(t){var r,i,n=t.samples||[],a=new Uint8Array(4+n.length);for(r=0;r<n.length;r++)i=n[r].flags,a[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e.box(e.types.sdtp,a)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var r,i,n,a=[],s=[];for(r=0;r<t.sps.length;r++)n=(i=t.sps[r]).byteLength,a.push(n>>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)n=(i=t.pps[r]).byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),u=t.width,d=t.height,c=t.pixelRatio[0],h=t.pixelRatio[1];return e.box(e.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,u>>8&255,255&u,d>>8&255,255&d,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]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,h>>24,h>>16&255,h>>8&255,255&h])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.audioStsd=function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])},e.mp4a=function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){return e.box(e.types[".mp3"],e.audioStsd(t))},e.ac3=function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var r=t.id,i=t.duration*t.timescale,n=t.width,a=t.height,s=Math.floor(i/(ot+1)),o=Math.floor(i%(ot+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o,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,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),n=t.id,a=Math.floor(r/(ot+1)),s=Math.floor(r%(ot+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var i,n,a,s,o,u,d=t.samples||[],c=d.length,h=12+16*c,l=new Uint8Array(h);for(r+=8+h,l.set(["video"===t.type?1:0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<c;i++)a=(n=d[i]).duration,s=n.size,o=n.flags,u=n.cts,l.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*i);return e.box(e.types.trun,l)},e.initSegment=function(t){e.types||e.init();var r=e.moov(t);return le(e.FTYP,r)},e}();ut.types=void 0,ut.HDLR_TYPES=void 0,ut.STTS=void 0,ut.STSC=void 0,ut.STCO=void 0,ut.STSZ=void 0,ut.VMHD=void 0,ut.SMHD=void 0,ut.STSD=void 0,ut.FTYP=void 0,ut.DINF=void 0;var dt="audio";function ct(e,t){return void 0===t&&(t=!1),function(e,t,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var n=e*t*r;return i?Math.round(n):n}(e,1e3,1/9e4,t)}var ht=null,lt=null,ft=function(){function i(e,t,r,i){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===ht){var n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ht=n?parseInt(n[1]):0}if(null===lt){var a=navigator.userAgent.match(/Safari\/(\d+)/i);lt=a?parseInt(a[1]):0}}var n=i.prototype;return n.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},n.resetTimeStamp=function(e){h.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},n.resetNextTimestamp=function(){h.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},n.resetInitSegment=function(){h.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},n.getVideoStartPts=function(e){var t=!1,r=e.reduce((function(e,r){var i=r.pts-e;return i<-4294967296?(t=!0,pt(e,r.pts)):i>0?e:r.pts}),e[0].pts);return t&&h.debug("PTS rollover detected"),r},n.remux=function(e,t,r,i,n,a,s,o){var u,d,c,l,f,p,m=n,v=n,y=e.pid>-1,g=t.pid>-1,S=t.samples.length,b=e.samples.length>0,T=s&&S>0||S>1;if((!y||b)&&(!g||T)||this.ISGenerated||s){if(this.ISGenerated){var E,A,x,R,_=this.videoTrackConfig;!_||t.width===_.width&&t.height===_.height&&(null==(E=t.pixelRatio)?void 0:E[0])===(null==(A=_.pixelRatio)?void 0:A[0])&&(null==(x=t.pixelRatio)?void 0:x[1])===(null==(R=_.pixelRatio)?void 0:R[1])||this.resetInitSegment()}else c=this.generateIS(e,t,n,a);var w,k=this.isVideoContiguous,D=-1;if(T&&(D=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!k&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,D>0){h.warn("[mp4-remuxer]: Dropped "+D+" out of "+S+" video samples due to a missing keyframe");var P=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(D),t.dropped+=D,w=v+=(t.samples[0].pts-P)/t.inputTimeScale}else-1===D&&(h.warn("[mp4-remuxer]: No keyframe found out of "+S+" video samples"),p=!1);if(this.ISGenerated){if(b&&T){var I=this.getVideoStartPts(t.samples),C=(pt(e.samples[0].pts,I)-I)/t.inputTimeScale;m+=Math.max(0,C),v+=Math.max(0,-C)}if(b){if(e.samplerate||(h.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),d=this.remuxAudio(e,m,this.isAudioContiguous,a,g||T||o===dt?v:void 0),T){var O=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(h.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),u=this.remuxVideo(t,v,k,O)}}else T&&(u=this.remuxVideo(t,v,k,0));u&&(u.firstKeyFrame=D,u.independent=-1!==D,u.firstKeyFramePTS=w)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(f=mt(r,n,this._initPTS,this._initDTS)),i.samples.length&&(l=vt(i,n,this._initPTS))),{audio:d,video:u,initSegment:c,independent:p,text:l,id3:f}},n.generateIS=function(e,t,r,i){var n,a,s,o=e.samples,u=t.samples,d=this.typeSupported,c={},h=this._initPTS,l=!h||i,f="audio/mp4";if(l&&(n=a=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":d.mpeg?(f="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}c.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&d.mpeg?new Uint8Array(0):ut.initSegment([e]),metadata:{channelCount:e.channelCount}},l&&(s=e.inputTimeScale,h&&s===h.timescale?l=!1:n=a=o[0].pts-Math.round(s*r))}if(t.sps&&t.pps&&u.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:ut.initSegment([t]),metadata:{width:t.width,height:t.height}},l)if(s=t.inputTimeScale,h&&s===h.timescale)l=!1;else{var p=this.getVideoStartPts(u),m=Math.round(s*r);a=Math.min(a,pt(u[0].dts,p)-m),n=Math.min(n,p-m)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,l?(this._initPTS={baseTime:n,timescale:s},this._initDTS={baseTime:a,timescale:s}):n=s=void 0,{tracks:c,initPTS:n,timescale:s}},n.remuxVideo=function(i,n,a,s){var o,u,d=i.inputTimeScale,c=i.samples,l=[],f=c.length,p=this._initPTS,m=this.nextAvcDts,v=8,y=this.videoSampleDuration,g=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,T=!1;if(!a||null===m){var E=n*d,A=c[0].pts-pt(c[0].dts,c[0].pts);ht&&null!==m&&Math.abs(E-A-m)<15e3?a=!0:m=E-A}for(var x=p.baseTime*d/p.timescale,R=0;R<f;R++){var _=c[R];_.pts=pt(_.pts-x,m),_.dts=pt(_.dts-x,m),_.dts<c[R>0?R-1:R].dts&&(T=!0)}T&&c.sort((function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i})),o=c[0].dts;var w=(u=c[c.length-1].dts)-o,k=w?Math.round(w/(f-1)):y||i.inputTimeScale/30;if(a){var D=o-m,P=D>k,I=D<-1;if((P||I)&&(P?h.warn("AVC: "+ct(D,!0)+" ms ("+D+"dts) hole between fragments detected at "+n.toFixed(3)):h.warn("AVC: "+ct(-D,!0)+" ms ("+D+"dts) overlapping between fragments detected at "+n.toFixed(3)),!I||m>=c[0].pts||ht)){o=m;var C=c[0].pts-D;if(P)c[0].dts=o,c[0].pts=C;else for(var O=0;O<c.length&&!(c[O].dts>C);O++)c[O].dts-=D,c[O].pts-=D;h.log("Video: Initial PTS/DTS adjusted: "+ct(C,!0)+"/"+ct(o,!0)+", delta: "+ct(D,!0)+" ms")}}for(var U=0,L=0,M=o=Math.max(0,o),F=0;F<f;F++){for(var N=c[F],V=N.units,G=V.length,B=0,K=0;K<G;K++)B+=V[K].data.length;L+=B,U+=G,N.length=B,N.dts<M?(N.dts=M,M+=k/4|0||1):M=N.dts,g=Math.min(N.pts,g),b=Math.max(N.pts,b)}u=c[f-1].dts;var Y,j=L+4*U+8;try{Y=new Uint8Array(j)}catch(i){return void this.observer.emit(e.ERROR,e.ERROR,{type:t.MUX_ERROR,details:r.REMUX_ALLOC_ERROR,fatal:!1,error:i,bytes:j,reason:"fail allocating video mdat "+j})}var z=new DataView(Y.buffer);z.setUint32(0,j),Y.set(ut.types.mdat,4);for(var H=!1,W=Number.POSITIVE_INFINITY,X=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,J=0;J<f;J++){for(var Q=c[J],$=Q.units,ee=0,te=0,re=$.length;te<re;te++){var ie=$[te],ne=ie.data,ae=ie.data.byteLength;z.setUint32(v,ae),v+=4,Y.set(ne,v),v+=ae,ee+=4+ae}var se=void 0;if(J<f-1)y=c[J+1].dts-Q.dts,se=c[J+1].pts-Q.pts;else{var oe=this.config,ue=J>0?Q.dts-c[J-1].dts:k;if(se=J>0?Q.pts-c[J-1].pts:k,oe.stretchShortVideoTrack&&null!==this.nextAudioPts){var de=Math.floor(oe.maxBufferHole*d),ce=(s?g+s*d:this.nextAudioPts)-Q.pts;ce>de?((y=ce-ue)<0?y=ue:H=!0,h.log("[mp4-remuxer]: It is approximately "+ce/90+" ms to the next segment; using duration "+y/90+" ms for the last video frame.")):y=ue}else y=ue}var he=Math.round(Q.pts-Q.dts);W=Math.min(W,y),q=Math.max(q,y),X=Math.min(X,se),Z=Math.max(Z,se),l.push(new yt(Q.key,y,ee,he))}if(l.length)if(ht){if(ht<70){var le=l[0].flags;le.dependsOn=2,le.isNonSync=0}}else if(lt&&Z-X<q-W&&k/q<.025&&0===l[0].cts){h.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var fe=o,pe=0,me=l.length;pe<me;pe++){var ve=fe+l[pe].duration,ye=fe+l[pe].cts;if(pe<me-1){var ge=ve+l[pe+1].cts;l[pe].duration=ge-ye}else l[pe].duration=pe?l[pe-1].duration:k;l[pe].cts=0,fe=ve}}y=H||!y?k:y,this.nextAvcDts=m=u+y,this.videoSampleDuration=y,this.isVideoContiguous=!0;var Se={data1:ut.moof(i.sequenceNumber++,o,S({},i,{samples:l})),data2:Y,startPTS:g/d,endPTS:(b+y)/d,startDTS:o/d,endDTS:m/d,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:i.dropped};return i.samples=[],i.dropped=0,Se},n.getSamplesPerFrame=function(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}},n.remuxAudio=function(i,n,a,s,o){var u=i.inputTimeScale,d=u/(i.samplerate?i.samplerate:u),c=this.getSamplesPerFrame(i),l=c*d,f=this._initPTS,p="mp3"===i.segmentCodec&&this.typeSupported.mpeg,m=[],v=void 0!==o,y=i.samples,g=p?0:8,b=this.nextAudioPts||-1,T=n*u,E=f.baseTime*u/f.timescale;if(this.isAudioContiguous=a=a||y.length&&b>0&&(s&&Math.abs(T-b)<9e3||Math.abs(pt(y[0].pts-E,T)-b)<20*l),y.forEach((function(e){e.pts=pt(e.pts-E,T)})),!a||b<0){if(y=y.filter((function(e){return e.pts>=0})),!y.length)return;b=0===o?0:s&&!v?Math.max(0,T):y[0].pts}if("aac"===i.segmentCodec)for(var A=this.config.maxAudioFramesDrift,x=0,R=b;x<y.length;x++){var _=y[x],w=_.pts,k=w-R,D=Math.abs(1e3*k/u);if(k<=-A*l&&v)0===x&&(h.warn("Audio frame @ "+(w/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*k/u)+" ms."),this.nextAudioPts=b=R=w);else if(k>=A*l&&D<1e4&&v){var P=Math.round(k/l);(R=w-P*l)<0&&(P--,R+=l),0===x&&(this.nextAudioPts=b=R),h.warn("[mp4-remuxer]: Injecting "+P+" audio frame @ "+(R/u).toFixed(3)+"s due to "+Math.round(1e3*k/u)+" ms gap.");for(var I=0;I<P;I++){var C=Math.max(R,0),O=st.getSilentFrame(i.manifestCodec||i.codec,i.channelCount);O||(h.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),O=_.unit.subarray()),y.splice(x,0,{unit:O,pts:C}),R+=l,x++}}_.pts=R,R+=l}for(var U,L=null,M=null,F=0,N=y.length;N--;)F+=y[N].unit.byteLength;for(var V=0,G=y.length;V<G;V++){var B=y[V],K=B.unit,Y=B.pts;if(null!==M){m[V-1].duration=Math.round((Y-M)/d)}else{if(a&&"aac"===i.segmentCodec&&(Y=b),L=Y,!(F>0))return;F+=g;try{U=new Uint8Array(F)}catch(i){return void this.observer.emit(e.ERROR,e.ERROR,{type:t.MUX_ERROR,details:r.REMUX_ALLOC_ERROR,fatal:!1,error:i,bytes:F,reason:"fail allocating audio mdat "+F})}p||(new DataView(U.buffer).setUint32(0,F),U.set(ut.types.mdat,4))}U.set(K,g);var j=K.byteLength;g+=j,m.push(new yt(!0,c,j,0)),M=Y}var z=m.length;if(z){var H=m[m.length-1];this.nextAudioPts=b=M+d*H.duration;var W=p?new Uint8Array(0):ut.moof(i.sequenceNumber++,L/d,S({},i,{samples:m}));i.samples=[];var X=L/u,q=b/u,Z={data1:W,data2:U,startPTS:X,endPTS:q,startDTS:X,endDTS:q,type:"audio",hasAudio:!0,hasVideo:!1,nb:z};return this.isAudioContiguous=!0,Z}},n.remuxEmptyAudio=function(e,t,r,i){var n=e.inputTimeScale,a=n/(e.samplerate?e.samplerate:n),s=this.nextAudioPts,o=this._initDTS,u=9e4*o.baseTime/o.timescale,d=(null!==s?s:i.startDTS*n)+u,c=i.endDTS*n+u,l=1024*a,f=Math.ceil((c-d)/l),p=st.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(h.warn("[mp4-remuxer]: remux empty Audio"),p){for(var m=[],v=0;v<f;v++){var y=d+v*l;m.push({unit:p,pts:y,dts:y})}return e.samples=m,this.remuxAudio(e,t,r,!1)}h.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},i}();function pt(e,t){var r;if(null===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}function mt(e,t,r,i){var n=e.samples.length;if(n){for(var a=e.inputTimeScale,s=0;s<n;s++){var o=e.samples[s];o.pts=pt(o.pts-r.baseTime*a/r.timescale,t*a)/a,o.dts=pt(o.dts-i.baseTime*a/i.timescale,t*a)/a}var u=e.samples;return e.samples=[],{samples:u}}}function vt(e,t,r){var i=e.samples.length;if(i){for(var n=e.inputTimeScale,a=0;a<i;a++){var s=e.samples[a];s.pts=pt(s.pts-r.baseTime*n/r.timescale,t*n)/n}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}}var yt=function(e,t,r,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=r,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}};function gt(e,t,r){var i;void 0===r&&(r=!0);var n=function(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}(r);return null!=(i=null==n?void 0:n.isTypeSupported(function(e,t){return t+'/mp4;codecs="'+e+'"'}(e,t)))&&i}var St={};var bt=/flac|opus/i;function Tt(e,t){return void 0===t&&(t=!0),e.replace(bt,(function(e){return function(e,t){if(void 0===t&&(t=!0),St[e])return St[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],i=0;i<r.length;i++)if(gt(r[i],"audio",t))return St[e]=r[i],r[i];return e}(e.toLowerCase(),t)}))}var Et=function(){function e(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this.initPTS=e,this.lastEndTime=null},t.resetNextTimestamp=function(){this.lastEndTime=null},t.resetInitSegment=function(e,t,r,i){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(ce(e,i)),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t=this.audioCodec,r=this.videoCodec;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var i=this.initData=ae(e);i.audio&&(t=At(i.audio,D)),i.video&&(r=At(i.video,P));var n={};i.audio&&i.video?n.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:i.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?n.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:h.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n},t.remux=function(e,t,r,i,n,a){var s,o,u=this.initPTS,d=this.lastEndTime,c={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};l(d)||(d=this.lastEndTime=n||0);var f=t.samples;if(null==f||!f.length)return c;var p={initPTS:void 0,timescale:1},m=this.initData;if(null!=(s=m)&&s.length||(this.generateInitSegment(f),m=this.initData),null==(o=m)||!o.length)return h.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1);var v=function(e,t){for(var r=0,i=0,n=0,a=ie(e,["moof","traf"]),s=0;s<a.length;s++){var o=a[s],u=ie(o,["tfhd"])[0],d=t[$(u,4)];if(d){var c=d.default,h=$(u,0)|(null==c?void 0:c.flags),f=null==c?void 0:c.duration;8&h&&(f=$(u,2&h?12:8));for(var p=d.timescale||9e4,m=ie(o,["trun"]),v=0;v<m.length;v++)!(r=he(m[v]))&&f&&(r=f*$(m[v],4)),d.type===P?i+=r/p:d.type===D&&(n+=r/p)}}if(0===i&&0===n){for(var y=1/0,g=0,S=0,b=ie(e,["sidx"]),T=0;T<b.length;T++){var E=ne(b[T]);if(null!=E&&E.references){y=Math.min(y,E.earliestPresentationTime/E.timescale);var A=E.references.reduce((function(e,t){return e+t.info.duration||0}),0);S=(g=Math.max(g,A+E.earliestPresentationTime/E.timescale))-y}}if(S&&l(S))return S}return i||n}(f,m),y=function(e,t){return ie(t,["moof","traf"]).reduce((function(t,r){var i=ie(r,["tfdt"])[0],n=i[0],a=ie(r,["tfhd"]).reduce((function(t,r){var a=$(r,4),s=e[a];if(s){var o=$(i,4);if(1===n){if(o===X)return h.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;o*=X+1,o+=$(i,8)}var u=o/(s.timescale||9e4);if(l(u)&&(null===t||u<t))return u}return t}),null);return null!==a&&l(a)&&(null===t||a<t)?a:t}),null)}(m,f),g=null===y?n:y;(function(e,t,r,i){if(null===e)return!0;var n=Math.max(i,1),a=t-e.baseTime/e.timescale;return Math.abs(a-r)>n}(u,g,n,v)||p.timescale!==u.timescale&&a)&&(p.initPTS=g-n,u&&1===u.timescale&&h.warn("Adjusting initPTS by "+(p.initPTS-u.baseTime)),this.initPTS=u={baseTime:p.initPTS,timescale:1});var S=e?g-u.baseTime/u.timescale:d,b=S+v;!function(e,t,r){ie(t,["moof","traf"]).forEach((function(t){ie(t,["tfhd"]).forEach((function(i){var n=$(i,4),a=e[n];if(a){var s=a.timescale||9e4;ie(t,["tfdt"]).forEach((function(e){var t=e[0],i=r*s;if(i){var n=$(e,4);if(0===t)n-=i,re(e,4,n=Math.max(n,0));else{n*=Math.pow(2,32),n+=$(e,8),n-=i,n=Math.max(n,0);var a=Math.floor(n/(X+1)),o=Math.floor(n%(X+1));re(e,4,a),re(e,8,o)}}}))}}))}))}(m,f,u.baseTime/u.timescale),v>0?this.lastEndTime=b:(h.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var T=!!m.audio,E=!!m.video,A="";T&&(A+="audio"),E&&(A+="video");var x={data1:f,startPTS:S,startDTS:S,endPTS:b,endDTS:b,type:A,hasAudio:T,hasVideo:E,nb:1,dropped:0};return c.audio="audio"===x.type?x:void 0,c.video="audio"!==x.type?x:void 0,c.initSegment=p,c.id3=mt(r,n,u,u),i.samples.length&&(c.text=vt(i,n,u)),c},e}();function At(e,t){var r=null==e?void 0:e.codec;if(r&&r.length>4)return r;if(t===D){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r){return Tt(r,!1)}var i="mp4a.40.5";return h.info('Parsed audio codec "'+r+'" or audio object type not handled. Using "'+i+'"'),i}return h.warn('Unhandled video codec "'+r+'"'),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}var xt,Rt="undefined"!=typeof self?self:void 0;try{xt=self.performance.now.bind(self.performance)}catch(e){h.debug("Unable to use Performance API on this environment"),xt=null==Rt?void 0:Rt.Date.now}var _t=[{demux:Ye,remux:Et},{demux:Qe,remux:ft},{demux:Be,remux:ft},{demux:at,remux:ft}];_t.splice(2,0,{demux:ze,remux:ft});var wt=function(){function i(e,t,r,i,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=r,this.vendor=i,this.id=n}var n=i.prototype;return n.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},n.push=function(i,n,a,s){var o=this,u=a.transmuxing;u.executeStart=xt();var d=new Uint8Array(i),c=this.currentTransmuxState,l=this.transmuxConfig;s&&(this.currentTransmuxState=s);var f=s||c,p=f.contiguous,m=f.discontinuity,v=f.trackSwitch,y=f.accurateTimeOffset,g=f.timeOffset,S=f.initSegmentChange,b=l.audioCodec,T=l.videoCodec,E=l.defaultInitPts,A=l.duration,x=l.initSegmentData,R=function(e,t){var r=null;e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(r=t);return r}(d,n);if(R&&"AES-128"===R.method){var _=this.getDecrypter();if(!_.isSync())return this.decryptionPromise=_.webCryptoDecrypt(d,R.key.buffer,R.iv.buffer).then((function(e){var t=o.push(e,null,a);return o.decryptionPromise=null,t})),this.decryptionPromise;var w=_.softwareDecrypt(d,R.key.buffer,R.iv.buffer);if(a.part>-1&&(w=_.flush()),!w)return u.executeEnd=xt(),kt(a);d=new Uint8Array(w)}var k=this.needsProbing(m,v);if(k){var D=this.configureTransmuxer(d);if(D)return h.warn("[transmuxer] "+D.message),this.observer.emit(e.ERROR,e.ERROR,{type:t.MEDIA_ERROR,details:r.FRAG_PARSING_ERROR,fatal:!1,error:D,reason:D.message}),u.executeEnd=xt(),kt(a)}(m||v||S||k)&&this.resetInitSegment(x,b,T,A,n),(m||S||k)&&this.resetInitialTimestamp(E),p||this.resetContiguity();var P=this.transmux(d,R,g,y,a),I=this.currentTransmuxState;return I.contiguous=!0,I.discontinuity=!1,I.trackSwitch=!1,u.executeEnd=xt(),P},n.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=xt();var i=this.decrypter,n=this.currentTransmuxState,a=this.decryptionPromise;if(a)return a.then((function(){return t.flush(e)}));var s=[],o=n.timeOffset;if(i){var u=i.flush();u&&s.push(this.push(u,null,e))}var d=this.demuxer,c=this.remuxer;if(!d||!c)return r.executeEnd=xt(),[kt(e)];var h=d.flush(o);return Dt(h)?h.then((function(r){return t.flushRemux(s,r,e),s})):(this.flushRemux(s,h,e),s)},n.flushRemux=function(e,t,r){var i=t.audioTrack,n=t.videoTrack,a=t.id3Track,s=t.textTrack,o=this.currentTransmuxState,u=o.accurateTimeOffset,d=o.timeOffset;h.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var c=this.remuxer.remux(i,n,a,s,d,u,!0,this.id);e.push({remuxResult:c,chunkMeta:r}),r.transmuxing.executeEnd=xt()},n.resetInitialTimestamp=function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))},n.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},n.resetInitSegment=function(e,t,r,i,n){var a=this.demuxer,s=this.remuxer;a&&s&&(a.resetInitSegment(e,t,r,i),s.resetInitSegment(e,t,r,n))},n.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},n.transmux=function(e,t,r,i,n){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,i,n):this.transmuxUnencrypted(e,r,i,n)},n.transmuxUnencrypted=function(e,t,r,i){var n=this.demuxer.demux(e,t,!1,!this.config.progressive),a=n.audioTrack,s=n.videoTrack,o=n.id3Track,u=n.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,u,t,r,!1,this.id),chunkMeta:i}},n.transmuxSampleAes=function(e,t,r,i,n){var a=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,i,!1,a.id),chunkMeta:n}}))},n.configureTransmuxer=function(e){for(var t,r=this.config,i=this.observer,n=this.typeSupported,a=this.vendor,s=0,o=_t.length;s<o;s++){var u;if(null!=(u=_t[s].demux)&&u.probe(e)){t=_t[s];break}}if(!t)return new Error("Failed to find demuxer by probing fragment data");var d=this.demuxer,c=this.remuxer,h=t.remux,l=t.demux;c&&c instanceof h||(this.remuxer=new h(i,r,n,a)),d&&d instanceof l||(this.demuxer=new l(i,r,n),this.probe=l.probe)},n.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},n.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new ye(this.config)),e},i}();var kt=function(e){return{remuxResult:{},chunkMeta:e}};function Dt(e){return"then"in e&&e.then instanceof Function}var Pt={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,i,a,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,a||e,s),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],o]:e._events[u].push(o):(e._events[u]=o,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),o.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,s=new Array(a);n<a;n++)s[n]=i[n].fn;return s},o.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},o.prototype.emit=function(e,t,i,n,a,s){var o=r?r+e:e;if(!this._events[o])return!1;var u,d,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,n),!0;case 5:return c.fn.call(c.context,t,i,n,a),!0;case 6:return c.fn.call(c.context,t,i,n,a,s),!0}for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var l,f=c.length;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),h){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,i);break;case 4:c[d].fn.call(c[d].context,t,i,n);break;default:if(!u)for(l=1,u=new Array(h-1);l<h;l++)u[l-1]=arguments[l];c[d].fn.apply(c[d].context,u)}}return!0},o.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,i,n){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||n&&!o.once||i&&o.context!==i||s(this,a);else{for(var u=0,d=[],c=o.length;u<c;u++)(o[u].fn!==t||n&&!o[u].once||i&&o[u].context!==i)&&d.push(o[u]);d.length?this._events[a]=1===d.length?d[0]:d:s(this,a)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o}(Pt);var It=E(Pt.exports);function Ct(e,t){if(!((r=t.remuxResult).audio||r.video||r.text||r.id3||r.initSegment))return!1;var r,i=[],n=t.remuxResult,a=n.audio,s=n.video;return a&&Ot(i,a),s&&Ot(i,s),e.postMessage({event:"transmuxComplete",data:t},i),!0}function Ot(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function Ut(e,t,r){t.reduce((function(t,r){return Ct(e,r)||t}),!1)||e.postMessage({event:"transmuxComplete",data:t[0]}),e.postMessage({event:"flush",data:r})}!function(i){var n=new It,a=function(e,t){i.postMessage({event:e,data:t})};n.on(e.FRAG_DECRYPTED,a),n.on(e.ERROR,a);var s=function(){var e=function(e){var t=function(t){a("workerLog",{logType:e,message:t})};h[e]=t};for(var t in h)e(t)};i.addEventListener("message",(function(o){var h=o.data;switch(h.cmd){case"init":var l=JSON.parse(h.config);i.transmuxer=new wt(n,h.typeSupported,l,"",h.id),function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){c(e,"debug","log","info","warn","error");try{d.log('Debug logs enabled for "'+t+'" in hls.js version 1.5.15')}catch(e){d=u}}else d=u}(l.debug,h.id),s(),a("init",null);break;case"configure":i.transmuxer.configure(h.config);break;case"demux":var f=i.transmuxer.push(h.data,h.decryptdata,h.chunkMeta,h.state);Dt(f)?(i.transmuxer.async=!0,f.then((function(e){Ct(i,e)})).catch((function(i){a(e.ERROR,{type:t.MEDIA_ERROR,details:r.FRAG_PARSING_ERROR,chunkMeta:h.chunkMeta,fatal:!1,error:i,err:i,reason:"transmuxer-worker push error"})}))):(i.transmuxer.async=!1,Ct(i,f));break;case"flush":var p=h.chunkMeta,m=i.transmuxer.flush(p);Dt(m)||i.transmuxer.async?(Dt(m)||(m=Promise.resolve(m)),m.then((function(e){Ut(i,e,p)})).catch((function(i){a(e.ERROR,{type:t.MEDIA_ERROR,details:r.FRAG_PARSING_ERROR,chunkMeta:h.chunkMeta,fatal:!1,error:i,err:i,reason:"transmuxer-worker flush error"})}))):Ut(i,m,p)}}))}(self)}();
|
|
//# sourceMappingURL=hls.worker.js.map
|