aliyun-aliplayer 2.16.0 → 2.26.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/aliplayer-ac-min.js +2 -0
- package/build/aliplayer-flash-min.js +2 -0
- package/build/aliplayer-h5-min.js +2 -0
- package/build/aliplayer-min.js +2 -0
- package/build/aliplayer-worker-min.js +2 -0
- package/build/dash/aliplayer-dash-min.js +3 -0
- package/build/drm/aliplayer-drm-min.js +876 -0
- package/build/flv/aliplayer-flv-min.js +7 -0
- package/build/hls/aliplayer-hls-min.js +22 -0
- package/build/hls/aliplayer-hls2-demuxer-min.js +2 -0
- package/build/hls/aliplayer-hls2-min.js +4 -0
- package/build/hls/aliplayer-remuxer-min.js +1 -0
- package/build/hls/aliplayer-vod-anti-min.js +1 -0
- package/build/hls/aliplayer-vod-min.js +1 -0
- package/build/hls/aliplayer-vod-p-min.js +1 -0
- package/{dist → build}/lang/en-us.json +41 -10
- package/{dist → build}/lang/zh-cn.json +41 -10
- package/build/rts/aliyun-rts-sdk.js +6 -0
- package/build/skins/default/aliplayer-min.css +1 -0
- package/package.json +10 -8
- package/dist/aliplayer-min.js +0 -2
- package/dist/lang/all.json +0 -154
- package/dist/skins/default/aliplayer-min.css +0 -1
- /package/{dist → build}/json/json.min.js +0 -0
- /package/{dist → build}/lang/flash/en-us.json +0 -0
- /package/{dist → build}/lang/flash/zh-cn.json +0 -0
- /package/{dist → build}/skins/default/img/bigpause.png +0 -0
- /package/{dist → build}/skins/default/img/bigplay.png +0 -0
- /package/{dist → build}/skins/default/img/bigreplay.png +0 -0
- /package/{dist → build}/skins/default/img/cc.png +0 -0
- /package/{dist → build}/skins/default/img/cursorhover.png +0 -0
- /package/{dist → build}/skins/default/img/cursori.png +0 -0
- /package/{dist → build}/skins/default/img/defaultSkin.png +0 -0
- /package/{dist → build}/skins/default/img/dragcursor.png +0 -0
- /package/{dist → build}/skins/default/img/dragcursorhover.png +0 -0
- /package/{dist → build}/skins/default/img/fullscreen.png +0 -0
- /package/{dist → build}/skins/default/img/fullscreenhover.png +0 -0
- /package/{dist → build}/skins/default/img/pause.png +0 -0
- /package/{dist → build}/skins/default/img/pauseanimation.png +0 -0
- /package/{dist → build}/skins/default/img/play.png +0 -0
- /package/{dist → build}/skins/default/img/playanimation.png +0 -0
- /package/{dist → build}/skins/default/img/prismplayer.png +0 -0
- /package/{dist → build}/skins/default/img/replaybig.png +0 -0
- /package/{dist → build}/skins/default/img/resource-min.css +0 -0
- /package/{dist → build}/skins/default/img/resource.css +0 -0
- /package/{dist → build}/skins/default/img/retryclick.png +0 -0
- /package/{dist → build}/skins/default/img/retryhover.png +0 -0
- /package/{dist → build}/skins/default/img/retrynormal.png +0 -0
- /package/{dist → build}/skins/default/img/setting.png +0 -0
- /package/{dist → build}/skins/default/img/smallpause.png +0 -0
- /package/{dist → build}/skins/default/img/smallpausehover.png +0 -0
- /package/{dist → build}/skins/default/img/smallplay.png +0 -0
- /package/{dist → build}/skins/default/img/smallplayhover.png +0 -0
- /package/{dist → build}/skins/default/img/smallscreen.png +0 -0
- /package/{dist → build}/skins/default/img/smallscreenhover.png +0 -0
- /package/{dist → build}/skins/default/img/snapshot.png +0 -0
- /package/{dist → build}/skins/default/img/snapshotback.png +0 -0
- /package/{dist → build}/skins/default/img/snapshothover.png +0 -0
- /package/{dist → build}/skins/default/img/snapshothoverback.png +0 -0
- /package/{dist → build}/skins/default/img/unmutevolume.png +0 -0
- /package/{dist → build}/skins/default/img/volume.png +0 -0
- /package/{dist → build}/skins/default/img/volumehover.png +0 -0
- /package/{dist → build}/skins/default/img/volumemute.png +0 -0
- /package/{dist → build}/skins/default/img/volumemutehover.png +0 -0
- /package/{dist → build}/skins/default/img/volumncursor.png +0 -0
- /package/{dist → build}/skins/default/img/volumncursorhover.png +0 -0
- /package/{dist → build}/skins/default/img/volumnsmall.png +0 -0
- /package/{dist → build}/skins/default/img/voumnsamllhover.png +0 -0
- /package/{dist → build}/skins/default/resource-min.css +0 -0
- /package/{dist → build}/skins/sprite/classic/resource-min.css +0 -0
- /package/{dist → build}/skins/sprite/classic/resource.css +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function e(t){var r,i;r=this,i=function(r){"use strict";function i(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 a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){var i,a,s;i=e,a=t,s=r[t],(a=n(a))in i?Object.defineProperty(i,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[a]=s})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(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 s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(){return u=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},u.apply(this,arguments)}function l(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var c={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function n(e,t,i,n,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new a(i,n||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,a=[];if(0===this._eventsCount)return a;for(i in e=this._events)t.call(e,i)&&a.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},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 a=0,n=i.length,s=new Array(n);a<n;a++)s[a]=i[a].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,a,n,s){var o=r?r+e:e;if(!this._events[o])return!1;var u,l,d=this._events[o],h=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),h){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,i),!0;case 4:return d.fn.call(d.context,t,i,a),!0;case 5:return d.fn.call(d.context,t,i,a,n),!0;case 6:return d.fn.call(d.context,t,i,a,n,s),!0}for(l=1,u=new Array(h-1);l<h;l++)u[l-1]=arguments[l];d.fn.apply(d.context,u)}else{var c,f=d.length;for(l=0;l<f;l++)switch(d[l].once&&this.removeListener(e,d[l].fn,void 0,!0),h){case 1:d[l].fn.call(d[l].context);break;case 2:d[l].fn.call(d[l].context,t);break;case 3:d[l].fn.call(d[l].context,t,i);break;case 4:d[l].fn.call(d[l].context,t,i,a);break;default:if(!u)for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];d[l].fn.apply(d[l].context,u)}}return!0},o.prototype.on=function(e,t,r){return n(this,e,t,r,!1)},o.prototype.once=function(e,t,r){return n(this,e,t,r,!0)},o.prototype.removeListener=function(e,t,i,a){var n=r?r+e:e;if(!this._events[n])return this;if(!t)return s(this,n),this;var o=this._events[n];if(o.fn)o.fn!==t||a&&!o.once||i&&o.context!==i||s(this,n);else{for(var u=0,l=[],d=o.length;u<d;u++)(o[u].fn!==t||a&&!o[u].once||i&&o[u].context!==i)&&l.push(o[u]);l.length?this._events[n]=1===l.length?l[0]:l:s(this,n)}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}(c);var f=h(c.exports),v=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},p=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=m},m=Number.MAX_SAFE_INTEGER||9007199254740991,g=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}var t=e.prototype;return t.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}(),y=function(){function e(e,t,r,i){void 0===i&&(i=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new g(e),this.fast_=new g(t),this.defaultTTFB_=i,this.ttfb_=new g(e)}var t=e.prototype;return t.update=function(e,t){var r=this.slow_,i=this.fast_,a=this.ttfb_;r.halfLife!==e&&(this.slow_=new g(e,r.getEstimate(),r.getTotalWeight())),i.halfLife!==t&&(this.fast_=new g(t,i.getEstimate(),i.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new g(e,a.getEstimate(),a.getTotalWeight()))},t.sample=function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/r;this.fast_.sample(r,i),this.slow_.sample(r,i)},t.sampleTTFB=function(e){var t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))},t.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},t.destroy=function(){},e}(),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}({}),S=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}({}),b=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}({}),T="audioTrack",A="subtitleTrack",R="main",L="audio",x="subtitle",_=function(){},w={trace:_,debug:_,log:_,warn:_,info:_,error:_},D=w;function k(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+"] >"):_}(t)}))}var C=D;function I(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var P={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function M(e,t,r){var i;void 0===r&&(r=!0);var a=I(r);return null!=(i=null==a?void 0:a.isTypeSupported(function(e,t){return t+'/mp4;codecs="'+e+'"'}(e,t)))&&i}function O(e){return e.split(",").reduce((function(e,t){var r=P.video[t];return r?(2*r+e)/(e?3:2):(P.audio[t]+e)/(e?2:1)}),0)}var F={},B=/flac|opus/i;function U(e,t){return void 0===t&&(t=!0),e.replace(B,(function(e){return function(e,t){if(void 0===t&&(t=!0),F[e])return F[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],i=0;i<r.length;i++)if(M(r[i],"audio",t))return F[e]=r[i],r[i];return e}(e.toLowerCase(),t)}))}function N(e,t){return e&&"mp4a"!==e?e:t?t.split(",")[0]:t}var G=["NONE","TYPE-0","TYPE-1",null],V=["SDR","PQ","HLG"],H=function(){function e(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter((function(e){return!!e})).map((function(e){return e.substring(0,4)})).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}var t=e.prototype;return t.hasAudioGroup=function(e){return K(this._audioGroups,e)},t.hasSubtitleGroup=function(e){return K(this._subtitleGroups,e)},t.addGroupId=function(e,t){if(t)if("audio"===e){var r=this._audioGroups;r||(r=this._audioGroups=[]),-1===r.indexOf(t)&&r.push(t)}else if("text"===e){var i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),-1===i.indexOf(t)&&i.push(t)}},t.addFallback=function(){},o(e,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"urlId",get:function(){return 0},set:function(e){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var e;return null==(e=this.audioGroups)?void 0:e[0]}},{key:"textGroupId",get:function(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}}]),e}();function K(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function j(e,t){var r=!1,i=[];return e&&(r="SDR"!==e,i=[e]),t&&(i=t.allowedVideoRanges||V.slice(0),i=(r=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())?i.filter((function(e){return"SDR"!==e})):["SDR"]),{preferHDR:r,allowedVideoRanges:i}}function Y(e,t){C.log('[abr] start candidates with "'+e+'" ignored because '+t)}var W=function(){function e(e){var t=this;this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=function(){var e=t.fragCurrent,r=t.partCurrent,i=t.hls,a=i.autoLevelEnabled,n=i.media;if(e&&n){var s=performance.now(),o=r?r.stats:e.stats,u=r?r.duration:e.duration,l=s-o.loading.start,d=i.minAutoLevel;if(o.aborted||o.loaded&&o.loaded===o.total||e.level<=d)return t.clearTimer(),void(t._nextAutoLevel=-1);if(a&&!n.paused&&n.playbackRate&&n.readyState){var h=i.mainForwardBufferInfo;if(null!==h){var c=t.bwEstimator.getEstimateTTFB(),f=Math.abs(n.playbackRate);if(!(l<=Math.max(c,u/(2*f)*1e3))){var p=h.len/f,m=o.loading.first?o.loading.first-o.loading.start:-1,g=o.loaded&&m>-1,y=t.getBwEstimate(),S=i.levels,b=S[e.level],T=o.total||Math.max(o.loaded,Math.round(u*b.averageBitrate/8)),A=g?l-m:l;A<1&&g&&(A=Math.min(l,8*o.loaded/y));var R=g?1e3*o.loaded/A:0,L=R?(T-o.loaded)/R:8*T/y+c/1e3;if(!(L<=p)){var x,_=R?8*R:y,w=Number.POSITIVE_INFINITY;for(x=e.level-1;x>d;x--){var D=S[x].maxBitrate;if((w=t.getTimeToLoadFrag(c/1e3,_,u*D,!S[x].details))<p)break}if(!(w>=L||w>10*u)){i.nextLoadLevel=i.nextAutoLevel=x,g?t.bwEstimator.sample(l-Math.min(c,m),o.loaded):t.bwEstimator.sampleTTFB(l);var k=S[x].maxBitrate;t.getBwEstimate()*t.hls.config.abrBandWidthUpFactor>k&&t.resetEstimator(k),t.clearTimer(),C.warn("[abr] Fragment "+e.sn+(r?" part "+r.index:"")+" of level "+e.level+" is loading too slowly;\n Time to underbuffer: "+p.toFixed(3)+" s\n Estimated load time for current fragment: "+L.toFixed(3)+" s\n Estimated load time for down switch fragment: "+w.toFixed(3)+" s\n TTFB estimate: "+(0|m)+" ms\n Current BW estimate: "+(v(y)?0|y:"Unknown")+" bps\n New BW estimate: "+(0|t.getBwEstimate())+" bps\n Switching to level "+x+" @ "+(0|k)+" bps"),i.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:r,stats:o})}}}}}}},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}var t=e.prototype;return t.resetEstimator=function(e){e&&(C.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},t.initEstimator=function(){var e=this.hls.config;return new y(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},t.registerListeners=function(){var e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))},t.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null},t.onManifestLoading=function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},t.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},t.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},t.onFragLoading=function(e,t){var r,i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},t.onLevelSwitching=function(e,t){this.clearTimer()},t.onError=function(e,t){if(!t.fatal)switch(t.details){case b.BUFFER_ADD_CODEC_ERROR:case b.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case b.FRAG_LOAD_TIMEOUT:var r=t.frag,i=this.fragCurrent,a=this.partCurrent;if(r&&i&&r.sn===i.sn&&r.level===i.level){var n=performance.now(),s=a?a.stats:r.stats,o=n-s.loading.start,u=s.loading.first?s.loading.first-s.loading.start:-1;if(s.loaded&&u>-1){var l=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(o-Math.min(l,u),s.loaded)}else this.bwEstimator.sampleTTFB(o)}}},t.getTimeToLoadFrag=function(e,t,r,i){return e+r/t+(i?this.lastLevelLoadSec:0)},t.onLevelLoaded=function(e,t){var r=this.hls.config,i=t.stats.loading,a=i.end-i.start;v(a)&&(this.lastLevelLoadSec=a/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},t.onFragLoaded=function(e,t){var r=t.frag,i=t.part,a=i?i.stats:r.stats;if(r.type===R&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var n=i?i.duration:r.duration,s=this.hls.levels[r.level],o=(s.loaded?s.loaded.bytes:0)+a.loaded,u=(s.loaded?s.loaded.duration:0)+n;s.loaded={bytes:o,duration:u},s.realBitrate=Math.round(8*o/u)}if(r.bitrateTest){var l={stats:a,frag:r,part:i,id:r.type};this.onFragBuffered(E.FRAG_BUFFERED,l),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}},t.onFragBuffered=function(e,t){var r=t.frag,i=t.part,a=null!=i&&i.stats.loaded?i.stats:r.stats;if(!a.aborted&&!this.ignoreFragment(r)){var n=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,a.loaded),a.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}},t.ignoreFragment=function(e){return e.type!==R||"initSegment"===e.sn},t.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},t.getAutoLevelKey=function(){return this.getBwEstimate()+"_"+this.getStarvationDelay().toFixed(2)},t.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,i=r.maxAutoLevel,a=r.config,n=r.minAutoLevel,s=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),u=this.getStarvationDelay(),l=a.abrBandWidthFactor,d=a.abrBandWidthUpFactor;if(u){var h=this.findBestLevel(o,n,i,u,0,l,d);if(h>=0)return h}var c=s?Math.min(s,a.maxStarvationDelay):a.maxStarvationDelay;if(!u){var f=this.bitrateTestDelay;f&&(c=(s?Math.min(s,a.maxLoadingDelay):a.maxLoadingDelay)-f,C.info("[abr] bitrate test took "+Math.round(1e3*f)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*c)+" ms"),l=d=1)}var v=this.findBestLevel(o,n,i,u,c,l,d);if(C.info("[abr] "+(u?"rebuffering expected":"buffer is empty")+", optimal quality level "+v),v>-1)return v;var p=r.levels[n],m=r.levels[r.loadLevel];return(null==p?void 0:p.bitrate)<(null==m?void 0:m.bitrate)?n:r.loadLevel},t.getStarvationDelay=function(){var e=this.hls,t=e.media;if(!t)return 1/0;var r=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/r},t.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},t.findBestLevel=function(e,t,r,i,a,n,s){var o,u=this,l=i+a,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,c=this.fragCurrent,f=this.partCurrent,p=this.hls,m=p.levels,g=p.allAudioTracks,y=p.loadLevel,E=p.config;if(1===m.length)return 0;var S,b=m[h],T=!(null==b||null==(o=b.details)||!o.live),A=-1===y||-1===d,R="SDR",L=(null==b?void 0:b.frameRate)||0,x=E.audioPreference,_=E.videoPreference;if(this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce((function(e,t){var r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);var i=t.channels||"2";return r.channels[i]=(r.channels[i]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(g)),A){if(-1!==this.firstSelection)return this.firstSelection;var w=this.codecTiers||(this.codecTiers=function(e,t,r,i){return e.slice(r,i+1).reduce((function(e,t){if(!t.codecSet)return e;var r=t.audioGroups,i=e[t.codecSet];i||(e[t.codecSet]=i={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}),i.minBitrate=Math.min(i.minBitrate,t.bitrate);var a=Math.min(t.height,t.width);return i.minHeight=Math.min(i.minHeight,a),i.minFramerate=Math.min(i.minFramerate,t.frameRate),i.maxScore=Math.max(i.maxScore,t.score),i.fragmentError+=t.fragmentError,i.videoRanges[t.videoRange]=(i.videoRanges[t.videoRange]||0)+1,e}),{})}(m,0,t,r)),D=function(e,t,r,i,a){for(var n=Object.keys(e),s=null==i?void 0:i.channels,o=null==i?void 0:i.audioCodec,u=s&&2===parseInt(s),l=!0,d=!1,h=1/0,c=1/0,f=1/0,p=0,m=[],g=j(t,a),y=g.preferHDR,E=g.allowedVideoRanges,S=function(){var t=e[n[b]];l=t.channels[2]>0,h=Math.min(h,t.minHeight),c=Math.min(c,t.minFramerate),f=Math.min(f,t.minBitrate);var r=E.filter((function(e){return t.videoRanges[e]>0}));r.length>0&&(d=!0,m=r)},b=n.length;b--;)S();h=v(h)?h:0,c=v(c)?c:0;var T=Math.max(1080,h),A=Math.max(30,c);return f=v(f)?f:r,r=Math.max(f,r),d||(t=void 0,m=[]),{codecSet:n.reduce((function(t,i){var a=e[i];if(i===t)return t;if(a.minBitrate>r)return Y(i,"min bitrate of "+a.minBitrate+" > current estimate of "+r),t;if(!a.hasDefaultAudio)return Y(i,"no renditions with default or auto-select sound found"),t;if(o&&i.indexOf(o.substring(0,4))%5!=0)return Y(i,'audio codec preference "'+o+'" not found'),t;if(s&&!u){if(!a.channels[s])return Y(i,"no renditions with "+s+" channel sound found (channels options: "+Object.keys(a.channels)+")"),t}else if((!o||u)&&l&&0===a.channels[2])return Y(i,"no renditions with stereo sound found"),t;return a.minHeight>T?(Y(i,"min resolution of "+a.minHeight+" > maximum of "+T),t):a.minFramerate>A?(Y(i,"min framerate of "+a.minFramerate+" > maximum of "+A),t):m.some((function(e){return a.videoRanges[e]>0}))?a.maxScore<p?(Y(i,"max score of "+a.maxScore+" < selected max of "+p),t):t&&(O(i)>=O(t)||a.fragmentError>e[t].fragmentError)?t:(p=a.maxScore,i):(Y(i,"no variants with VIDEO-RANGE of "+JSON.stringify(m)+" found"),t)}),void 0),videoRanges:m,preferHDR:y,minFramerate:c,minBitrate:f}}(w,R,e,x,_),k=D.codecSet,I=D.videoRanges,P=D.minFramerate,M=D.minBitrate,F=D.preferHDR;S=k,R=F?I[I.length-1]:I[0],L=P,e=Math.max(e,M),C.log("[abr] picked start tier "+JSON.stringify(D))}else S=null==b?void 0:b.codecSet,R=null==b?void 0:b.videoRange;for(var B,U=f?f.duration:c?c.duration:0,N=this.bwEstimator.getEstimateTTFB()/1e3,G=[],V=function(){var t,o=m[H],c=H>h;if(!o)return 0;if(S&&o.codecSet!==S||R&&o.videoRange!==R||c&&L>o.frameRate||!c&&L>0&&L<o.frameRate||o.supportedResult&&(null==(t=o.supportedResult.decodingInfoResults)||!t[0].smooth))return G.push(H),0;var p,g=o.details,E=(f?null==g?void 0:g.partTarget:null==g?void 0:g.averagetargetduration)||U;p=c?s*e:n*e;var x=U&&i>=2*U&&0===a?m[H].averageBitrate:m[H].maxBitrate,_=u.getTimeToLoadFrag(N,p,x*E,void 0===g);if(p>=x&&(H===d||0===o.loadError&&0===o.fragmentError)&&(_<=N||!v(_)||T&&!u.bitrateTestDelay||_<l)){var w=u.forcedAutoLevel;return H===y||-1!==w&&w===y||(G.length&&C.trace("[abr] Skipped level(s) "+G.join(",")+" of "+r+' max with CODECS and VIDEO-RANGE:"'+m[G[0]].codecs+'" '+m[G[0]].videoRange+'; not compatible with "'+b.codecs+'" '+R),C.info("[abr] switch candidate:"+h+"->"+H+" adjustedbw("+Math.round(p)+")-bitrate="+Math.round(p-x)+" ttfb:"+N.toFixed(1)+" avgDuration:"+E.toFixed(1)+" maxFetchDuration:"+l.toFixed(1)+" fetchDuration:"+_.toFixed(1)+" firstSelection:"+A+" codecSet:"+S+" videoRange:"+R+" hls.loadLevel:"+y)),A&&(u.firstSelection=H),{v:H}}},H=r;H>=t;H--)if(0!==(B=V())&&B)return B.v;return-1},o(e,[{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,r=e.minAutoLevel,i=this.getBwEstimate(),a=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,r,t,0,a,1,1);if(n>-1)return n;var s=this.hls.firstLevel,o=Math.min(Math.max(s,r),t);return C.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist "+s+" clamped to "+o),o}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var i=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var a=this.hls.levels;if(a.length>Math.max(e,i)&&a[e].loadError<=a[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i},set:function(e){var t=this.hls,r=t.maxAutoLevel,i=t.minAutoLevel,a=Math.min(Math.max(e,i),r);this._nextAutoLevel!==a&&(this.nextAutoLevelKey="",this._nextAutoLevel=a)}}]),e}(),z={length:0,start:function(){return 0},end:function(){return 0}},q=function(){function e(){}return e.isBuffered=function(t,r){try{if(t)for(var i=e.getBuffered(t),a=0;a<i.length;a++)if(r>=i.start(a)&&r<=i.end(a))return!0}catch(e){}return!1},e.bufferInfo=function(t,r,i){try{if(t){var a,n=e.getBuffered(t),s=[];for(a=0;a<n.length;a++)s.push({start:n.start(a),end:n.end(a)});return this.bufferedInfo(s,r,i)}}catch(e){}return{len:0,start:r,end:r,nextStart:void 0}},e.bufferedInfo=function(e,t,r){t=Math.max(0,t),e.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var i=[];if(r)for(var a=0;a<e.length;a++){var n=i.length;if(n){var s=i[n-1].end;e[a].start-s<r?e[a].end>s&&(i[n-1].end=e[a].end):i.push(e[a])}else i.push(e[a])}else i=e;for(var o,u=0,l=t,d=t,h=0;h<i.length;h++){var c=i[h].start,f=i[h].end;if(t+r>=c&&t<f)l=c,u=(d=f)-t;else if(t+r<c){o=c;break}}return{len:u,start:l||0,end:d||0,nextStart:o}},e.getBuffered=function(e){try{return e.buffered}catch(e){return C.log("failed to get media.buffered",e),z}},e}();!function(e,t){var r,i,a,n,s;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var a=s.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");return a.path=s.normalizePath(a.path),s.buildURLFromParts(a)}var n=s.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=s.normalizePath(n.path),s.buildURLFromParts(n)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=i.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(l.netLoc=o.netLoc,"/"!==n.path[0]))if(n.path){var d=o.path,h=d.substring(0,d.lastIndexOf("/")+1)+n.path;l.path=s.normalizePath(h)}else l.path=o.path,n.params||(l.params=o.params,n.query||(l.query=o.query));return null===l.path&&(l.path=r.alwaysNormalize?s.normalizePath(n.path):n.path),s.buildURLFromParts(l)},parseURL:function(e){var t=r.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(a,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s}({exports:{}});var X=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},Q="audio",Z="video",J="audiovideo";function $(e,t,r){return Uint8Array.prototype.slice?e.slice(t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))}var ee,te=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},re=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},ie=function(e,t){for(var r=t,i=0;te(e,t);)i+=10,i+=ae(e,t+6),re(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(r,r+i)},ae=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]},ne=function(e,t){return te(e,t)&&ae(e,t+6)+10<=e.length-t},se=function(e){for(var t=le(e),r=0;r<t.length;r++){var i=t[r];if(oe(i))return ve(i)}},oe=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},ue=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=ae(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}},le=function(e){for(var t=0,r=[];te(e,t);){for(var i=ae(e,t+6),a=(t+=10)+i;t+8<a;){var n=ue(e.subarray(t)),s=de(n);s&&r.push(s),t+=n.size+10}re(e,t)&&(t+=10)}return r},de=function(e){return"PRIV"===e.type?he(e):"W"===e.type[0]?fe(e):ce(e)},he=function(e){if(!(e.size<2)){var t=pe(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}},ce=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=pe(e.data.subarray(t),!0);t+=r.length+1;var i=pe(e.data.subarray(t));return{key:e.type,info:r,data:i}}var a=pe(e.data.subarray(1));return{key:e.type,data:a}}},fe=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=pe(e.data.subarray(t),!0);t+=r.length+1;var i=pe(e.data.subarray(t));return{key:e.type,info:r,data:i}}var a=pe(e.data);return{key:e.type,data:a}},ve=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)}},pe=function(e,t){void 0===t&&(t=!1);var r=me();if(r){var i=r.decode(e);if(t){var a=i.indexOf("\0");return-1!==a?i.substring(0,a):i}return i.replace(/\0/g,"")}for(var n,s,o,u=e.length,l="",d=0;d<u;){if(0===(n=e[d++])&&t)return l;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(n);break;case 12:case 13:s=e[d++],l+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[d++],o=e[d++],l+=String.fromCharCode((15&n)<<12|(63&s)<<6|(63&o)<<0)}}return l};function me(){if(!navigator.userAgent.includes("PlayStation 4"))return ee||void 0===self.TextDecoder||(ee=new self.TextDecoder("utf-8")),ee}var ge=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},ye=Math.pow(2,32)-1,Ee=[].push,Se={video:1,audio:2,id3:3,text:4};function be(e){return String.fromCharCode.apply(null,e)}function Te(e,t){var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function Ae(e,t){var r=Le(e,t);return r<0?4294967296+r:r}function Re(e,t){var r=Ae(e,t);return r*=Math.pow(2,32),r+=Ae(e,t+4)}function Le(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function xe(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 _e(e,t){var r=[];if(!t.length)return r;for(var i=e.byteLength,a=0;a<i;){var n=Ae(e,a),s=n>1?a+n:i;if(be(e.subarray(a+4,a+8))===t[0])if(1===t.length)r.push(e.subarray(a+8,s));else{var o=_e(e.subarray(a+8,s),t.slice(1));o.length&&Ee.apply(r,o)}a=s}return r}function we(e){var t=[],r=e[0],i=8,a=Ae(e,i);i+=4;var n=0,s=0;0===r?(n=Ae(e,i),s=Ae(e,i+4),i+=8):(n=Re(e,i),s=Re(e,i+8),i+=16),i+=2;var o=e.length+s,u=Te(e,i);i+=2;for(var l=0;l<u;l++){var d=i,h=Ae(e,d);d+=4;var c=2147483647&h;if(1==(2147483648&h)>>>31)return C.warn("SIDX has hierarchical references (not supported)"),null;var f=Ae(e,d);d+=4,t.push({referenceSize:c,subsegmentDuration:f,info:{duration:f/a,start:o,end:o+c-1}}),o+=c,i=d+=4}return{earliestPresentationTime:n,timescale:a,version:r,referencesCount:u,references:t}}function De(e){for(var t=[],r=_e(e,["moov","trak"]),i=0;i<r.length;i++){var n=r[i],s=_e(n,["tkhd"])[0];if(s){var o=s[0],u=Ae(s,0===o?12:20),l=_e(n,["mdia","mdhd"])[0];if(l){var d=Ae(l,0===(o=l[0])?12:20),h=_e(n,["mdia","hdlr"])[0];if(h){var c=be(h.subarray(8,12)),f={soun:Q,vide:Z}[c];if(f){var v=ke(_e(n,["mdia","minf","stbl","stsd"])[0]);t[u]={timescale:d,type:f},t[f]=a({timescale:d,id:u},v)}}}}}return _e(e,["moov","mvex","trex"]).forEach((function(e){var r=Ae(e,4),i=t[r];i&&(i.default={duration:Ae(e,12),flags:Ae(e,20)})})),t}function ke(e){var t=e.subarray(8),r=t.subarray(86),i=be(t.subarray(4,8)),a=i,n="enca"===i||"encv"===i;if(n){var s=_e(t,[i])[0];_e(s.subarray("enca"===i?28:78),["sinf"]).forEach((function(e){var t=_e(e,["schm"])[0];if(t){var r=be(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var i=_e(e,["frma"])[0];i&&(a=be(i))}}}))}switch(a){case"avc1":case"avc2":case"avc3":case"avc4":var o=_e(r,["avcC"])[0];a+="."+Ie(o[1])+Ie(o[2])+Ie(o[3]);break;case"mp4a":var u=_e(t,[i])[0],l=_e(u.subarray(28),["esds"])[0];if(l&&l.length>12){var d=4;if(3!==l[d++])break;d=Ce(l,d),d+=2;var h=l[d++];if(128&h&&(d+=2),64&h&&(d+=l[d++]),4!==l[d++])break;d=Ce(l,d);var c=l[d++];if(64!==c)break;if(a+="."+Ie(c),d+=12,5!==l[d++])break;d=Ce(l,d);var f=l[d++],v=(248&f)>>3;31===v&&(v+=1+((7&f)<<3)+((224&l[d])>>5)),a+="."+v}break;case"hvc1":case"hev1":var p=_e(r,["hvcC"])[0],m=p[1],g=["","A","B","C"][m>>6],y=31&m,E=Ae(p,2),S=(32&m)>>5?"H":"L",b=p[12],T=p.subarray(6,12);a+="."+g+y,a+="."+E.toString(16).toUpperCase(),a+="."+S+b;for(var A="",R=T.length;R--;){var L=T[R];(L||A)&&(A="."+L.toString(16).toUpperCase()+A)}a+=A;break;case"dvh1":case"dvhe":var x=_e(r,["dvcC"])[0],_=x[2]>>1&127,w=x[2]<<5&32|x[3]>>3&31;a+="."+Pe(_)+"."+Pe(w);break;case"vp09":var D=_e(r,["vpcC"])[0],k=D[4],C=D[5],I=D[6]>>4&15;a+="."+Pe(k)+"."+Pe(C)+"."+Pe(I);break;case"av01":var P=_e(r,["av1C"])[0],M=P[1]>>>5,O=31&P[1],F=P[2]>>>7?"H":"M",B=(64&P[2])>>6,U=(32&P[2])>>5,N=2===M&&B?U?12:10:B?10:8,G=(16&P[2])>>4,V=(8&P[2])>>3,H=(4&P[2])>>2,K=3&P[2];a+="."+M+"."+Pe(O)+F+"."+Pe(N)+"."+G+"."+V+H+K+"."+Pe(1)+"."+Pe(1)+"."+Pe(1)+".0"}return{codec:a,encrypted:n}}function Ce(e,t){for(var r=t+5;128&e[t++]&&t<r;);return t}function Ie(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function Pe(e){return(e<10?"0":"")+e}function Me(e,t){if(!e||!t)return e;var r=t.keyId;return r&&t.isCommonEncryption&&_e(e,["moov","trak"]).forEach((function(e){var t=_e(e,["mdia","minf","stbl","stsd"])[0].subarray(8),i=_e(t,["enca"]),a=i.length>0;a||(i=_e(t,["encv"])),i.forEach((function(e){_e(a?e.subarray(28):e.subarray(78),["sinf"]).forEach((function(e){var t=function(e){var t=_e(e,["schm"])[0];if(t){var r=be(t.subarray(4,8));if("cbcs"===r||"cenc"===r)return _e(e,["schi","tenc"])[0]}return C.error("[eme] missing 'schm' box"),null}(e);if(t){var i=t.subarray(8,24);i.some((function(e){return 0!==e}))||(C.log("[eme] Patching keyId in 'enc"+(a?"a":"v")+">sinf>>tenc' box: "+ge(i)+" -> "+ge(r)),t.set(r,8))}}))}))})),e}function Oe(e){var t=Ae(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var i=0,a=Ae(e,4),n=0;n<a;n++)256&t&&(i+=Ae(e,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return i}function Fe(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function Be(e,t){var r=[],i=t.samples,a=t.timescale,n=t.id,s=!1;return _e(i,["moof"]).map((function(o){var u=o.byteOffset-8;_e(o,["traf"]).map((function(o){var l=_e(o,["tfdt"]).map((function(e){var t=e[0],r=Ae(e,4);return 1===t&&(r*=Math.pow(2,32),r+=Ae(e,8)),r/a}))[0];return void 0!==l&&(e=l),_e(o,["tfhd"]).map((function(l){var d=Ae(l,4),h=16777215&Ae(l,0),c=0,f=0!=(16&h),v=0,p=0!=(32&h),m=8;d===n&&(0!=(1&h)&&(m+=8),0!=(2&h)&&(m+=4),0!=(8&h)&&(c=Ae(l,m),m+=4),f&&(v=Ae(l,m),m+=4),p&&(m+=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)),_e(o,["trun"]).map((function(n){var o=n[0],l=16777215&Ae(n,0),d=0!=(1&l),h=0,f=0!=(4&l),p=0!=(256&l),m=0,g=0!=(512&l),y=0,E=0!=(1024&l),S=0!=(2048&l),b=0,T=Ae(n,4),A=8;d&&(h=Ae(n,A),A+=4),f&&(A+=4);for(var R=h+u,L=0;L<T;L++){if(p?(m=Ae(n,A),A+=4):m=c,g?(y=Ae(n,A),A+=4):y=v,E&&(A+=4),S&&(b=0===o?Ae(n,A):Le(n,A),A+=4),t.type===Z)for(var x=0;x<y;){var _=Ae(i,R);Ue(s,i[R+=4])&&Ne(i.subarray(R,R+_),s?2:1,e+b/a,r),R+=_,x+=_+4}e+=m/a}})))}))}))})),r}function Ue(e,t){if(e){var r=t>>1&63;return 39===r||40===r}return 6==(31&t)}function Ne(e,t,r,i){var a=Ge(e),n=0;n+=t;for(var s=0,o=0,u=0;n<a.length;){s=0;do{if(n>=a.length)break;s+=u=a[n++]}while(255===u);o=0;do{if(n>=a.length)break;o+=u=a[n++]}while(255===u);var l=a.length-n,d=n;if(o<l)n+=o;else if(o>l){C.error("Malformed SEI payload. "+o+" is too small, only "+l+" bytes left to parse.");break}if(4===s){if(181===a[d++]){var h=Te(a,d);if(d+=2,49===h){var c=Ae(a,d);if(d+=4,1195456820===c){var f=a[d++];if(3===f){var v=a[d++],p=64&v,m=p?2+3*(31&v):0,g=new Uint8Array(m);if(p){g[0]=v;for(var y=1;y<m;y++)g[y]=a[d++]}i.push({type:f,payloadType:s,pts:r,bytes:g})}}}}}else if(5===s&&o>16){for(var E=[],S=0;S<16;S++){var b=a[d++].toString(16);E.push(1==b.length?"0"+b:b),3!==S&&5!==S&&7!==S&&9!==S||E.push("-")}for(var T=o-16,A=new Uint8Array(T),R=0;R<T;R++)A[R]=a[d++];i.push({payloadType:s,pts:r,uuid:E.join(""),userData:pe(A),userDataBytes:A})}}}function Ge(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 a=t-r.length,n=new Uint8Array(a),s=0;for(i=0;i<a;s++,i++)s===r[0]&&(s++,r.shift()),n[i]=e[s];return n}var Ve=/^(\d+)x(\d+)$/,He=/(.+?)=(".*?"|.*?)(?:,|$)/g,Ke=function(){function e(t){"string"==typeof t&&(t=e.parseAttrList(t)),u(this,t)}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var r=this[e];return r?parseFloat(r):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=Ve.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,r={};for(He.lastIndex=0;null!==(t=He.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[t[1].trim()]=i}return r},o(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter((function(e){return"X-"===e.substring(0,2)}))}}]),e}();function je(e){e.forEach((function(e,t){var r=e.details;null!=r&&r.fragments&&r.fragments.forEach((function(e){e.level=t}))}))}var Ye=function(e,t){for(var r=0,i=e.length-1,a=null,n=null;r<=i;){var s=t(n=e[a=(r+i)/2|0]);if(s>0)r=a+1;else{if(!(s<0))return n;i=a-1}}return null};function We(e,t,r){if(void 0===e&&(e=0),void 0===t&&(t=0),r.start<=e&&r.start+r.duration>e)return 0;var i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function ze(e){switch(e.details){case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_TIMEOUT:case b.LEVEL_LOAD_TIMEOUT:case b.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function qe(e,t){var r=ze(t);return e.default[(r?"timeout":"error")+"Retry"]}function Xe(e,t,r,i){if(!e)return!1;var a=null==i?void 0:i.code,n=t<e.maxNumRetry&&(function(e){return 0===e&&!1===navigator.onLine||!!e&&(e<400||e>499)}(a)||!!r);return e.shouldRetry?e.shouldRetry(e,t,r,i,n):n}var Qe=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}(),Ze=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}(),Je=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],a=r[1],n=r[2],s=r[3],o=this.invSubMix,u=o[0],l=o[1],d=o[2],h=o[3],c=new Uint32Array(256),f=0,v=0,p=0;for(p=0;p<256;p++)c[p]=p<128?p<<1:p<<1^283;for(p=0;p<256;p++){var m=v^v<<1^v<<2^v<<3^v<<4;m=m>>>8^255&m^99,e[f]=m,t[m]=f;var g=c[f],y=c[g],E=c[y],S=257*c[m]^16843008*m;i[f]=S<<24|S>>>8,a[f]=S<<16|S>>>16,n[f]=S<<8|S>>>24,s[f]=S,S=16843009*E^65537*y^257*g^16843008*f,u[m]=S<<24|S>>>8,l[m]=S<<16|S>>>16,d[m]=S<<8|S>>>24,h[m]=S,f?(f=g^c[c[c[E^g]]],v^=c[c[v]]):f=v=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 a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);var n,s,o,u,l=this.ksRows=4*(a+6+1),d=this.keySchedule=new Uint32Array(l),h=this.invKeySchedule=new Uint32Array(l),c=this.sBox,f=this.rcon,v=this.invSubMix,p=v[0],m=v[1],g=v[2],y=v[3];for(n=0;n<l;n++)n<a?o=d[n]=t[n]:(u=o,n%a==0?(u=c[(u=u<<8|u>>>24)>>>24]<<24|c[u>>>16&255]<<16|c[u>>>8&255]<<8|c[255&u],u^=f[n/a|0]<<24):a>6&&n%a==4&&(u=c[u>>>24]<<24|c[u>>>16&255]<<16|c[u>>>8&255]<<8|c[255&u]),d[n]=o=(d[n-a]^u)>>>0);for(s=0;s<l;s++)n=l-s,u=3&s?d[n]:d[n-4],h[s]=s<4||n<=4?u:p[c[u>>>24]]^m[c[u>>>16&255]]^g[c[u>>>8&255]]^y[c[255&u]],h[s]=h[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decryptECB=function(e,t){for(var r,i,a,n,s,o,u,l,d,h,c,f,v,p,m=this.keySize+6,g=this.invKeySchedule,y=this.invSBox,E=this.invSubMix,S=E[0],b=E[1],T=E[2],A=E[3],R=new Int32Array(e),L=new Int32Array(R.length),x=this.networkToHostOrderSwap;t<R.length;){for(d=x(R[t]),h=x(R[t+1]),c=x(R[t+2]),f=x(R[t+3]),s=d^g[0],o=f^g[1],u=c^g[2],l=h^g[3],v=4,p=1;p<m;p++)r=S[s>>>24]^b[o>>16&255]^T[u>>8&255]^A[255&l]^g[v],i=S[o>>>24]^b[u>>16&255]^T[l>>8&255]^A[255&s]^g[v+1],a=S[u>>>24]^b[l>>16&255]^T[s>>8&255]^A[255&o]^g[v+2],n=S[l>>>24]^b[s>>16&255]^T[o>>8&255]^A[255&u]^g[v+3],s=r,o=i,u=a,l=n,v+=4;r=y[s>>>24]<<24^y[o>>16&255]<<16^y[u>>8&255]<<8^y[255&l]^g[v],i=y[o>>>24]<<24^y[u>>16&255]<<16^y[l>>8&255]<<8^y[255&s]^g[v+1],a=y[u>>>24]<<24^y[l>>16&255]<<16^y[s>>8&255]<<8^y[255&o]^g[v+2],n=y[l>>>24]<<24^y[s>>16&255]<<16^y[o>>8&255]<<8^y[255&u]^g[v+3],L[t]=x(r),L[t+1]=x(n),L[t+2]=x(a),L[t+3]=x(i),t+=4}return L.buffer},t.decrypt=function(e,t,r){for(var i,a,n,s,o,u,l,d,h,c,f,v,p,m,g=this.keySize+6,y=this.invKeySchedule,E=this.invSBox,S=this.invSubMix,b=S[0],T=S[1],A=S[2],R=S[3],L=this.uint8ArrayToUint32Array_(r),x=L[0],_=L[1],w=L[2],D=L[3],k=new Int32Array(e),C=new Int32Array(k.length),I=this.networkToHostOrderSwap;t<k.length;){for(h=I(k[t]),c=I(k[t+1]),f=I(k[t+2]),v=I(k[t+3]),o=h^y[0],u=v^y[1],l=f^y[2],d=c^y[3],p=4,m=1;m<g;m++)i=b[o>>>24]^T[u>>16&255]^A[l>>8&255]^R[255&d]^y[p],a=b[u>>>24]^T[l>>16&255]^A[d>>8&255]^R[255&o]^y[p+1],n=b[l>>>24]^T[d>>16&255]^A[o>>8&255]^R[255&u]^y[p+2],s=b[d>>>24]^T[o>>16&255]^A[u>>8&255]^R[255&l]^y[p+3],o=i,u=a,l=n,d=s,p+=4;i=E[o>>>24]<<24^E[u>>16&255]<<16^E[l>>8&255]<<8^E[255&d]^y[p],a=E[u>>>24]<<24^E[l>>16&255]<<16^E[d>>8&255]<<8^E[255&o]^y[p+1],n=E[l>>>24]<<24^E[d>>16&255]<<16^E[o>>8&255]<<8^E[255&u]^y[p+2],s=E[d>>>24]<<24^E[o>>16&255]<<16^E[u>>8&255]<<8^E[255&l]^y[p+3],C[t]=I(i^x),C[t+1]=I(s^_),C[t+2]=I(n^w),C[t+3]=I(a^D),x=h,_=c,w=f,D=v,t+=4}return C.buffer},e}(),$e=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 a=self.crypto;a&&(this.subtle=a.subtle||a.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,a,n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?(i=(r=n).byteLength,(a=i&&new DataView(r.buffer).getUint8(i-1))?$(r,0,i-a):r):n},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decryptSync=function(e,t,r){this.softwareDecrypt(new Uint8Array(e),t,r,"ECB");var i=this.flush();return i?i.buffer:(console.error("failed to decrypt data"),new ArrayBuffer(0))},t.decrypt=function(e,t,r){var i=this;return this.useSoftware?new Promise((function(a,n){i.softwareDecrypt(new Uint8Array(e),t,r);var s=i.flush();s?a(s.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,r)},t.softwareDecrypt=function(e,t,r,i){void 0===i&&(i="CBC");var a=this.currentIV,n=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(e=Fe(s,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;a&&(r=a);var u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Je),u.expandKey(t);var l=n;return this.currentResult="ECB"===i?u.decryptECB(o.buffer,0):u.decrypt(o.buffer,0,r),this.currentIV=$(o,-16).buffer,l||null},t.webCryptoDecrypt=function(e,t,r){var i=this;if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,r));this.key=t,this.fastAesKey=new Ze(this.subtle,t)}return this.fastAesKey.expandKey().then((function(t){return i.subtle?(i.logOnce("WebCrypto AES decrypt"),new Qe(i.subtle,new Uint8Array(r)).decrypt(e.buffer,t)):Promise.reject(new Error("web crypto not initialized"))})).catch((function(a){return C.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+a.name+": "+a.message),i.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=$(e,0,r),this.remainderData=$(e,r)),t},t.logOnce=function(e){this.logEnabled&&(C.log("[decrypter]: "+e),this.logEnabled=!1)},e}(),et=0,tt=2,rt=5,it=0,at=1,nt=2,st=function(){function e(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=C.log.bind(C,"[info]:"),this.warn=C.warn.bind(C,"[warning]:"),this.error=C.error.bind(C,"[error]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))},t.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},t.startLoad=function(e){},t.stopLoad=function(){this.playlistError=0},t.getVariantLevelIndex=function(e){return(null==e?void 0:e.type)===R?e.level:this.hls.loadLevel},t.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},t.onLevelUpdated=function(){this.playlistError=0},t.onError=function(e,t){var r,i;if(!t.fatal){var a=this.hls,n=t.context;switch(t.details){case b.FRAG_LOAD_ERROR:case b.FRAG_LOAD_TIMEOUT:case b.KEY_LOAD_ERROR:case b.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case b.FRAG_PARSING_ERROR:if(null!=(r=t.frag)&&r.gap)return void(t.errorAction={action:et,flags:it});case b.FRAG_GAP:case b.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=tt);case b.LEVEL_EMPTY_ERROR:case b.LEVEL_PARSING_ERROR:var s,o,u=t.parent===R?t.level:a.loadLevel;return void(t.details===b.LEVEL_EMPTY_ERROR&&null!=(s=t.context)&&null!=(o=s.levelDetails)&&o.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,u)));case b.LEVEL_LOAD_ERROR:case b.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case b.AUDIO_TRACK_LOAD_ERROR:case b.AUDIO_TRACK_LOAD_TIMEOUT:case b.SUBTITLE_LOAD_ERROR:case b.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var l=a.levels[a.loadLevel];if(l&&(n.type===T&&l.hasAudioGroup(n.groupId)||n.type===A&&l.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.loadLevel),t.errorAction.action=tt,void(t.errorAction.flags=at)}return;case b.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var d=a.levels[a.loadLevel],h=null==d?void 0:d.attrs["HDCP-LEVEL"];return void(h?t.errorAction={action:tt,flags:nt,hdcpLevel:h}:this.keySystemError(t));case b.BUFFER_ADD_CODEC_ERROR:case b.REMUX_ALLOC_ERROR:case b.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(i=t.level)?i:a.loadLevel));case b.INTERNAL_EXCEPTION:case b.BUFFER_APPENDING_ERROR:case b.BUFFER_FULL_ERROR:case b.LEVEL_SWITCH_ERROR:case b.BUFFER_STALLED_ERROR:case b.BUFFER_SEEK_OVER_HOLE:case b.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:et,flags:it})}t.type===S.KEY_SYSTEM_ERROR&&this.keySystemError(t)}},t.keySystemError=function(e){var t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)},t.getPlaylistRetryOrSwitchAction=function(e,t){var r=qe(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(Xe(r,i,ze(e),e.response))return{action:rt,flags:it,retryConfig:r,retryCount:i};var a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=i),a},t.getFragRetryOrSwitchAction=function(e){var t=this.hls,r=this.getVariantLevelIndex(e.frag),i=t.levels[r],a=t.config,n=a.fragLoadPolicy,s=a.keyLoadPolicy,o=qe(e.details.startsWith("key")?s:n,e),u=t.levels.reduce((function(e,t){return e+t.fragmentError}),0);if(i&&(e.details!==b.FRAG_GAP&&i.fragmentError++,Xe(o,u,ze(e),e.response)))return{action:rt,flags:it,retryConfig:o,retryCount:u};var l=this.getLevelSwitchAction(e,r);return o&&(l.retryConfig=o,l.retryCount=u),l},t.getLevelSwitchAction=function(e,t){var r=this.hls;null==t&&(t=r.loadLevel);var i=this.hls.levels[t];if(i){var a,n,s=e.details;i.loadError++,s===b.BUFFER_APPEND_ERROR&&i.fragmentError++;var o=-1,u=r.levels,l=r.loadLevel,d=r.minAutoLevel,h=r.maxAutoLevel;r.autoLevelEnabled||(r.loadLevel=-1);for(var c,f=null==(a=e.frag)?void 0:a.type,v=(f===L&&s===b.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(s===b.BUFFER_ADD_CODEC_ERROR||s===b.BUFFER_APPEND_ERROR))&&u.some((function(e){var t=e.audioCodec;return i.audioCodec!==t})),p="video"===e.sourceBufferName&&(s===b.BUFFER_ADD_CODEC_ERROR||s===b.BUFFER_APPEND_ERROR)&&u.some((function(e){var t=e.codecSet,r=e.audioCodec;return i.codecSet!==t&&i.audioCodec===r})),m=null!=(n=e.context)?n:{},g=m.type,y=m.groupId,E=function(){var t=(S+l)%u.length;if(t!==l&&t>=d&&t<=h&&0===u[t].loadError){var r,a,n=u[t];if(s===b.FRAG_GAP&&e.frag){var c=u[t].details;if(c){var m=function(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var a=null;if(e){a=t[e.sn-t[0].sn+1]||null;var n=e.endDTS-r;n>0&&n<15e-7&&(r+=15e-7)}else 0===r&&0===t[0].start&&(a=t[0]);if(a&&(!e||e.level===a.level)&&0===We(r,i,a))return a;var s=Ye(t,We.bind(null,r,i));return!s||s===e&&a?a:s}(e.frag,c.fragments,e.frag.start);if(null!=m&&m.gap)return 0}}else{if(g===T&&n.hasAudioGroup(y)||g===A&&n.hasSubtitleGroup(y))return 0;if(f===L&&null!=(r=i.audioGroups)&&r.some((function(e){return n.hasAudioGroup(e)}))||f===x&&null!=(a=i.subtitleGroups)&&a.some((function(e){return n.hasSubtitleGroup(e)}))||v&&i.audioCodec===n.audioCodec||!v&&i.audioCodec!==n.audioCodec||p&&i.codecSet===n.codecSet)return 0}return o=t,1}},S=u.length;S--&&(0===(c=E())||1!==c););if(o>-1&&r.loadLevel!==o)return e.levelRetry=!0,this.playlistError=0,{action:tt,flags:it,nextAutoLevel:o}}return{action:tt,flags:at}},t.onErrorOut=function(e,t){var r;switch(null==(r=t.errorAction)?void 0:r.action){case et:break;case tt:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===b.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'+t.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()},t.sendAlternateToPenaltyBox=function(e){var t=this.hls,r=e.errorAction;if(r){var i=r.flags,a=r.hdcpLevel,n=r.nextAutoLevel;switch(i){case it:this.switchLevel(e,n);break;case nt:a&&(t.maxHdcpLevel=G[G.indexOf(a)-1],r.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}r.resolved||this.switchLevel(e,n)}},t.switchLevel=function(e,t){void 0!==t&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},e}(),ot="org.id3",ut="https://aomedia.org/emsg/ID3";function lt(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 dt=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=Fe(this.cachedData,e),this.cachedData=null);var r,i=ie(e,0),a=i?i.length:0,n=this._audioTrack,s=this._id3Track,o=i?se(i):void 0,u=e.length;for((null===this.basePTS||0===this.frameIndex&&v(o))&&(this.basePTS=ht(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ot,duration:Number.POSITIVE_INFINITY});a<u;){if(this.canParse(e,a)){var l=this.appendFrame(n,e,a);l?(this.frameIndex++,this.lastPTS=l.sample.pts,r=a+=l.length):a=u}else ne(e,a)?(i=ie(e,a),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ot,duration:Number.POSITIVE_INFINITY}),r=a+=i.length):a++;if(a===u&&r!==u){var d=$(e,r);this.cachedData?this.cachedData=Fe(this.cachedData,d):this.cachedData=d}}return{audioTrack:n,videoTrack:lt(),id3Track:s,textTrack:lt()}},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:lt(),id3Track:this._id3Track,textTrack:lt()}},t.destroy=function(){},e}(),ht=function(e,t,r){return v(e)?90*e:9e4*t+(r?9e4*r.baseTime/r.timescale:0)};function ct(e,t){return 255===e[t]&&240==(246&e[t+1])}function ft(e,t){return 1&e[t+1]?7:9}function vt(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function pt(e,t){return t+1<e.length&&ct(e,t)}function mt(e,t){if(pt(e,t)){var r=ft(e,t);if(t+r>=e.length)return!1;var i=vt(e,t);if(i<=r)return!1;var a=t+i;return a===e.length||pt(e,a)}return!1}function gt(e,t,r,i,a){if(!e.samplerate){var n=function(e,t,r,i){var a,n,s,o,u=navigator.userAgent.toLowerCase(),l=i,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];a=1+((192&t[r+2])>>>6);var h=(60&t[r+2])>>>2;if(!(h>d.length-1))return s=(1&t[r+2])<<2,s|=(192&t[r+3])>>>6,C.log("manifest codec:"+i+", ADTS type:"+a+", samplingIndex:"+h),/firefox/i.test(u)?h>=6?(a=5,o=new Array(4),n=h-3):(a=2,o=new Array(2),n=h):-1!==u.indexOf("android")?(a=2,o=new Array(2),n=h):(a=5,o=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&h>=6?n=h-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(h>=6&&1===s||/vivaldi/i.test(u))||!i&&1===s)&&(a=2,o=new Array(2)),n=h)),o[0]=a<<3,o[0]|=(14&h)>>1,o[1]|=(1&h)<<7,o[1]|=s<<3,5===a&&(o[1]|=(14&n)>>1,o[2]=(1&n)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:d[h],channelCount:s,codec:"mp4a.40."+a,manifestCodec:l};var c=new Error("invalid ADTS sampling index:"+h);e.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!0,error:c,reason:c.message})}(t,r,i,a);if(!n)return;e.config=n.config,e.samplerate=n.samplerate,e.channelCount=n.channelCount,e.codec=n.codec,e.manifestCodec=n.manifestCodec,C.log("parsed codec:"+e.codec+", rate:"+n.samplerate+", channels:"+n.channelCount)}}function yt(e){return 9216e4/e}function Et(e,t,r,i,a){var n,s=i+a*yt(e.samplerate),o=function(e,t){var r=ft(e,t);if(t+r<=e.length){var i=vt(e,t)-r;if(i>0)return{headerLength:r,frameLength:i}}}(t,r);if(o){var u=o.frameLength,l=o.headerLength,d=l+u,h=Math.max(0,r+d-t.length);h?(n=new Uint8Array(d-l)).set(t.subarray(r+l,t.length),0):n=t.subarray(r+l,r+d);var c={unit:n,pts:s};return h||e.samples.push(c),{sample:c,length:d,missing:h}}var f=t.length-r;return(n=new Uint8Array(f)).set(t.subarray(r,t.length),0),{sample:{unit:n,pts:s},length:f,missing:-1}}var St=null,bt=[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],Tt=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],At=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Rt=[0,1,1,4];function Lt(e,t,r,i,a){if(!(r+24>t.length)){var n=xt(t,r);if(n&&r+n.frameLength<=t.length){var s=i+a*(9e4*n.samplesPerFrame/n.sampleRate),o={unit:t.subarray(r,r+n.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(o),{sample:o,length:n.frameLength,missing:0}}}}function xt(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,a=e[t+2]>>4&15,n=e[t+2]>>2&3;if(1!==r&&0!==a&&15!==a&&3!==n){var s=e[t+2]>>1&1,o=e[t+3]>>6,u=1e3*bt[14*(3===r?3-i:3===i?3:4)+a-1],l=Tt[3*(3===r?0:2===r?1:2)+n],d=3===o?1:2,h=At[r][i],c=Rt[i],f=8*h*c,v=Math.floor(h*u/l+s)*c;if(null===St){var p=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);St=p?parseInt(p[1]):0}return!!St&&St<=87&&2===i&&u>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:l,channelCount:d,frameLength:v,samplesPerFrame:f}}}function _t(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function wt(e,t){return t+1<e.length&&_t(e,t)}function Dt(e,t){if(t+1<e.length&&_t(e,t)){var r=xt(e,t),i=4;null!=r&&r.frameLength&&(i=r.frameLength);var a=t+i;return a===e.length||wt(e,a)}return!1}var kt=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}l(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,a){e.prototype.resetInitSegment.call(this,t,r,i,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=ie(e,0),r=(null==t?void 0:t.length)||0;if(Dt(e,r))return!1;for(var i=e.length;r<i;r++)if(mt(e,r))return C.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)&&ct(e,t)&&vt(e,t)<=e.length-t}(e,t)},r.appendFrame=function(e,t,r){gt(e,this.observer,t,r,e.manifestCodec);var i=Et(e,t,r,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i},t}(dt),Ct=/\/emsg[-/]ID3/i,It=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 a=this.videoTrack=lt("video",1),n=this.audioTrack=lt("audio",1),s=this.txtTrack=lt("text",1);if(this.id3Track=lt("id3",1),this.timeOffset=0,null!=e&&e.byteLength){var o=De(e);if(o.video){var u=o.video,l=u.id,d=u.timescale,h=u.codec;a.id=l,a.timescale=s.timescale=d,a.codec=h}if(o.audio){var c=o.audio,f=c.id,v=c.timescale,p=c.codec;n.id=f,n.timescale=v,n.codec=p}s.id=Se.text,a.sampleDuration=0,a.duration=n.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=Ae(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,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Fe(this.remainderData,e));var n=function(e){var t={valid:null,remainder:null},r=_e(e,["moof"]);if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=$(e,0,i.byteOffset-8),t.remainder=$(e,i.byteOffset-8),t}(r);this.remainderData=n.remainder,i.samples=n.valid||new Uint8Array}else i.samples=r;var s=this.extractID3Track(i,t);return a.samples=Be(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:s,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=Be(e,t),{videoTrack:t,audioTrack:lt(),id3Track:i,textTrack:lt()}},t.extractID3Track=function(e,t){var r=this.id3Track;if(e.samples.length){var i=_e(e.samples,["emsg"]);i&&i.forEach((function(e){var i=function(e){var t=e[0],r="",i="",a=0,n=0,s=0,o=0,u=0,l=0;if(0===t){for(;"\0"!==be(e.subarray(l,l+1));)r+=be(e.subarray(l,l+1)),l+=1;for(r+=be(e.subarray(l,l+1)),l+=1;"\0"!==be(e.subarray(l,l+1));)i+=be(e.subarray(l,l+1)),l+=1;i+=be(e.subarray(l,l+1)),l+=1,a=Ae(e,12),n=Ae(e,16),o=Ae(e,20),u=Ae(e,24),l=28}else if(1===t){a=Ae(e,l+=4);var d=Ae(e,l+=4),h=Ae(e,l+=4);for(l+=4,s=Math.pow(2,32)*d+h,p(s)||(s=Number.MAX_SAFE_INTEGER,C.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ae(e,l),u=Ae(e,l+=4),l+=4;"\0"!==be(e.subarray(l,l+1));)r+=be(e.subarray(l,l+1)),l+=1;for(r+=be(e.subarray(l,l+1)),l+=1;"\0"!==be(e.subarray(l,l+1));)i+=be(e.subarray(l,l+1)),l+=1;i+=be(e.subarray(l,l+1)),l+=1}return{schemeIdUri:r,value:i,timeScale:a,presentationTime:s,presentationTimeDelta:n,eventDuration:o,id:u,payload:e.subarray(l,e.byteLength)}}(e);if(Ct.test(i.schemeIdUri)){var a=v(i.presentationTime)?i.presentationTime/i.timeScale:t+i.presentationTimeDelta/i.timeScale,n=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;n<=.001&&(n=Number.POSITIVE_INFINITY);var s=i.payload;r.samples.push({data:s,len:s.byteLength,dts:a,pts:a,type:ut,duration:n})}}))}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}(),Pt=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 a=i.units;r=a[a.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 a=r[i-1];e.pts=a.pts,e.dts=a.dts}t.samples.push(e)}e.debug.length&&C.log(e.pts+"/"+e.dts+":"+e.debug)},e}(),Mt=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),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");i.set(e.subarray(r,r+a)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a},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&&C.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,a=0,n=0,s=0,o=this.readUByte.bind(this),u=this.readBits.bind(this),l=this.readUEG.bind(this),d=this.readBoolean.bind(this),h=this.skipBits.bind(this),c=this.skipEG.bind(this),f=this.skipUEG.bind(this),v=this.skipScalingList.bind(this);o();var p=o();if(u(5),h(3),o(),f(),100===p||110===p||122===p||244===p||44===p||83===p||86===p||118===p||128===p){var m=l();if(3===m&&h(1),f(),f(),h(1),d())for(t=3!==m?8:12,r=0;r<t;r++)d()&&v(r<6?16:64)}f();var g=l();if(0===g)l();else if(1===g)for(h(1),c(),c(),e=l(),r=0;r<e;r++)c();f(),h(1);var y=l(),E=l(),S=u(1);0===S&&h(1),h(1),d()&&(i=l(),a=l(),n=l(),s=l());var b=[1,1];if(d()&&d())switch(o()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:b=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*i-2*a),height:(2-S)*(E+1)*16-(S?2:4)*(n+s),pixelRatio:b}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}(),Ot=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.parseAVCPES=function(e,t,r,i,a){var n,s=this,o=r.data,u=this.parseAVCNALu(e,r.data),l=this.VideoSample,d=!1;r.data=null,l&&u.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),u.forEach((function(i){var u;switch(i.type){case 1:var h=!1;n=!0;var c,f=i.data;if(d&&f.length>4){var v=new Mt(f).readSliceType();2!==v&&4!==v&&7!==v&&9!==v||(h=!0)}h&&null!=(c=l)&&c.frame&&!l.key&&(s.pushAccessUnit(l,e),l=s.VideoSample=null),l||(l=s.VideoSample=s.createVideoSample(!0,r.pts,r.dts,"")),l.frame=!0,l.key=h;break;case 5:n=!0,null!=(u=l)&&u.frame&&!l.key&&(s.pushAccessUnit(l,e),l=s.VideoSample=null),l||(l=s.VideoSample=s.createVideoSample(!0,r.pts,r.dts,"")),l.key=!0,l.frame=!0;break;case 6:n=!0,Ne(i.data,1,r.pts,t.samples);break;case 7:var p,m;n=!0,d=!0;var g=i.data,y=new Mt(g).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=[g],e.duration=a;for(var E=g.subarray(1,4),S="avc1.",b=0;b<3;b++){var T=E[b].toString(16);T.length<2&&(T="0"+T),S+=T}e.codec=S}break;case 8:n=!0,e.pps=[i.data];break;case 9:n=!0,e.audFound=!0,l&&s.pushAccessUnit(l,e),l=s.VideoSample=s.createVideoSample(!1,r.pts,r.dts,"");break;case 12:n=!0;break;default:n=!1,l&&(l.debug+="unknown NAL "+i.type+" ")}l&&n&&l.units.push(i),l&&(l.pes=o)})),i&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)},r.parseAVCNALu=function(e,t){var r,i,a=t.byteLength,n=e.naluState||0,s=n,o=[],u=0,l=-1,d=0;for(-1===n&&(l=0,d=31&t[0],n=0,u=1);u<a;)if(r=t[u++],n)if(1!==n)if(r)if(1===r){if(i=u-n-1,l>=0){var h={data:t.subarray(l,i),type:d};o.push(h)}else{var c=this.getLastNalUnit(e.samples);c&&(s&&u<=4-s&&c.state&&(c.data=c.data.subarray(0,c.data.byteLength-s)),i>0&&(c.data=Fe(c.data,t.subarray(0,i)),c.state=0))}u<a?(l=u,d=31&t[u],n=0):n=-1}else n=0;else n=3;else n=r?0:2;else n=r?0:1;if(l>=0&&n>=0){var f={data:t.subarray(l,a),type:d,state:n};o.push(f)}if(0===o.length){var v=this.getLastNalUnit(e.samples);v&&(v.data=Fe(v.data,t))}return e.naluState=n,o},t}(Pt),Ft=function(){function e(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new $e(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,a=e[t].unit;if(!(a.length<=16)){var n=a.subarray(16,a.length-a.length%16),s=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(s).then((function(n){var s=new Uint8Array(n);a.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,a=32;a<e.length-16;a+=160,i+=16)r.set(e.subarray(a,a+16),i);return r},t.getAvcDecryptedUnit=function(e,t){for(var r=new Uint8Array(t),i=0,a=32;a<e.length-16;a+=160,i+=16)e.set(r.subarray(i,i+16),a);return e},t.decryptAvcSample=function(e,t,r,i,a){var n=this,s=Ge(a.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){a.data=n.getAvcDecryptedUnit(s,o),n.decrypter.isSync()||n.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 a=e[t].units;!(r>=a.length);r++){var n=a[r];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(e,t,r,i,n),this.decrypter.isSync())))return}}},e}(),Bt=188,Ut=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.aliDecrypter=void 0,this.vpk=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.videoParser=new Ot,this.aliDecrypter=new $e(t,{removePKCS7Padding:!1}),this.vpk=t._vpk}e.probe=function(t){var r=e.syncOffset(t);return r>0&&C.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-Bt)+1,i=0;i<r;){for(var a=!1,n=-1,s=0,o=i;o<t;o+=Bt){if(71!==e[o]||t-o!==Bt&&71!==e[o+Bt]){if(s)return-1;break}if(s++,-1===n&&0!==(n=o)&&(r=Math.min(n+18612,e.length-Bt)+1),a||(a=0===Nt(e,o)),a&&s>1&&(0===n&&s>2||o+Bt>r))return n}i++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Se[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,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",a),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=a},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,a,n){var s,o=this;void 0===i&&(i=!1),void 0===a&&(a=!1),void 0===n&&(n=""),i||(this.sampleAes=null);var u=this._videoTrack,l=this._audioTrack,d=this._id3Track,h=this._txtTrack,c=u.pid,f=u.pesData,v=l.pid,p=d.pid,m=l.pesData,g=d.pesData,y=null,T=this.pmtParsed,A=this._pmtId,R=t.length;if(this.remainderData&&(R=(t=Fe(this.remainderData,t)).length,this.remainderData=null),R<Bt&&!a)return this.remainderData=t,{audioTrack:l,videoTrack:u,id3Track:d,textTrack:h};var L=Math.max(0,e.syncOffset(t));(R-=(R-L)%Bt)<t.byteLength&&!a&&(this.remainderData=new Uint8Array(t.buffer,R,t.buffer.byteLength-R)),Array.isArray(this.config._vpk)&&this.config._vpk.forEach((function(e){var t;(null==(t=e.url)?void 0:t.split("?")[0])===n.split("?")[0]&&(o.vpk=e.secData)}));for(var x=0,_=L;_<R;_+=Bt)if(71===t[_]){var w=!!(64&t[_+1]),D=Nt(t,_),k=void 0;if((48&t[_+3])>>4>1){if((k=_+5+t[_+4])===_+Bt)continue}else k=_+4;switch(D){case c:w&&(f&&(s=Kt(f,this.vpk,this.aliDecrypter))&&this.videoParser.parseAVCPES(u,h,s,!1,this._duration),f={data:[],size:0}),f&&(f.data.push(t.subarray(k,_+Bt)),f.size+=_+Bt-k);break;case v:if(w){if(m&&(s=Kt(m,this.vpk,this.aliDecrypter)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,s);break;case"mp3":this.parseMPEGPES(l,s)}m={data:[],size:0}}m&&(m.data.push(t.subarray(k,_+Bt)),m.size+=_+Bt-k);break;case p:w&&(g&&(s=Kt(g,this.vpk,this.aliDecrypter))&&this.parseID3PES(d,s),g={data:[],size:0}),g&&(g.data.push(t.subarray(k,_+Bt)),g.size+=_+Bt-k);break;case 0:w&&(k+=t[k]+1),A=this._pmtId=Gt(t,k);break;case A:w&&(k+=t[k]+1);var I=Vt(t,k,this.typeSupported,i);(c=I.videoPid)>0&&(u.pid=c,u.segmentCodec=I.segmentVideoCodec),(v=I.audioPid)>0&&(l.pid=v,l.segmentCodec=I.segmentAudioCodec),(p=I.id3Pid)>0&&(d.pid=p),null===y||T||(C.warn("MPEG-TS PMT found at "+_+" after unknown PID '"+y+"'. Backtracking to sync byte @"+L+" to parse all TS packets."),y=null,_=L-188),T=this.pmtParsed=!0;break;case 17:case 8191:break;default:y=D}}else x++;if(x>0){var P=new Error("Found "+x+" TS packet/s that do not start with 0x47");this.observer.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,error:P,reason:P.message})}u.pesData=f,l.pesData=m,d.pesData=g;var M={audioTrack:l,videoTrack:u,id3Track:d,textTrack:h};return a&&this.extractRemainingSamples(M),M},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,a=e.id3Track,n=e.textTrack,s=i.pesData,o=r.pesData,u=a.pesData;if(s&&(t=Kt(s,this.vpk,this.aliDecrypter))?(this.videoParser.parseAVCPES(i,n,t,!0,this._duration),i.pesData=null):i.pesData=s,o&&(t=Kt(o,this.vpk,this.aliDecrypter))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,t);break;case"mp3":this.parseMPEGPES(r,t)}r.pesData=null}else null!=o&&o.size&&C.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=o;u&&(t=Kt(u,this.vpk,this.aliDecrypter))?(this.parseID3PES(a,t),a.pesData=null):a.pesData=u},t.demuxSampleAes=function(e,t,r){var i=this.demux(e,r,!0,!this.config.progressive),a=this.sampleAes=new Ft(this.observer,this.config,t);return this.decrypt(i,a)},t.decrypt=function(e,t){return new Promise((function(r){var i=e.audioTrack,a=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(function(){a.samples?t.decryptAvcSamples(a.samples,0,0,(function(){r(e)})):r(e)})):a.samples&&t.decryptAvcSamples(a.samples,0,0,(function(){r(e)}))}))},t.destroy=function(){this._duration=0},t.parseAACPES=function(e,t){var r,i,a,n=0,s=this.aacOverFlow,o=t.data;if(s){this.aacOverFlow=null;var u=s.missing,l=s.sample.unit.byteLength;if(-1===u)o=Fe(s.sample.unit,o);else{var d=l-u;s.sample.unit.set(o.subarray(0,u),d),e.samples.push(s.sample),n=s.missing}}for(r=n,i=o.length;r<i-1&&!pt(o,r);r++);if(r!==n){var h,c=r<i-1;h=c?"AAC PES did not start with ADTS header,offset:"+r:"No ADTS header found in AAC PES";var f=new Error(h);if(C.warn("parsing error: "+h),this.observer.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,levelRetry:c,error:f,reason:h}),!c)return}if(gt(e,this.observer,o,r,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!s)return void C.warn("[tsdemuxer]: AAC PES unknown PTS");var v=yt(e.samplerate);a=s.sample.pts+v}for(var p,m=0;r<i;){if(r+=(p=Et(e,o,r,a,m)).length,p.missing){this.aacOverFlow=p;break}for(m++;r<i-1&&!pt(o,r);r++);}},t.parseMPEGPES=function(e,t){var r=t.data,i=r.length,a=0,n=0,s=t.pts;if(void 0!==s)for(;n<i;)if(wt(r,n)){var o=Lt(e,r,n,s,a);if(!o)break;n+=o.length,a++}else n++;else C.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseAC3PES=function(e,t){},t.parseID3PES=function(e,t){if(void 0!==t.pts){var r=u({},t,{type:this._videoTrack?ut:ot,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}else C.warn("[tsdemuxer]: ID3 PES unknown PTS")},e}();function Nt(e,t){return((31&e[t+1])<<8)+e[t+2]}function Gt(e,t){return(31&e[t+10])<<8|e[t+11]}function Vt(e,t,r,i){var a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<n;){var s=Nt(e,t),o=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!i){Ht("ADTS AAC");break}case 15:-1===a.audioPid&&(a.audioPid=s);break;case 21:-1===a.id3Pid&&(a.id3Pid=s);break;case 219:if(!i){Ht("H.264");break}case 27:-1===a.videoPid&&(a.videoPid=s,a.segmentVideoCodec="avc");break;case 3:case 4:r.mpeg||r.mp3?-1===a.audioPid&&(a.audioPid=s,a.segmentAudioCodec="mp3"):C.log("MPEG audio found, not supported in this browser");break;case 193:if(!i){Ht("AC-3");break}case 129:C.warn("AC-3 in M2TS support not included in build");break;case 6:if(-1===a.audioPid&&o>0)for(var u=t+5,l=o;l>2;){106===e[u]&&C.warn("AC-3 in M2TS support not included in build");var d=e[u+1]+2;u+=d,l-=d}break;case 194:case 135:throw new Error("Unsupported EC-3 in M2TS found");case 36:throw new Error("Unsupported HEVC in M2TS found")}t+=o+5}return a}function Ht(e){C.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function Kt(e,t,r){var i,a,n,s,o,u=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=Fe(l[0],l[1]),l.splice(1,1);if(1===((i=l[0])[0]<<16)+(i[1]<<8)+i[2]){if((a=(i[4]<<8)+i[5])&&a>e.size-6)return null;var d=i[7];192&d&&(s=536870912*(14&i[9])+4194304*(255&i[10])+16384*(254&i[11])+128*(255&i[12])+(254&i[13])/2,64&d?s-(o=536870912*(14&i[14])+4194304*(255&i[15])+16384*(254&i[16])+128*(255&i[17])+(254&i[18])/2)>54e5&&(C.warn(Math.round((s-o)/9e4)+"s delta between PTS and DTS, align them"),s=o):o=s);var h=(n=i[8])+9;if(e.size<=h)return null;e.size-=h;for(var c=new Uint8Array(e.size),f=0,v=l.length;f<v;f++){var p=(i=l[f]).byteLength;if(h){if(h>p){h-=p;continue}i=i.subarray(h),p-=h,h=0}c.set(i,u),u+=p}return a&&(a-=n+3),t&&(c=function(e,t,r){var i=new Uint8Array(t),a=new ArrayBuffer(16);try{if(e.length%16>0){var n=16*parseInt(String(e.length/16)),s=e.slice(0,n),o=r.decryptSync(s,i.buffer,a),u=new Uint8Array(o);return e.set(u,0),o=u=null,e}var l=r.decryptSync(e,i.buffer,a);return new Uint8Array(l)}catch(t){return console.log("ERROR in DECRYPT",t),e}}(c,t,r)),{data:c,pts:s,dts:o,len:a}}return null}var jt=function(e){function t(){return e.apply(this,arguments)||this}l(t,e);var r=t.prototype;return r.resetInitSegment=function(t,r,i,a){e.prototype.resetInitSegment.call(this,t,r,i,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=ie(e,0),r=(null==t?void 0:t.length)||0;if(t&&11===e[r]&&119===e[r+1]&&void 0!==se(t)&&function(e,t){var r=0,i=5;t+=i;for(var a=new Uint32Array(1),n=new Uint32Array(1),s=new Uint8Array(1);i>0;){s[0]=e[t];var o=Math.min(i,8),u=8-o;n[0]=4278190080>>>24+u<<u,a[0]=(s[0]&n[0])>>u,r=r?r<<o|a[0]:a[0],t+=1,i-=o}return r}(e,r)<=16)return!1;for(var i=e.length;r<i;r++)if(Dt(e,r))return C.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(e,t){return function(e,t){return _t(e,t)&&4<=e.length-t}(e,t)},r.appendFrame=function(e,t,r){if(null!==this.basePTS)return Lt(e,t,r,this.basePTS,this.frameIndex)},t}(dt),Yt=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}(),Wt=Math.pow(2,32)-1,zt=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 a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=n,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,a))},e.box=function(e){for(var t=8,r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];for(var n=i.length,s=n;n--;)t+=i[n].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),n=0,t=8;n<s;n++)o.set(i[n],t),t+=i[n].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/(Wt+1)),a=Math.floor(r%(Wt+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,a>>24,a>>16&255,a>>8&255,255&a,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/(Wt+1)),a=Math.floor(r%(Wt+1)),n=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,a>>24,a>>16&255,a>>8&255,255&a,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,n)},e.sdtp=function(t){var r,i,a=t.samples||[],n=new Uint8Array(4+a.length);for(r=0;r<a.length;r++)i=a[r].flags,n[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e.box(e.types.sdtp,n)},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,a,n=[],s=[];for(r=0;r<t.sps.length;r++)a=(i=t.sps[r]).byteLength,n.push(a>>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)a=(i=t.pps[r]).byteLength,s.push(a>>>8&255),s.push(255&a),s=s.concat(Array.prototype.slice.call(i));var o=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(s))),u=t.width,l=t.height,d=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,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]),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([d>>24,d>>16&255,d>>8&255,255&d,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,a=t.width,n=t.height,s=Math.floor(i/(Wt+1)),o=Math.floor(i%(Wt+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,a>>8&255,255&a,0,0,n>>8&255,255&n,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),a=t.id,n=Math.floor(r/(Wt+1)),s=Math.floor(r%(Wt+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,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,a,n,s,o,u,l=t.samples||[],d=l.length,h=12+16*d,c=new Uint8Array(h);for(r+=8+h,c.set(["video"===t.type?1:0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<d;i++)n=(a=l[i]).duration,s=a.size,o=a.flags,u=a.cts,c.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,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,c)},e.initSegment=function(t){e.types||e.init();var r=e.moov(t);return Fe(e.FTYP,r)},e}();function qt(e,t){return void 0===t&&(t=!1),function(e,t,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var a=e*t*r;return i?Math.round(a):a}(e,1e3,1/9e4,t)}zt.types=void 0,zt.HDLR_TYPES=void 0,zt.STTS=void 0,zt.STSC=void 0,zt.STCO=void 0,zt.STSZ=void 0,zt.VMHD=void 0,zt.SMHD=void 0,zt.STSD=void 0,zt.FTYP=void 0,zt.DINF=void 0;var Xt=null,Qt=null,Zt=function(){function e(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===Xt){var a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Xt=a?parseInt(a[1]):0}if(null===Qt){var n=navigator.userAgent.match(/Safari\/(\d+)/i);Qt=n?parseInt(n[1]):0}}var t=e.prototype;return t.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},t.resetTimeStamp=function(e){C.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){C.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){C.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},t.getVideoStartPts=function(e){var t=!1,r=e.reduce((function(e,r){var i=r.pts-e;return i<-4294967296?(t=!0,Jt(e,r.pts)):i>0?e:r.pts}),e[0].pts);return t&&C.debug("PTS rollover detected"),r},t.remux=function(e,t,r,i,a,n,s,o){var u,l,d,h,c,f,v=a,p=a,m=e.pid>-1,g=t.pid>-1,y=t.samples.length,E=e.samples.length>0,S=s&&y>0||y>1;if((!m||E)&&(!g||S)||this.ISGenerated||s){if(this.ISGenerated){var b,T,A,R,x=this.videoTrackConfig;!x||t.width===x.width&&t.height===x.height&&(null==(b=t.pixelRatio)?void 0:b[0])===(null==(T=x.pixelRatio)?void 0:T[0])&&(null==(A=t.pixelRatio)?void 0:A[1])===(null==(R=x.pixelRatio)?void 0:R[1])||this.resetInitSegment()}else d=this.generateIS(e,t,a,n);var _,w=this.isVideoContiguous,D=-1;if(S&&(D=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!w&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,D>0){C.warn("[mp4-remuxer]: Dropped "+D+" out of "+y+" video samples due to a missing keyframe");var k=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(D),t.dropped+=D,_=p+=(t.samples[0].pts-k)/t.inputTimeScale}else-1===D&&(C.warn("[mp4-remuxer]: No keyframe found out of "+y+" video samples"),f=!1);if(this.ISGenerated){if(E&&S){var I=this.getVideoStartPts(t.samples),P=(Jt(e.samples[0].pts,I)-I)/t.inputTimeScale;v+=Math.max(0,P),p+=Math.max(0,-P)}if(E){if(e.samplerate||(C.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(e,t,a,n)),l=this.remuxAudio(e,v,this.isAudioContiguous,n,g||S||o===L?p:void 0),S){var M=l?l.endPTS-l.startPTS:0;t.inputTimeScale||(C.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(e,t,a,n)),u=this.remuxVideo(t,p,w,M)}}else S&&(u=this.remuxVideo(t,p,w,0));u&&(u.firstKeyFrame=D,u.independent=-1!==D,u.firstKeyFramePTS=_)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(c=$t(r,a,this._initPTS,this._initDTS)),i.samples.length&&(h=er(i,a,this._initPTS))),{audio:l,video:u,initSegment:d,independent:f,text:h,id3:c}},t.generateIS=function(e,t,r,i){var a,n,s,o=e.samples,u=t.samples,l=this.typeSupported,d={},h=this._initPTS,c=!h||i,f="audio/mp4";if(c&&(a=n=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(f="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}d.audio={id:"audio",container:f,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&l.mpeg?new Uint8Array(0):zt.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(s=e.inputTimeScale,h&&s===h.timescale?c=!1:a=n=o[0].pts-Math.round(s*r))}if(t.sps&&t.pps&&u.length){if(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:zt.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(s=t.inputTimeScale,h&&s===h.timescale)c=!1;else{var v=this.getVideoStartPts(u),p=Math.round(s*r);n=Math.min(n,Jt(u[0].dts,v)-p),a=Math.min(a,v-p)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(d).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:a,timescale:s},this._initDTS={baseTime:n,timescale:s}):a=s=void 0,{tracks:d,initPTS:a,timescale:s}},t.remuxVideo=function(e,t,r,i){var a,n,s=e.inputTimeScale,o=e.samples,l=[],d=o.length,h=this._initPTS,c=this.nextAvcDts,f=8,v=this.videoSampleDuration,p=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!r||null===c){var y=t*s,T=o[0].pts-Jt(o[0].dts,o[0].pts);Xt&&null!==c&&Math.abs(y-T-c)<15e3?r=!0:c=y-T}for(var A=h.baseTime*s/h.timescale,R=0;R<d;R++){var L=o[R];L.pts=Jt(L.pts-A,c),L.dts=Jt(L.dts-A,c),L.dts<o[R>0?R-1:R].dts&&(g=!0)}g&&o.sort((function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i})),a=o[0].dts;var x=(n=o[o.length-1].dts)-a,_=x?Math.round(x/(d-1)):v||e.inputTimeScale/30;if(r){var w=a-c,D=w>_,k=w<-1;if((D||k)&&(D?C.warn("AVC: "+qt(w,!0)+" ms ("+w+"dts) hole between fragments detected at "+t.toFixed(3)):C.warn("AVC: "+qt(-w,!0)+" ms ("+w+"dts) overlapping between fragments detected at "+t.toFixed(3)),!k||c>=o[0].pts||Xt)){a=c;var I=o[0].pts-w;if(D)o[0].dts=a,o[0].pts=I;else for(var P=0;P<o.length&&!(o[P].dts>I);P++)o[P].dts-=w,o[P].pts-=w;C.log("Video: Initial PTS/DTS adjusted: "+qt(I,!0)+"/"+qt(a,!0)+", delta: "+qt(w,!0)+" ms")}}for(var M=0,O=0,F=a=Math.max(0,a),B=0;B<d;B++){for(var U=o[B],N=U.units,G=N.length,V=0,H=0;H<G;H++)V+=N[H].data.length;O+=V,M+=G,U.length=V,U.dts<F?(U.dts=F,F+=_/4|0||1):F=U.dts,p=Math.min(U.pts,p),m=Math.max(U.pts,m)}n=o[d-1].dts;var K,j=O+4*M+8;try{K=new Uint8Array(j)}catch(e){return void this.observer.emit(E.ERROR,E.ERROR,{type:S.MUX_ERROR,details:b.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:j,reason:"fail allocating video mdat "+j})}var Y=new DataView(K.buffer);Y.setUint32(0,j),K.set(zt.types.mdat,4);for(var W=!1,z=Number.POSITIVE_INFINITY,q=Number.POSITIVE_INFINITY,X=Number.NEGATIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,Z=0;Z<d;Z++){for(var J=o[Z],$=J.units,ee=0,te=0,re=$.length;te<re;te++){var ie=$[te],ae=ie.data,ne=ie.data.byteLength;Y.setUint32(f,ne),f+=4,K.set(ae,f),f+=ne,ee+=4+ne}var se=void 0;if(Z<d-1)v=o[Z+1].dts-J.dts,se=o[Z+1].pts-J.pts;else{var oe=this.config,ue=Z>0?J.dts-o[Z-1].dts:_;if(se=Z>0?J.pts-o[Z-1].pts:_,oe.stretchShortVideoTrack&&null!==this.nextAudioPts){var le=Math.floor(oe.maxBufferHole*s),de=(i?p+i*s:this.nextAudioPts)-J.pts;de>le?((v=de-ue)<0?v=ue:W=!0,C.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+v/90+" ms for the last video frame.")):v=ue}else v=ue}var he=Math.round(J.pts-J.dts);z=Math.min(z,v),X=Math.max(X,v),q=Math.min(q,se),Q=Math.max(Q,se),l.push(new tr(J.key,v,ee,he))}if(l.length)if(Xt){if(Xt<70){var ce=l[0].flags;ce.dependsOn=2,ce.isNonSync=0}}else if(Qt&&Q-q<X-z&&_/X<.025&&0===l[0].cts){C.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var fe=a,ve=0,pe=l.length;ve<pe;ve++){var me=fe+l[ve].duration,ge=fe+l[ve].cts;if(ve<pe-1){var ye=me+l[ve+1].cts;l[ve].duration=ye-ge}else l[ve].duration=ve?l[ve-1].duration:_;l[ve].cts=0,fe=me}}v=W||!v?_:v,this.nextAvcDts=c=n+v,this.videoSampleDuration=v,this.isVideoContiguous=!0;var Ee={data1:zt.moof(e.sequenceNumber++,a,u({},e,{samples:l})),data2:K,startPTS:p/s,endPTS:(m+v)/s,startDTS:a/s,endDTS:c/s,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Ee},t.getSamplesPerFrame=function(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}},t.remuxAudio=function(e,t,r,i,a){var n=e.inputTimeScale,s=n/(e.samplerate?e.samplerate:n),o=this.getSamplesPerFrame(e),l=o*s,d=this._initPTS,h="mp3"===e.segmentCodec&&this.typeSupported.mpeg,c=[],f=void 0!==a,v=e.samples,p=h?0:8,m=this.nextAudioPts||-1,g=t*n,y=d.baseTime*n/d.timescale;if(this.isAudioContiguous=r=r||v.length&&m>0&&(i&&Math.abs(g-m)<9e3||Math.abs(Jt(v[0].pts-y,g)-m)<20*l),v.forEach((function(e){e.pts=Jt(e.pts-y,g)})),!r||m<0){if(v=v.filter((function(e){return e.pts>=0})),!v.length)return;m=0===a?0:i&&!f?Math.max(0,g):v[0].pts}if("aac"===e.segmentCodec)for(var T=this.config.maxAudioFramesDrift,A=0,R=m;A<v.length;A++){var L=v[A],x=L.pts,_=x-R,w=Math.abs(1e3*_/n);if(_<=-T*l&&f)0===A&&(C.warn("Audio frame @ "+(x/n).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*_/n)+" ms."),this.nextAudioPts=m=R=x);else if(_>=T*l&&w<1e4&&f){var D=Math.round(_/l);(R=x-D*l)<0&&(D--,R+=l),0===A&&(this.nextAudioPts=m=R),C.warn("[mp4-remuxer]: Injecting "+D+" audio frame @ "+(R/n).toFixed(3)+"s due to "+Math.round(1e3*_/n)+" ms gap.");for(var k=0;k<D;k++){var I=Math.max(R,0),P=Yt.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);P||(C.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),P=L.unit.subarray()),v.splice(A,0,{unit:P,pts:I}),R+=l,A++}}L.pts=R,R+=l}for(var M,O=null,F=null,B=0,U=v.length;U--;)B+=v[U].unit.byteLength;for(var N=0,G=v.length;N<G;N++){var V=v[N],H=V.unit,K=V.pts;if(null!==F)c[N-1].duration=Math.round((K-F)/s);else{if(r&&"aac"===e.segmentCodec&&(K=m),O=K,!(B>0))return;B+=p;try{M=new Uint8Array(B)}catch(e){return void this.observer.emit(E.ERROR,E.ERROR,{type:S.MUX_ERROR,details:b.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:B,reason:"fail allocating audio mdat "+B})}h||(new DataView(M.buffer).setUint32(0,B),M.set(zt.types.mdat,4))}M.set(H,p);var j=H.byteLength;p+=j,c.push(new tr(!0,o,j,0)),F=K}var Y=c.length;if(Y){var W=c[c.length-1];this.nextAudioPts=m=F+s*W.duration;var z=h?new Uint8Array(0):zt.moof(e.sequenceNumber++,O/s,u({},e,{samples:c}));e.samples=[];var q=O/n,X=m/n,Q={data1:z,data2:M,startPTS:q,endPTS:X,startDTS:q,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:Y};return this.isAudioContiguous=!0,Q}},t.remuxEmptyAudio=function(e,t,r,i){var a=e.inputTimeScale,n=a/(e.samplerate?e.samplerate:a),s=this.nextAudioPts,o=this._initDTS,u=9e4*o.baseTime/o.timescale,l=(null!==s?s:i.startDTS*a)+u,d=i.endDTS*a+u,h=1024*n,c=Math.ceil((d-l)/h),f=Yt.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(C.warn("[mp4-remuxer]: remux empty Audio"),f){for(var v=[],p=0;p<c;p++){var m=l+p*h;v.push({unit:f,pts:m,dts:m})}return e.samples=v,this.remuxAudio(e,t,r,!1)}C.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},e}();function Jt(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 $t(e,t,r,i){var a=e.samples.length;if(a){for(var n=e.inputTimeScale,s=0;s<a;s++){var o=e.samples[s];o.pts=Jt(o.pts-r.baseTime*n/r.timescale,t*n)/n,o.dts=Jt(o.dts-i.baseTime*n/i.timescale,t*n)/n}var u=e.samples;return e.samples=[],{samples:u}}}function er(e,t,r){var i=e.samples.length;if(i){for(var a=e.inputTimeScale,n=0;n<i;n++){var s=e.samples[n];s.pts=Jt(s.pts-r.baseTime*a/r.timescale,t*a)/a}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}}var tr=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}},rr=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(Me(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=De(e);i.audio&&(t=ir(i.audio,Q)),i.video&&(r=ir(i.video,Z));var a={};i.audio&&i.video?a.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:i.audio?a.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?a.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:C.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},t.remux=function(e,t,r,i,a,n){var s,o,u=this.initPTS,l=this.lastEndTime,d={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};v(l)||(l=this.lastEndTime=a||0);var h=t.samples;if(null==h||!h.length)return d;var c={initPTS:void 0,timescale:1},f=this.initData;if(null!=(s=f)&&s.length||(this.generateInitSegment(h),f=this.initData),null==(o=f)||!o.length)return C.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(c.tracks=this.initTracks,this.emitInitSegment=!1);var p=function(e,t){for(var r=0,i=0,a=0,n=_e(e,["moof","traf"]),s=0;s<n.length;s++){var o=n[s],u=_e(o,["tfhd"])[0],l=t[Ae(u,4)];if(l){var d=l.default,h=Ae(u,0)|(null==d?void 0:d.flags),c=null==d?void 0:d.duration;8&h&&(c=Ae(u,2&h?12:8));for(var f=l.timescale||9e4,p=_e(o,["trun"]),m=0;m<p.length;m++)!(r=Oe(p[m]))&&c&&(r=c*Ae(p[m],4)),l.type===Z?i+=r/f:l.type===Q&&(a+=r/f)}}if(0===i&&0===a){for(var g=1/0,y=0,E=0,S=_e(e,["sidx"]),b=0;b<S.length;b++){var T=we(S[b]);if(null!=T&&T.references){g=Math.min(g,T.earliestPresentationTime/T.timescale);var A=T.references.reduce((function(e,t){return e+t.info.duration||0}),0);E=(y=Math.max(y,A+T.earliestPresentationTime/T.timescale))-g}}if(E&&v(E))return E}return i||a}(h,f),m=function(e,t){return _e(t,["moof","traf"]).reduce((function(t,r){var i=_e(r,["tfdt"])[0],a=i[0],n=_e(r,["tfhd"]).reduce((function(t,r){var n=Ae(r,4),s=e[n];if(s){var o=Ae(i,4);if(1===a){if(o===ye)return C.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;o*=ye+1,o+=Ae(i,8)}var u=o/(s.timescale||9e4);if(v(u)&&(null===t||u<t))return u}return t}),null);return null!==n&&v(n)&&(null===t||n<t)?n:t}),null)}(f,h),g=null===m?a:m;(function(e,t,r,i){if(null===e)return!0;var a=Math.max(i,1),n=t-e.baseTime/e.timescale;return Math.abs(n-r)>a}(u,g,a,p)||c.timescale!==u.timescale&&n)&&(c.initPTS=g-a,u&&1===u.timescale&&C.warn("Adjusting initPTS by "+(c.initPTS-u.baseTime)),this.initPTS=u={baseTime:c.initPTS,timescale:1});var y=e?g-u.baseTime/u.timescale:l,E=y+p;!function(e,t,r){_e(t,["moof","traf"]).forEach((function(t){_e(t,["tfhd"]).forEach((function(i){var a=Ae(i,4),n=e[a];if(n){var s=n.timescale||9e4;_e(t,["tfdt"]).forEach((function(e){var t=e[0],i=r*s;if(i){var a=Ae(e,4);if(0===t)a-=i,xe(e,4,a=Math.max(a,0));else{a*=Math.pow(2,32),a+=Ae(e,8),a-=i,a=Math.max(a,0);var n=Math.floor(a/(ye+1)),o=Math.floor(a%(ye+1));xe(e,4,n),xe(e,8,o)}}}))}}))}))}(f,h,u.baseTime/u.timescale),p>0?this.lastEndTime=E:(C.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var S=!!f.audio,b=!!f.video,T="";S&&(T+="audio"),b&&(T+="video");var A={data1:h,startPTS:y,startDTS:y,endPTS:E,endDTS:E,type:T,hasAudio:S,hasVideo:b,nb:1,dropped:0};return d.audio="audio"===A.type?A:void 0,d.video="audio"!==A.type?A:void 0,d.initSegment=c,d.id3=$t(r,a,u,u),i.samples.length&&(d.text=er(i,a,u)),d},e}();function ir(e,t){var r=null==e?void 0:e.codec;if(r&&r.length>4)return r;if(t===Q){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r)return U(r,!1);var i="mp4a.40.5";return C.info('Parsed audio codec "'+r+'" or audio object type not handled. Using "'+i+'"'),i}return C.warn('Unhandled video codec "'+r+'"'),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}var ar,nr="undefined"!=typeof self?self:void 0;try{ar=self.performance.now.bind(self.performance)}catch(e){C.debug("Unable to use Performance API on this environment"),ar=null==nr?void 0:nr.Date.now}var sr=[{demux:It,remux:rr},{demux:Ut,remux:Zt},{demux:kt,remux:Zt},{demux:jt,remux:Zt}],or=function(){function e(e,t,r,i,a){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=a}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,r,i,a){var n=this,s=r.transmuxing;s.executeStart=ar();var o=new Uint8Array(e),u=this.currentTransmuxState,l=this.transmuxConfig;i&&(this.currentTransmuxState=i);var d=i||u,h=d.contiguous,c=d.discontinuity,f=d.trackSwitch,v=d.accurateTimeOffset,p=d.timeOffset,m=d.initSegmentChange,g=l.audioCodec,y=l.videoCodec,T=l.defaultInitPts,A=l.duration,R=l.initSegmentData,L=function(e,t){var r=null;return e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(r=t),r}(o,t);if(L&&"AES-128"===L.method){var x=this.getDecrypter();if(!x.isSync())return this.decryptionPromise=x.webCryptoDecrypt(o,L.key.buffer,L.iv.buffer).then((function(e){var t=n.push(e,null,r);return n.decryptionPromise=null,t})),this.decryptionPromise;var _=x.softwareDecrypt(o,L.key.buffer,L.iv.buffer);if(r.part>-1&&(_=x.flush()),!_)return s.executeEnd=ar(),ur(r);o=new Uint8Array(_)}var w=this.needsProbing(c,f);if(w){var D=this.configureTransmuxer(o);if(D)return C.warn("[transmuxer] "+D.message),this.observer.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,fatal:!1,error:D,reason:D.message}),s.executeEnd=ar(),ur(r)}(c||f||m||w)&&this.resetInitSegment(R,g,y,A,t),(c||m||w)&&this.resetInitialTimestamp(T),h||this.resetContiguity();var k=this.transmux(o,L,p,v,r,a),I=this.currentTransmuxState;return I.contiguous=!0,I.discontinuity=!1,I.trackSwitch=!1,s.executeEnd=ar(),k},t.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=ar();var i=this.decrypter,a=this.currentTransmuxState,n=this.decryptionPromise;if(n)return n.then((function(){return t.flush(e)}));var s=[],o=a.timeOffset;if(i){var u=i.flush();u&&s.push(this.push(u,null,e))}var l=this.demuxer,d=this.remuxer;if(!l||!d)return r.executeEnd=ar(),[ur(e)];var h=l.flush(o);return lr(h)?h.then((function(r){return t.flushRemux(s,r,e),s})):(this.flushRemux(s,h,e),s)},t.flushRemux=function(e,t,r){var i=t.audioTrack,a=t.videoTrack,n=t.id3Track,s=t.textTrack,o=this.currentTransmuxState,u=o.accurateTimeOffset,l=o.timeOffset;C.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var d=this.remuxer.remux(i,a,n,s,l,u,!0,this.id);e.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=ar()},t.resetInitialTimestamp=function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,r,i,a){var n=this.demuxer,s=this.remuxer;n&&s&&(n.resetInitSegment(e,t,r,i),s.resetInitSegment(e,t,r,a))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,r,i,a,n){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,i,a):this.transmuxUnencrypted(e,r,i,a,n)},t.transmuxUnencrypted=function(e,t,r,i,a){var n=this.demuxer.demux(e,t,!1,!this.config.progressive,a),s=n.audioTrack,o=n.videoTrack,u=n.id3Track,l=n.textTrack;return{remuxResult:this.remuxer.remux(s,o,u,l,t,r,!1,this.id),chunkMeta:i}},t.transmuxSampleAes=function(e,t,r,i,a){var n=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:n.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,i,!1,n.id),chunkMeta:a}}))},t.configureTransmuxer=function(e){for(var t,r=this.config,i=this.observer,a=this.typeSupported,n=this.vendor,s=0,o=sr.length;s<o;s++){var u;if(null!=(u=sr[s].demux)&&u.probe(e)){t=sr[s];break}}if(!t)return new Error("Failed to find demuxer by probing fragment data");var l=this.demuxer,d=this.remuxer,h=t.remux,c=t.demux;d&&d instanceof h||(this.remuxer=new h(i,r,a,n)),l&&l instanceof c||(this.demuxer=new c(i,r,a),this.probe=c.probe)},t.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},t.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new $e(this.config)),e},e}(),ur=function(e){return{remuxResult:{},chunkMeta:e}};function lr(e){return"then"in e&&e.then instanceof Function}function dr(e,t){if(!((r=t.remuxResult).audio||r.video||r.text||r.id3||r.initSegment))return!1;var r,i=[],a=t.remuxResult,n=a.audio,s=a.video;return n&&hr(i,n),s&&hr(i,s),e.postMessage({event:"transmuxComplete",data:t},i),!0}function hr(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function cr(e,t,r){t.reduce((function(t,r){return dr(e,r)||t}),!1)||e.postMessage({event:"transmuxComplete",data:t[0]}),e.postMessage({event:"flush",data:r})}void 0!==t&&t&&function(e){var t=new f,r=function(t,r){e.postMessage({event:t,data:r})};t.on(E.FRAG_DECRYPTED,r),t.on(E.ERROR,r);var i=function(){var e=function(e){var t=function(t){r("workerLog",{logType:e,message:t})};C[e]=t};for(var t in C)e(t)};e.addEventListener("message",(function(a){var n=a.data;switch(n.cmd){case"init":var s=JSON.parse(n.config);e.transmuxer=new or(t,n.typeSupported,s,n.vendor,n.id),function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){k(e,"debug","log","info","warn","error");try{D.log('Debug logs enabled for "'+t+'" in hls.js version '+void 0)}catch(e){D=w}}else D=w}(s.debug,n.id),i(),r("init",null);break;case"configure":e.transmuxer.configure(n.config);break;case"demux":var o=e.transmuxer.push(n.data,n.decryptdata,n.chunkMeta,n.state,n.baseurl);lr(o)?(e.transmuxer.async=!0,o.then((function(t){dr(e,t)})).catch((function(e){r(E.ERROR,{type:S.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,chunkMeta:n.chunkMeta,fatal:!1,error:e,err:e,reason:"transmuxer-worker push error"})}))):(e.transmuxer.async=!1,dr(e,o));break;case"flush":var u=n.chunkMeta,l=e.transmuxer.flush(u);lr(l)||e.transmuxer.async?(lr(l)||(l=Promise.resolve(l)),l.then((function(t){cr(e,t,u)})).catch((function(e){r(E.ERROR,{type:S.MEDIA_ERROR,details:b.FRAG_PARSING_ERROR,chunkMeta:n.chunkMeta,fatal:!1,error:e,err:e,reason:"transmuxer-worker flush error"})}))):cr(e,l,u)}}))}(self);var fr=function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t,r){var i=this.queues[t];i.push(e),1!==i.length||r||this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,r=new Promise((function(e){t=e})),i={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(i,e),r},t.executeNext=function(e){var t=this.queues[e];if(t.length){var r=t[0];try{r.execute()}catch(t){C.warn('[buffer-operation-queue]: Exception executing "'+e+'" SourceBuffer operation: '+t),r.onError(t);var i=this.buffers[e];null!=i&&i.updating||this.shiftAndExecuteNext(e)}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e}(),vr=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,pr=function(){function e(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=function(e){t.hls&&t.hls.pauseBuffering()},this._onStartStreaming=function(e){t.hls&&t.hls.resumeBuffering()},this._onMediaSourceOpen=function(){var e=t.media,r=t.mediaSource;t.log("Media source opened"),e&&(e.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(E.MEDIA_ATTACHED,{media:e,mediaSource:r})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){t.log("Media source closed")},this._onMediaSourceEnded=function(){t.log("Media source ended")},this._onMediaEmptied=function(){var e=t.mediaSrc,r=t._objectUrl;e!==r&&C.error("Media element src was set while attaching MediaSource ("+r+" > "+e+")")},this.hls=e;var r,i="[buffer-controller]";this.appendSource=(r=I(e.config.preferManagedMediaSource),"undefined"!=typeof self&&r===self.ManagedMediaSource),this.log=C.log.bind(C,i),this.warn=C.warn.bind(C,i),this.error=C.error.bind(C,i),this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null},t.registerListeners=function(){var e=this.hls;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new fr(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null},t.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},t.onManifestParsed=function(e,t){var r=2;t.audio&&!t.video||t.altAudio,r=1,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var r=this.media=t.media,i=I(this.appendSource);if(r&&i){var a,n=this.mediaSource=new i;this.log("created media source: "+(null==(a=n.constructor)?void 0:a.name)),n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming));var s=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{r.removeAttribute("src");var o=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||o&&n instanceof o,mr(r),function(e,t){var r=self.document.createElement("source");r.type="video/mp4",r.src=t,e.appendChild(r)}(r,s),r.load()}catch(e){r.src=s}else r.src=s;r.addEventListener("emptied",this._onMediaEmptied)}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,r=this._objectUrl;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn("onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(e.removeAttribute("src"),this.appendSource&&mr(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach((function(t){e.resetBuffer(t)})),this._initSourceBuffer()},t.resetBuffer=function(e){var t=this.sourceBuffer[e];try{var r;t&&(this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t))}catch(t){this.warn("onBufferReset "+e,t)}},t.onBufferCodecs=function(e,t){var r=this,i=this.getSourceBufferTypes().length,a=Object.keys(t);if(a.forEach((function(e){if(i){var a=r.tracks[e];if(a&&"function"==typeof a.buffer.changeType){var n,s=t[e],o=s.id,u=s.codec,l=s.levelCodec,d=s.container,h=s.metadata,c=N(a.codec,a.levelCodec),f=null==c?void 0:c.replace(vr,"$1"),v=N(u,l),p=null==(n=v)?void 0:n.replace(vr,"$1");if(v&&f!==p){"audio"===e.slice(0,5)&&(v=U(v,r.appendSource));var m=d+";codecs="+v;r.appendChangeType(e,m),r.log("switching codec "+c+" to "+v),r.tracks[e]={buffer:a.buffer,codec:u,container:d,levelCodec:l,metadata:h,id:o}}}}else r.pendingTracks[e]=t[e]})),!i){var n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(n+" bufferCodec event(s) expected "+a.join(",")),this.bufferCodecEventsExpected=n),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}},t.appendChangeType=function(e,t){var r=this,i=this.operationQueue,a={execute:function(){var a=r.sourceBuffer[e];a&&(r.log("changing "+e+" sourceBuffer type to "+t),a.changeType(t)),i.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){r.warn("Failed to change "+e+" SourceBuffer type",t)}};i.append(a,e,!!this.pendingTracks[e])},t.onBufferAppending=function(e,t){var r=this,i=this.hls,a=this.operationQueue,n=this.tracks,s=t.data,o=t.type,u=t.frag,l=t.part,d=t.chunkMeta,h=d.buffering[o],c=self.performance.now();h.start=c;var f=u.stats.buffering,v=l?l.stats.buffering:null;0===f.start&&(f.start=c),v&&0===v.start&&(v.start=c);var p=n.audio,m=!1;"audio"===o&&"audio/mpeg"===(null==p?void 0:p.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);var g=u.start,y={execute:function(){if(h.executeStart=self.performance.now(),m){var e=r.sourceBuffer[o];if(e){var t=g-e.timestampOffset;Math.abs(t)>=.1&&(r.log("Updating audio SourceBuffer timestampOffset to "+g+" (delta: "+t+") sn: "+u.sn+")"),e.timestampOffset=g)}}r.appendExecutor(s,o)},onStart:function(){},onComplete:function(){var e=self.performance.now();h.executeEnd=h.end=e,0===f.first&&(f.first=e),v&&0===v.first&&(v.first=e);var t=r.sourceBuffer,i={};for(var a in t)i[a]=q.getBuffered(t[a]);r.appendErrors[o]=0,"audio"===o||"video"===o?r.appendErrors.audiovideo=0:(r.appendErrors.audio=0,r.appendErrors.video=0),r.hls.trigger(E.BUFFER_APPENDED,{type:o,frag:u,part:l,chunkMeta:d,parent:u.type,timeRanges:i})},onError:function(e){var t={type:S.MEDIA_ERROR,parent:u.type,details:b.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:u,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=b.BUFFER_FULL_ERROR;else{var a=++r.appendErrors[o];t.details=b.BUFFER_APPEND_ERROR,r.warn("Failed "+a+"/"+i.config.appendErrorMaxRetry+' times to append segment in "'+o+'" sourceBuffer'),a>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(E.ERROR,t)}};a.append(y,o,!!this.pendingTracks[o])},t.onBufferFlushing=function(e,t){var r=this,i=this.operationQueue,a=function(e){return{execute:r.removeExecutor.bind(r,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(E.BUFFER_FLUSHED,{type:e})},onError:function(t){r.warn("Failed to remove from "+e+" SourceBuffer",t)}}};t.type?i.append(a(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){i.append(a(e),e)}))},t.onFragParsed=function(e,t){var r=this,i=t.frag,a=t.part,n=[],s=a?a.elementaryStreams:i.elementaryStreams;s[J]?n.push("audiovideo"):(s[Q]&&n.push("audio"),s[Z]&&n.push("video")),0===n.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+i.type+" level: "+i.level+" sn: "+i.sn),this.blockBuffers((function(){var e=self.performance.now();i.stats.buffering.end=e,a&&(a.stats.buffering.end=e);var t=a?a.stats:i.stats;r.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:a,stats:t,id:i.type})}),n)},t.onFragChanged=function(e,t){this.trimBuffers()},t.onBufferEos=function(e,t){var r=this;this.getSourceBufferTypes().reduce((function(e,i){var a=r.sourceBuffer[i];return!a||t.type&&t.type!==i||(a.ending=!0,a.ended||(a.ended=!0,r.log(i+" sourceBuffer now EOS"))),e&&!(a&&!a.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((function(){r.getSourceBufferTypes().forEach((function(e){var t=r.sourceBuffer[e];t&&(t.ending=!1)}));var e=r.mediaSource;e&&"open"===e.readyState?(r.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&r.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)})))},t.onLevelUpdated=function(e,t){var r=t.details;r.fragments.length&&(this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.trimBuffers=function(){var e=this.hls,t=this.details,r=this.media;if(r&&null!==t&&this.getSourceBufferTypes().length){var i=e.config,a=r.currentTime,n=t.levelTargetDuration,s=t.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(v(s)&&s>0){var o=Math.max(s,n),u=Math.floor(a/n)*n-o;this.flushBackBuffer(a,n,u)}if(v(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){var l=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),d=Math.max(l,n),h=Math.floor(a/n)*n+d;this.flushFrontBuffer(a,n,h)}}},t.flushBackBuffer=function(e,t,r){var i=this,a=this.details,n=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(s){var o=n[s];if(o){var u=q.getBuffered(o);if(u.length>0&&r>u.start(0)){if(i.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:r}),null!=a&&a.live)i.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(o.ended&&u.end(u.length-1)-e<2*t)return void i.log("Cannot flush "+s+" back buffer while SourceBuffer is in ended state");i.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}}))},t.flushFrontBuffer=function(e,t,r){var i=this,a=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(n){var s=a[n];if(s){var o=q.getBuffered(s),u=o.length;if(u<2)return;var l=o.start(u-1),d=o.end(u-1);if(r>l||e>=l&&e<=d)return;if(s.ended&&e-d<2*t)return void i.log("Cannot flush "+n+" front buffer while SourceBuffer is in ended state");i.hls.trigger(E.BUFFER_FLUSHING,{startOffset:l,endOffset:1/0,type:n})}}))},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,r=this.media,i=this.mediaSource,a=e.fragments[0].start+e.totalduration,n=r.duration,s=v(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(a>s&&a>n||!v(n))&&(this.log("Updating Media Source duration to "+a.toFixed(3)),i.duration=a)}},t.updateSeekableRange=function(e){var t=this.mediaSource,r=e.fragments;if(r.length&&e.live&&null!=t&&t.setLiveSeekableRange){var i=Math.max(0,r[0].start),a=Math.max(i,i+e.totalduration);this.log("Media Source duration is set to "+t.duration+". Setting seekable range to "+i+"-"+a+"."),t.setLiveSeekableRange(i,a)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,r=this.pendingTracks,i=Object.keys(r).length;if(i&&(!e||2===i||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};var a=this.getSourceBufferTypes();if(a.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),a.forEach((function(e){t.executeNext(e)}));else{var n=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:b.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:n,reason:n.message})}}},t.createSourceBuffers=function(e){var t=this,r=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var a=function(a){if(!r[a]){var n,s=e[a];if(!s)throw Error("source buffer exists for track "+a+", however track does not");var o=-1===(null==(n=s.levelCodec)?void 0:n.indexOf(","))?s.levelCodec:s.codec;o&&"audio"===a.slice(0,5)&&(o=U(o,t.appendSource));var u=s.container+";codecs="+o;t.log("creating sourceBuffer("+u+")");try{var l=r[a]=i.addSourceBuffer(u),d=a;t.addBufferListener(d,"updatestart",t._onSBUpdateStart),t.addBufferListener(d,"updateend",t._onSBUpdateEnd),t.addBufferListener(d,"error",t._onSBUpdateError),t.appendSource&&t.addBufferListener(d,"bufferedchange",(function(e,r){var i=r.removedRanges;null!=i&&i.length&&t.hls.trigger(E.BUFFER_FLUSHED,{type:a})})),t.tracks[a]={buffer:l,codec:o,container:s.container,levelCodec:s.levelCodec,metadata:s.metadata,id:s.id}}catch(e){t.error("error while trying to add sourceBuffer: "+e.message),t.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:b.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:a,mimeType:u})}}};for(var n in e)a(n)},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var r=this.operationQueue;r.current(e).onComplete(),r.shiftAndExecuteNext(e)}else this.resetBuffer(e)},t._onSBUpdateError=function(e,t){var r,i=new Error(e+" SourceBuffer error. MediaSource readyState: "+(null==(r=this.mediaSource)?void 0:r.readyState));this.error(""+i,t),this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:b.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});var a=this.operationQueue.current(e);a&&a.onError(i)},t.removeExecutor=function(e,t,r){var i=this.media,a=this.mediaSource,n=this.operationQueue,s=this.sourceBuffer[e];if(!i||!a||!s)return this.warn("Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(e);var o=v(i.duration)?i.duration:1/0,u=v(a.duration)?a.duration:1/0,l=Math.max(0,t),d=Math.min(r,o,u);d>l&&(!s.ending||s.ended)?(s.ended=!1,this.log("Removing ["+l+","+d+"] from the "+e+" SourceBuffer"),s.remove(l,d)):n.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var r=this.sourceBuffer[t];if(r)r.ended=!1,r.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error("Attempting to append to the "+t+" SourceBuffer, but it does not exist")},t.blockBuffers=function(e,t){var r=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var i=this.operationQueue,a=t.map((function(e){return i.appendBlocker(e)}));Promise.all(a).then((function(){e(),t.forEach((function(e){var t=r.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,r){var i=this.sourceBuffer[e];if(i){var a=r.bind(this,e);this.listeners[e].push({event:t,listener:a}),i.addEventListener(t,a)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))},o(e,[{key:"mediaSrc",get:function(){var e,t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}}]),e}();function mr(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach((function(t){e.removeChild(t)}))}var gr=function(){if(null!=nr&&nr.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var r=t.toLowerCase();return!!~e.indexOf(r)&&r}function i(e){return r(t,e)}function a(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var s in n)e[s]=n[s]}return e}function n(t,n,s){var o=this,u={enumerable:!0};o.hasBeenReset=!1;var l="",d=!1,h=t,c=n,f=s,v=null,p="",m=!0,g="auto",y="start",E=50,S="middle",b=50,T="middle";Object.defineProperty(o,"id",a({},u,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(o,"pauseOnExit",a({},u,{get:function(){return d},set:function(e){d=!!e}})),Object.defineProperty(o,"startTime",a({},u,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",a({},u,{get:function(){return c},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",a({},u,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",a({},u,{get:function(){return v},set:function(e){v=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",a({},u,{get:function(){return p},set:function(t){var i=function(t){return r(e,t)}(t);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");p=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",a({},u,{get:function(){return m},set:function(e){m=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",a({},u,{get:function(){return g},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",a({},u,{get:function(){return y},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",a({},u,{get:function(){return E},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",a({},u,{get:function(){return S},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",a({},u,{get:function(){return b},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",a({},u,{get:function(){return T},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");T=t,this.hasBeenReset=!0}})),o.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();new gr(0,0,"").align;var yr=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()};function Er(e,t,r){return yr(e.toString())+yr(t.toString())+yr(r)}var Sr,br,Tr,Ar,Rr,Lr=function(){function e(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.destroy=function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},t.registerListeners=function(){var e=this.hls;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListener=function(){var e=this.hls;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)},t.onFpsDropLevelCapping=function(e,t){var r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})},t.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()},t.onManifestParsed=function(e,t){var r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()},t.onLevelsUpdated=function(e,t){this.timer&&v(this.autoLevelCapping)&&this.detectPlayerSize()},t.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},t.onMediaDetaching=function(){this.stopCapping()},t.detectPlayerSize=function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);var e=this.hls.levels;if(e.length){var t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&C.log("Setting autoLevelCapping to "+r+": "+e[r].height+"p@"+e[r].bitrate+" for media "+this.mediaWidth+"x"+this.mediaHeight),t.autoLevelCapping=r,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},t.getMaxLevel=function(t){var r=this,i=this.hls.levels;if(!i.length)return-1;var a=i.filter((function(e,i){return r.isLevelAllowed(e)&&i<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t},t.isLevelAllowed=function(e){return!this.restrictedLevels.some((function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height}))},e.getMaxLevelByMediaSize=function(e,t,r){if(null==e||!e.length)return-1;for(var i,a,n=e.length-1,s=Math.max(t,r),o=0;o<e.length;o+=1){var u=e[o];if((u.width>=s||u.height>=s)&&(i=u,!(a=e[o+1])||i.width!==a.width||i.height!==a.height)){n=o;break}}return n},o(e,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}}]),e}(),xr=function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var r=this.hls.config;if(r.capLevelOnFPSDrop){var i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,r){var i=performance.now();if(t){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*n/a,u=this.hls;if(u.trigger(E.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:r}),o>0&&n>u.config.fpsDroppedMonitoringThreshold*s){var l=u.currentLevel;C.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(-1===u.autoLevelCapping||u.autoLevelCapping>=l)&&(l-=1,u.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:u.currentLevel}),u.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e}();null!=nr&&null!=(Sr=nr.navigator)&&Sr.requestMediaKeySystemAccess&&self.navigator.requestMediaKeySystemAccess.bind(self.navigator),function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(br||(br={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(Tr||(Tr={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(Ar||(Ar={})),(Rr={})[Ar.OBJECT]=["br","d","ot","tb"],Rr[Ar.REQUEST]=["bl","dl","mtp","nor","nrr","su"],Rr[Ar.SESSION]=["cid","pr","sf","sid","st","v"],Rr[Ar.STATUS]=["bs","rtp"];var _r=function(){function e(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=C.log.bind(C,"[content-steering]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))},t.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}},t.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},t.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},t.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},t.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter((function(t){return t!==e})))},t.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},t.onManifestLoaded=function(e,t){var r=t.contentSteering;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())},t.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},t.onError=function(e,t){var r=t.errorAction;if((null==r?void 0:r.action)===tt&&r.flags===at){var i=this.levels,a=this.pathwayPriority,n=this.pathwayId;if(t.context){var s=t.context,o=s.groupId,u=s.pathwayId,l=s.type;o&&i?n=this.getPathwayForGroupId(o,l,n):u&&(n=u)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!a&&i&&(a=i.reduce((function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e}),[])),a&&a.length>1&&(this.updatePathwayPriority(a),r.resolved=this.pathwayId!==n),r.resolved||C.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+n+" levels: "+(i?i.length:i)+" priorities: "+JSON.stringify(a)+" penalized: "+JSON.stringify(this.penalizedPathways))}},t.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){var r=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+r+'"'),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},t.getLevelsForPathway=function(e){return null===this.levels?[]:this.levels.filter((function(t){return e===t.pathwayId}))},t.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach((function(e){i-r[e]>3e5&&delete r[e]}));for(var a=0;a<e.length;a++){var n=e[a];if(!(n in r)){if(n===this.pathwayId)return;var s=this.hls.nextLoadLevel,o=this.hls.levels[s];if((t=this.getLevelsForPathway(n)).length>0){this.log('Setting Pathway to "'+n+'"'),this.pathwayId=n,je(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});var u=this.hls.levels[s];o&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==o.bitrate&&this.log("Unstable Pathways change from bitrate "+o.bitrate+" to "+u.bitrate),this.hls.nextLoadLevel=s);break}}}},t.getPathwayForGroupId=function(e,t,r){for(var i=this.getLevelsForPathway(r).concat(this.levels||[]),a=0;a<i.length;a++)if(t===T&&i[a].hasAudioGroup(e)||t===A&&i[a].hasSubtitleGroup(e))return i[a].pathwayId;return r},t.clonePathways=function(e){var t=this,r=this.levels;if(r){var i={},a={};e.forEach((function(e){var n=e.ID,s=e["BASE-ID"],o=e["URI-REPLACEMENT"];if(!r.some((function(e){return e.pathwayId===n}))){var u=t.getLevelsForPathway(s).map((function(e){var t=new Ke(e.attrs);t["PATHWAY-ID"]=n;var r=t.AUDIO&&t.AUDIO+"_clone_"+n,s=t.SUBTITLES&&t.SUBTITLES+"_clone_"+n;r&&(i[t.AUDIO]=r,t.AUDIO=r),s&&(a[t.SUBTITLES]=s,t.SUBTITLES=s);var u=Dr(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),l=new H({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:u,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(var d=1;d<e.audioGroups.length;d++)l.addGroupId("audio",e.audioGroups[d]+"_clone_"+n);if(e.subtitleGroups)for(var h=1;h<e.subtitleGroups.length;h++)l.addGroupId("text",e.subtitleGroups[h]+"_clone_"+n);return l}));r.push.apply(r,u),wr(t.audioTracks,i,o,n),wr(t.subtitleTracks,a,o,n)}}))}},t.loadSteeringManifest=function(e){var t,r=this,i=this.hls.config,a=i.loader;this.loader&&this.loader.destroy(),this.loader=new a(i);try{t=new self.URL(e)}catch(t){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+e)}if("data:"!==t.protocol){var n=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);t.searchParams.set("_HLS_pathway",this.pathwayId),t.searchParams.set("_HLS_throughput",""+n)}var s={responseType:"json",url:t.href},o=i.steeringManifestLoadPolicy.default,u=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:u.maxNumRetry||0,retryDelay:u.retryDelayMs||0,maxRetryDelay:u.maxRetryDelayMs||0},d={onSuccess:function(e,i,a,n){r.log('Loaded steering manifest: "'+t+'"');var s=e.data;if(1===s.VERSION){r.updated=performance.now(),r.timeToLoad=s.TTL;var o=s["RELOAD-URI"],u=s["PATHWAY-CLONES"],l=s["PATHWAY-PRIORITY"];if(o)try{r.uri=new self.URL(o,t).href}catch(e){return r.enabled=!1,void r.log("Failed to parse Steering Manifest RELOAD-URI: "+o)}r.scheduleRefresh(r.uri||a.url),u&&r.clonePathways(u);var d={steeringManifest:s,url:t.toString()};r.hls.trigger(E.STEERING_MANIFEST_LOADED,d),l&&r.updatePathwayPriority(l)}else r.log("Steering VERSION "+s.VERSION+" not supported!")},onError:function(e,t,i,a){if(r.log("Error loading steering manifest: "+e.code+" "+e.text+" ("+t.url+")"),r.stopLoad(),410===e.code)return r.enabled=!1,void r.log("Steering manifest "+t.url+" no longer available");var n=1e3*r.timeToLoad;if(429!==e.code)r.scheduleRefresh(r.uri||t.url,n);else{var s=r.loader;if("function"==typeof(null==s?void 0:s.getResponseHeader)){var o=s.getResponseHeader("Retry-After");o&&(n=1e3*parseFloat(o))}r.log("Steering manifest "+t.url+" rate limited")}},onTimeout:function(e,t,i){r.log("Timeout loading steering manifest ("+t.url+")"),r.scheduleRefresh(r.uri||t.url)}};this.log("Requesting steering manifest: "+t),this.loader.load(s,l,d)},t.scheduleRefresh=function(e,t){var r=this;void 0===t&&(t=1e3*this.timeToLoad),this.clearTimeout(),this.reloadTimer=self.setTimeout((function(){var t,i=null==(t=r.hls)?void 0:t.media;!i||i.ended?r.scheduleRefresh(e,1e3*r.timeToLoad):r.loadSteeringManifest(e)}),t)},e}();function wr(e,t,r,i){e&&Object.keys(t).forEach((function(a){var n=e.filter((function(e){return e.groupId===a})).map((function(e){var n=u({},e);return n.details=void 0,n.attrs=new Ke(n.attrs),n.url=n.attrs.URI=Dr(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),n.groupId=n.attrs["GROUP-ID"]=t[a],n.attrs["PATHWAY-ID"]=i,n}));e.push.apply(e,n)}))}function Dr(e,t,r,i){var a,n=i.HOST,s=i.PARAMS,o=i[r];t&&(a=null==o?void 0:o[t])&&(e=a);var u=new self.URL(e);return n&&!a&&(u.host=n),s&&Object.keys(s).sort().forEach((function(e){e&&u.searchParams.set(e,s[e])})),u.href}var kr,Cr=/^age:\s*[\d.]+\s*$/im,Ir=/\s/,Pr=a(a({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,maxSyncLiveEdgeTolerance:.3,reduceServerBlockTime:170,loader:function(){function e(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new X,this.retryDelay=0}var t=e.prototype;return t.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null},t.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},t.load=function(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()},t.loadInternal=function(){var e=this,t=this.config,r=this.context;if(t&&r){var i=this.loader=new self.XMLHttpRequest,a=this.stats;a.loading.first=0,a.loaded=0,a.aborted=!1;var n=this.xhrSetup;n?Promise.resolve().then((function(){if(!e.stats.aborted)return n(i,r.url)})).catch((function(e){return i.open("GET",r.url,!0),n(i,r.url)})).then((function(){e.stats.aborted||e.openAndSendXhr(i,r,t)})).catch((function(t){e.callbacks.onError({code:i.status,text:t.message},r,i,a)})):this.openAndSendXhr(i,r,t)}},t.openAndSendXhr=function(e,t,r){e.readyState||e.open("GET",t.url,!0);var i=t.headers,a=r.loadPolicy,n=a.maxTimeToFirstByteMs,s=a.maxLoadTimeMs;if(i)for(var o in i)e.setRequestHeader(o,i[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=n&&v(n)?n:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()},t.readystatechange=function(){var e=this.context,t=this.loader,r=this.stats;if(e&&t){var i=t.readyState,a=this.config;if(!r.aborted&&i>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var n=t.status,s="text"!==t.responseType;if(n>=200&&n<300&&(s&&t.response||null!==t.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);var o=s?t.response:t.responseText,u="arraybuffer"===t.responseType?o.byteLength:o.length;if(r.loaded=r.total=u,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first),!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(r,e,o,t),!this.callbacks)return;var d={url:t.responseURL,data:o,code:n};this.callbacks.onSuccess(d,r,e,t)}else{var h=a.loadPolicy.errorRetry;Xe(h,r.retry,!1,{url:e.url,data:void 0,code:n})?this.retry(h):(C.error(n+" while loading "+e.url),this.callbacks.onError({code:n,text:t.statusText},e,t,r))}}}},t.loadtimeout=function(){var e,t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(Xe(t,this.stats.retry,!0))this.retry(t);else{var r;C.warn("timeout while loading "+(null==(r=this.context)?void 0:r.url));var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},t.retry=function(e){var t=this.context,r=this.stats;this.retryDelay=function(e,t){var r="linear"===e.backoff?1:Math.pow(2,t);return Math.min(r*e.retryDelayMs,e.maxRetryDelayMs)}(e,r.retry),r.retry++,C.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==t?void 0:t.url)+", retrying "+r.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&Cr.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},e}(),fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W,bufferController:pr,capLevelController:Lr,errorController:st,fpsController:xr,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:null,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!1,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(e,t,r,i){for(var a,n,s,o,u,l=[],d=self.VTTCue||self.TextTrackCue,h=0;h<i.rows.length;h++)if(s=!0,o=0,u="",!(a=i.rows[h]).isEmpty()){for(var c,f=0;f<a.chars.length;f++)Ir.test(a.chars[f].uchar)&&s?o++:(u+=a.chars[f].uchar,s=!1);a.cueStartTime=t,t===r&&(r+=1e-4),o>=16?o--:o++;var v=u.trim().replace(/<br(?: \/)?>/gi,"\n"),p=Er(t,r,v);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||((n=new d(t,r,v)).id=p,n.line=h+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*o/32)),l.push(n))}return e&&l.length&&(l.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),l.forEach((function(t){return function(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(r){C.debug("[texttrack-utils]: "+r);try{var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){C.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+e)}}"disabled"===r&&(e.mode=r)}(e,t)}))),l}},enableWebVTT:!1,enableIMSC1:!1,enableCEA708Captions:!1,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,audioStreamController:void 0,audioTrackController:void 0,emeController:void 0,cmcdController:void 0,contentSteeringController:_r}),Mr=function(){function e(e){this.observer=new f,this.demuxer=void 0,this.configureDemuxer(e)}var t=e.prototype;return t.demux=function(e,t){if(this.demuxer)return this.resetInitSegment(),this.demuxer.demux(e,0,!1,!0,t);console.error("no available demuxer")},t.on=function(e,t,r){void 0===r&&(r=this),this.observer.on(e,t,r)},t.once=function(e,t,r){void 0===r&&(r=this),this.observer.once(e,t,r)},t.removeAllListeners=function(e){this.observer.removeAllListeners(e)},t.flush=function(){this.demuxer&&this.demuxer.flush()},t.configureDemuxer=function(e){this.demuxer=new Ut(this.observer,a(a({},Pr),e),{mpeg:!1,mp3:!1,ac3:!1})},t.resetInitSegment=function(){this.demuxer?this.demuxer.resetInitSegment(void 0,"","",0):console.error("no available demuxer")},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0)},e}();void 0!==t&&t&&function(e){e.addEventListener("message",(function(t){var r,i,a=t.data;switch(a.name){case"setup":r=a.payload.key,i=a.payload.debug,(kr=new Mr({_vpk:r,debug:i,enableWorker:!0})).on(E.ERROR,(function(t,r){e.postMessage({name:"error",payload:r})}));break;case"demux":var n=function(e,t,r){if(kr){performance.now();var i=kr.demux(new Uint8Array(e),r);return i.id=t,i}}(a.payload.buffer,a.payload.url,a.payload.playlistUrl);e.postMessage({name:"result",payload:{demuxResult:n}});break;case"flush":kr&&kr.flush();break;case"dispose":kr&&(kr.destroy(),kr=null),e.postMessage({name:"disposed"})}}))}(self),r.injectWorker=function(){var t=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+e.toString()+")(true);"],{type:"text/javascript"}),r=self.URL.createObjectURL(t);return{worker:new self.Worker(r),objectURL:r}}},"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((r="undefined"!=typeof globalThis?globalThis:r||self).AliDemuxerWorker={})}(!1);
|
|
2
|
+
//# sourceMappingURL=aliplayer-hls2.demuxer.min.js.map
|