From 87f6e90d341b8d031e83f04c37b4094cf220b597 Mon Sep 17 00:00:00 2001 From: Jose Hassan Date: Thu, 18 Jan 2024 13:27:12 -0300 Subject: [PATCH] v1.1.5 --- crunchyroll.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crunchyroll.min.js b/crunchyroll.min.js index 50de9f7..58a0379 100644 --- a/crunchyroll.min.js +++ b/crunchyroll.min.js @@ -1,4 +1,4 @@ -!function Va(Wa){var e=this,t=function(){"use strict";function A(t,e){var i,n=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)),n}function p(n){for(var e=1;ee.length)&&(t=e.length);for(var i=0,n=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function N(e){e=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"==typeof e?e:String(e)}var M,F,B,U,G,j={},$=(M=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,F=/^(?=([^\/?#]*))\1([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,G={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=G.parseURL(e);if(n)return n.path=G.normalizePath(n.path),G.buildURLFromParts(n);throw new Error("Error trying to parse base URL.")}n=G.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return i.alwaysNormalize?(n.path=G.normalizePath(n.path),G.buildURLFromParts(n)):t;t=G.parseURL(e);if(!t)throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=F.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var r,e={scheme:t.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};return n.netLoc||(e.netLoc=t.netLoc,"/"===n.path[0])||(n.path?(r=(r=t.path).substring(0,r.lastIndexOf("/")+1)+n.path,e.path=G.normalizePath(r)):(e.path=t.path,n.params||(e.params=t.params,n.query)||(e.query=t.query))),null===e.path&&(e.path=i.alwaysNormalize?G.normalizePath(n.path):n.path),G.buildURLFromParts(e)},parseURL:function(e){e=M.exec(e);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(B,"");e.length!==(e=e.replace(U,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},{get exports(){return j},set exports(e){j=e}}.exports=G,Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)}),Z=((t={}).MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t),ee=((t={}).NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t),te=((t={}).KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown",t),q=function(){},Y={trace:q,debug:q,log:q,warn:q,info:q,error:q},V=Y;function W(e,t){if(self.console&&!0===e||"object"==typeof e){!function(i){for(var e=arguments.length,t=new Array(1"):q)})}(e,"debug","log","info","warn","error");try{V.log('Debug logs enabled for "'+t+'" in hls.js version 1.4.0')}catch(e){V=Y}}else V=Y}var ie=V,z=/^(\d+)x(\d+)$/,X=/(.+?)=(".*?"|.*?)(?:,|$)/g,K=((t=Q.prototype).decimalInteger=function(e){e=parseInt(this[e],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},t.hexadecimalInteger=function(e){if(this[e]){for(var t=(1&(t=(this[e]||"0x").slice(2)).length?"0":"")+t,i=new Uint8Array(t.length/2),n=0;nNumber.MAX_SAFE_INTEGER?1/0:e},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){e=this[e];return e?parseFloat(e):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){e=z.exec(this[e]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},Q.parseAttrList=function(e){var t,i={};for(X.lastIndex=0;null!==(t=X.exec(e));){var n=t[2];0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),i[t[1].trim()]=n}return i},Q);function Q(e){for(var t in e="string"==typeof e?Q.parseAttrList(e):e)e.hasOwnProperty(t)&&("X-"===t.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(t)),this[t]=e[t])}r(ve,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){var e;return this._endDate||(null!==(e=this.duration)?new Date(this._startDate.getTime()+1e3*e):null)}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if($(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&$(this.startDate.getTime())&&(null===this.duration||0<=this.duration)&&(!this.endOnNext||!!this.class)}}]);var re,se,ae=ve,oe=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}},E="audio",le="video",de="audiovideo",t=(me.prototype.setByteRange=function(e,t){var e=e.split("@",2),i=[];1===e.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(e[1]),i[1]=parseInt(e[0])+i[0],this._byteRange=i},r(me,[{key:"byteRange",get:function(){return this._byteRange||[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=j.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]),me),ue=(e(ge,se=t),(i=ge.prototype).setKeyFormat=function(e){this.levelkeys&&(e=this.levelkeys[e])&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))},i.abortRequests=function(){var e;null!=(e=this.loader)&&e.abort(),null!=(e=this.keyLoader)&&e.abort()},i.setElementaryStreamInfo=function(e,t,i,n,r,s){void 0===s&&(s=!1);var a=this.elementaryStreams,o=a[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,r)):a[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:r,partial:s}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[E]=null,e[le]=null,e[de]=null},r(ge,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){var e;return null!==this.programDateTime&&$(this.programDateTime)?(e=$(this.duration)?this.duration:0,this.programDateTime+1e3*e):null}},{key:"encrypted",get:function(){if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var e=Object.keys(this.levelkeys),t=e.length;if(1e.endSN||0>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(r);break;case 12:case 13:s=e[d++],l+=String.fromCharCode((31&r)<<6|63&s);break;case 14:s=e[d++],a=e[d++],l+=String.fromCharCode((15&r)<<12|(63&s)<<6|(63&a)<<0)}}return l};function Ke(e){for(var t="",i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function C(e,t){var i=[];if(t.length)for(var n=e.byteLength,r=0;r>1&63)||40==e;return 6==(31&t)}(A,S[f+=4])||Je(S.subarray(f,f+m),A?2:1,E+u/w,k),f+=m,g+=m+4}E+=s/w}}))})})}),k}function Je(e,t,i,n){var r=Ze(e),s=0;s+=t;for(var a=0,o=0,l=!1,d=0;s=r.length)&&(a+=d=r[s++],255===d););for(o=0;!(s>=r.length)&&(o+=d=r[s++],255===d););var u=r.length-s;if(!l&&4===a&&s>8*(15-i)&255;return t}(e),new nt(this.method,this.uri,"identity",this.keyFormatVersions,e);e=(e=this.uri).split(":"),t=null,"data"===e[0]&&2===e.length&&2===(n=(e=e[1].split(";"))[e.length-1].split(",")).length&&(i="base64"===n[0],n=n[1],t=i?(e.splice(-1,1),ye(n)):(i=Te(n).subarray(0,16),(e=new Uint8Array(16)).set(i,16-i.length),e));var t,i,n,r=t;if(r)switch(this.keyFormat){case Se:22<=(this.pssh=r).length&&(this.keyId=r.subarray(r.length-22,r.length-6));break;case ke:var s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),s=(this.pssh=function(e,t,i){if(16!==e.byteLength)throw new RangeError("Invalid system id");var n;if(t)for(var r=1,s=new Uint8Array(16*t.length),a=0;a>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(e,4),a=0,s=8;ae[i].endTime)return-1;for(var n=0,r=i;n<=r;){var s=Math.floor((r+n)/2);if(te[s].startTime&&n=t&&o.endTime<=i)n.push(o);else if(o.startTime>i)return n}return n}(e.cues,t,i),a=0;an.startDate&&e.push(i),e},[]).sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()})[0])&&(a=$t(o.startDate,y),r=!0);for(var l,d=Object.keys(n.attr),u=0;ue.sn?(i=n-e.start,e):(i=e.start-n,t)).duration!==i&&(n.duration=i)):t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function Qt(e,t,i,n,r,s){n-i<=0&&(ie.warn("Fragment should have a positive duration",t),n=i+t.duration,s=r+t.duration);var a=i,o=n,l=t.startPTS,d=t.endPTS,u=($(l)&&(u=Math.abs(l-i),$(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,a=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),o=Math.min(n,d),n=Math.max(n,d),s=Math.max(s,t.endDTS)),i-t.start);0!==t.start&&(t.start=i),t.duration=n-t.start,t.startPTS=i,t.maxStartPTS=a,t.startDTS=r,t.endPTS=n,t.minEndPTS=o,t.endDTS=s;var c,l=t.sn;if(!e||le.endSN)return 0;var d=l-e.startSN,h=e.fragments;for(h[d]=t,c=d;0=e.length||ei(t,e[i].start)}function ei(e,t){if(t){for(var i=e.fragments,n=e.skippedSegments;ne?0:(t=Math.min(t,i.duration+(i.deltaPTS||0)),i.start+i.duration-t<=e?1:i.start-t>e&&i.start?-1:0)}(i=mi.prototype).registerListeners=function(){var e=this.hls;e.on(Z.ERROR,this.onError,this),e.on(Z.MANIFEST_LOADING,this.onManifestLoading,this)},i.unregisterListeners=function(){var e=this.hls;e&&(e.off(Z.ERROR,this.onError,this),e.off(Z.ERROR,this.onErrorOut,this),e.off(Z.MANIFEST_LOADING,this.onManifestLoading,this))},i.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},i.startLoad=function(e){this.playlistError=0},i.stopLoad=function(){},i.getVariantLevelIndex=function(e){return(null==e?void 0:e.type)===g?e.level:this.hls.loadLevel},i.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},i.onError=function(e,t){if(!t.fatal){var i,n=this.hls,r=t.context;switch(t.details){case te.FRAG_LOAD_ERROR:case te.FRAG_LOAD_TIMEOUT:case te.KEY_LOAD_ERROR:case te.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case te.FRAG_GAP:case te.FRAG_PARSING_ERROR:case te.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=2);case te.LEVEL_EMPTY_ERROR:case te.LEVEL_PARSING_ERROR:var s=t.parent===g?t.level:n.loadLevel;return void(t.details===te.LEVEL_EMPTY_ERROR&&null!=(a=t.context)&&null!=(a=a.levelDetails)&&a.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,s)));case te.LEVEL_LOAD_ERROR:case te.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==r?void 0:r.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.level)));case te.AUDIO_TRACK_LOAD_ERROR:case te.AUDIO_TRACK_LOAD_TIMEOUT:case te.SUBTITLE_LOAD_ERROR:case te.SUBTITLE_TRACK_LOAD_TIMEOUT:if(r){var a=n.levels[n.loadLevel];if(a&&(r.type===wt&&r.groupId===a.audioGroupId||r.type===At&&r.groupId===a.textGroupId))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=2,void(t.errorAction.flags=1)}return;case te.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var s=n.levels[n.loadLevel],a=null==s?void 0:s.attrs["HDCP-LEVEL"];return void(a&&(t.errorAction={action:2,flags:2,hdcpLevel:a}));case te.BUFFER_ADD_CODEC_ERROR:case te.REMUX_ALLOC_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:n.loadLevel));case te.INTERNAL_EXCEPTION:case te.BUFFER_APPENDING_ERROR:case te.BUFFER_APPEND_ERROR:case te.BUFFER_FULL_ERROR:case te.LEVEL_SWITCH_ERROR:case te.BUFFER_STALLED_ERROR:case te.BUFFER_SEEK_OVER_HOLE:case te.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:0,flags:0})}t.type===ee.KEY_SYSTEM_ERROR&&(i=this.getVariantLevelIndex(t.frag),t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,i))}},i.getPlaylistRetryOrSwitchAction=function(e,t){var i=ri(this.hls.config.playlistLoadPolicy,e),n=this.playlistError++,r=null==(r=e.response)?void 0:r.code;return oi(i,n,ni(e),r)?{action:5,flags:0,retryConfig:i,retryCount:n}:null!=(r=e.context)&&r.deliveryDirectives?{action:0,flags:0,retryConfig:i||{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},retryCount:n}:this.getLevelSwitchAction(e,t)},i.getFragRetryOrSwitchAction=function(e){var t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],r=t.config,s=r.fragLoadPolicy,r=r.keyLoadPolicy,r=ri(e.details.startsWith("key")?r:s,e),s=t.levels.reduce(function(e,t){return e+t.fragmentError},0);if(n){e.details!==te.FRAG_GAP&&n.fragmentError++;n=null==(t=e.response)?void 0:t.code;if(oi(r,s,ni(e),n))return{action:5,flags:0,retryConfig:r,retryCount:s}}t=this.getLevelSwitchAction(e,i);return r&&(t.retryConfig=r,t.retryCount=s),t},i.getLevelSwitchAction=function(e,t){var i=this.hls,n=(null==t&&(t=i.loadLevel),this.hls.levels[t]);if(n&&(n.loadError++,i.autoLevelEnabled)){for(var r=-1,s=i.levels,a=null==(t=e.frag)?void 0:t.type,t=null!=(t=e.context)?t:{},o=t.type,l=t.groupId,d=s.length;d--;){var u=(d+i.loadLevel)%s.length;if(u!==i.loadLevel&&0===s[u].loadError){var c=s[u];if(e.details===te.FRAG_GAP&&e.frag){var h=s[u].details;if(h){h=di(e.frag,h.fragments,e.frag.start);if(null!=h&&h.gap)continue}}else{if(o===wt&&l===c.audioGroupId||o===At&&l===c.textGroupId)continue;if(a===Lt&&n.audioGroupId===c.audioGroupId||a===Ct&&n.textGroupId===c.textGroupId)continue}r=u;break}}if(-13*n.targetduration)return 1}}(e,i,s[d]))return n.warn("Switching to Redundant Stream "+(1+t)+"/"+l+': "'+o.url[t]+'" after '+i.details),n.playlistError=0,r.levels.forEach(function(e){e.urlId=t}),r.nextLoadLevel=a,{v:!0}}();if("object"==typeof e)return e.v}return!1},i.penalizeRendition=function(e,t){var i=this.penalizedRenditions,n=i[e.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};n.lastErrorPerfMs=performance.now(),n.errors.push(t),n.details=e.details,i[e.urlId]=n};var ci,hi,t=mi,i=((i=gi.prototype).destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},i.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},i.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},i.stopLoad=function(){this.canLoad=!1,this.clearTimer()},i.switchParams=function(e,t){var i=null==t?void 0:t.renditionReports;if(i){for(var n,r,s,a=-1,o=0;ot.partTarget&&(r+=1),new jt(n,0<=r?r:void 0,"")}},i.loadPlaylist=function(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())},i.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},i.shouldReloadPlaylist=function(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)},i.playlistLoaded=function(e,t,i){var n=this,r=t.details,s=t.stats,a=self.performance.now(),o=s.loading.first?Math.max(0,a-s.loading.first):0;if(r.advancedDateTime=Date.now()-o,r.live||null!=i&&i.live){if(r.reloaded(i),i&&this.log("live playlist "+e+" "+(r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:"MISSED")),i&&0i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+h+" with playlist age: "+r.age),h=0):(o+=f=Math.floor(h/r.targetduration),void 0!==d&&(d+=Math.round(h%r.targetduration/r.partTarget)),this.log("CDN Tune-in age: "+r.ageHeader+"s last advanced "+c.toFixed(2)+"s goal: "+h+" skip sn "+f+" to part "+d)),r.tuneInGoal=h),l=this.getDeliveryDirectives(r,t.deliveryDirectives,o,d),u||!p)return void this.loadPlaylist(l)}else r.canBlockReload&&(l=this.getDeliveryDirectives(r,t.deliveryDirectives,o,d));i=this.hls.mainForwardBufferInfo,c=i?i.end-i.len:0,p=(void 0===(f=1e3*(r.edge-c))&&(f=1/0),h=1e3*r.targetduration,r.updated?(u=r.fragments).length&&f<4*h&&(f=1e3*u[u.length-1].duration)this.requestScheduled+p&&(this.requestScheduled=s.loading.start),void 0!==o&&r.canBlockReload?this.requestScheduled=s.loading.first+p-(1e3*r.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+p(t.attrs["HDCP-LEVEL"]||"")?1:-1:e.bitrate!==t.bitrate?e.bitrate-t.bitrate:e.attrs["FRAME-RATE"]!==t.attrs["FRAME-RATE"]?e.attrs.decimalFloatingPoint("FRAME-RATE")-t.attrs.decimalFloatingPoint("FRAME-RATE"):e.attrs.SCORE!==t.attrs.SCORE?e.attrs.decimalFloatingPoint("SCORE")-t.attrs.decimalFloatingPoint("SCORE"):s&&e.height!==t.height?e.height-t.height:0}),d[0]);if(this.steering&&(l=this.steering.filterParsedLevels(l)).length!==d.length)for(var c=0;c=t.length){var i=new Error("invalid level idx"),n=e<0;if(this.hls.trigger(Z.ERROR,{type:ee.OTHER_ERROR,details:te.LEVEL_SWITCH_ERROR,level:e,fatal:n,error:i,reason:i.message}),n)return;e=Math.min(e,t.length-1)}var i=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,t=t[e],s=t.attrs["PATHWAY-ID"];this.currentLevelIndex=e,this.currentLevel=t,i===e&&t.details&&n&&r===s||(this.log("Switching to level "+e+(s?" with Pathway "+s:"")+" from level "+i+(r?" with Pathway "+r:"")),delete(s=J({},t,{level:e,maxBitrate:t.maxBitrate,attrs:t.attrs,uri:t.uri,urlId:t.urlId}))._attrs,delete s._urlId,this.hls.trigger(Z.LEVEL_SWITCHING,s),(i=t.details)&&!i.live)||(r=this.switchParams(t.uri,null==n?void 0:n.details),this.loadPlaylist(r))}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){var e;return void 0===this._startLevel?void 0!==(e=this.hls.config.startLevel)?e:this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),pi);function pi(e,t){return(e=hi.call(this,e,"[level-controller]")||this)._levels=[],e._firstLevel=-1,e._startLevel=void 0,e.currentLevel=null,e.currentLevelIndex=-1,e.manualLevelIndex=-1,e.steering=void 0,e.onParsedComplete=void 0,e.steering=t,e._registerListeners(),e}function gi(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=ie.log.bind(ie,t+":"),this.warn=ie.warn.bind(ie,t+":"),this.hls=e}function mi(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=ie.log.bind(ie,"[info]:"),this.warn=ie.warn.bind(ie,"[warning]:"),this.error=ie.error.bind(ie,"[error]:"),this.registerListeners()}function vi(e,t,i){i&&("audio"===t?(e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds[e.url.length-1]=i):"text"===t&&(e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds[e.url.length-1]=i))}function yi(e){var i={};e.forEach(function(e){var t=e.groupId||"";e.id=i[t]=i[t]||0,i[t]++})}var Ti="NOT_LOADED",Ei="APPENDING",bi="PARTIAL",ki="OK",Si=((n=wi.prototype)._registerListeners=function(){var e=this.hls;e.on(Z.BUFFER_APPENDED,this.onBufferAppended,this),e.on(Z.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Z.FRAG_LOADED,this.onFragLoaded,this)},n._unregisterListeners=function(){var e=this.hls;e.off(Z.BUFFER_APPENDED,this.onBufferAppended,this),e.off(Z.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Z.FRAG_LOADED,this.onFragLoaded,this)},n.destroy=function(){this._unregisterListeners(),this.fragments=this.endListFragments=this.timeRanges=this.mainFragEntity=this.activeParts=null},n.getAppendedFrag=function(e,t){if(t===g){var i=this.mainFragEntity,n=this.activeParts;if(i)if(n)for(var r=n.length;r--;){var s=n[r],a=s?s.end:i.appendedPTS;if(s.start<=e&&null!==a&&e<=a)return 9i.startPTS?d.appendedPTS=Math.max(r,d.appendedPTS||0):d.appendedPTS=i.endPTS}}})},n.onFragBuffered=function(e,t){this.detectPartialFragments(t)},n.hasFragment=function(e){e=Li(e);return!!this.fragments[e]},n.removeFragmentsInRange=function(i,n,r,s,a){var o=this;s&&!this.hasGaps||Object.keys(this.fragments).forEach(function(e){var t,e=o.fragments[e];!e||(t=e.body).type!==r||s&&!t.gap||t.starti&&(e.buffered||a)&&o.removeFragment(t)})},n.removeFragment=function(e){var t=Li(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),this.mainFragEntity===this.fragments[t]&&(this.mainFragEntity=null),delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},n.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.mainFragEntity=null,this.activeParts=null,this.hasGaps=!1},wi);function wi(e){this.mainFragEntity=null,this.activeParts=null,this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}function Ai(e){var t;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(t=e.range.audio)?void 0:t.partial))}function Li(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}var Ci=Math.pow(2,17),Ri=((n=xi.prototype).destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},n.abort=function(){this.loader&&this.loader.abort()},n.load=function(o,l){var d=this,u=o.url;if(!u)return Promise.reject(new Oi({type:ee.NETWORK_ERROR,details:te.FRAG_LOAD_ERROR,fatal:!1,frag:o,error:new Error("Fragment does not have a "+(u?"part list":"url")),networkDetails:null}));this.abort();var i=this.config,c=i.fLoader,h=i.loader;return new Promise(function(r,s){var a,e,t,n;d.loader&&d.loader.destroy(),o.gap?s(Di(o)):(a=d.loader=o.loader=new(c||h)(i),e=_i(o),t=ai(i.fragLoadPolicy.default),n={loadPolicy:t,timeout:t.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===o.sn?1/0:Ci},o.stats=a.stats,a.load(e,n,{onSuccess:function(e,t,i,n){d.resetLoader(o,a);e=e.data;i.resetIV&&o.decryptdata&&(o.decryptdata.iv=new Uint8Array(e.slice(0,16)),e=e.slice(16)),r({frag:o,part:null,payload:e,networkDetails:n})},onError:function(e,t,i,n){d.resetLoader(o,a),s(new Oi({type:ee.NETWORK_ERROR,details:te.FRAG_LOAD_ERROR,fatal:!1,frag:o,response:p({url:u,data:void 0},e),error:new Error("HTTP Error "+e.code+" "+e.text),networkDetails:i,stats:n}))},onAbort:function(e,t,i){d.resetLoader(o,a),s(new Oi({type:ee.NETWORK_ERROR,details:te.INTERNAL_ABORTED,fatal:!1,frag:o,error:new Error("Aborted"),networkDetails:i,stats:e}))},onTimeout:function(e,t,i){d.resetLoader(o,a),s(new Oi({type:ee.NETWORK_ERROR,details:te.FRAG_LOAD_TIMEOUT,fatal:!1,frag:o,error:new Error("Timeout after "+n.timeout+"ms"),networkDetails:i,stats:e}))},onProgress:function(e,t,i,n){l&&l({frag:o,part:null,payload:i,networkDetails:n})}}))})},n.loadPart=function(l,d,u){var c=this,t=(this.abort(),this.config),i=t.fLoader,h=t.loader;return new Promise(function(r,s){var a,o,e,n;c.loader&&c.loader.destroy(),l.gap||d.gap?s(Di(l,d)):(a=c.loader=l.loader=new(i||h)(t),o=_i(l,d),e=ai(t.fragLoadPolicy.default),n={loadPolicy:e,timeout:e.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ci},d.stats=a.stats,a.load(o,n,{onSuccess:function(e,t,i,n){c.resetLoader(l,a),c.updateStatsFromPart(l,d);e={frag:l,part:d,payload:e.data,networkDetails:n};u(e),r(e)},onError:function(e,t,i,n){c.resetLoader(l,a),s(new Oi({type:ee.NETWORK_ERROR,details:te.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:d,response:p({url:o.url,data:void 0},e),error:new Error("HTTP Error "+e.code+" "+e.text),networkDetails:i,stats:n}))},onAbort:function(e,t,i){l.stats.aborted=d.stats.aborted,c.resetLoader(l,a),s(new Oi({type:ee.NETWORK_ERROR,details:te.INTERNAL_ABORTED,fatal:!1,frag:l,part:d,error:new Error("Aborted"),networkDetails:i,stats:e}))},onTimeout:function(e,t,i){c.resetLoader(l,a),s(new Oi({type:ee.NETWORK_ERROR,details:te.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:d,error:new Error("Timeout after "+n.timeout+"ms"),networkDetails:i,stats:e}))}}))})},n.updateStatsFromPart=function(e,t){var i=e.stats,n=t.stats,r=n.total,e=(i.loaded+=n.loaded,r?(r=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/r),e)))*Math.round(i.loaded/t),i.total=i.loaded+r):i.total=Math.max(i.loaded,i.total),i.loading),t=n.loading;e.start?e.first+=t.first-t.start:(e.start=t.start,e.first=t.first),e.end=t.end},n.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},xi);function xi(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}function _i(e,t){var i,n,r=(t=void 0===t?null:t)||e,t={frag:e,part:t,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},s=r.byteRangeStartOffset,r=r.byteRangeEndOffset;return $(s)&&$(r)&&(i=s,n=r,"initSegment"===e.sn&&"AES-128"===(null==(e=e.decryptdata)?void 0:e.method)&&((e=r-s)%16&&(n=r+(16-e%16)),0!==s)&&(t.resetIV=!0,i=s-16),t.rangeStart=i,t.rangeEnd=n),t}function Di(e,t){var i=new Error("GAP "+(e.gap?"tag":"attribute")+" found"),i={type:ee.MEDIA_ERROR,details:te.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new Oi(i)}function Ii(e,t,i,n,r,s){void 0===n&&(n=0),void 0===r&&(r=-1),void 0===s&&(s=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=r,this.partial=s}e($i,Pi=I(Error));var Pi,Oi=$i,Ni=((n=Ui.prototype).abort=function(){for(var e in this.keyUriToKeyInfo){e=this.keyUriToKeyInfo[e].loader;e&&e.abort()}},n.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},n.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){e=this.keyUriToKeyInfo[e].loader;e&&e.destroy()}this.keyUriToKeyInfo={}},n.createKeyLoadError=function(e,t,i,n,r){return void 0===t&&(t=te.KEY_LOAD_ERROR),new Oi({type:ee.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:n})},n.loadClear=function(e,i){var n=this;if(this.emeController&&this.config.emeEnabled)for(var r=e.sn,s=e.cc,a=0;a=i.start(n)&&t<=i.end(n))return!0}catch(e){}return!1},Fi.bufferInfo=function(e,t,i){try{if(e){for(var n=Fi.getBuffered(e),r=[],s=0;ss&&(n[a-1].end=e[r].end):n.push(e[r])}else n=e;for(var o,l=0,d=t,u=t,c=0;c>>8^255&g^99,c[t[g]=h]),v=c[m],y=c[v],T=257*c[g]^16843008*g;n[h]=T<<24|T>>>8,r[h]=T<<16|T>>>16,s[h]=T<<8|T>>>24,a[h]=T,o[g]=(T=16843009*y^65537*v^257*m^16843008*h)<<24|T>>>8,l[g]=T<<16|T>>>16,d[g]=T<<8|T>>>24,u[g]=T,h?(h=m^c[c[c[y^m]]],f^=c[c[f]]):h=f=1}},s.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,n=0;nn.end)&&(r=r buffer:"+(i?function(e){for(var t="",i=e.length,n=0;nt.end&&s.fragmentHint&&(t=s.fragmentHint);var l,d=this.getNextPart(o,t,e);if(-1i&&this.flushMainBuffer(n,e.start)):this.flushMainBuffer(0,e.start))},s.getFwdBufferInfo=function(e,t){var i=this.getLoadPosition();return $(i)?this.getFwdBufferInfoAtPos(e,i,t):null},s.getFwdBufferInfoAtPos=function(e,t,i){var n=this.config.maxBufferHole,r=y.bufferInfo(e,t,n);if(0===r.len&&void 0!==r.nextStart){i=this.fragmentTracker.getBufferedFrag(t,i);if(i&&r.nextStart=e&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},s.getNextFragment=function(e,t){var i=t.fragments,n=i.length;if(!n)return null;var r,s=this.config,a=i[0].start;if(t.live){var o=s.initialLiveManifestSize;if(nt},s.getNextFragmentLoopLoading=function(e,t,i,n,r){var s=e.gap,t=this.getNextFragment(this.nextLoadPosition,t);if(null===t)return t;if(e=t,s&&e&&!e.gap&&i.nextStart){t=this.getFwdBufferInfoAtPos(this.mediaBuffer||this.media,i.nextStart,n);if(null!==t&&i.len+t.len>=r)return this.log('buffer full after gaps in "'+n+'" playlist starting at sn: '+e.sn),null}return e},s.mapToInitFragWhenRequired=function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment},s.getNextPart=function(e,t,i){for(var n=-1,r=!1,s=!0,a=0,o=e.length;ae.start&&e.loaded},s.getInitialLiveFragment=function(e,t){var i,n,r=this.fragPrevious,s=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),s=function(e,t,i){if(null!==t&&Array.isArray(e)&&e.length&&$(t)&&!(t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))){i=i||0;for(var n,r,s,a=0;an)return o}}return null}(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),s||((i=r.sn+1)>=e.startSN&&i<=e.endSN&&(i=t[i-e.startSN],r.cc===i.cc)&&this.log("Live playlist, switching playlist, load frag with next SN: "+(s=i).sn),!s&&(n=r.cc,s=li(t,function(e){return e.ccn?-1:0}))&&this.log("Live playlist, switching playlist, load frag with same CC: "+s.sn))):null!==(i=this.hls.liveSyncPosition)&&(s=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),s},s.getFragmentAtPosition=function(e,t,i){var n=this.config,r=this.fragPrevious,s=i.fragments,a=i.endSN,o=i.fragmentHint,l=n.maxFragLookUpTolerance,n=!!(n.lowLatencyMode&&i.partList&&o);return n&&o&&!this.bitrateTest&&(s=s.concat(o),a=o.sn),(o=e=r-s.maxFragLookUpTolerance&&i<=n,null!==t)&&a.duration>t&&(il.startCC||n&&n.cc"+e.startSN+" prev-sn: "+(h?h.sn:"na")+" fragments: "+c),o):i):(this.warn("No fragments in live playlist"),0)},s.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},s.setStartPosition=function(e,t){var i,n,r=this.startPosition;-1!==(r=r "+(null==(i=this.fragCurrent)?void 0:i.url)):((i=t.details===te.FRAG_GAP)&&this.fragmentTracker.fragBuffered(o,!0),a=(s=(n=t.errorAction)||{}).action,r=void 0===(r=s.retryCount)?0:r,s=s.retryConfig,n&&5===a&&s?(this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),a=si(s,r),this.warn("Fragment "+o.sn+" of "+e+" "+o.level+" errored with "+t.details+", retrying loading "+(r+1)+"/"+s.maxNumRetry+" in "+a+"ms"),n.resolved=!0,this.retryDate=self.performance.now()+a,this.state=Zi):s&&n?(this.resetFragmentErrors(e),r"+e))}}]),ln);function ln(e,t,i,n,r){var s;return(s=qi.call(this)||this).hls=void 0,s.fragPrevious=null,s.fragCurrent=null,s.fragmentTracker=void 0,s.transmuxer=null,s._state=Xi,s.playlistType=void 0,s.media=null,s.mediaBuffer=null,s.config=void 0,s.bitrateTest=!1,s.lastCurrentTime=0,s.nextLoadPosition=0,s.startPosition=0,s.startTimeOffset=null,s.loadedmetadata=!1,s.retryDate=0,s.levels=null,s.fragmentLoader=void 0,s.keyLoader=void 0,s.levelLastLoaded=null,s.startFragRequested=!1,s.decrypter=void 0,s.initPTS=[],s.onvseeking=null,s.onvended=null,s.logPrefix="",s.log=void 0,s.warn=void 0,s.playlistType=r,s.logPrefix=n,s.log=ie.log.bind(ie,n+":"),s.warn=ie.warn.bind(ie,n+":"),s.hls=e,s.fragmentLoader=new Ri(e.config),s.keyLoader=i,s.fragmentTracker=t,s.config=e.config,s.decrypter=new zi(e.config),e.on(Z.MANIFEST_LOADED,s.onManifestLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(s)),s}function dn(e,t){t=(void 0===t?{}:t).removePKCS7Padding,t=void 0===t||t;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=t)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(e){}null===this.subtle&&(this.useSoftware=!0)}function un(){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()}function cn(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}function hn(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}function fn(){if("undefined"!=typeof self)return self.MediaSource||self.WebKitMediaSource}function pn(){return self.SourceBuffer||self.WebKitSourceBuffer}function gn(e,t){return{type:e=void 0===e?"":e,id:-1,pid:-1,inputTimeScale:t=void 0===t?9e4:t,sequenceNumber:-1,samples:[],dropped:0}}(s=vn.prototype).resetInitSegment=function(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},s.resetTimeStamp=function(e){this.initPTS=e,this.resetContiguity()},s.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},s.canParse=function(e,t){return!1},s.appendFrame=function(e,t,i){},s.demux=function(e,t){this.cachedData&&(e=Xe(this.cachedData,e),this.cachedData=null);var i,n,r,s=Ie(e,0),a=s?s.length:0,o=this._audioTrack,l=this._id3Track,d=s?function(){for(var e=Oe(s),t=0;t>>5}function bn(e,t){return t+1>>6),u=(60&i[n+2])>>>2,n=l.length-1>>6,ie.log("manifest codec:"+r+", ADTS type:"+d+", samplingIndex:"+u),i=/firefox/i.test(a)?6<=u?(d=5,s=new Array(4),u-3):(d=2,s=new Array(2),u):-1!==a.indexOf("android")?(d=2,s=new Array(2),u):(d=5,s=new Array(4),r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&6<=u?u-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(6<=u&&1==t||/vivaldi/i.test(a))||!r&&1==t)&&(d=2,s=new Array(2)),u)),s[0]=d<<3,s[0]|=(14&u)>>1,s[1]|=(1&u)<<7,s[1]|=t<<3,5===d&&(s[1]|=(14&i)>>1,s[2]=(1&i)<<7,s[2]|=8,s[3]=0),{config:s,samplerate:l[u],channelCount:t,codec:"mp4a.40."+d,manifestCodec:o}))&&(e.config=n.config,e.samplerate=n.samplerate,e.channelCount=n.channelCount,e.codec=n.codec,e.manifestCodec=n.manifestCodec,ie.log("parsed codec:"+e.codec+", rate:"+n.samplerate+", channels:"+n.channelCount))}function Sn(e){return 9216e4/e}function wn(e,i,n,t,r){var s,a,o,t=t+r*Sn(e.samplerate),r=function(){var e=Tn(i,n);if(n+e<=i.length){var t=En(i,n)-e;if(0=t.length?void 0:!((n=En(t,i))<=r)&&((r=i+n)===t.length||bn(t,r)))return ie.log("ADTS sync word found !"),!0;return!1},a.canParse=function(e,t){return(t=t)+5<(e=e).length&&yn(e,t)&&En(e,t)<=e.length-t},a.appendFrame=function(e,t,i){kn(e,this.observer,t,i,e.manifestCodec);e=wn(e,t,i,this.basePTS,this.frameIndex);if(e&&0===e.missing)return e};var An,a=Pn,Ln=/\/emsg[-/]ID3/i,o=((o=In.prototype).resetTimeStamp=function(){},o.resetInitSegment=function(e,t,i,n){var r,s,a,o=this.videoTrack=gn("video",1),l=this.audioTrack=gn("audio",1),d=this.txtTrack=gn("text",1);this.id3Track=gn("id3",1),this.timeOffset=0,null!=e&&e.byteLength&&((e=We(e)).video&&(r=(a=e.video).id,s=a.timescale,a=a.codec,o.id=r,o.timescale=d.timescale=s,o.codec=a),e.audio&&(s=(r=e.audio).id,a=r.timescale,e=r.codec,l.id=s,l.timescale=a,l.codec=e),d.id=je.text,o.sampleDuration=0,o.duration=l.duration=n)},o.resetContiguity=function(){},In.probe=function(e){return 0t.length)){var s=Nn(t,i);if(s&&i+s.frameLength<=t.length)return n=n+r*(9e4*s.samplesPerFrame/s.sampleRate),r={unit:t.subarray(i,i+s.frameLength),pts:n,dts:n},e.config=[],e.channelCount=s.channelCount,e.samplerate=s.sampleRate,e.samples.push(r),{sample:r,length:s.frameLength,missing:0}}}function Nn(e,t){var i,n,r,s,a,o=e[t+1]>>3&3,l=e[t+1]>>1&3,d=e[t+2]>>4&15,u=e[t+2]>>2&3;if(1!=o&&0!=d&&15!=d&&3!=u)return a=e[t+2]>>1&1,i=e[t+3]>>6,d=1e3*Rn[14*(3==o?3-l:3==l?3:4)+d-1],u=xn[3*(3==o?0:2==o?1:2)+u],n=3==i?1:2,s=8*(o=_n[o][l])*(r=Dn[l]),o=Math.floor(o*d/u+a)*r,null===Cn&&(a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),Cn=a?parseInt(a[1]):0),Cn&&Cn<=87&&2==l&&224e3<=d&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:n,frameLength:o,samplesPerFrame:s}}function Mn(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Fn(e,t){return t+1e||(e=(e-=this.bitsAvailable)-((t=e>>3)<<3),this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},l.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;if(32>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},l.skipUEG=function(){this.skipBits(1+this.skipLZ())},l.skipEG=function(){this.skipBits(1+this.skipLZ())},l.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},l.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},l.readBoolean=function(){return 1===this.readBits(1)},l.readUByte=function(){return this.readBits(8)},l.readUShort=function(){return this.readBits(16)},l.readUInt=function(){return this.readBits(32)},l.skipScalingList=function(e){for(var t=8,i=8,n=0;n=e.length)return void i();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,i),this.decrypter.isSync())))return}},l.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),n=0,r=32;r=e.length)return void n();for(var r=e[t].units;!(i>=r.length);i++){var s=r[i];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(e,t,i,n,s),this.decrypter.isSync())))return}}},Hn),$n=188,l=(Kn.probe=function(e){e=Kn.syncOffset(e);return 0>4){if((A=k+5+e[k+4])===k+$n)continue}else A=k+4;switch(w){case d:S&&(u&&(r=Yn(u))&&this.parseAVCPES(s,l,r,!1),u={data:[],size:0}),u&&(u.data.push(e.subarray(A,k+$n)),u.size+=k+$n-A);break;case c:if(S){if(f&&(r=Yn(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,r);break;case"mp3":this.parseMPEGPES(a,r)}f={data:[],size:0}}f&&(f.data.push(e.subarray(A,k+$n)),f.size+=k+$n-A);break;case h:S&&(p&&(r=Yn(p))&&this.parseID3PES(o,r),p={data:[],size:0}),p&&(p.data.push(e.subarray(A,k+$n)),p.size+=k+$n-A);break;case 0:S&&(A+=e[A]+1),v=this._pmtId=(31&(L=e)[(E=A)+10])<<8|L[E+11];break;case v:S&&(A+=e[A]+1);var L=function(e,t,i,n){var r={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},s=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);te.size-6)return null;var l=t[7],d=(192&l&&(n=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?54e5>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),s=0,t=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,85,196,0,0]))},h.mdia=function(e){return h.box(h.types.mdia,h.mdhd(e.timescale,e.duration),h.hdlr(e.type),h.minf(e))},h.mfhd=function(e){return h.box(h.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},h.minf=function(e){return"audio"===e.type?h.box(h.types.minf,h.box(h.types.smhd,h.SMHD),h.DINF,h.stbl(e)):h.box(h.types.minf,h.box(h.types.vmhd,h.VMHD),h.DINF,h.stbl(e))},h.moof=function(e,t,i){return h.box(h.types.moof,h.mfhd(e),h.traf(i,t))},h.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=h.trak(e[t]);return h.box.apply(null,[h.types.moov,h.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(h.mvex(e)))},h.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=h.trex(e[t]);return h.box.apply(null,[h.types.mvex].concat(i))},h.mvhd=function(e,t){t*=e;var i=Math.floor(t/(1+Xn)),t=Math.floor(t%(1+Xn)),e=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,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 h.box(h.types.mvhd,e)},h.sdtp=function(e){for(var t,i=e.samples||[],n=new Uint8Array(4+i.length),r=0;r>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(t));for(s=0;s>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));var a=h.box(h.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(r))),o=e.width,l=e.height,d=e.pixelRatio[0],u=e.pixelRatio[1];return h.box(h.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,h.box(h.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),h.box(h.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,u>>24,u>>16&255,u>>8&255,255&u])))},h.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]))},h.mp4a=function(e){var t=e.samplerate;return h.box(h.types.mp4a,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]),h.box(h.types.esds,h.esds(e)))},h.mp3=function(e){var t=e.samplerate;return h.box(h.types[".mp3"],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]))},h.stsd=function(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?h.box(h.types.stsd,h.STSD,h.mp3(e)):h.box(h.types.stsd,h.STSD,h.mp4a(e)):h.box(h.types.stsd,h.STSD,h.avc1(e))},h.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,n=e.width,e=e.height,r=Math.floor(i/(1+Xn)),i=Math.floor(i%(1+Xn));return h.box(h.types.tkhd,new Uint8Array([1,0,0,7,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,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,e>>8&255,255&e,0,0]))},h.traf=function(e,t){var i=h.sdtp(e),n=e.id,r=Math.floor(t/(1+Xn)),t=Math.floor(t%(1+Xn));return h.box(h.types.traf,h.box(h.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),h.box(h.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,t>>24,t>>16&255,t>>8&255,255&t])),h.trun(e,i.length+16+20+8+16+8+8),i)},h.trak=function(e){return e.duration=e.duration||4294967295,h.box(h.types.trak,h.tkhd(e),h.mdia(e))},h.trex=function(e){e=e.id;return h.box(h.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},h.trun=function(e,t){var i,n,r,s,a,o=e.samples||[],l=o.length,d=12+16*l,u=new Uint8Array(d);for(u.set(["video"===e.type?1:0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,(t+=8+d)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12+16*i);return h.box(h.types.trun,u)},h.initSegment=function(e){h.types||h.init();var e=h.moov(e),t=new Uint8Array(h.FTYP.byteLength+e.byteLength);return t.set(h.FTYP),t.set(e,h.FTYP.byteLength),t},h);function h(){}function Qn(){}function Jn(){return Wn.apply(this,arguments)||this}function Zn(e,t,i,n){e=e*t*(i=void 0===i?1:i);return(n=void 0===n?!1:n)?Math.round(e):e}function er(e,t){return Zn(e,1e3,1/9e4,t=void 0===t?!1:t)}ne.types=void 0,ne.HDLR_TYPES=void 0,ne.STTS=void 0,ne.STSC=void 0,ne.STCO=void 0,ne.STSZ=void 0,ne.VMHD=void 0,ne.SMHD=void 0,ne.STSD=void 0,ne.FTYP=void 0,ne.DINF=void 0;var tr=null,ir=null,d=((d=nr.prototype).destroy=function(){},d.resetTimeStamp=function(e){ie.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},d.resetNextTimestamp=function(){ie.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},d.resetInitSegment=function(){ie.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},d.getVideoStartPts=function(e){var n=!1,e=e.reduce(function(e,t){var i=t.pts-e;return i<-4294967296?(n=!0,rr(e,t.pts)):0s[0].pts)&&(y=d,i=s[0].pts-l,s[0].dts=y,s[0].pts=i,ie.log("Video: First PTS/DTS adjusted: "+er(i,!0)+"/"+er(y,!0)+", delta: "+er(l,!0)+" ms")),y=Math.max(0,y);for(var E=0,M=0,b=0;bsinf>>tenc' box: "+Ke(t)+" -> "+Ke(r)),e.set(r,8))})})}),t)),this.emitInitSegment=!0},u.generateInitSegment=function(e){var t,i,n=this.audioCodec,r=this.videoCodec;null!=e&&e.byteLength?(t=this.initData=We(e),n=n||cr(t.audio,E),r=r||cr(t.video,le),i={},t.audio&&t.video?i.audiovideo={container:"video/mp4",codec:n+","+r,initSegment:e,id:"main"}:t.audio?i.audio={container:"audio/mp4",codec:n,initSegment:e,id:"audio"}:t.video?i.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:ie.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i):(this.initTracks=void 0,this.initData=void 0)},u.remux=function(e,t,i,n,r,s){var a,o,l,d,u,c,h,f=this.initPTS,p=this.lastEndTime,g={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0},t=($(p)||(p=this.lastEndTime=r||0),t.samples);return null!=t&&t.length&&(a={initPTS:void 0,timescale:1},null!=(h=this.initData)&&h.length||(this.generateInitSegment(t),h=this.initData),null!=h&&h.length?(this.emitInitSegment&&(a.tracks=this.initTracks,this.emitInitSegment=!1),o=h,c=C(t,["moof","traf"]).reduce(function(e,t){var n=C(t,["tfdt"])[0],r=n[0],t=C(t,["tfhd"]).reduce(function(e,t){t=L(t,4),t=o[t];if(t){var i=L(n,4);if(1===r){if(i===He)return ie.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;i=i*(1+He)+L(n,8)}i=i/(t.timescale||9e4);if(isFinite(i)&&(null===e||i>>31)return ie.warn("SIDX has hierarchical references (not supported)"),null;d=L(e,l);l+=4,t.push({referenceSize:u,subsegmentDuration:d,info:{duration:d/r,start:s,end:s+u-1}}),s+=u,n=l+=4}return{earliestPresentationTime:0,timescale:r,version:i,referencesCount:a,references:t}}(v[y]);null!=T&&T.references&&(m+=T.references.reduce(function(e,t){return e+t.info.duration||0},0))}return m}(t,h),e=(s=e?c-f.baseTime/f.timescale:p)+u,l=h,d=f.baseTime/f.timescale,C(t,["moof","traf"]).forEach(function(t){C(t,["tfhd"]).forEach(function(e){var n,e=L(e,4),e=l[e];e&&(n=e.timescale||9e4,C(t,["tfdt"]).forEach(function(e){var t=e[0],i=L(e,4);0===t?(i-=d*n,Ve(e,4,i=Math.max(i,0))):(i=(i=(i*=Math.pow(2,32))+L(e,8))-d*n,i=Math.max(i,0),t=Math.floor(i/(1+He)),i=Math.floor(i%(1+He)),Ve(e,4,t),Ve(e,8,i))}))})}),0i.maxBufferHole||e.nextStart&&e.nextStart-r1e3*i.highBufferWatchdogPeriod&&(ie.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},a._reportStall=function(e){var t=this.hls,i=this.media;!this.stallReported&&i&&(this.stallReported=!0,i=new Error("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(e)+")"),ie.warn(i.message),t.trigger(Z.ERROR,{type:ee.MEDIA_ERROR,details:te.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len}))},a._trySkipBufferHole=function(e){var t=this.config,i=this.hls,n=this.media;if(null!==n){var r=n.currentTime,s=y.bufferInfo(n,r,0),a=rt.maxBufferHole){var d=this.fragmentTracker,o=!1;if(!(o=0===r&&(s=d.getAppendedFrag(0,g))&&as.end&&(this.backtrackFragment=null),o=this.backtrackFragment?this.backtrackFragment.start:s.end,r=this.getNextFragment(o,a),this.couldBacktrack&&!this.fragPrevious&&r&&"initSegment"!==r.sn&&this.fragmentTracker.getState(r)!==ki?(e=(null!=(e=this.backtrackFragment)?e:r).sn-a.startSN,(e=a.fragments[e-1])&&r.cc===e.cc&&this.fragmentTracker.removeFragment(r=e)):this.backtrackFragment&&s.len&&(this.backtrackFragment=null),r&&this.isLoopLoading(r,o)&&(r.gap||(t=((e=this.audioOnly&&!this.altAudio?E:le)===le?this.videoBuffer:this.mediaBuffer)||this.media)&&this.afterBufferFlushed(t,e,g),r=this.getNextFragmentLoopLoading(r,a,s,g,i)),r&&(!r.initSegment||r.initSegment.data||this.bitrateTest||(r=r.initSegment),this.loadFragment(r,n,o)))))))},s.loadFragment=function(e,t,i){var n=this.fragmentTracker.getState(e);this.fragCurrent=e,n===Ti?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,Or.prototype.loadFragment.call(this,e,t,i)):this.clearTrackerIfNeeded(e)},s.getAppendedFrag=function(e){e=this.fragmentTracker.getAppendedFrag(e,g);return e&&"fragment"in e?e.fragment:e},s.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,g)},s.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},s.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},s.nextLevelSwitch=function(){var e,t=this.levels,i=this.media;null!=i&&i.readyState&&((e=this.getAppendedFrag(i.currentTime))&&1=this.minWeight_},o.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},o.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},o.destroy=function(){},Yr),l=((u=qr.prototype).registerListeners=function(){var e=this.hls;e.on(Z.FRAG_LOADING,this.onFragLoading,this),e.on(Z.FRAG_LOADED,this.onFragLoaded,this),e.on(Z.FRAG_BUFFERED,this.onFragBuffered,this),e.on(Z.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Z.LEVEL_LOADED,this.onLevelLoaded,this)},u.unregisterListeners=function(){var e=this.hls;e.off(Z.FRAG_LOADING,this.onFragLoading,this),e.off(Z.FRAG_LOADED,this.onFragLoaded,this),e.off(Z.FRAG_BUFFERED,this.onFragBuffered,this),e.off(Z.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Z.LEVEL_LOADED,this.onLevelLoaded,this)},u.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},u.onFragLoading=function(e,t){var i=t.frag;this.ignoreFragment(i)||(this.fragCurrent=i,this.partCurrent=null!=(i=t.part)?i:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))},u.onLevelSwitching=function(e,t){this.clearTimer()},u.getTimeToLoadFrag=function(e,t,i,n){return e+i/t+(n?this.lastLevelLoadSec:0)},u.onLevelLoaded=function(e,t){var i=this.hls.config,n=t.stats,r=n.total,n=n.bwEstimate;$(r)&&$(n)&&(this.lastLevelLoadSec=8*r/n),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},u._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,n=i.autoLevelEnabled,r=i.media;if(e&&r){var s=performance.now(),a=(t||e).stats,o=(t||e).duration,s=s-a.loading.start;if(a.aborted||a.loaded&&a.loaded===a.total||0===e.level)this.clearTimer(),this._nextAutoLevel=-1;else if(n&&!r.paused&&r.playbackRate&&r.readyState){n=i.mainForwardBufferInfo;if(null!==n){var l=this.bwEstimator.getEstimateTTFB(),r=Math.abs(r.playbackRate);if(!(s<=Math.max(l,o/(2*r)*1e3))){var d=n.len/r;if(!(2*o/r<=d)){var n=a.loading.first?a.loading.first-a.loading.start:-1,r=a.loaded&&-1Math.max(e,t)&&i[e].loadError<=i[t].loadError)return e}return t=-1!==e?Math.min(e,t):t},set:function(e){this._nextAutoLevel=e}}]),qr),Kr=((a=jr.prototype).push=function(e){this.chunks.push(e),this.dataLength+=e.length},a.flush=function(){var e=this.chunks,s=this.dataLength;return e.length?(e=1===e.length?e[0]:function(e){for(var t=new Uint8Array(s),i=0,n=0;no||n.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=o+.05),this.getNextFragment(d,t)),s=!1;if(a&&this.isLoopLoading(a,d)&&(s=!!a.gap,a=this.getNextFragmentLoopLoading(a,t,n,g,l)),a){var u=e&&a.start>e.end+t.targetduration;if(u||(null==e||!e.len)&&n.len){i=this.fragmentTracker.getBufferedFrag(a.start,g);if(null===i)return;if(s=s||!!i.gap||!!u&&0===e.len,u&&!s||s&&n.nextStart&&n.nextStart=r.length?this.warn("Invalid id passed to audio-track controller"):(this.clearTimer(),t=this.currentTrack,r[this.trackId],i=(r=r[e]).groupId,n=r.name,this.log("Switching to audio-track "+e+' "'+n+'" lang:'+r.lang+" group:"+i),this.trackId=e,this.currentTrack=r,this.selectDefaultTrack=!1,this.hls.trigger(Z.AUDIO_TRACK_SWITCHING,p({},r)),r.details&&!r.details.live||(n=this.switchParams(r.url,null==t?void 0:t.details),this.loadPlaylist(n)))},o.selectInitialTrack=function(){var e=this.tracksInGroup,t=this.findTrackId(this.currentTrack)|this.findTrackId(null);-1!=t?this.setAudioTrack(t):(t=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+e.length),this.warn(t.message),this.hls.trigger(Z.ERROR,{type:ee.MEDIA_ERROR,details:te.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t}))},o.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i=n[a].start&&s<=n[a].end){r=n[a];break}t=i.start+i.duration;r?r.end=t:n.push(r={start:s,end:t}),this.fragmentTracker.fragBuffered(i)}}},a.onBufferFlushing=function(e,t){var i,n,r,s=t.startOffset,a=t.endOffset;0===s&&a!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(n=this.levels).length)&&n[i]&&n[i].details&&((r=a-n[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(function(e){for(var t=0;t=r.length||t!==n)&&s){this.mediaBuffer=this.mediaBufferTimeRanges;r=0;if(i.live||null!=(n=s.details)&&n.live){n=this.mainDetails;if(i.deltaUpdateFailed||!n)return;var a=n.fragments[0];s.details?0===(r=this.alignPlaylists(i,s.details))&&a&&ei(i,r=a.start):i.hasProgramDateTime&&n.hasProgramDateTime?(ji(i,n),r=i.fragments[0].start):a&&ei(i,r=a.start)}s.details=i,this.levelLastLoaded=t,this.startFragRequested||!this.mainDetails&&i.live||this.setStartPosition(s.details,r),this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==c||di(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),s.details=void 0)}}},a._handleFragmentLoadComplete=function(e){var i,t=this,n=e.frag,e=e.payload,r=n.decryptdata,s=this.hls;!this.fragContextChanged(n)&&e&&0this.getMaxBufferLength(null==r?void 0:r.len)+o||(r=(n=s.fragments).length,o=s.edge,s=null,a=this.fragPrevious,i>>=0)>i-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is greater than the maximum bound ("+i+")");return n[t][e]}this.buffered={get length(){return n.length},end:function(e){return t("end",e,n.length)},start:function(e){return t("start",e,n.length)}}},n=(e(ts,Jr=i),(o=ts.prototype).destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,Jr.prototype.destroy.call(this)},o.registerListeners=function(){var e=this.hls;e.on(Z.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Z.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(Z.MANIFEST_LOADING,this.onManifestLoading,this),e.on(Z.MANIFEST_PARSED,this.onManifestParsed,this),e.on(Z.LEVEL_LOADING,this.onLevelLoading,this),e.on(Z.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(Z.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(Z.ERROR,this.onError,this)},o.unregisterListeners=function(){var e=this.hls;e.off(Z.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Z.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Z.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Z.MANIFEST_PARSED,this.onManifestParsed,this),e.off(Z.LEVEL_LOADING,this.onLevelLoading,this),e.off(Z.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(Z.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(Z.ERROR,this.onError,this)},o.onMediaAttached=function(e,t){this.media=t.media,this.media&&(-1=o.length||(this.clearTimer(),i=o[e],this.log("Switching to subtitle-track "+e+(i?' "'+i.name+'" lang:'+i.lang+" group:"+i.groupId:"")),this.trackId=e,i?(o=i.id,n=i.groupId,r=i.name,s=i.type,a=i.url,this.hls.trigger(Z.SUBTITLE_TRACK_SWITCH,{id:o,groupId:void 0===n?"":n,name:r,type:s,url:a}),o=this.switchParams(i.url,null==t?void 0:t.details),this.loadPlaylist(o)):this.hls.trigger(Z.SUBTITLE_TRACK_SWITCH,{id:e}))):this.queuedDefaultTrack=e},o.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=ns(this.media.textTracks),i=0;ii.config.appendErrorMaxRetry&&(ie.error("[buffer-controller]: Failed "+i.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),i.trigger(Z.ERROR,t)}},o)},i.onBufferFlushing=function(e,i){function t(t){return{execute:n.removeExecutor.bind(n,t,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(Z.BUFFER_FLUSHED,{type:t})},onError:function(e){ie.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}}var n=this,r=this.operationQueue;i.type?r.append(t(i.type),i.type):this.getSourceBufferTypes().forEach(function(e){r.append(t(e),e)})},i.onFragParsed=function(e,t){var i=this,n=t.frag,r=t.part,t=[],s=(r||n).elementaryStreams;s[de]?t.push("audiovideo"):(s[E]&&t.push("audio"),s[le]&&t.push("video")),0===t.length&&ie.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers(function(){var e=self.performance.now(),e=(n.stats.buffering.end=e,r&&(r.stats.buffering.end=e),(r||n).stats);i.hls.trigger(Z.FRAG_BUFFERED,{frag:n,part:r,stats:e,id:n.type})},t)},i.onFragChanged=function(e,t){this.flushBackBuffer()},i.onBufferEos=function(e,n){var r=this;this.getSourceBufferTypes().reduce(function(e,t){var i=r.sourceBuffer[t];return!i||n.type&&n.type!==t||(i.ending=!0,i.ended)||(i.ended=!0,ie.log("[buffer-controller]: "+t+" sourceBuffer now EOS")),e&&!(i&&!i.ended)},!0)&&(ie.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){r.getSourceBufferTypes().forEach(function(e){e=r.sourceBuffer[e];e&&(e.ending=!1)});var e=r.mediaSource;e&&"open"===e.readyState?(ie.log("[buffer-controller]: Calling mediaSource.endOfStream()"),e.endOfStream()):e&&ie.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)}))},i.onLevelUpdated=function(e,t){t=t.details;t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},i.flushBackBuffer=function(){var e,t,n,r,s,a=this.hls,o=this.details,i=this.media,l=this.sourceBuffer;i&&null!==o&&(e=this.getSourceBufferTypes()).length&&(t=o.live&&null!==a.config.liveBackBufferLength?a.config.liveBackBufferLength:a.config.backBufferLength,!$(t)||t<0||(n=i.currentTime,r=o.levelTargetDuration,i=Math.max(t,r),s=Math.floor(n/r)*r-i,e.forEach(function(e){var t=l[e];if(t){var i=y.getBuffered(t);if(0i.start(0)){if(a.trigger(Z.BACK_BUFFER_REACHED,{bufferEnd:s}),o.live)a.trigger(Z.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(t.ended&&i.end(i.length-1)-n<2*r)return void ie.info("[buffer-controller]: Cannot flush "+e+" back buffer while SourceBuffer is in ended state");a.trigger(Z.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:e})}}})))},i.updateMediaElementDuration=function(){var e,t,i,n,r,s;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,r=this.media,i=this.mediaSource,n=e.fragments[0].start+e.totalduration,r=r.duration,s=$(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(ie.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(s=e&&(t="function"==typeof t?t():t,ie.log(this.time+" ["+e+"] "+t))},_s),ys=((a=xs.prototype).reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},a.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;ics&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=cs)},a.moveCursor=function(e){var t=this.pos+e;if(1=cs?this.logger.log(0,function(){return"Cannot insert "+e.toString(16)+" ("+i+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(i,this.currPenState),this.moveCursor(1))},a.clearFromPos=function(e){for(var t=e;t ("+ss([a,o])+")"),!(i=(i=(i=(i=this.parseCmd(a,o))||this.parseMidrow(a,o))||this.parsePAC(a,o))||this.parseBackgroundAttributes(a,o))&&(n=this.parseChars(a,o))&&((s=this.currentChannel)&&0 "+e.src+")")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}function Is(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}function Ps(e,t,i){i.a=e,i.b=t}function Os(e,t,i){return i.a===e&&i.b===t}(a=qs.prototype).dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},a.newCue=function(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},a.reset=function(){this.cueRanges=[],this.startTime=null};var Ns,Ms,Fs=qs,Bs="undefined"!=typeof self&&self.VTTCue?self.VTTCue:(Ns=["","lr","rl"],Ms=["start","middle","end","left","right"],js.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},js),Us=($s.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},$s);function $s(){}function Ks(e,t){return"string"==typeof t&&!!Array.isArray(e)&&(t=t.toLowerCase(),!!~e.indexOf(t))&&t}function Hs(e){return Ks(Ms,e)}function Gs(e){for(var t=arguments.length,i=new Array(1/gi,"\n")}function Zs(e,t,i){return e.slice(i=void 0===i?0:i,i+t.length)===t}(a=na.prototype).parse=function(e){var n=this;function t(){for(var e=0,t=Js(t=n.buffer);e>>0).toString()};function na(){this.state="INITIAL",this.buffer="",this.decoder=new Us,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}function ra(e,t,i){return ia(e.toString())+ia(t.toString())+ia(i)}var sa="stpp.ttml.im1t",aa=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,oa=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,la={left:"start",center:"center",right:"end",start:"start",end:"end"};function da(e,t,i,n){var r=C(new Uint8Array(e),["mdat"]);if(0!==r.length){var s,r=r.map(function(e){return $e(e)}),a=Zn(t.baseTime,1,1/(t=void 0===(t=t.timescale)?1:t),s=void 0===s?!1:s);try{r.forEach(function(e){return i(function(e,d){var i,u,c,h,f,n=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(n)return i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},u=Object.keys(i).reduce(function(e,t){return e[t]=n.getAttribute("ttp:"+t)||i[t],e},{}),c="preserve"!==n.getAttribute("xml:space"),h=ca(ua(n,"styling","style")),f=ca(ua(n,"layout","region")),e=ua(n,"body","[begin]"),[].map.call(e,function(e){var t=function n(e,r){return[].slice.call(e.childNodes).reduce(function(e,t,i){return"br"===t.nodeName&&i?e+"\n":null!=(i=t.childNodes)&&i.length?n(t,r):r?e+t.textContent.trim().replace(/\s+/g," "):e+t.textContent},"")}(e,c);if(!t||!e.hasAttribute("begin"))return null;var i=pa(e.getAttribute("begin"),u),n=pa(e.getAttribute("dur"),u),r=pa(e.getAttribute("end"),u);if(null===i)throw fa(e);if(null===r){if(null===n)throw fa(e);r=i+n}var s,a,o,l,n=new Bs(i-d,r-d,t),t=(n.id=ra(n.startTime,n.endTime,n.text),s=f[e.getAttribute("region")],a=h[e.getAttribute("style")],i=h,o="http://www.w3.org/ns/ttml#styling",(r=(l=null)!=s&&s.hasAttribute("style")?s.getAttribute("style"):null)&&i.hasOwnProperty(r)&&(l=i[r]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(function(e,t){var i=ha(a,o,t)||ha(s,o,t)||ha(l,o,t);return i&&(e[t]=i),e},{})),e=t.textAlign;return e&&((i=la[e])&&(n.lineAlign=i),n.align=e),J(n,t),n}).filter(function(e){return null!==e});throw new Error("Invalid ttml")}(e,a))})}catch(e){n(e)}}else n(new Error("Could not parse IMSC1 mdat"))}function ua(e,t,i){e=e.getElementsByTagName(t)[0];return e?[].slice.call(e.querySelectorAll(i)):[]}function ca(e){return e.reduce(function(e,t){var i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function ha(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function fa(e){return new Error("Could not parse ttml timestamp "+e)}function pa(n,e){var t,i,r,s;return n?(null===(t=Ys(n))&&(aa.test(n)?(i=e,r=aa.exec(n),s=(0|r[4])+(0|r[5])/i.subFrameRate,t=3600*(0|r[1])+60*(0|r[2])+(0|r[3])+s/i.frameRate):oa.test(n)&&(t=function(e){var t=oa.exec(n),i=Number(t[1]);switch(t[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}(e))),t):null}(i=ga.prototype).destroy=function(){var e=this.hls;e.off(Z.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(Z.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(Z.MANIFEST_LOADING,this.onManifestLoading,this),e.off(Z.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(Z.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(Z.FRAG_LOADING,this.onFragLoading,this),e.off(Z.FRAG_LOADED,this.onFragLoaded,this),e.off(Z.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(Z.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(Z.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(Z.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(Z.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(e,t,i,n,r){for(var s,a,o,l=!1,d=r.length;d--;){var u=r[d],c=(s=u[0],c=u[1],a=t,Math.min(c,i)-Math.max(s,a));if(0<=c&&(u[0]=Math.min(u[0],t),u[1]=Math.max(u[1],i),l=!0,.5this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping)},i.getMaxLevel=function(i){var n=this,e=this.hls.levels;return e.length?(e=e.filter(function(e,t){return n.isLevelAllowed(e)&&t<=i}),this.clientRect=null,Ea.getMaxLevelByMediaSize(e,this.mediaWidth,this.mediaHeight)):-1},i.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){var e,t,i;return this.clientRect||(t={width:0,height:0},(e=this.media)&&(i=e.getBoundingClientRect(),t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)),this.clientRect=t)},i.isLevelAllowed=function(t){return!this.restrictedLevels.some(function(e){return t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height})},Ea.getMaxLevelByMediaSize=function(e,t,i){if(null==e||!e.length)return-1;for(var n,r=e.length-1,s=0;s=t||a.height>=i)&&(!(n=e[s+1])||a.width!==n.width||a.height!==n.height)){r=s;break}}return r},r(Ea,[{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}}]);var i=Ea,ma=((ma=Ta.prototype).setStreamController=function(e){this.streamController=e},ma.registerListeners=function(){this.hls.on(Z.MEDIA_ATTACHING,this.onMediaAttaching,this)},ma.unregisterListeners=function(){this.hls.off(Z.MEDIA_ATTACHING,this.onMediaAttaching,this)},ma.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},ma.onMediaAttaching=function(e,t){var i=this.hls.config;i.capLevelOnFPSDrop&&(t=t.media instanceof self.HTMLVideoElement?t.media:null,(this.media=t)&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod))},ma.checkFPS=function(e,t,i){var n,r,s,a,o=performance.now();t&&(this.lastTime&&(a=o-this.lastTime,n=i-this.lastDroppedFrames,r=t-this.lastDecodedFrames,a=1e3*n/a,(s=this.hls).trigger(Z.FPS_DROP,{currentDropped:n,currentDecoded:r,totalDroppedFrames:i}),0s.config.fpsDroppedMonitoringThreshold*r&&(a=s.currentLevel,ie.warn("drop FPS ratio greater than max allowed value for currentLevel: "+a),0=a)&&(s.trigger(Z.FPS_DROP_LEVEL_CAPPING,{level:--a,droppedLevel:s.currentLevel}),s.autoLevelCapping=a,this.streamController.nextLevelSwitch()),this.lastTime=o,this.lastDroppedFrames=i,this.lastDecodedFrames=t)},ma.checkFPSInterval=function(){var e,t=this.media;t&&(this.isVideoPlaybackQualityAvailable?(e=t.getVideoPlaybackQuality(),this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)):this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount))},Ta),va="[eme]",k=((k=ya.prototype).destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},k.registerListeners=function(){this.hls.on(Z.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Z.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Z.MANIFEST_LOADED,this.onManifestLoaded,this)},k.unregisterListeners=function(){this.hls.off(Z.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Z.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Z.MANIFEST_LOADED,this.onManifestLoaded,this)},k.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,t=t.widevineLicenseUrl,i=i[e];if(i)return i.licenseUrl;if(e===m.WIDEVINE&&t)return t;throw new Error('no license server URL configured for key-system "'+e+'"')},k.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},k.attemptKeySystemAccess=function(e){function t(e,t,i){return!!e&&i.indexOf(e)===t}var a=this,i=this.hls.levels,o=i.map(function(e){return e.audioCodec}).filter(t),l=i.map(function(e){return e.videoCodec}).filter(t);return o.length+l.length===0&&l.push("avc1.42e01e"),new Promise(function(r,s){!function t(i){var n=i.shift();a.getMediaKeysPromise(n,o,l).then(function(e){return r({keySystem:n,mediaKeys:e})}).catch(function(e){i.length?t(i):s(e instanceof ka?e:new ka({type:ee.KEY_SYSTEM_ERROR,details:te.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))})}(e)})},k.requestMediaKeySystemAccess=function(e,t){var i,n=this.config.requestMediaKeySystemAccessFunc;return"function"!=typeof n?(i="Configured requestMediaKeySystemAccess is not a function "+n,null===Re&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(i))):n(e,t)},k.getMediaKeysPromise=function(n,e,t){var r,s=this,e=function(e,t,i,n){var r,s;switch(e){case m.FAIRPLAY:r=["cenc","sinf"];break;case m.WIDEVINE:case m.PLAYREADY:r=["cenc"];break;case m.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+e)}return i=i,[{initDataTypes:r,persistentState:(s=n).persistentState||"not-allowed",distinctiveIdentifier:s.distinctiveIdentifier||"not-allowed",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map(function(e){return{contentType:'audio/mp4; codecs="'+e+'"',robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}}),videoCapabilities:i.map(function(e){return{contentType:'video/mp4; codecs="'+e+'"',robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}})}]}(n,e,t,this.config.drmSystemOptions),i=this.keySystemAccessPromises[n],t=null==i?void 0:i.keySystemAccess;return t?t.then(function(){return i.mediaKeys}):(this.log('Requesting encrypted media "'+n+'" key-system access with config: '+JSON.stringify(e)),t=this.requestMediaKeySystemAccess(n,e),r=this.keySystemAccessPromises[n]={keySystemAccess:t},t.catch(function(e){s.log('Failed to obtain access to key-system "'+n+'": '+e)}),t.then(function(e){s.log('Access for key-system "'+e.keySystem+'" obtained');var i=s.fetchServerCertificate(n);return s.log('Create media-keys for "'+n+'"'),r.mediaKeys=e.createMediaKeys().then(function(t){return s.log('Media-keys created for "'+n+'"'),i.then(function(e){return e?s.setMediaKeysServerCertificate(t,n,e):t})}),r.mediaKeys.catch(function(e){s.error('Failed to create media-keys for "'+n+'"}: '+e)}),r.mediaKeys}))},k.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,e=e.mediaKeys,n=(this.log('Creating key-system session "'+i+'" keyId: '+Ke(t.keyId||[])),e.createSession()),t={decryptdata:t,keySystem:i,mediaKeys:e,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(t),t},k.renewKeySession=function(e){var t,i,n=e.decryptdata;n.pssh?(t=this.createMediaKeySessionContext(e),i=this.getKeyIdString(n),this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(t,"cenc",n.pssh,"expired")):this.warn("Could not renew expired session. Missing pssh initData."),this.removeSession(e)},k.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return Ke(e.keyId)},k.updateKeySession=function(e,t){var i=e.mediaKeysSession;return this.log('Updating key-session "'+i.sessionId+'" for keyID '+Ke((null==(e=e.decryptdata)?void 0:e.keyId)||[])+"\n } (data length: "+(t&&t.byteLength)+")"),i.update(t)},k.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},k.getKeyFormatPromise=function(r){var s=this;return new Promise(function(i,n){var t=Ce(s.config),e=r.map(we).filter(function(e){return!!e&&-1!==t.indexOf(e)});return s.getKeySystemSelectionPromise(e).then(function(e){var e=e.keySystem,t=Le(e);t?i(t):n(new Error('Unable to find format for key-system "'+e+'"'))}).catch(n)})},k.loadKey=function(n){var r=this,s=n.keyInfo.decryptdata,e=this.getKeyIdString(s),a="(keyId: "+e+' format: "'+s.keyFormat+'" method: '+s.method+" uri: "+s.uri+")",t=(this.log("Starting session for key "+a),this.keyIdToKeySessionPromise[e]);return t||(t=this.keyIdToKeySessionPromise[e]=this.getKeySystemForKeyPromise(s).then(function(e){var t=e.keySystem,i=e.mediaKeys;return r.throwIfDestroyed(),r.log("Handle encrypted media sn: "+n.frag.sn+" "+n.frag.type+": "+n.frag.level+" using key "+a),r.attemptSetMediaKeys(t,i).then(function(){r.throwIfDestroyed();var e=r.createMediaKeySessionContext({keySystem:t,mediaKeys:i,decryptdata:s});return r.generateRequestWithPreferredKeySession(e,"cenc",s.pssh,"playlist-key")})})).catch(function(e){return r.handleError(e)}),t},k.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},k.handleError=function(e){this.hls&&(this.error(e.message),e instanceof ka?this.hls.trigger(Z.ERROR,e.data):this.hls.trigger(Z.ERROR,{type:ee.KEY_SYSTEM_ERROR,details:te.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},k.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),t=this.keyIdToKeySessionPromise[t];return t||(e=(t=we(e.keyFormat))?[t]:Ce(this.config),this.attemptKeySystemAccess(e))},k.getKeySystemSelectionPromise=function(e){if(0===(e=e.length?e:Ce(this.config)).length)throw new ka({type:ee.KEY_SYSTEM_ERROR,details:te.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},k._onMediaEncrypted=function(e){var r,t,s=this,a=e.initDataType,o=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+a+'"'),null!==o){if("sinf"===a&&this.config.drmSystems[m.FAIRPLAY]){var i=v(new Uint8Array(o));try{var n=ye(JSON.parse(i).sinf),l=ze(new Uint8Array(n));if(!l)return;r=l.subarray(8,24),t=m.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var d=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;var t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),n=i.getUint32(0);if(e.byteLength!==n&&44>>24,1e||400<=s.status&&s.status<500?n(new ka({type:ee.KEY_SYSTEM_ERROR,details:te.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:{url:r,data:void 0,code:s.status,text:s.statusText}},"License Request XHR failed ("+r+"). Status: "+s.status+" ("+s.statusText+")")):(t=e-l._requestLicenseFailureCount+1,l.warn("Retrying license request, "+t+" attempts left"),l.requestLicense(a,o).then(i,n))}},a.licenseXhr&&a.licenseXhr.readyState!==XMLHttpRequest.DONE&&a.licenseXhr.abort(),a.licenseXhr=s,l.setupLicenseXHR(s,r,a,o).then(function(e){var t=e.xhr,e=e.licenseChallenge;t.send(e)})})},k.onMediaAttached=function(e,t){this.config.emeEnabled&&(t=t.media,(this.media=t).addEventListener("encrypted",this.onMediaEncrypted),t.addEventListener("waitingforkey",this.onWaitingForKey))},k.onMediaDetached=function(){var t=this,i=this.media,e=this.mediaKeySessions,n=(i&&(i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},tt.clearKeyUriToKeyIdMap(),e.length);ya.CDMCleanupPromise=Promise.all(e.map(function(e){return t.removeSession(e)}).concat(null==i?void 0:i.setMediaKeys(null).catch(function(e){t.log("Could not clear media keys: "+e+". media.src: "+(null==i?void 0:i.src))}))).then(function(){n&&(t.log("finished closing key sessions and clearing media keys"),e.length=0)}).catch(function(e){t.log("Could not close sessions and clear media keys: "+e+". media.src: "+(null==i?void 0:i.src))})},k.onManifestLoaded=function(e,t){var t=t.sessionKeys;t&&this.config.emeEnabled&&!this.keyFormatPromise&&(t=t.reduce(function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e},[]),this.log("Selecting key-system from session-keys "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t))},k.removeSession=function(e){var t=this,i=e.mediaKeysSession,n=e.licenseXhr;if(i)return this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0,-1<(n=this.mediaKeySessions.indexOf(e))&&this.mediaKeySessions.splice(n,1),i.remove().catch(function(e){t.log("Could not remove session: "+e)}).then(function(){return i.close()}).catch(function(e){t.log("Could not close session: "+e)})},ya);function ya(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=ya.CDMCleanupPromise?[ya.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=ie.debug.bind(ie,va),this.log=ie.log.bind(ie,va),this.warn=ie.warn.bind(ie,va),this.error=ie.error.bind(ie,va),this.hls=e,this.config=e.config,this.registerListeners()}function Ta(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()}function Ea(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()}k.CDMCleanupPromise=void 0;e(_a,ba=I(Error));var ba,ka=_a,Sa="m",wa="a",Aa="v",La="av",Ca=((Ca=xa.prototype).registerListeners=function(){var e=this.hls;e.on(Z.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(Z.MEDIA_DETACHED,this.onMediaDetached,this),e.on(Z.BUFFER_CREATED,this.onBufferCreated,this)},Ca.unregisterListeners=function(){var e=this.hls;e.off(Z.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(Z.MEDIA_DETACHED,this.onMediaDetached,this),e.off(Z.BUFFER_CREATED,this.onBufferCreated,this)},Ca.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},Ca.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},Ca.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},Ca.onBufferCreated=function(e,t){var i;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer},Ca.createData=function(){var e;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},Ca.apply=function(e,t){J(t=void 0===t?{}:t,this.createData());var i="i"===t.ot||t.ot===Aa||t.ot===La;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering),this.useHeaders?(i=xa.toHeaders(t),Object.keys(i).length&&(e.headers||(e.headers={}),J(e.headers,i))):(i=xa.toQuery(t))&&(e.url=xa.appendQueryToUri(e.url,i))},Ca.getObjectType=function(e){var t=e.type;return"subtitle"===t?"tt":"initSegment"===e.sn?"i":"audio"===t?wa:"main"===t?this.hls.audioTracks.length?Aa:La:void 0},Ca.getTopBandwidth=function(e){for(var t=0,i=this.hls,n=O(e===wa?i.audioTracks:(e=-1<(e=i.maxAutoLevel)?e+1:i.levels.length,i.levels.slice(0,e)));!(r=n()).done;){var r=r.value;r.bitrate>t&&(t=r.bitrate)}return 0=a&&o(r,s,l.flush(),n)):o(r,s,e,n),i())}).catch(function(){return Promise.reject()})}()},Fa);function Fa(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Ua,this.controller=new self.AbortController,this.stats=new oe}function Ba(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=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new oe,this.retryDelay=0}function Ua(e,t){return new self.Request(e.url,t)}e(ja,$a=I(Error));var $a,Ka=ja,Ha=/\s/,Ga=p(p({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength: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,loader:Oa,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:l,bufferController:o,capLevelController:i,errorController:t,fpsController:ma,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Re,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,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(t,e,i,n){for(var r,s,a,o,l=[],d=self.VTTCue||self.TextTrackCue,u=0;u=t)return n;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping,i=this.maxHdcpLevel,t=-1===t&&e&&e.length?e.length-1:t;if(i)for(var n=t;n--;){var r=e[n].attrs["HDCP-LEVEL"];if(r&&r<=i)return n}return t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.4.0"}},{key:"Events",get:function(){return Z}},{key:"ErrorTypes",get:function(){return ee}},{key:"ErrorDetails",get:function(){return te}},{key:"DefaultConfig",get:function(){return Ya.defaultConfig||Ga},set:function(e){Ya.defaultConfig=e}}]);var w,l=Ya;function Ya(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Ar,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,W(e.debug||!1,"Hls instance");var t=this.config=function(e,l){if((l.liveSyncDurationCount||l.liveMaxLatencyDurationCount)&&(l.liveSyncDuration||l.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==l.liveMaxLatencyDurationCount&&(void 0===l.liveSyncDurationCount||l.liveMaxLatencyDurationCount<=l.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==l.liveMaxLatencyDuration&&(void 0===l.liveSyncDuration||l.liveMaxLatencyDuration<=l.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var d=qa(e),t=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(r){var s=("level"===r?"playlist":r)+"LoadPolicy",a=void 0===l[s],o=[];t.forEach(function(e){var t=r+"Loading"+e,i=l[t];if(void 0!==i&&a){o.push(t);var n=d[s].default;switch(l[s]={default:n},e){case"TimeOut":n.maxLoadTimeMs=i,n.maxTimeToFirstByteMs=i;break;case"MaxRetry":n.errorRetry.maxNumRetry=i,n.timeoutRetry.maxNumRetry=i;break;case"RetryDelay":n.errorRetry.retryDelayMs=i,n.timeoutRetry.retryDelayMs=i;break;case"MaxRetryTimeout":n.errorRetry.maxRetryDelayMs=i,n.timeoutRetry.maxRetryDelayMs=i}}}),o.length&&ie.warn('hls.js config: "'+o.join('", "')+'" setting(s) are deprecated, use "'+s+'": '+JSON.stringify(l[s]))}),p(p({},d),l)}(Ya.DefaultConfig,e),i=(this.userConfig=e,this._autoLevelCapping=-1,t.progressive&&((i=(e=t).loader)!==Ma&&i!==Oa?(ie.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),1}catch(e){}}()&&(e.loader=Ma,e.progressive=!0,e.enableSoftwareAES=!0,ie.log("[config]: Progressive streaming enabled, using FetchLoader"))),t.abrController),e=t.bufferController,n=t.capLevelController,r=t.errorController,s=t.fpsController,r=new r(this),a=this.abrController=new i(this),e=this.bufferController=new e(this),n=this.capLevelController=new n(this),s=new s(this),o=new _t(this),l=new Kt(this),d=t.contentSteeringController,d=d?new d(this):null,u=this.levelController=new fi(this,d),c=new Si(this),h=new Ni(this.config),f=this.streamController=new Br(this,c,h),o=(n.setStreamController(f),s.setStreamController(f),[o,u,f]),u=(d&&o.splice(1,0,d),this.networkControllers=o,[a,e,n,s,l,c]),f=(this.audioTrackController=this.createController(t.audioTrackController,o),t.audioStreamController),d=(f&&o.push(new f(this,c,h)),this.subtitleTrackController=this.createController(t.subtitleTrackController,o),t.subtitleStreamController),a=(d&&o.push(new d(this,c,h)),this.createController(t.timelineController,u),h.emeController=this.emeController=this.createController(t.emeController,u),this.cmcdController=this.createController(t.cmcdController,u),this.latencyController=this.createController(Ht,u),this.coreComponents=u,o.push(r),r.onErrorOut);"function"==typeof a&&this.on(Z.ERROR,a,r)}return l.defaultConfig=void 0,l};"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Hls=t()}(!1),function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(e.document)return t(e);throw new Error("jQuery requires a window with a document")}:t(e)}("undefined"!=typeof window?window:this,function(k,M){"use strict";function y(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item}function g(e){return null!=e&&e===e.window}var t=[],F=Object.getPrototypeOf,o=t.slice,B=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},U=t.push,$=t.indexOf,K={},H=K.toString,G=K.hasOwnProperty,j=G.toString,q=j.call(Object),m={},S=k.document,Y={type:!0,src:!0,nonce:!0,noModule:!0};function V(e,t,i){var n,r,s=(i=i||S).createElement("script");if(s.text=e,t)for(n in Y)(r=t[n]||t.getAttribute&&t.getAttribute(n))&&s.setAttribute(n,r);i.head.appendChild(s).parentNode.removeChild(s)}function p(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?K[H.call(e)]||"object":typeof e}var w=function(e,t){return new w.fn.init(e,t)};function W(e){var t=!!e&&"length"in e&&e.length,i=p(e);return!y(e)&&!g(e)&&("array"===i||0===t||"number"==typeof t&&0>10|55296,1023&e|56320))}function F(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}function B(){k()}var e,h,E,s,U,f,$,K,b,l,d,k,S,i,w,p,n,r,g,A="sizzle"+ +new Date,u=M.document,L=0,H=0,G=D(),j=D(),q=D(),m=D(),Y=function(e,t){return e===t&&(d=!0),0},V={}.hasOwnProperty,t=[],W=t.pop,z=t.push,C=t.push,X=t.slice,y=function(e,t){for(var i=0,n=e.length;i+~]|"+a+")"+a+"*"),ne=new RegExp(a+"|>"),re=new RegExp(Z),se=new RegExp("^"+o+"$"),T={ID:new RegExp("^#("+o+")"),CLASS:new RegExp("^\\.("+o+")"),TAG:new RegExp("^("+o+"|[*])"),ATTR:new RegExp("^"+J),PSEUDO:new RegExp("^"+Z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+a+"*(even|odd|(([+-]|)(\\d*)n|)"+a+"*(?:([+-]|)"+a+"*(\\d+)|))"+a+"*\\)|)","i"),bool:new RegExp("^(?:"+Q+")$","i"),needsContext:new RegExp("^"+a+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+a+"*((?:-\\d)?\\d*)"+a+"*\\)|)(?=[^-]|$)","i")},ae=/HTML$/i,oe=/^(?:input|select|textarea|button)$/i,le=/^h\d$/i,R=/^[^{]+\{\s*\[native \w/,de=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ue=/[+~]/,x=new RegExp("\\\\[\\da-fA-F]{1,6}"+a+"?|\\\\([^\\r\\n\\f])","g"),ce=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,he=ye(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{C.apply(t=X.call(u.childNodes),u.childNodes),t[u.childNodes.length].nodeType}catch(e){C={apply:t.length?function(e,t){z.apply(e,X.call(t))}:function(e,t){for(var i=e.length,n=0;e[i++]=t[n++];);e.length=i-1}}}function _(e,t,i,n){var r,s,a,o,l,d,u=t&&t.ownerDocument,c=t?t.nodeType:9;if(i=i||[],"string"!=typeof e||!e||1!==c&&9!==c&&11!==c)return i;if(!n&&(k(t),t=t||S,w)){if(11!==c&&(o=de.exec(e)))if(r=o[1]){if(9===c){if(!(d=t.getElementById(r)))return i;if(d.id===r)return i.push(d),i}else if(u&&(d=u.getElementById(r))&&g(t,d)&&d.id===r)return i.push(d),i}else{if(o[2])return C.apply(i,t.getElementsByTagName(e)),i;if((r=o[3])&&h.getElementsByClassName&&t.getElementsByClassName)return C.apply(i,t.getElementsByClassName(r)),i}if(h.qsa&&!m[e+" "]&&(!p||!p.test(e))&&(1!==c||"object"!==t.nodeName.toLowerCase())){if(d=e,u=t,1===c&&(ne.test(e)||ie.test(e))){for((u=ue.test(e)&&me(t.parentNode)||t)===t&&h.scope||((a=t.getAttribute("id"))?a=a.replace(ce,F):t.setAttribute("id",a=A)),s=(l=f(e)).length;s--;)l[s]=(a?"#"+a:":scope")+" "+N(l[s]);d=l.join(",")}try{if(h.cssSupportsSelector&&!CSS.supports("selector(:is("+d+"))"))throw new Error;return C.apply(i,u.querySelectorAll(d)),i}catch(t){m(e,!0)}finally{a===A&&t.removeAttribute("id")}}}return K(e.replace(v,"$1"),t,i,n)}function D(){var n=[];return function e(t,i){return n.push(t+" ")>E.cacheLength&&delete e[n.shift()],e[t+" "]=i}}function I(e){return e[A]=!0,e}function P(e){var t=S.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t)}}function fe(e,t){for(var i=e.split("|"),n=i.length;n--;)E.attrHandle[i[n]]=t}function pe(e,t){var i=t&&e,n=i&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(n)return n;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&he(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function O(a){return I(function(s){return s=+s,I(function(e,t){for(var i,n=a([],e.length,s),r=n.length;r--;)e[i=n[r]]&&(e[i]=!(t[i]=e[i]))})})}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in h=_.support={},U=_.isXML=function(e){var t=e&&e.namespaceURI,e=e&&(e.ownerDocument||e).documentElement;return!ae.test(t||e&&e.nodeName||"HTML")},k=_.setDocument=function(e){var e=e?e.ownerDocument||e:u;return e!=S&&9===e.nodeType&&e.documentElement&&(i=(S=e).documentElement,w=!U(S),u!=S&&(e=S.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",B,!1):e.attachEvent&&e.attachEvent("onunload",B)),h.scope=P(function(e){return i.appendChild(e).appendChild(S.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),h.cssSupportsSelector=P(function(){return CSS.supports("selector(*)")&&S.querySelectorAll(":is(:jqfake)")&&!CSS.supports("selector(:is(*,:jqfake))")}),h.attributes=P(function(e){return e.className="i",!e.getAttribute("className")}),h.getElementsByTagName=P(function(e){return e.appendChild(S.createComment("")),!e.getElementsByTagName("*").length}),h.getElementsByClassName=R.test(S.getElementsByClassName),h.getById=P(function(e){return i.appendChild(e).id=A,!S.getElementsByName||!S.getElementsByName(A).length}),h.getById?(E.filter.ID=function(e){var t=e.replace(x,c);return function(e){return e.getAttribute("id")===t}},E.find.ID=function(e,t){if(void 0!==t.getElementById&&w)return(t=t.getElementById(e))?[t]:[]}):(E.filter.ID=function(e){var t=e.replace(x,c);return function(e){e=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return e&&e.value===t}},E.find.ID=function(e,t){if(void 0!==t.getElementById&&w){var i,n,r,s=t.getElementById(e);if(s){if((i=s.getAttributeNode("id"))&&i.value===e)return[s];for(r=t.getElementsByName(e),n=0;s=r[n++];)if((i=s.getAttributeNode("id"))&&i.value===e)return[s]}return[]}}),E.find.TAG=h.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):h.qsa?t.querySelectorAll(e):void 0}:function(e,t){var i,n=[],r=0,s=t.getElementsByTagName(e);if("*"!==e)return s;for(;i=s[r++];)1===i.nodeType&&n.push(i);return n},E.find.CLASS=h.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&w)return t.getElementsByClassName(e)},n=[],p=[],(h.qsa=R.test(S.querySelectorAll))&&(P(function(e){var t;i.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&p.push("[*^$]="+a+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||p.push("\\["+a+"*(?:value|"+Q+")"),e.querySelectorAll("[id~="+A+"-]").length||p.push("~="),(t=S.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||p.push("\\["+a+"*name"+a+"*="+a+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||p.push(":checked"),e.querySelectorAll("a#"+A+"+*").length||p.push(".#.+[+~]"),e.querySelectorAll("\\\f"),p.push("[\\r\\n\\f]")}),P(function(e){e.innerHTML="";var t=S.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&p.push("name"+a+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&p.push(":enabled",":disabled"),i.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&p.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),p.push(",.*:")})),(h.matchesSelector=R.test(r=i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.oMatchesSelector||i.msMatchesSelector))&&P(function(e){h.disconnectedMatch=r.call(e,"*"),r.call(e,"[s!='']:x"),n.push("!=",Z)}),h.cssSupportsSelector||p.push(":has"),p=p.length&&new RegExp(p.join("|")),n=n.length&&new RegExp(n.join("|")),e=R.test(i.compareDocumentPosition),g=e||R.test(i.contains)?function(e,t){var i=9===e.nodeType&&e.documentElement||e,t=t&&t.parentNode;return e===t||!(!t||1!==t.nodeType||!(i.contains?i.contains(t):e.compareDocumentPosition&&16&e.compareDocumentPosition(t)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Y=e?function(e,t){var i;return e===t?(d=!0,0):!e.compareDocumentPosition-!t.compareDocumentPosition||(1&(i=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!h.sortDetached&&t.compareDocumentPosition(e)===i?e==S||e.ownerDocument==u&&g(u,e)?-1:t==S||t.ownerDocument==u&&g(u,t)?1:l?y(l,e)-y(l,t):0:4&i?-1:1)}:function(e,t){if(e===t)return d=!0,0;var i,n=0,r=e.parentNode,s=t.parentNode,a=[e],o=[t];if(!r||!s)return e==S?-1:t==S?1:r?-1:s?1:l?y(l,e)-y(l,t):0;if(r===s)return pe(e,t);for(i=e;i=i.parentNode;)a.unshift(i);for(i=t;i=i.parentNode;)o.unshift(i);for(;a[n]===o[n];)n++;return n?pe(a[n],o[n]):a[n]==u?-1:o[n]==u?1:0}),S},_.matches=function(e,t){return _(e,null,null,t)},_.matchesSelector=function(e,t){if(k(e),h.matchesSelector&&w&&!m[t+" "]&&(!n||!n.test(t))&&(!p||!p.test(t)))try{var i=r.call(e,t);if(i||h.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){m(t,!0)}return 0<_(t,S,null,[e]).length},_.contains=function(e,t){return(e.ownerDocument||e)!=S&&k(e),g(e,t)},_.attr=function(e,t){(e.ownerDocument||e)!=S&&k(e);var i=E.attrHandle[t.toLowerCase()],i=i&&V.call(E.attrHandle,t.toLowerCase())?i(e,t,!w):void 0;return void 0!==i?i:h.attributes||!w?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},_.escape=function(e){return(e+"").replace(ce,F)},_.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},_.uniqueSort=function(e){var t,i=[],n=0,r=0;if(d=!h.detectDuplicates,l=!h.sortStable&&e.slice(0),e.sort(Y),d){for(;t=e[r++];)t===e[r]&&(n=i.push(r));for(;n--;)e.splice(i[n],1)}return l=null,e},s=_.getText=function(e){var t,i="",n=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=s(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[n++];)i+=s(t);return i},(E=_.selectors={cacheLength:50,createPseudo:I,match:T,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(x,c),e[3]=(e[3]||e[4]||e[5]||"").replace(x,c),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||_.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&_.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return T.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&re.test(i)&&(t=(t=f(i,!0))&&i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(x,c).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=G[e+" "];return t||(t=new RegExp("(^|"+a+")"+e+"("+a+"|$)"))&&G(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(t,i,n){return function(e){e=_.attr(e,t);return null==e?"!="===i:!i||(e+="","="===i?e===n:"!="===i?e!==n:"^="===i?n&&0===e.indexOf(n):"*="===i?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function J(e,i,n){return y(i)?w.grep(e,function(e,t){return!!i.call(e,t,e)!==n}):i.nodeType?w.grep(e,function(e){return e===i!==n}):"string"!=typeof i?w.grep(e,function(e){return-1<$.call(i,e)!==n}):w.filter(i,e,n)}w.filter=function(e,t,i){var n=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?w.find.matchesSelector(n,e)?[n]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,i,n=this.length,r=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t)[^>]*|#([\w-]+))$/,te=((w.fn.init=function(e,t,i){if(e){if(i=i||Z,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):y(e)?void 0!==i.ready?i.ready(e):e(w):w.makeArray(e,this);if(!(n="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:ee.exec(e))||!n[1]&&t)return(!t||t.jquery?t||i:this.constructor(t)).find(e);if(n[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:S,!0)),Q.test(n[1])&&w.isPlainObject(t))for(var n in t)y(this[n])?this[n](t[n]):this.attr(n,t[n])}else(i=S.getElementById(n[2]))&&(this[0]=i,this.length=1)}return this}).prototype=w.fn,Z=w(S),/^(?:parents|prev(?:Until|All))/),ie={children:!0,contents:!0,next:!0,prev:!0};function ne(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}w.fn.extend({has:function(e){var t=w(e,this),i=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Se=/^$|^module$|\/(?:java|ecma)script/i,i=S.createDocumentFragment().appendChild(S.createElement("div")),R=((s=S.createElement("input")).setAttribute("type","radio"),s.setAttribute("checked","checked"),s.setAttribute("name","t"),i.appendChild(s),m.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,i.innerHTML="",m.noCloneChecked=!!i.cloneNode(!0).lastChild.defaultValue,i.innerHTML="",m.option=!!i.lastChild,{thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]});function x(e,t){var i=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&l(e,t)?w.merge([e],i):i}function we(e,t){for(var i=0,n=e.length;i",""]);var Ae=/<|&#?\w+;/;function Le(e,t,i,n,r){for(var s,a,o,l,d,u=t.createDocumentFragment(),c=[],h=0,f=e.length;h\s*$/g;function Oe(e,t){return l(e,"table")&&l(11!==t.nodeType?t:t.firstChild,"tr")&&w(e).children("tbody")[0]||e}function Ne(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var i,n,r,s;if(1===t.nodeType){if(E.hasData(e)&&(s=E.get(e).events))for(r in E.remove(t,"handle events"),s)for(i=0,n=s[r].length;i").attr(i.scriptAttrs||{}).prop({charset:i.scriptCharset,src:i.url}).on("load error",r=function(e){n.remove(),r=null,e&&t("error"===e.type?404:200,e.type)}),S.head.appendChild(n[0])},abort:function(){r&&r()}}});var zt=[],Xt=/(=)\?(?=&|$)|\?\?/,Qt=(w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||w.expando+"_"+Rt.guid++;return this[e]=!0,e}}),w.ajaxPrefilter("json jsonp",function(e,t,i){var n,r,s,a=!1!==e.jsonp&&(Xt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Xt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return n=e.jsonpCallback=y(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Xt,"$1"+n):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+n),e.converters["script json"]=function(){return s||w.error(n+" was not called"),s[0]},e.dataTypes[0]="json",r=k[n],k[n]=function(){s=arguments},i.always(function(){void 0===r?w(k).removeProp(n):k[n]=r,e[n]&&(e.jsonpCallback=t.jsonpCallback,zt.push(n)),s&&y(r)&&r(s[0]),s=r=void 0}),"script"}),m.createHTMLDocument=((s=S.implementation.createHTMLDocument("").body).innerHTML="
",2===s.childNodes.length),w.parseHTML=function(e,t,i){return"string"!=typeof e?[]:("boolean"==typeof t&&(i=t,t=!1),t||(m.createHTMLDocument?((n=(t=S.implementation.createHTMLDocument("")).createElement("base")).href=S.location.href,t.head.appendChild(n)):t=S),n=!i&&[],(i=Q.exec(e))?[t.createElement(i[1])]:(i=Le([e],t,n),n&&n.length&&w(n).remove(),w.merge([],i.childNodes)));var n},w.fn.load=function(e,t,i){var n,r,s,a=this,o=e.indexOf(" ");return-1").append(w.parseHTML(e)).find(n):e)}).always(i&&function(e,t){a.each(function(){i.apply(this,s||[e.responseText,t,e])})}),this},w.expr.pseudos.animated=function(t){return w.grep(w.timers,function(e){return t===e.elem}).length},w.offset={setOffset:function(e,t,i){var n,r,s,a,o=w.css(e,"position"),l=w(e),d={};"static"===o&&(e.style.position="relative"),s=l.offset(),n=w.css(e,"top"),a=w.css(e,"left"),o=("absolute"===o||"fixed"===o)&&-1<(n+a).indexOf("auto")?(r=(o=l.position()).top,o.left):(r=parseFloat(n)||0,parseFloat(a)||0),null!=(t=y(t)?t.call(e,i,w.extend({},s)):t).top&&(d.top=t.top-s.top+r),null!=t.left&&(d.left=t.left-s.left+o),"using"in t?t.using.call(e,d):l.css(d)}},w.fn.extend({offset:function(t){var e,i;return arguments.length?void 0===t?this:this.each(function(e){w.offset.setOffset(this,t,e)}):(i=this[0])?i.getClientRects().length?(e=i.getBoundingClientRect(),i=i.ownerDocument.defaultView,{top:e.top+i.pageYOffset,left:e.left+i.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,i,n=this[0],r={top:0,left:0};if("fixed"===w.css(n,"position"))t=n.getBoundingClientRect();else{for(t=this.offset(),i=n.ownerDocument,e=n.offsetParent||i.documentElement;e&&(e===i.body||e===i.documentElement)&&"static"===w.css(e,"position");)e=e.parentNode;e&&e!==n&&1===e.nodeType&&((r=w(e).offset()).top+=w.css(e,"borderTopWidth",!0),r.left+=w.css(e,"borderLeftWidth",!0))}return{top:t.top-r.top-w.css(n,"marginTop",!0),left:t.left-r.left-w.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===w.css(e,"position");)e=e.offsetParent;return e||b})}}),w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,r){var s="pageYOffset"===r;w.fn[t]=function(e){return c(this,function(e,t,i){var n;if(g(e)?n=e:9===e.nodeType&&(n=e.defaultView),void 0===i)return n?n[r]:e[t];n?n.scrollTo(s?n.pageXOffset:i,s?i:n.pageYOffset):e[t]=i},t,e,arguments.length)}}),w.each(["top","left"],function(e,i){w.cssHooks[i]=Ze(m.pixelPosition,function(e,t){if(t)return t=Je(e,i),We.test(t)?w(e).position()[i]+"px":t})}),w.each({Height:"height",Width:"width"},function(a,o){w.each({padding:"inner"+a,content:o,"":"outer"+a},function(n,s){w.fn[s]=function(e,t){var i=arguments.length&&(n||"boolean"!=typeof e),r=n||(!0===e||!0===t?"margin":"border");return c(this,function(e,t,i){var n;return g(e)?0===s.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(n=e.documentElement,Math.max(e.body["scroll"+a],n["scroll"+a],e.body["offset"+a],n["offset"+a],n["client"+a])):void 0===i?w.css(e,t,r):w.style(e,t,i,r)},o,i?e:void 0,i)}})}),w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}}),w.fn.extend({bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,i,n){return this.on(t,e,i,n)},undelegate:function(e,t,i){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),w.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,i){w.fn[i]=function(e,t){return 0["recommendations","history","browse","series","because_you_watched"].includes(e.response_type)),t=e.data.find(e=>"panel"===e.resource_type);home.data.main={banner:{id:t.panel.id,title:t.panel.title,description:t.panel.description,background:mapper.preventImageErrorTest(function(){return t.panel.images.poster_wide[0][4].source},t.panel.id)},lists:n.map(e=>({title:e.title,items:[]}))};for(var r=mapper.loaded=0;r0{session.refresh({success:function(e){var t="dynamic_collection"===n.resource_type?n.link:`/content/v2/cms/objects/${n.ids.join()}?locale=`+e.account.language,i=new Headers;return i.append("Authorization","Bearer "+e.access_token),i.append("Content-Type","application/x-www-form-urlencoded"),fetch(""+service.api.url+t,{headers:i}).then(e=>e.json()).then(e=>s.success(e,r)).catch(e=>{console.log(e)})}})},continue:function(e){var t=e.data[0];return{id:t.panel.id,stream:t.panel.streams_link.substr(t.panel.streams_link.indexOf("/videos/")+8,9),serie:t.panel.episode_metadata.series_title,episode:t.panel.title,season_number:t.panel.episode_metadata.season_number||0,episode_number:t.panel.episode_metadata.episode_number||0,description:t.panel.description,background:mapper.preventImageErrorTest(function(){return t.panel.images.thumbnail[0][4].source},t.panel.id),watched:!t.never_watched,playhead:Math.round(t.playhead/60),duration:Math.round(t.panel.episode_metadata.duration_ms/6e4),played:100*t.playhead/(t.panel.episode_metadata.duration_ms/1e3)}},seasons:function(e){return e.items.map(e=>({id:e.id,title:e.title,number:e.season_number}))},episodes:function(e,t){var n=e.items.map(e=>({id:e.id,title:e.title,episode:e.title,serie:e.series_title,description:e.description,episode_number:e.episode_number||0,season_number:e.season_number||0,background:mapper.preventImageErrorTest(function(){return e.images.thumbnail?e.images.thumbnail[0][1].source:""},e.id),stream:e.__links__.streams?e.__links__.streams.href.substr(e.__links__.streams.href.indexOf("/videos/")+8,9):void 0,duration:Math.round(e.duration_ms/6e4),premium:e.is_premium_only}));mapper.playheads(n,function(i){n=n.map(e=>{var t=i.get(e.id);return e.playhead=t?t.fully_watched?e.duration:Math.round(t.playhead/60):0,e}),t&&t(n)})},playheads:function(e,t){service.playheads({data:{ids:e.map(e=>e.id).join()},success:function(e){e=new Map(e.data.map(e=>[e.content_id,e]));t&&t(e)},error:function(e){console.log(e)}})},search:function(e){return e.data.reduce((e,t)=>"series"===t.type||"movie_listing"===t.type?[...e,...t.items.map(e=>({display:"serie",type:e.type,id:e.id,title:e.title,description:e.description,background:mapper.preventImageErrorTest(function(){return e.images.poster_wide[0][5].source},e.id),poster:mapper.preventImageErrorTest(function(){return e.images.poster_tall[0][2].source})}))]:e,[])},history:function(e){return e.data.filter(e=>e.panel).map(e=>({id:e.panel.episode_metadata.series_id,playhead:e.playhead?Math.round(e.playhead/60):0,duration:Math.round((e.panel||e).episode_metadata.duration_ms/6e4),title:e.panel?e.panel.episode_metadata.series_title:e.title,description:e.panel.title,background:mapper.preventImageErrorTest(function(){return(e.panel||e).images.thumbnail[0][4].source},e.panel.episode_metadata.series_id)}))},preventImageErrorTest:function(e,t){try{return e()}catch(e){return console.log("error image #"+t),"https://dummyimage.com/600x400/f48321/fff.png&text=IMAGE+"+t}},listByCategories:function(e,i,n){home.data.main={category:i[0].parent_category,banner:{id:"",title:"",description:"",background:""},lists:i.map(e=>({lazy:!0,id:e.tenant_category,title:e.localization.description,items:[]}))};for(var t=mapper.loadedSubcategories=0;t0{var t,i,n,r=e.playhead?Math.round(e.playhead/60):void 0,s=(e=e.panel||e).id,a="serie",o=e.title;return n="episode"===e.type?(s=e.episode_metadata.series_id,t=Math.round(e.episode_metadata.duration_ms/6e4),a="episode",o=e.episode_metadata.series_title,void(i=e.images.thumbnail[0][4].source)):"movie"==e.type?(t=Math.round(e.movie_metadata.duration_ms/6e4),a="episode",void(i=e.images.thumbnail[0][4].source)):(i=e.images.poster_wide[0][4].source,e.images.poster_tall[0][2].source),{id:s,display:a,duration:t,playhead:r,background:i,poster:n,title:o,description:e.description,type:e.type}})}catch(e){return console.log("CRITICAL: error on map element."),[]}},loadCategoryListAsync:function(i,n,r,s,a){session.refresh({success:function(e){var t=new Headers;return t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(service.api.url+`/content/v1/browse?categories=${i}&n=${r}&start=`+n,{headers:t}).then(e=>e.json()).then(e=>a.success(e,s)).catch(e=>{a.error(e)})}})}},window.player={states:{STOPPED:0,PLAYING:1,PAUSED:2,FORWARD:3,REWIND:4},values:{forward_rewind:0},timers:{forward_rewind:NaN},state:-1,plugin:NaN,video:NaN,duration:0,levelId:-1,getVideo:function(){return player.video||(player.video=document.getElementById("videoplayer")),player.video},config:function(e,t){player.getVideo().addEventListener("timeupdate",e),player.getVideo().addEventListener("ended",t),player.getVideo().addEventListener("waiting",player.onbufferingstart),player.getVideo().addEventListener("playing",player.onbufferingcomplete)},getPlayed:function(){return player.getVideo().currentTime},getDuration:function(){return player.getVideo().duration},play:function(e,t,i){Hls.isSupported()?(player.plugin=new Hls,player.plugin.loadSource(e),player.plugin.attachMedia(player.getVideo()),player.plugin.on(Hls.Events.MANIFEST_PARSED,function(e,t){player.levelId=player.getQuality(t),player.plugin.startLevel=player.levelId,player.plugin.startLoad(),player.plugin.currentLevel=player.levelId,i||(player.getVideo().play(),player.state=player.states.PLAYING)})):player.getVideo().canPlayType("application/vnd.apple.mpegurl")&&(player.getVideo().src=e,i||(player.getVideo().play(),player.state=player.states.PLAYING)),t&&0player.getDuration()-.02*player.getDuration()?player.getPlayed():player.values.forward_rewind+player.getPlayed(),player.values.forward_rewind=0,player.resume()},500)},forwardTo:function(e){player.getVideo().currentTime=e},getQuality:function(t){var e=Object.keys(t.levels).find(e=>t.levels[e].height===+session.storage.quality);return void 0!==e?e:-1},stop:function(){player.state!=player.states.STOPPED&&(player.plugin.stopLoad(),player.pause(),player.plugin.destroy(),player.plugin=NaN,player.video=NaN,player.STOP_CALLBACK&&player.STOP_CALLBACK(),player.state=player.states.STOPPED)},speed:function(e){player.getVideo().playbackRate=e},destroy:function(){player.stop()},onbufferingstart:function(){video.showBTN("loading")},onbufferingcomplete:function(){video.hideBTN()},oncurrentplaytime:function(e){video.setPlayingTime(e)},onstreamcompleted:function(){console.log("onstreamcompleted"),app.stop()},onevent:function(e,t){console.log("onevent "+e+" - "+t)},onerror:function(e){console.log("onerror "+e)},ondrmevent:function(e,t){console.log("ondrmevent "+e+" - "+t)},onsubtitlechange:function(e,t,i,n,r){console.log("onsubtitlechange")}},window.service={api:{url:"http://api.crunchyroll.local",static:"http://static.crunchyroll.local",auth:"Basic b2VkYXJteHN0bGgxanZhd2ltbnE6OWxFaHZIWkpEMzJqdVY1ZFc5Vk9TNTdkb3BkSnBnbzE="},token:function(t){var e=new Headers,i=(e.append("Authorization",service.api.auth),e.append("Content-Type","application/x-www-form-urlencoded"),service.format({username:t.data.username,password:t.data.password,grant_type:"password",scope:"offline_access"}));fetch(service.api.url+"/auth/v1/token",{method:"POST",headers:e,body:i}).then(e=>e.json()).then(e=>t.success&&t.success(e)).catch(e=>{console.log(e),t.error&&t.error(e)})},refresh:function(t){var e=new Headers,i=(e.append("Authorization",service.api.auth),e.append("Content-Type","application/x-www-form-urlencoded"),service.format({refresh_token:session.storage.refresh_token,grant_type:"refresh_token",scope:"offline_access"}));fetch(service.api.url+"/auth/v1/token",{method:"POST",headers:e,body:i}).then(e=>e.json()).then(e=>t.success(e)).catch(e=>t.error(e))},profile:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(service.api.url+"/accounts/v1/me/profile",{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},setProfile:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(service.api.url+"/accounts/v1/me/profile",{method:"PATCH",headers:t,body:JSON.stringify(i.data)}).then(e=>null).then(e=>i.success(e)).catch(e=>i.error(e))}})},cookies:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(service.api.url+"/index/v2",{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},home:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/content/v2/discover/${e.id}/home_feed?start=0&n=100&preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},continue:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/content/v2/discover/up_next/${i.data.ids}?locale=${e.language}&preferred_audio_language=`+e.account.audio,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},playheads:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/content/v2/${e.id}/playheads?content_ids=${i.data.ids}&preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},seasons:function(i){return session.cookies({success:function(e){var t=new Headers;t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/cms/v2${e.cookies.bucket}/seasons?series_id=${i.data.id}&preferred_audio_language=${e.account.audio}&locale=${e.language}&Signature=${e.cookies.signature}&Policy=${e.cookies.policy}&Key-Pair-Id=`+e.cookies.key_pair_id,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))},error:function(e){i.error(e)}})},episodes:function(i){return session.cookies({success:function(e){var t=new Headers;t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/cms/v2${e.cookies.bucket}/episodes?season_id=${i.data.id}&preferred_audio_language=${e.account.audio}&locale=${e.language}&Signature=${e.cookies.signature}&Policy=${e.cookies.policy}&Key-Pair-Id=`+e.cookies.key_pair_id,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))},error:function(e){i.error(e)}})},video:function(i){return session.cookies({success:function(e){var t=new Headers;t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/cms/v2${e.cookies.bucket}/videos/${i.data.id}/streams?Signature=${e.cookies.signature}&Policy=${e.cookies.policy}&Key-Pair-Id=`+e.cookies.key_pair_id,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))},error:function(e){i.error(e)}})},search:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/content/v2/discover/search?q=${i.data.query}&type=series,movie_listing&n=100&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},history:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(`${service.api.url}/content/v2/${e.id}/watch-history?page_size=100&preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},setHistory:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/${e.id}/playheads?preferred_audio_language=${e.account.audio}&locale=`+e.language,{method:"POST",headers:t,body:JSON.stringify(i.data)}).then(e=>e.text()).then(e=>i.success(e)).catch(e=>i.error(e))}})},languages:function(t){fetch(service.api.static+"/config/i18n/v3/"+("subtitle"===t.data.type?"timed_text_languages.json":"audio_languages.json")).then(e=>e.json()).then(e=>t.success(e)).catch(e=>t.error(e))},intro:function(t){fetch(`${service.api.static}/datalab-intro-v2/${t.data.id}.json`).then(e=>e.json()).then(e=>t.success(e)).catch(e=>t.error(e))},categories:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/x-www-form-urlencoded"),fetch(service.api.url+"/content/v1/tenant_categories?include_subcategories=true&locale="+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},getCustomLists:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/${e.id}/custom-lists?preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},getCustomListItems:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/${e.id}/custom-lists/${i.data}?ratings=true&preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},getWatchList:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/discover/${e.id}/watchlist?order=desc&n=1000&preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},inWatchList:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/${e.id}/watchlist?content_ids=${i.data}&preferred_audio_language=${e.account.audio}&locale=`+e.language,{headers:t}).then(e=>e.json()).then(e=>i.success(e)).catch(e=>i.error(e))}})},addWatchlist:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/${e.id}/watchlist?preferred_audio_language=${e.account.audio}&locale=`+e.language,{method:"POST",headers:t,body:JSON.stringify(i.data)}).then(e=>e.text()).then(e=>i.success(e)).catch(e=>i.error(e))}})},removeWatchlist:function(i){return session.refresh({success:function(e){var t=new Headers;t.append("Authorization","Bearer "+e.access_token),t.append("Content-Type","application/json"),fetch(`${service.api.url}/content/v2/${e.id}/watchlist/${i.data.content_id}?preferred_audio_language=${e.account.audio}&locale=`+e.language,{method:"DELETE",headers:t}).then(e=>e.text()).then(e=>i.success(e)).catch(e=>i.error(e))}})},format:function(t){return Object.keys(t).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&")}},window.session={languages:{audios:{},subtitles:{}},storage:{version:NaN,language:NaN,quality:"auto",account:{password:NaN,username:NaN,avatar:"0001-cr-white-orange.png",premium:!1,language:NaN,audio:NaN},cookies:{bucket:NaN,policy:NaN,signature:NaN,key_pair_id:NaN,expires:NaN},id:NaN,country:NaN,token_type:NaN,access_token:NaN,expires_in:NaN,refresh_token:NaN},init:function(){service.languages({data:{type:"audio"},success:function(e){session.languages.audios=e,session.languages.audios["ja-JP"]="Japanese"},error:function(e){console.log(e)}}),service.languages({data:{type:"subtitle"},success:function(e){session.languages.subtitles=e,session.languages.subtitles[""]="Disabled"},error:function(e){console.log(e)}});var e=localStorage.getItem("session");if(e)try{e=JSON.parse(e),session.storage=e||session.storage}catch(e){console.log("error parse session.")}session.update()},start:function(t,i,n){service.token({data:{password:i,username:t},success:function(e){return session.storage.expires_in=(new Date).setSeconds((new Date).getSeconds()+e.expires_in),session.storage.id=e.account_id,session.storage.account.username=t,session.storage.account.password=i,session.storage.country=e.country,session.storage.token_type=e.token_type,session.storage.access_token=e.access_token,session.storage.refresh_token=e.refresh_token,n.success(session.update())},error:function(e){return session.clear(),n.error(e)}})},refresh:function(t){session.isExpired()?service.refresh({data:{refresh_token:session.storage.refresh_token},success:function(e){session.storage.expires_in=(new Date).setSeconds((new Date).getSeconds()+e.expires_in),session.storage.id=e.account_id,session.storage.country=e.country,session.storage.token_type=e.token_type,session.storage.access_token=e.access_token,session.storage.refresh_token=e.refresh_token,t.success(session.update())},error:function(e){t.error(e)}}):t.success(session.storage)},cookies:function(t){session.isExpired(!0)?service.cookies({success:function(e){session.storage.cookies.bucket=e.cms.bucket,session.storage.account.premium=session.storage.cookies.bucket.includes("crunchyroll"),session.storage.cookies.policy=e.cms.policy,session.storage.cookies.signature=e.cms.signature,session.storage.cookies.key_pair_id=e.cms.key_pair_id,session.storage.cookies.expires=new Date(e.cms.expires).getTime(),t.success(session.update())},error:function(e){t.error(e)}}):t.success(session.storage)},load_account:function(t){service.profile({success:function(e){session.storage.account.audio=e.preferred_content_audio_language,session.storage.account.language=e.preferred_content_subtitle_language,session.storage.account.avatar=e.avatar,session.storage.account.mature=e.maturity_rating,session.storage.account.username=e.username,session.update(),t.success()},error:t.error}),session.cookies({success:function(e){},error:function(e){}})},valid:function(e){return session.storage&&session.storage.access_token?session.refresh(e):e.error()},isExpired:function(e){e=e?session.storage.cookies.expires:session.storage.expires_in;return!(e&&e>=(new Date).getTime())},update:function(){return localStorage.setItem("session",JSON.stringify(session.storage)),session.storage},clear:function(){session.storage={language:"en-US",quality:"auto",account:{password:NaN,username:NaN,mature:NaN,avatar:"0001-cr-white-orange.png",premium:!1,language:"en-US",audio:""},cookies:{bucket:NaN,policy:NaN,signature:NaN,key_pair_id:NaN,expires:NaN},id:NaN,country:NaN,token_type:NaN,access_token:NaN,expires_in:NaN,refresh_token:NaN},session.update()}},function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(d){"use strict";var n,s=window.Slick||{};n=0,(s=function(e,t){var i=this;i.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:d(e),appendDots:d(e),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return d('',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return d('