(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1b955c17"],{11:function(e,t){},12:function(e,t){},13:function(e,t){},14:function(e,t){},15:function(e,t){},16:function(e,t){},17:function(e,t){},18:function(e,t){},19:function(e,t){},20:function(e,t){},21:function(e,t){},22:function(e,t){},fe94:function(t,r,a){(function(n,o){var s,l,c,u=a("6b58").default,d=a("4082").default,h=a("278c").default,p=a("9523").default,f=a("63748").default,m=a("3c96").default,g=a("448a").default,y=a("a128").default,v=a("7ec2").default,A=a("c973").default,b=a("3740").default,_=a("61e5").default,k=a("ed6d").default,w=a("5bc3").default,S=a("970b").default,E=a("ded3b").default,T=a("7037").default,C=["retry","retryDelay","onRetryError","transformError"];a("a4d3"),a("e01a"),a("8172"),a("d9e2"),a("99af"),a("a874"),a("cb29"),a("4de4"),a("7db0"),a("c740"),a("a630"),a("caad"),a("a15b"),a("d81d"),a("14d9"),a("13d5"),a("fb6a"),a("4e82"),a("a434"),a("c19f"),a("82da"),a("ace4"),a("efec"),a("b0c0"),a("6c57"),a("e9c4"),a("4ec9"),a("4057"),a("a9e3"),a("35b3"),a("f00c"),a("8ba4"),a("9129"),a("583b"),a("aff5"),a("b680"),a("4fadc"),a("e439"),a("dbb4"),a("3410"),a("b64b"),a("1f68"),a("d3b7"),a("4d63"),a("c607"),a("ac1f"),a("5377"),a("2c3e"),a("00b4"),a("25f0"),a("6062"),a("f5b2"),a("8a79"),a("f6d6"),a("2532"),a("3ca3"),a("466d"),a("4d90"),a("38cf"),a("5319"),a("841c"),a("1276"),a("2ca0"),a("498a"),a("c7cd"),a("cfc3"),a("4a9b"),a("fd87"),a("8b09"),a("143c"),a("5cc6"),a("8a59"),a("84c3"),a("fb2c"),a("907a"),a("9a8c"),a("a975"),a("735e"),a("c1ac"),a("d139"),a("3a7b"),a("986a"),a("1d02"),a("d5d6"),a("20bf"),a("82f8"),a("e91f"),a("60bd"),a("5f96"),a("3280"),a("3fcc"),a("ec97"),a("ca91"),a("25a1"),a("cd26"),a("3c5d"),a("2954"),a("649e"),a("219c"),a("170b"),a("b39a"),a("72f7"),a("1b3b"),a("3d71"),a("c6e3"),a("81b2"),a("313d"),a("159b"),a("ddb0"),a("0eb6"),a("b7ef"),a("8bd4"),a("2b3d"),a("bf19"),a("9861"),function(e,i){"object"==T(r)&&"undefined"!=typeof t?t.exports=i(a("1c46")):(l=[a("1c46")],s=i,c="function"===typeof s?s.apply(r,l):s,void 0===c||(t.exports=c))}(0,(function(t){"use strict";function r(e){return e&&"object"==T(e)&&"default"in e?e:{default:e}}var a=r(t),s=1,l=2,c=3,x=4,R=5,D=6,L=["","websocket","fetch","hls","webrtc","webTransport","aliyunRtc","ts"],P="fetch",B="hls",I="websocket",M="webrtc",U="webTransport",F="worker",O="aliyunRtc",N="player",j="playerAudio",z="playbackTF",G="mp4",H="webm",V="flv",W="flv",J="m7s",q="hls",K="webrtc",Y="webTransport",Q="nakedFlow",X="fmp4",Z="mpeg4",$="aliyunRtc",ee="ts",te={flv:"FLV",m7s:"M7S",hls:"HLS",fmp4:"FMP4",mpeg4:"MPEG4",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流",aliyunRtc:"AliyunRtc",ts:"TS"},re="mse",ie="wcs",ae="offscreen",ne="wasm",oe="simd",se="mt",le="webrtc",ce="hls",ue="aliyunRtc",de="canvas",he="video",pe="debug",fe="warn",me="click",ge="mouseDownAndUp",ye={normal:"normal",simple:"simple"},ve=36e5,Ae="/crypto/",be="jbprov",_e=1e4,ke={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:N,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!0,isM7sCrypto:!1,supportHls265:!1,playFailedUseLastFrameShow:!0,playFailedAndPausedShowMessage:!1,pauseAndNextPlayUseLastFrameShow:!1,widthOrHeightChangeReplayDelayTime:0,isUseNewFullscreenWatermark:!1,websocket1006ErrorReplay:!1,websocket1006ErrorReplayDelayTime:1,streamErrorReplay:!1,streamErrorReplayDelayTime:1,streamEndReplay:!1,streamEndReplayDelayTime:1,networkDisconnectReplay:!1},we={playType:N,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isFmp4:!1,isFmp4Private:!1,isWebrtc:!1,isWebrtcForZLM:!1,isWebrtcForSRS:!1,isWebrtcForOthers:!1,isNakedFlow:!1,isMpeg4:!1,isAliyunRtc:!1,isTs:!1,debug:!1,debugLevel:fe,debugUuid:"",isMulti:!0,multiIndex:-1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!0,replayUseLastFrameShow:!0,replayShowLoadingIcon:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,mseCorrectTimeDuration:20,mseCorrectAudioTimeDuration:20,keepScreenOn:!0,isNotMute:!1,muted:!0,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1,ptz:!1,quality:!1,zoom:!1,close:!1,scale:!1,performance:!1,logSave:!1,aiFace:!1,aiObject:!1,aiOcclusion:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingIconStyle:{},loadingText:"",background:"",poster:"",backgroundLoadingShow:!0,loadingBackground:"",loadingBackgroundWidth:0,loadingBackgroundHeight:0,decoder:"decoder-pro.js",decoderAudio:"decoder-pro-audio.js",decoderHard:"decoder-pro-hard.js",decoderHardNotWasm:"decoder-pro-hard-not-wasm.js",wasmMp4RecorderDecoder:"jessibuca-pro-mp4-recorder-decoder.js",decoderWASM:"",isDecoderUseCDN:!1,url:"",rotate:0,mirrorRotate:"none",aspectRatio:"default",playbackConfig:{playList:[],fps:"",showControl:!0,controlType:ye.normal,duration:0,startTime:"",showRateBtn:!1,rateConfig:[],showPrecision:"",showPrecisionBtn:!0,isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1,useWCS:!1,useMSE:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:l,demuxType:W,useWasm:!1,useMSE:!1,useWCS:!1,useSIMD:!0,useMThreading:!1,wcsUseVideoRender:!0,wcsUseWebgl2Render:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,webrtcUseCanvasRender:!1,useOffscreen:!1,useWebGPU:!1,mseDecodeErrorReplay:!0,wcsDecodeErrorReplay:!0,wasmDecodeErrorReplay:!0,simdDecodeErrorReplay:!0,simdDecodeErrorReplayType:ne,autoWasm:!0,decoderErrorAutoWasm:!0,hardDecodingNotSupportAutoWasm:!0,webglAlignmentErrorReplay:!0,webglContextLostErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,syncAudioAndVideoDiff:500,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:4,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:G,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,useImageDetector:!1,useOcclusionDetector:!1,ptzPositionConfig:{},ptzShowType:"vertical",ptzClickType:me,ptzStopEmitDelay:.3,ptzZoomShow:!1,ptzApertureShow:!1,ptzFocusShow:!1,ptzMoreArrowShow:!1,ptzCruiseShow:!1,ptzFogShow:!1,ptzWiperShow:!1,ptzSupportDraggable:!1,weiXinInAndroidAudioBufferSize:4800,isM7sCrypto:!1,m7sCryptoAudio:!1,isSm4Crypto:!1,isXorCrypto:!1,sm4CryptoKey:"",m7sCryptoKey:"",xorCryptoKey:"",cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectLevel:2,aiFaceDetectWidth:240,aiFaceDetectShowRect:!0,aiFaceDetectInterval:1e3,aiFaceDetectRectConfig:{},aiObjectDetectLevel:2,aiObjectDetectWidth:240,aiObjectDetectShowRect:!0,aiObjectDetectInterval:1e3,aiObjectDetectRectConfig:{},aiOcclusionDetectInterval:1e3,aiImageDetectDrop:!1,aiImageDetectActive:!1,videoRenderSupportScale:!0,mediaSourceTsIsMaxDiffReplay:!0,controlHtml:"",isH265:!1,isWebrtcH265:!1,supportLockScreenPlayAudio:!0,supportHls265:!1,isEmitSEI:!1,pauseAndNextPlayUseLastFrameShow:!1,demuxUseWorker:!0,playFailedAndReplay:!0,showMessageConfig:{webglAlignmentError:"Webgl 渲染失败",webglContextLostError:"webgl 上下文丢失",mediaSourceH265NotSupport:"不支持硬解码H265",mediaSourceFull:"缓冲区已满",mediaSourceAppendBufferError:"初始化解码器失败",mseSourceBufferError:"解码失败",mseAddSourceBufferError:"初始化解码器失败",mediaSourceDecoderConfigurationError:"初始化解码器失败",mediaSourceTsIsMaxDiff:"流异常",mseWidthOrHeightChange:"流异常",mediaSourceAudioG711NotSupport:"硬解码不支持G711a/u音频格式",mediaSourceUseCanvasRenderPlayFailed:"MediaSource解码使用canvas渲染失败",webcodecsH265NotSupport:"不支持硬解码H265",webcodecsUnsupportedConfigurationError:"初始化解码器失败",webcodecsDecodeConfigureError:"初始化解码器失败",webcodecsDecodeError:"解码失败",wcsWidthOrHeightChange:"解码失败",wasmDecodeError:"解码失败",simdDecodeError:"解码失败",wasmWidthOrHeightChange:"流异常",wasmUseVideoRenderError:"video自动渲染失败",videoElementPlayingFailed:"video自动渲染失败",simdH264DecodeVideoWidthIsTooLarge:"不支持该分辨率的视频",networkDelayTimeout:"网络超时重播失败",fetchError:"请求失败",streamEnd:"请求结束",websocketError:"请求失败",webrtcError:"请求失败",hlsError:"请求失败",decoderWorkerInitError:"初始化worker失败",videoElementPlayingFailedForWebrtc:"video自动渲染失败",videoInfoError:"解析视频分辨率失败",webrtcStreamH265:"webrtc不支持H265",delayTimeout:"播放超时重播失败",loadingTimeout:"加载超时重播失败",loadingTimeoutRetryEnd:"加载超时重播失败",delayTimeoutRetryEnd:"播放超时重播失败"},videoElementPlayingFailedReplay:!0,mp4RecordUseWasm:!0,mseAutoCleanupSourceBuffer:!0,mseAutoCleanupMaxBackwardDuration:30,mseAutoCleanupMinBackwardDuration:10,widthOrHeightChangeReplay:!0,simdH264DecodeVideoWidthIsTooLargeReplay:!0,mediaSourceAudioG711NotSupportReplay:!0,mediaSourceAudioInitTimeoutReplay:!0,mediaSourceUseCanvasRenderPlayFailedReplay:!0,mediaSourceUseCanvasRenderPlayFailedReplayType:he,widthOrHeightChangeReplayDelayTime:0,ghostWatermarkConfig:{on:5,off:5,content:"",fontSize:12,color:"white",opacity:.15,speed:.2},dynamicWatermarkConfig:{content:"",speed:.2,fontSize:12,color:"white",opacity:.15},isDropSameTimestampGop:!1,mseDecodeAudio:!1,nakedFlowH265DemuxUseNew:!0,extendDomConfig:{html:"",showBeforePlay:!1,showAfterLoading:!0},disableContextmenu:!1,mseDecoderUseWorker:!1,openMemoryLog:!1,mainThreadFetchUseWorker:!0,playFailedAndPausedShowPlayBtn:!0,mseCorrectionTimestamp:!0,flvDemuxBufferSizeTooLargeReplay:!1,flvDemuxBufferSizeTooLargeEmitFailed:!1,flvDemuxBufferSizeMaxLarge:1048576,isCheckInView:!1,hiddenControl:!1},Se="init",Ee="initVideo",Te="render",Ce="playAudio",xe="initAudio",Re="audioCode",De="audioNalu",Le="audioAACSequenceHeader",Pe="videoCode",Be="videoCodec",Ie="videoNalu",Me="videoPayload",Ue="audioPayload",Fe="wasmError",Oe="workerFetch",Ne="iframeIntervalTs",je="isDropping",ze="workerEnd",Ge="playbackStreamVideoFps",He="wasmDecodeVideoNoResponseError",Ve="wasmWidthOrHeightChange",We="simdDecodeError",Je="simdH264DecodeVideoWidthIsTooLarge",qe="closeEnd",Ke="tempStream",Ye="videoSEI",Qe="flvScriptData",Xe="aacSequenceHeader",Ze="videoSequenceHeader",$e="flvBufferData",et="checkFirstIFrame",tt="mseHandle",rt="mseFirstRenderTime",it="mseError",at="Invalid NAL unit size",nt=1,ot=2,st=8,lt=9,ct=18,ut="init",dt="decode",ht="audioDecode",pt="videoDecode",ft="close",mt="updateConfig",gt="clearBuffer",yt="fetchStream",vt="sendWsMessage",At="mseUpdateVideoTimestamp",bt="fetch",_t="destroy",kt="destroyEnd",wt="buffer",St="fetchError",Et="fetchClose",Tt="fetchSuccess",Ct={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",zooming:"zooming",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",delayTimeoutRetryEnd:"delayTimeoutRetryEnd",loadingTimeout:"loadingTimeout",loadingTimeoutRetryEnd:"loadingTimeoutRetryEnd",stats:"stats",performance:"performance",videoSmooth:"videoSmooth",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",occlusionDetectActive:"occlusionDetectActive",imageDetectActive:"imageDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",videoSEI:"videoSEI",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",volume:"volume",destroy:"destroy",beforeDestroy:"beforeDestroy",streamEnd:"streamEnd",streamRate:"streamRate",streamAbps:"streamAbps",streamVbps:"streamVbps",streamDts:"streamDts",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",streamStats:"streamStats",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceended:"mseSourceended",mseSourceStartStreaming:"mseSourceStartStreaming",mseSourceEndStreaming:"mseSourceEndStreaming",mseSourceBufferError:"mseSourceBufferError",mseAddSourceBufferError:"mseAddSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackTimeScroll:"playbackTimeScroll",playbackPrecision:"playbackPrecision",playbackShowPrecisionChange:"playbackShowPrecisionChange",playbackJustTime:"playbackJustTime",playbackStats:"playbackStats",playbackSeek:"playbackSeek",playbackPause:"playbackPause",playbackPauseOrResume:"playbackPauseOrResume",playbackRateChange:"playbackRateChange",playbackPreRateChange:"playbackPreRateChange",ptz:"ptz",streamQualityChange:"streamQualityChange",visibilityChange:"visibilityChange",netBuf:"netBuf",close:"close",networkDelayTimeout:"networkDelayTimeout",togglePerformancePanel:"togglePerformancePanel",viewResizeChange:"viewResizeChange",flvDemuxBufferSizeTooLarge:"flvDemuxBufferSizeTooLarge",talkGetUserMediaSuccess:"talkGetUserMediaSuccess",talkGetUserMediaFail:"talkGetUserMediaFail",talkGetUserMediaTimeout:"talkGetUserMediaTimeout",talkStreamStart:"talkStreamStart",talkStreamOpen:"talkStreamOpen",talkStreamClose:"talkStreamClose",talkStreamError:"talkStreamError",talkStreamInactive:"talkStreamInactive",webrtcDisconnect:"webrtcDisconnect",webrtcFailed:"webrtcFailed",webrtcClosed:"webrtcClosed",webrtcOnConnectionStateChange:"webrtcOnConnectionStateChange",webrtcOnIceConnectionStateChange:"webrtcOnIceConnectionStateChange",crashLog:"crashLog",focus:"focus",blur:"blur",inView:"inView",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetectorInfo:"aiFaceDetectorInfo",aiOcclusionDetectResult:"aiOcclusionDetectResult",aiImageDetectResult:"aiImageDetectResult",playFailedAndPaused:"playFailedAndPaused",audioResumeState:"audioResumeState",webrtcStreamH265:"webrtcStreamH265",flvMetaData:"flvMetaData",talkFailedAndStop:"talkFailedAndStop",removeLoadingBgImage:"removeLoadingBgImage",memoryLog:"memoryLog",downloadMemoryLog:"downloadMemoryLog",pressureObserverCpu:"pressureObserverCpu",currentPts:"currentPts",online:"online",offline:"offline",networkState:"networkState"},xt={load:Ct.load,timeUpdate:Ct.timeUpdate,videoInfo:Ct.videoInfo,audioInfo:Ct.audioInfo,error:Ct.error,kBps:Ct.kBps,start:Ct.start,timeout:Ct.timeout,loadingTimeout:Ct.loadingTimeout,loadingTimeoutRetryEnd:Ct.loadingTimeoutRetryEnd,delayTimeout:Ct.delayTimeout,delayTimeoutRetryEnd:Ct.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:Ct.webFullscreen,play:Ct.play,pause:Ct.pause,mute:Ct.mute,stats:Ct.stats,performance:Ct.performance,recordingTimestamp:Ct.recordingTimestamp,recordStart:Ct.recordStart,recordCreateError:Ct.recordCreateError,recordEnd:Ct.recordEnd,recordBlob:Ct.recordBlob,playToRenderTimes:Ct.playToRenderTimes,playbackSeek:Ct.playbackSeek,playbackStats:Ct.playbackStats,playbackTimestamp:Ct.playbackTimestamp,playbackPauseOrResume:Ct.playbackPauseOrResume,playbackPreRateChange:Ct.playbackPreRateChange,playbackRateChange:Ct.playbackRateChange,playbackShowPrecisionChange:Ct.playbackShowPrecisionChange,ptz:Ct.ptz,streamQualityChange:Ct.streamQualityChange,zooming:Ct.zooming,crashLog:Ct.crashLog,focus:Ct.focus,blur:Ct.blur,visibilityHiddenTimeout:Ct.visibilityHiddenTimeout,visibilityChange:Ct.visibilityChange,websocketOpen:Ct.websocketOpen,websocketClose:Ct.websocketClose,networkDelayTimeout:Ct.networkDelayTimeout,aiObjectDetectorInfo:Ct.aiObjectDetectorInfo,aiFaceDetectorInfo:Ct.aiFaceDetectorInfo,aiOcclusionDetectResult:Ct.aiOcclusionDetectResult,aiImageDetectResult:Ct.aiImageDetectResult,playFailedAndPaused:Ct.playFailedAndPaused,streamEnd:Ct.streamEnd,audioResumeState:Ct.audioResumeState,videoSEI:Ct.videoSEI,flvMetaData:Ct.flvMetaData,webrtcOnConnectionStateChange:Ct.webrtcOnConnectionStateChange,webrtcOnIceConnectionStateChange:Ct.webrtcOnIceConnectionStateChange,currentPts:Ct.currentPts,videoSmooth:Ct.videoSmooth,networkState:Ct.networkState,volume:Ct.volume},Rt={talkStreamClose:Ct.talkStreamClose,talkStreamError:Ct.talkStreamError,talkStreamInactive:Ct.talkStreamInactive,talkGetUserMediaTimeout:Ct.talkGetUserMediaTimeout,talkFailedAndStop:Ct.talkFailedAndStop},Dt={talkStreamError:Ct.talkStreamError,talkStreamClose:Ct.talkStreamClose},Lt=E({playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",webcodecsUnsupportedConfigurationError:"webcodecsUnsupportedConfigurationError",webcodecsDecodeConfigureError:"webcodecsDecodeConfigureError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceAudioG711NotSupport:"mediaSourceAudioG711NotSupport",mediaSourceAudioInitTimeout:"mediaSourceAudioInitTimeout",mediaSourceAudioNoDataTimeout:"mediaSourceAudioNoDataTimeout",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:Ct.mseSourceBufferFull,mseSourceBufferError:Ct.mseSourceBufferError,mseAddSourceBufferError:Ct.mseAddSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceTsIsMaxDiff:"mediaSourceTsIsMaxDiff",mediaSourceUseCanvasRenderPlayFailed:"mediaSourceUseCanvasRenderPlayFailed",mediaSourceBufferedIsZeroError:"mediaSourceBufferedIsZeroError",wasmDecodeError:"wasmDecodeError",wasmUseVideoRenderError:"wasmUseVideoRenderError",hlsError:"hlsError",webrtcError:"webrtcError",webrtcClosed:Ct.webrtcClosed,webrtcIceCandidateError:"webrtcIceCandidateError",webglAlignmentError:"webglAlignmentError",wasmWidthOrHeightChange:"wasmWidthOrHeightChange",mseWidthOrHeightChange:"mseWidthOrHeightChange",wcsWidthOrHeightChange:"wcsWidthOrHeightChange",widthOrHeightChange:"widthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:Ct.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",simdDecodeError:"simdDecodeError",webglContextLostError:"webglContextLostError",videoElementPlayingFailed:"videoElementPlayingFailed",videoElementPlayingFailedForWebrtc:"videoElementPlayingFailedForWebrtc",decoderWorkerInitError:"decoderWorkerInitError",videoInfoError:"videoInfoError",videoCodecIdError:"videoCodecIdError",streamEnd:Ct.streamEnd,websocket1006Error:"websocket1006Error",delayTimeout:Ct.delayTimeout,loadingTimeout:Ct.loadingTimeout,networkDelayTimeout:Ct.networkDelayTimeout,aliyunRtcError:"aliyunRtcError"},Dt),Pt="notConnect",Bt="open",It="close",Mt="error",Ut={download:"download",base64:"base64",blob:"blob"},Ft="download",Ot="blob",Nt={7:"H264(AVC)",12:"H265(HEVC)",99:"MPEG4"},jt=7,zt=12,Gt="H264(AVC)",Ht="H265(HEVC)",Vt=10,Wt=2,Jt={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)",MP3:"MP3"},qt={10:"AAC",7:"ALAW",8:"MULAW",2:"MP3"},Kt=7,Yt=8,Qt=5,Xt=1,Zt=5,$t=6,er=7,tr=8,rr=14,ir=19,ar=20,nr=21,or=32,sr=32,lr=33,cr=33,ur=34,dr=34,hr=39,pr=39,fr=40,mr=38,gr=48,yr=0,vr=1,Ar=2,br="webcodecs",_r="webgl",kr="webgl2",wr="webgpu",Sr="offscreen",Er="mse",Tr="hls",Cr="webrtc",xr="key",Rr="delta",Dr='video/mp4; codecs="avc1.64002A"',Lr='video/mp4; codecs="hev1.1.6.L123.b0"',Pr='video/mp4;codecs="hev1.1.6.L120.90"',Br='video/mp4;codecs="hev1.2.4.L120.90"',Ir='video/mp4;codecs="hev1.3.E.L120.90"',Mr='video/mp4;codecs="hev1.4.10.L120.90"',Ur="ended",Fr="open",Or="closed",Nr=27,jr=38,zr=40,Gr="oneHour",Hr="halfHour",Vr="tenMin",Wr="fiveMin",Jr={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},qr=["oneHour","halfHour","tenMin","fiveMin"],Kr=["up","right","down","left","left-up","right-up","left-down","right-down"],Yr="stop",Qr="fiStop",Xr="zoomExpand",Zr="zoomNarrow",$r="apertureFar",ei="apertureNear",ti="focusFar",ri="focusNear",ii="cruiseStart",ai="cruiseStop",ni="fogOpen",oi="fogClose",si="wiperOpen",li="wiperClose",ci="g711a",ui="g711u",di="pcm",hi="opus",pi={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},fi="sourceclose",mi="sourceopen",gi="sourceended",yi="startstreaming",vi="endstreaming",Ai="qualitychange",bi="canplay",_i="waiting",ki="timeupdate",wi="ratechange",Si="avc",Ei="hevc",Ti="A key frame is required after configure() or flush()",Ci="Cannot call 'decode' on a closed codec",xi="Unsupported configuration",Ri="Decoder failure",Di="Decoding error",Li="Decoder error",Pi="HEVC decoding is not supported",Bi="The user aborted a request",Ii="AbortError",Mi="AbortError",Ui="loading",Fi="playing",Oi="paused",Ni="destroy",ji=0,zi=1,Gi=8,Hi=0,Vi=98,Wi="empty",Ji="rtp",qi="tcp",Ki="open",Yi="close",Qi="error",Xi="message",Zi="worklet",$i="script",ea={encType:ci,packetType:Ji,packetTcpSendType:qi,rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,sendInterval:20,debug:!1,debugLevel:fe,testMicrophone:!1,saveToTempFile:!1,audioBufferLength:160,engine:Zi,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4,audioConstraints:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1}},ta="worklet",ra="script",ia="active",aa={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},na={content:"",click:null,index:0},oa=1,sa="subtitle-segments",la="hls-manifest-loaded",ca="hls-level-loaded",ua="demuxed-track",da="flv-script-data",ha="metadata-parsed",pa="ttfb",fa="load-retry",ma="load-start",ga="speed",ya="load-complete",va="load-response-headers",Aa="sei",ba="sei-in-time",_a="switch-url-failed",ka="switch-url-success",wa="subtitle-playlist",Sa="stream-parsed",Ea="error",Ta=[0,160,240,320,480,640],Ca=[0,160,240,320,480,640],xa=["轻松","正常","较高","高"],Ra="idle",Da="buffering",La="complete",Pa={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},Ba="video decoder initialization failed",Ia="audio packet",Ma=1,Ua=2,Fa=0,Oa=1,Na=3,ja=16,za="candidate-pair",Ga="inbound-rtp",Ha="local-candidate",Va="remote-candidate",Wa="track",Ja=9e4,qa=45e4,Ka=9e4,Ya="ws1006",Qa="mseDecodeError",Xa="wcsDecodeError",Za=w((function e(t){S(this,e),this.log=function(e){if(t._opt.debug&&t._opt.debugLevel==pe){for(var r,i=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",a=arguments.length,n=new Array(a>1?a-1:0),o=1;o1?a-1:0),o=1;o1?a-1:0),o=1;o32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var r=this._current_word_bits_left?this._current_word:0;r>>>=32-this._current_word_bits_left;var i=e-this._current_word_bits_left;this._fillCurrentWord();var a=Math.min(i,this._current_word_bits_left),n=this._current_word>>>32-a;return this._current_word<<=a,this._current_word_bits_left-=a,r=r<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}},{key:"readUEG",value:function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}},{key:"readSEG",value:function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}])}(),an=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],nn=an,on=an;function sn(e){var t=e.profile,r=e.sampleRate,i=e.channel;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function ln(e){return cn(e)&&e[1]===ji}function cn(e){return e[0]>>4===Vt}function un(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function dn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}var hn=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],pn=function(){function e(t){S(this,e),this.buffer=t,this.buflen=t.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}return w(e,[{key:"read",value:function(e){for(var t=0,r=0;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}},{key:"look",value:function(e){var t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}},{key:"read_golomb",value:function(){var e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}},{key:"readNextAACFrame",value:function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,a=(6&e[r+1])>>>1,n=1&e[r+1],o=(192&e[r+2])>>>6,s=(60&e[r+2])>>>2,l=(1&e[r+2])<<2|(192&e[r+3])>>>6,c=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+c>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var u=1===n?7:9,d=c-u;r+=u;var h=this.findNextSyncwordOffset(r+d);if(this.current_syncword_offset_=h,(0===i||1===i)&&0===a){var p=e.subarray(r,r+d);t={},t.audio_object_type=o+1,t.sampling_freq_index=s,t.sampling_frequency=nn[s],t.channel_config=l,t.data=p}}return t}},{key:"hasIncompleteData",value:function(){return this.has_last_incomplete_data}},{key:"getIncompleteData",value:function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}])}(),An=function(){function e(t){S(this,e),this.data_=t,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}return w(e,[{key:"findNextSyncwordOffset",value:function(e){for(var t=e,r=this.data_;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}},{key:"getLATMValue",value:function(e){for(var t=e.readBits(2),r=0,i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}},{key:"readNextAACFrame",value:function(e){for(var t=this.data_,r=null;null==r&&!this.eof_flag_;){var i=this.current_syncword_offset_,a=(31&t[i+1])<<8|t[i+2];if(i+3+a>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var n=new rn(t.subarray(i+3,i+3+a)),o=null;if(n.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+a),n.destroy();continue}o=e}else{var s=n.readBool();if(s&&n.readBool()){console.error("audioMuxVersionA is Not Supported"),n.destroy();break}if(s&&this.getLATMValue(n),!n.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),n.destroy();break}if(0!==n.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),n.destroy();break}if(0!==n.readBits(4)){console.error("more than 2 numProgram Not Supported"),n.destroy();break}if(0!==n.readBits(3)){console.error("more than 2 numLayer Not Supported"),n.destroy();break}var l=s?this.getLATMValue(n):0,c=n.readBits(5);l-=5;var u=n.readBits(4);l-=4;var d=n.readBits(4);l-=4,n.readBits(3),l-=3,l>0&&n.readBits(l);var h=n.readBits(3);if(0!==h){console.error("frameLengthType = ".concat(h,". Only frameLengthType = 0 Supported")),n.destroy();break}n.readByte();var p=n.readBool();if(p)if(s)this.getLATMValue(n);else{for(var f=0;;){f<<=8;var m=n.readBool();if(f+=n.readByte(),!m)break}console.log(f)}n.readBool()&&n.readByte(),o={},o.audio_object_type=c,o.sampling_freq_index=u,o.sampling_frequency=nn[o.sampling_freq_index],o.channel_config=d,o.other_data_present=p}for(var g=0;;){var y=n.readByte();if(g+=y,255!==y)break}for(var v=new Uint8Array(g),A=0;A1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function _n(e){var t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;var i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function kn(){}function wn(e){for(var t=null,r=["webgl","experimental-webgl","moz-webgl","webkit-3d"],i=0;!t&&i0&&void 0!==arguments[0]?arguments[0]:"",t=e.split(","),r=atob(t[1]),i=t[0].replace("data:","").replace(";base64",""),a=r.length,n=new Uint8Array(a);a--;)n[a]=r.charCodeAt(a);return new File([n],"file",{type:i})}function Tn(){return(new Date).getTime()}function Cn(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function xn(e,t,r){if(e)return"object"==T(t)&&Object.keys(t).forEach((function(r){xn(e,r,t[r])})),e.style[t]=r,e}function Rn(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;var i=getComputedStyle(e,null).getPropertyValue(t);return r?parseFloat(i):i}function Dn(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function Ln(e){var t=0,r=Dn();return function(i){if(Jn(i)){t+=i;var a=Dn(),n=a-r;n>=1e3&&(e(t/n*1e3),r=a,t=0)}}}(function(){try{if("object"==("undefined"===typeof WebAssembly?"undefined":T(WebAssembly))&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(t instanceof WebAssembly.Module)new WebAssembly.Instance(t),WebAssembly.Instance}}catch(e){}})();var Pn='"4-1-2024"';function Bn(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function In(){return!(Bn()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function Mn(){var e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function Un(){var e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function Fn(){var e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},r={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(var i in r)if(r[i]){var a="";if("IE"===i){var n=e.match(/(msie\s|trident.*rv:)([\w.]+)/);n&&n.length>2&&(a=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===i){for(var o in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[o].type&&(i="360");var s=e.match(/chrome\/([\d.]+)/);s&&s.length>1&&(a=s[1])}else if("Firefox"===i){var l=e.match(/firefox\/([\d.]+)/);l&&l.length>1&&(a=l[1])}else if("Opera"===i){var c=e.match(/opera\/([\d.]+)/);c&&c.length>1&&(a=c[1])}else if("Safari"===i){var u=e.match(/version\/([\d.]+)/);u&&u.length>1&&(a=u[1])}else if("Edge"===i){var d=e.match(/edge\/([\d.]+)/);d&&d.length>1&&(a=d[1])}else if("QQBrowser"===i){var h=e.match(/qqbrowser\/([\d.]+)/);h&&h.length>1&&(a=h[1])}t.type=i,t.version=parseInt(a)}return t}function On(){var e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function Nn(){var e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function jn(e,t){if(0===arguments.length)return null;var r,i=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==T(e)?r=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,r=new Date(e));var a={y:r.getFullYear(),m:r.getMonth()+1,d:r.getDate(),h:r.getHours(),i:r.getMinutes(),s:r.getSeconds(),a:r.getDay()},n=i.replace(/{(y|m|d|h|i|s|a)+}/g,(function(e,t){var r=a[t];return"a"===t?["一","二","三","四","五","六","日"][r-1]:(e.length>0&&r<10&&(r="0"+r),r||0)}));return n}function zn(){return"VideoFrame"in window}function Gn(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function Hn(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function Vn(e,t){var r,i,a=!1;return function n(){for(var o=arguments.length,s=new Array(o),l=0;l=107}function Yn(){var e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function Qn(){var e=!1;return"MediaStream"in window&&(e=!0),e}function Xn(e,t){var r=window.URL.createObjectURL(t),i=window.document.createElement("a");i.download=e,i.href=r;var a=window.document.createEvent("MouseEvents");a.initEvent("click",!0,!0),i.dispatchEvent(a),setTimeout((function(){window.URL.revokeObjectURL(r)}),On()?1e3:0)}function Zn(e){return null==e}function $n(e){return!0===e||!1===e}function eo(e){return!Zn(e)}function to(e){var t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""},r=Object.assign(t.image,e.image||{}),i=Object.assign(t.text,e.text||{}),a=Object.assign(t.rect,e.rect||{}),n=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:r,text:i,rect:a,line:n}),t}function ro(e,t){var r={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return r=Object.assign(r,t),{watermark_parent_node:r.container,watermark_alpha:r.opacity,watermark_angle:r.angle,watermark_fontsize:r.fontSize,watermark_color:r.color,watermark_font:r.fontFamily,watermark_txt:r.text}}function io(e,t){return new Promise((function(r,i){var a=to(t);if(!a.image.src&&!a.text.content)return r(e);var n=document.createElement("canvas");n.width=t.width,n.height=t.height;var o=n.getContext("2d"),s=0,l=0;Jn(a.left)?s=a.left:Jn(a.right)&&(s=n.width-a.right),Jn(a.top)?l=a.top:Jn(a.bottom)&&(l=n.height-a.bottom);var c=new Image;c.src=e,c.onload=function(){if(o.drawImage(c,0,0),a.image&&a.image.src){var e=new Image;e.src=a.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=function(){s-=a.image.width,o.drawImage(e,s,l,a.image.width,a.image.height),r(n.toDataURL(t.format,t.quality))},e.onerror=function(e){i()}}else a.text&&a.text.content&&(o.font=a.text.fontSize+"px 宋体",o.fillStyle=a.text.color,o.textAlign="right",o.fillText(a.text.content,s,l),r(n.toDataURL(t.format,t.quality)))},c.onerror=function(e){i(e)}}))}function ao(e){var t;if(e>-1){var r=Math.floor(e/3600),i=Math.floor(e/60)%60,a=e%60;t=r<10?"0"+r+":":r+":",i<10&&(t+="0"),t+=i+":",(a=Math.round(a))<10&&(t+="0"),t+=a.toFixed(0)}return t}function no(e,t){var r="";if(e>-1){var i=Math.floor(e/60)%60,a=e%60;a=Math.round(a),r=i<10?"0"+i+":":i+":",a<10&&(r+="0"),r+=a,Zn(t)||(t<10&&(t="0"+t),r+=":"+t)}return r}function oo(e){var t="";if(e>-1){var r=Math.floor(e/60/60)%60,i=Math.floor(e/60)%60,a=e%60;i=Math.round(i),t=r<10?"0"+r+":":r+":",i<10&&(t+="0"),t+=i+":",a<10&&(t+="0"),t+=a}return t}function so(e,t){var r=Math.floor(t/60)%60,i=Math.floor(t%60);return new Date(e).setHours(r,i,0,0)}function lo(e,t){var r=Math.floor(t/60/60)%60,i=Math.floor(t/60)%60,a=t%60;return new Date(e).setHours(r,i,a,0)}function co(e){return(""+e).length}function uo(e){return e&&0===Object.keys(e).length}function ho(e){return!uo(e)}function po(e){return"string"==typeof e}var fo=function(){var e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},mo=function(){var e=window.navigator.userAgent;return/Chrome/i.test(e)};function go(e){var t=e||window.event;return t.target||t.srcElement}function yo(){return Un()&&function(){var e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function vo(e){return"function"==typeof e}function Ao(e){if(Bn()){var t=0,r=0;if(1===e.touches.length){var i=e.touches[0];t=i.clientX,r=i.clientY}return{posX:t,posY:r}}var a=0,n=0,o=e||window.event;return o.pageX||o.pageY?(a=o.pageX,n=o.pageY):(o.clientX||o.clientY)&&(a=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,n=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:a,posY:n}}function bo(){var e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function _o(e){var t=Io(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&Io(e.demuxUseWorker);return!!(Io(t)&&e.useMSE&&e.mseDecodeAudio&&Io(e.demuxUseWorker))||t}function ko(e){var t=e.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1],r=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(r)}function wo(e){e.close()}function So(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function Eo(e){var t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==T(e)?JSON.stringify(e,null,2):String(e)}function To(e,t){t&&(e=e.filter((function(e){return e.type&&e.type===t})));var r=e[0],i=null,a=1;if(e.length>0){var n=e[1];n&&n.ts-r.ts>1e5&&(r=n,a=2)}if(r)for(var o=a;o=1e3&&e[o-1].ts-r.ts<1e3&&(i=o+1)}return i}function Co(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),r=window.atob(t),i=new Uint8Array(r.length),a=0;a>4===zi&&e[1]===ji}function Bo(e){return!0===e||"true"===e}function Io(e){return!0!==e&&"true"!==e}function Mo(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function Uo(){return/iphone/i.test(navigator.userAgent)}function Fo(){return window.performance&&window.performance.memory?window.performance.memory:null}function Oo(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function No(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function jo(){var e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function zo(){var e=!1;return"PressureObserver"in window&&(e=!0),e}var Go=function(){function e(t){S(this,e),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=t}return w(e,[{key:"proxy",value:function(e,t,r){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e){if(Array.isArray(t))return t.map((function(t){return i.proxy(e,t,r,a)}));e.addEventListener(t,r,a);var n=function(){vo(e.removeEventListener)&&e.removeEventListener(t,r,a)};return this.destroys.push(n),n}}},{key:"destroy",value:function(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((function(e){return e()})),this.destroys=[]}}])}(),Ho=function(){function e(){S(this,e)}return w(e,[{key:"on",value:function(e,t,r){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}},{key:"once",value:function(e,t,r){var i=this;function a(){i.off(e,a);for(var n=arguments.length,o=new Array(n),s=0;s1?r-1:0),a=1;a0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),r=this.gl.createProgram();return this.gl.attachShader(r,e),this.gl.attachShader(r,t),this.gl.linkProgram(r),this.gl.getProgramParameter(r,this.gl.LINK_STATUS)?r:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(r)),null)}},{key:"_loadShader",value:function(e,t){var r=this.gl,i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),r.getShaderParameter(i,r.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+r.getShaderInfoLog(i)),r.deleteShader(i),null)}},{key:"_initBuffers",value:function(){var e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);var r=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);var i=[];i=i.concat([0,1],[1,1],[1,0],[0,0]);var a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var n=e.createBuffer();return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:r,position:t,texPosition:a,indices:n}}},{key:"_createTexture",value:function(){var e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}},{key:"_drawScene",value:function(e,t,r){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices),r?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,r?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}},{key:"_calRect",value:function(e,t,r,i,a,n){var o=2*e/a-1,s=2*(n-t-i)/n-1,l=2*(e+r)/a-1,c=2*(n-t)/n-1;return[o,s,l,s,l,c,o,c]}},{key:"_clear",value:function(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}},{key:"render",value:function(e,t,r,i,a){var n=this.gl;this._clear(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._ytexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e,t,0,n.LUMINANCE,n.UNSIGNED_BYTE,r),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._utexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,i),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,this._vtexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,a),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"renderYUV",value:function(e,t,r){var i=r.slice(0,e*t),a=r.slice(e*t,e*t*5/4),n=r.slice(e*t*5/4,e*t*3/2),o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,i),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,a),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,n),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"drawDom",value:function(e,t,r,i,a){var n=this.gl;n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._rgbatexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a),this._buffers.positions=this._calRect(r,i,a.width,a.height,e,t),this._drawScene(e,t,!1)}}])}(),Zo=function(){function e(t){var r=this;S(this,e),this.gpu=t,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this._initPipeline().then((function(e){r.pipeline=e,r.matrixGroupInfo=r._initMatrixGroupInfo(),r.hasInited=!0}))}return w(e,[{key:"destroy",value:function(){this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}},{key:"_initBuffer",value:function(){var e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),r=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,t);var i=new Float32Array([0,1,1,1,1,0,0,0]),a=e.createBuffer({size:i.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(a,0,i);var n=new Uint16Array([0,1,2,0,2,3]),o=e.createBuffer({size:n.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(o,0,n),{positionBuffer:r,texpositionBuffer:a,indexBuffer:o}}},{key:"_initPipeline",value:function(){var e=this;return new Promise((function(t,r){var i=e.gpu.device,a=e.gpu.format,n={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var yTexture: texture_2d;\n @group(1) @binding(2) var uTexture: texture_2d;\n @group(1) @binding(3) var vTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n }\n\n "}),entryPoint:"main",targets:[{format:a}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(n).then((function(e){t(e)})).catch((function(e){r(e)}))}))}},{key:"_initMatrixGroupInfo",value:function(){var e=this.gpu.device,t=this.pipeline,r=Jo();Yo(r,-1,1,-1,1,.1,100);var i=Jo();qo(i);var a=Jo();!function(e,t,r,i){var a,n,o,s,l,c,u,d,h,p,f=t[0],m=t[1],g=t[2],y=i[0],v=i[1],A=i[2],b=r[0],_=r[1],k=r[2];Math.abs(f-b)0&&r.width>0){var i=r.width,a=r.height,n=this.player._opt,o=t,s=e;if(n.hasControl&&!n.controlAutoHide){var l=n.playType===z?gr:mr;Bn()&&this.player.fullscreen&&n.useWebFullScreen?s-=l:o-=l}var c=n.rotate,u=(s-i)/2,d=(o-a)/2;270!==c&&90!==c||(i=r.height,a=r.width);var h=s/i,p=o/a,f=h>p?p:h;n.isResize||h!==p&&(f=h+","+p),n.isFullResize&&(f=h>p?h:p);var m="scale("+f+")";"none"===n.mirrorRotate&&c&&(m+=" rotate("+c+"deg)"),"level"===n.mirrorRotate?m+=" rotateY(180deg)":"vertical"===n.mirrorRotate&&(m+=" rotateX(180deg)"),this.scale=-1!==(""+f).indexOf(",")?h:f,this.shadowRootInnerDom.style.transform=m,this.shadowRootInnerDom.style.left=u+"px",this.shadowRootInnerDom.style.top=d+"px",this.shadowRootInnerDom.style.width=r.width+"px",this.shadowRootInnerDom.style.height=r.height+"px",this.shadowRootInnerDom.style.display="block"}}},{key:"_resizeDomForCanvas",value:function(){var e=this.player.getVideoInfo();if(e&&e.height>0&&e.width>0){var t=this.player._opt,r=this.player.width,i=this.player.height;if(t.hasControl&&!t.controlAutoHide){var a=t.playType===z?gr:mr;Bn()&&this.player.fullscreen&&t.useWebFullScreen?r-=a:i-=a}var n=e.width,o=e.height,s=t.rotate,l=(r-n)/2,c=(i-o)/2;270!==s&&90!==s||(n=e.height,o=e.width);var u=r/n,d=i/o,h=u>d?d:u;t.isResize||u!==d&&(h=u+","+d),t.isFullResize&&(h=u>d?u:d);var p="scale("+h+")";"none"===t.mirrorRotate&&s&&(p+=" rotate("+s+"deg)"),"level"===t.mirrorRotate?p+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(p+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=p,this.shadowRootInnerDom.style.left=l+"px",this.shadowRootInnerDom.style.top=c+"px",this.shadowRootInnerDom.style.display="block"}}},{key:"_resizeDomRatio",value:function(){var e=this.player.getVideoInfo();if(e&&e.height>0&&e.width>0){var t=this.player._opt.aspectRatio.split(":").map(Number),r=this.player.width,i=this.player.height,a=this.player._opt,n=0;a.hasControl&&!a.controlAutoHide&&(n=a.playType===z?gr:mr,i-=n);var o=e.width/e.height,s=t[0]/t[1];if(o>s){var l=s*e.height/e.width;this.shadowRootInnerDom.style.width=100*l+"%",this.shadowRootInnerDom.style.height="calc(100% - ".concat(n,"px)"),this.shadowRootInnerDom.style.padding="0 ".concat((r-r*l)/2,"px")}else{var c=e.width/s/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height="calc(".concat(100*c,"% - ").concat(n,"px)"),this.shadowRootInnerDom.style.padding=(i-i*c)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}}},{key:"_updateDom",value:function(){var e=this;this.shadowRoot&&this.configList.forEach((function(t){var r=document.createElement("div"),i=null;if(t.image&&t.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=t.image.src):t.text&&t.text.content?i=document.createTextNode(t.text.content):(t.rect&&t.rect.color&&t.rect.width||t.html||t.line&&t.line.x1&&t.line.y1&&t.line.x2&&t.line.y2||t.polygon&&t.polygon.list&&t.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(r.appendChild(i),r.style.visibility="",r.style.position="absolute",r.style.display="block",r.style["-ms-user-select"]="none",r.style["-moz-user-select"]="none",r.style["-webkit-user-select"]="none",r.style["-o-user-select"]="none",r.style["user-select"]="none",r.style["-webkit-touch-callout"]="none",r.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",r.style["-webkit-text-size-adjust"]="none",r.style["-webkit-touch-callout"]="none",r.style.opacity=t.opacity,eo(t.left)&&(Jn(t.left)?r.style.left=t.left+"px":r.style.left=t.left),eo(t.right)&&(Jn(t.right)?r.style.right=t.right+"px":r.style.right=t.right),eo(t.top)&&(Jn(t.top)?r.style.top=t.top+"px":r.style.top=t.top),eo(t.bottom)&&(Jn(t.bottom)?r.style.bottom=t.bottom+"px":r.style.bottom=t.bottom),t.backgroundColor&&(r.style.backgroundColor=t.backgroundColor),r.style.overflow="hidden",r.style.zIndex="9999999",t.image&&t.image.src)r.style.width=t.image.width+"px",r.style.height=t.image.height+"px";else if(t.text&&t.text.content)r.style.fontSize=t.text.fontSize+"px",r.style.color=t.text.color,t.text.width&&(r.style.width=t.text.width+"px"),t.text.height&&(r.style.height=t.text.height+"px");else if(t.rect&&t.rect.color&&t.rect.width){if(r.style.width=t.rect.width+"px",r.style.height=t.rect.height+"px",r.style.borderWidth=t.rect.lineWidth+"px",r.style.borderStyle="solid",r.style.borderColor=t.rect.color,t.rect.fill){var a=document.createElement("div");a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.backgroundColor=t.rect.fill,t.rect.fillOpacity&&(a.style.opacity=t.rect.fillOpacity),r.appendChild(a)}}else if(t.html)r.style.width="100%",r.style.height="100%",r.innerHTML=t.html;else if(t.line&&t.line.x1&&t.line.y1&&t.line.x2&&t.line.y2)e.settingLine(r,t.line);else if(t.polygon&&t.polygon.list&&t.polygon.list.length>=3){r.style.width="100%",r.style.height="100%";var n=t.polygon.list,o=t.polygon.color,s=t.polygon.lineWidth;if(n=n.sort((function(e,t){return(e.index||0)-(t.index||0)})),t.polygon.fill){var l=document.createElement("div");l.style.position="absolute",l.style.width="100%",l.style.height="100%";var c="polygon("+n.map((function(e){return"".concat(e.x,"px ").concat(e.y,"px")})).join(", ")+")";l.style.clipPath=c,l.style.backgroundColor=t.polygon.fill,t.polygon.fillOpacity&&(l.style.opacity=t.polygon.fillOpacity),r.appendChild(l)}n.forEach((function(t,i){var a=document.createElement("div");if(i===n.length-1){var l=n[0],c={x1:t.x,y1:t.y,x2:l.x,y2:l.y,color:o,lineWidth:s};return e.settingLine(a,c),void r.appendChild(a)}var u=n[i+1],d={x1:t.x,y1:t.y,x2:u.x,y2:u.y,color:o,lineWidth:s};e.settingLine(a,d),r.appendChild(a)}))}e.isDynamic&&(e.shadowRootDynamicDom=r),e.shadowRootInnerDom.appendChild(r)}}))}},{key:"settingLine",value:function(e,t){var r=t.x1,i=t.y1,a=t.x2,n=t.y2,o=Math.sqrt(Math.pow(r-a,2)+Math.pow(i-n,2)),s=180*Math.atan2(n-i,a-r)/Math.PI;e.style.backgroundColor=t.color,e.style.width=o+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=i+"px",e.style.left=r+"px",e.style.transform="rotate("+s+"deg)",e.style.transformOrigin="0 0"}},{key:"remove",value:function(){this._removeDom()}},{key:"_removeDom",value:function(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}])}(),es=function(e){function t(){var e;return S(this,t),e=_(this,t),e.videoInfo={width:null,height:null,encType:null,encTypeCode:null},e.init=!1,e.prevAiFaceDetectTime=null,e.prevAiObjectDetectTime=null,e.prevOcclusionDetectTime=null,e.contentWatermark=null,e.aiContentWatermark=null,e.tempContentList=[],e.tempAiContentList=[],e.streamFps=0,e}return k(t,e),w(t,[{key:"destroy",value:function(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}},{key:"resetInit",value:function(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}},{key:"getHasInit",value:function(){return this.init}},{key:"updateVideoInfo",value:function(e){eo(e.encTypeCode)&&(this.videoInfo.encType=Nt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),eo(e.encType)&&(this.videoInfo.encType=e.encType),eo(e.width)&&(this.videoInfo.width=e.width),eo(e.height)&&(this.videoInfo.height=e.height),eo(this.videoInfo.encType)&&eo(this.videoInfo.height)&&eo(this.videoInfo.width)&&!this.init&&(this.player.emit(Ct.videoInfo,this.videoInfo),this.init=!0)}},{key:"getVideoInfo",value:function(){return this.videoInfo}},{key:"clearView",value:function(){this.tempContentList=[],this.tempAiContentList=[]}},{key:"resize",value:function(){if(this.player.debug.log("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||Bn()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){var e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}},{key:"_resizeRatio",value:function(){this.player.debug.log("CommonVideo","_resizeRatio()");var e=this.player._opt.aspectRatio.split(":").map(Number),t=this.player.width,r=this.player.height,i=this.player._opt,a=0;i.hasControl&&!i.controlAutoHide&&(a=i.playType===z?gr:mr,r-=a);var n=this.videoInfo,o=n.width/n.height,s=e[0]/e[1];if(this.getType()===de&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===he&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),o>s){var l=s*n.height/n.width;this.$videoElement.style.width=100*l+"%",this.$videoElement.style.height="calc(100% - ".concat(a,"px)"),this.$videoElement.style.padding="0 ".concat((t-t*l)/2,"px")}else{var c=n.width/s/n.height;this.$videoElement.style.width="100%",this.$videoElement.style.height="calc(".concat(100*c,"% - ").concat(a,"px)"),this.$videoElement.style.padding=(r-r*c)/2+"px 0"}}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"setRate",value:function(e){}},{key:"getType",value:function(){return""}},{key:"getCanvasType",value:function(){return""}},{key:"getCurrentTime",value:function(){return 0}},{key:"getStreamFps",value:function(){return this.streamFps}},{key:"isPlaying",value:function(){return!0}},{key:"getPlaybackQuality",value:function(){return null}},{key:"setStreamFps",value:function(e){this.player.debug.log("CommonVideo","setStreamFps",e),this.streamFps=e}},{key:"addContentToCanvas",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}},{key:"addAiContentToCanvas",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}},{key:"doAddContentToWatermark",value:function(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new $o(this.player),this.contentWatermark.resize());var e=[];this.tempContentList.forEach((function(t){var r={left:t.x||0,top:t.y||0};"text"===t.type?r.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?r.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?r.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(r.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(r)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}},{key:"doAddAiContentToWatermark",value:function(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new $o(this.player),this.aiContentWatermark.resize());var e=this.tempAiContentList.map((function(e){var t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}},{key:"_getStyleScale",value:function(){var e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";return e&&e[0]&&(t=e[0].replace("scale(","").replace(")","").split(",")),t}},{key:"getReadyStateInited",value:function(){return!0}}])}(Ho),ts="object"==("undefined"===typeof window?"undefined":T(window))&&window.window===window?window:"object"==("undefined"===typeof self?"undefined":T(self))&&self.self===self?self:"object"==("undefined"===typeof n?"undefined":T(n))&&n.global===n?n:void 0;function rs(e,t,r){var i=new XMLHttpRequest;i.open("GET",e),i.responseType="blob",i.onload=function(){os(i.response,t,r)},i.onerror=function(){console.error("could not download file")},i.send()}function is(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function as(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var ns=ts.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),os="object"!=("undefined"===typeof window?"undefined":T(window))||window!==ts?function(){}:"download"in HTMLAnchorElement.prototype&&!ns?function(e,t,r){var i=ts.URL||ts.webkitURL,a=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",a.download=t,a.rel="noopener","string"==typeof e?(a.href=e,a.origin!==location.origin?is(a.href)?rs(e,t,r):as(a,a.target="_blank"):as(a)):(a.href=i.createObjectURL(e),setTimeout((function(){i.revokeObjectURL(a.href)}),4e4),setTimeout((function(){as(a)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,r){if(t=t||e.name||"download","string"==typeof e)if(is(e))rs(e,t,r);else{var i=document.createElement("a");i.href=e,i.target="_blank",setTimeout((function(){as(i)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=T(t)&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,r),t)}:function(e,t,r,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return rs(e,t,r);var a="application/octet-stream"===e.type,n=/constructor/i.test(ts.HTMLElement)||ts.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||a&&n||ns)&&"undefined"!=typeof FileReader){var s=new FileReader;s.onloadend=function(){var e=s.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},s.readAsDataURL(e)}else{var l=ts.URL||ts.webkitURL,c=l.createObjectURL(e);i?i.location=c:location.href=c,i=null,setTimeout((function(){l.revokeObjectURL(c)}),4e4)}},ss=function(){function e(t,r){S(this,e),this.canvas=t,this.gl=r;var i=r.createShader(r.VERTEX_SHADER);if(r.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),r.compileShader(i),!r.getShaderParameter(i,r.COMPILE_STATUS))throw r.getShaderInfoLog(i);var a=r.createShader(r.FRAGMENT_SHADER);if(r.shaderSource(a,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw r.getShaderInfoLog(a);var n=r.createProgram();if(r.attachShader(n,i),r.attachShader(n,a),r.linkProgram(n),!r.getProgramParameter(n,r.LINK_STATUS))throw r.getProgramInfoLog(n);r.useProgram(n);var o=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);var s=r.getAttribLocation(n,"xy");r.vertexAttribPointer(s,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(s);var l=r.createTexture();r.bindTexture(r.TEXTURE_2D,l),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),this.program=n,this.buffer=o,this.vertexShader=i,this.fragmentShader=a,this.texture=l}return w(e,[{key:"destroy",value:function(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}},{key:"render",value:function(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;var t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}])}(),ls=function(t){function r(e){var t;S(this,r),t=_(this,r),t.player=e;var i=document.createElement("canvas");return i.style.position="absolute",i.style.top=0,i.style.left=0,t.$videoElement=i,e.$container.appendChild(t.$videoElement),t.context2D=null,t.contextGl=null,t.webglRender=null,t.webglRectRender=null,t.webGPURender=null,t.isWebglContextLost=!1,t.isWcsWebgl2=!1,t.bitmaprenderer=null,t.renderType=null,t.controlHeight=0,t.proxyDestroyList=[],t._initCanvasRender(),t}return k(r,t),w(r,[{key:"destroy",value:function(){b(r,"destroy",this,3)([]),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((function(e){e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}},{key:"_initContext2D",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}},{key:"_initContextGl",value:function(){if(this.player.events,this.contextGl=wn(this.$videoElement),!this.contextGl)throw this.player.debug.error("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Xo(this.contextGl,this.player._opt.openWebglAlignment)}},{key:"_initContextGl2",value:function(){if(this.contextGl=Sn(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new ss(this.$videoElement,this.contextGl)}catch(e){this.player.debug.error("CommonCanvasLoader","create webgl2Render error is ".concat(e," and next use context2d.draw render")),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debug.error("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}},{key:"_bindContextGlEvents",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=this.player.events.proxy,i=r(this.$videoElement,"webglcontextlost",(function(r){r.preventDefault(),e.player.debug.error("canvasVideo","webglcontextlost error",r),e.isWebglContextLost=!0,e.webglRender&&(e.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),e.webglRender.destroy(),e.webglRender=null),e.webglRectRender&&(e.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),e.webglRectRender.destroy(),e.webglRectRender=null),e.contextGl=null,setTimeout((function(){if(e.player.debug.log("CommonCanvasLoader","createContextGL() version ".concat(t)),1===t?e.contextGl=wn(e.$videoElement):2===t&&(e.contextGl=Sn(e.$videoElement)),e.player.debug.log("CommonCanvasLoader","createContextGL success"),e.contextGl&&e.contextGl.getContextAttributes){var r=e.contextGl.getContextAttributes();r&&r.stencil?(1===t?e.webglRender=new Xo(e.contextGl,e.player._opt.openWebglAlignment):2===t&&(e.webglRender=new ss(e.$videoElement,e.contextGl)),e.isWebglContextLost=!1,e.player.debug.log("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(e.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),e.player.emitError(Lt.webglContextLostError))}else e.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),e.player.emitError(Lt.webglContextLostError)}),500)})),a=r(this.$videoElement,"webglcontextrestored",(function(t){t.preventDefault(),e.player.debug.log("CommonCanvasLoader","webglcontextrestored ",t)}));this.proxyDestroyList.push(i,a)}},{key:"_initContextGPU",value:function(){var t,r=this;(t=this.$videoElement,new Promise((function(e,r){navigator.gpu?navigator.gpu.requestAdapter().then((function(i){i?i.requestDevice().then((function(a){if(a){var n=t.getContext("webgpu");if(n){var o=navigator.gpu.getPreferredCanvasFormat();n.configure({device:a,format:o,alphaMode:"opaque"}),e({adapter:i,device:a,context:n,format:o})}else r('WebGPU "context" create fail')}else r('WebGPU "device" request fail')})).catch((function(e){r('WebGPU "adapter.requestDevice()" fail')})):r('WebGPU "adapter" request fail is empty')})).catch((function(e){r('WebGPU "navigator.gpu.requestAdapter()" fail')})):r("WebGPU not support!!")}))).then((function(t){t?(r.webGPURender=new Zo(t),r.player.debug.log("CommonCanvasLoader","webGPURender init success")):(r.player.debug.warn("CommonCanvasLoader","createWebGPUContext error is ".concat(e," and next use webgl render")),r.renderType=_r,r._initContextGl())})).catch((function(e){r.player.debug.warn("CommonCanvasLoader","createWebGPUContext error is ".concat(e," and next use webgl render")),r.renderType=_r,r._initContextGl()}))}},{key:"initCanvasViewSize",value:function(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}},{key:"screenshot",value:function(e,t,r,i){e=e||Tn(),i=i||Ut.download;var a=.92;!pi[t]&&Ut[t]&&(i=t,t="png",r=void 0),"string"==typeof r&&(i=r,r=void 0),void 0!==r&&(a=Number(r));var n=pi[t]||pi.png,o=this.$videoElement.toDataURL(n,a);if(i===Ut.base64)return o;var s=En(o);if(i===Ut.blob)return s;if(i===Ut.download){var l=n.split("/")[1];os(s,e+"."+l)}}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(r,i){po(e)&&(e={filename:e}),(e=e||{}).width=t.videoInfo.width,e.height=t.videoInfo.height,e.filename=e.filename||Tn(),e.format=e.format?pi[e.format]:pi.png,e.quality=Number(e.quality)||.92,e.type=e.type||Ut.download;var a=t.$videoElement.toDataURL(e.format,e.quality);io(a,e).then((function(t){if(e.type===Ut.base64)r(a);else{var i=En(t);if(e.type===Ut.blob)r(i);else if(e.type===Ut.download){r();var n=e.format.split("/")[1];os(i,e.filename+"."+n)}}})).catch((function(e){i(e)}))}))}},{key:"render",value:function(){}},{key:"clearView",value:function(){b(r,"clearView",this,3)([])}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"_resize",value:function(){this.player.debug.log("canvasVideo","_resize()");var e=this.player._opt,t=this.player.width,r=this.player.height;if(e.hasControl&&!e.controlAutoHide){var i=this.controlHeight;Bn()&&this.player.fullscreen&&e.useWebFullScreen?t-=i:r-=i}var a=this.$videoElement.width,n=this.$videoElement.height,o=e.rotate,s=(t-a)/2,l=(r-n)/2;270!==o&&90!==o||(a=this.$videoElement.height,n=this.$videoElement.width);var c=t/a,u=r/n,d=c>u?u:c;Io(e.isResize)&&c!==u&&(d=c+","+u),e.isFullResize&&(d=c>u?c:u);var h="scale("+d+")";"none"===e.mirrorRotate&&o&&(h+=" rotate("+o+"deg)"),"level"===e.mirrorRotate?h+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(h+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=h,this.$videoElement.style.left=s+"px",this.$videoElement.style.top=l+"px"}},{key:"initFps",value:function(){}},{key:"setStreamFps",value:function(e){}},{key:"getStreamFps",value:function(){return 25}},{key:"getType",value:function(){return de}},{key:"getCanvasType",value:function(){var e=this.renderType===wr?wr:_r;return this.isWcsWebgl2&&(e=kr),e}}])}(es),cs=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.yuvList=[],r.controlHeight=mr,r.tempTextCanvas=null,r.tempTextCanvasCtx=null,r.player.debug.log("CanvasVideo","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:b(t,"destroy",this,3)([]),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debug.log("CanvasVideoLoader","destroy");case 1:case"end":return e.stop()}}),e,this)})));function r(){return e.apply(this,arguments)}return r}()},{key:"_initCanvasRender",value:function(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=br,Oo()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=Er,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=Tr,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=Cr,this._initContext2D()):this._supportOffscreen()?(this.renderType=Sr,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=wr,this._initContextGPU()):(this.renderType=_r,this._initContextGl())}},{key:"_supportOffscreen",value:function(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}},{key:"_bindOffscreen",value:function(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}},{key:"render",value:function(e){this.yuvList.push(e),this.startRender()}},{key:"startRender",value:function(){for(;!(this.yuvList.length<=0);){var e=this.yuvList.shift();this.doRender(e)}}},{key:"doRender",value:function(e){var t=this;if(this.renderType!==Er){var r={ts:e.ts||0,fps:!0};this.player.updateStats(r)}switch(this.renderType){case Sr:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case _r:case wr:if(this.isWebglContextLost)return void this.player.debug.warn("CanvasVideoLoader","doRender() and webgl context is lost");var i=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=Tn());var a=Tn();a-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(i=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=a)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=Tn());var n=Tn();n-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(i=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=n)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=Tn());var o=Tn();if(o-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){var s=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=o,s&&this.player.emit(Ct.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){var l=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(l&&l.data&&(this.player.emit(Ct.aiOcclusionDetectResult,{type:l.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debug.log("CanvasVideoLoader","doRender() and ai image detect result type is ".concat(l.type," and drop"))}if(this.renderType===wr)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,i)}catch(e){this.player.debug.error("CanvasVideoLoader","doRender webgpu render and error: ".concat(e.toString()))}else if(this.renderType===_r)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,i)}catch(e){this.player.debug.error("CanvasVideoLoader","doRender webgl render context is lost ".concat(this.contextGl&&this.contextGl.isContextLost()," and error: ").concat(e.toString()))}break;case br:if(this.webglRender)this.webglRender.render(e.videoFrame),wo(e.videoFrame);else if(this.context2D)if(vo(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((function(r){t.context2D.drawImage(r,0,0,t.$videoElement.width,t.$videoElement.height),wo(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),wo(e.videoFrame);else this.player.debug.warn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case Er:case Tr:case Cr:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}var c=e.ts||0;this.renderType===Er&&(c=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(c),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}},{key:"clearView",value:function(){var e=this;switch(b(t,"clearView",this,3)([]),this.renderType){case Sr:(function(e,t){var r=document.createElement("canvas");r.width=e,r.height=t;var i=window.createImageBitmap(r,0,0,e,t);return r.width=0,r.height=0,i})(this.$videoElement.width,this.$videoElement.height).then((function(t){e.bitmaprenderer.transferFromImageBitmap(t)}));break;case _r:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case wr:this.webGPURender.clear();break;case br:this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case Er:case Tr:case Cr:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}},{key:"_initTempTextCanvas",value:function(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}},{key:"doAddContentToCanvas",value:function(){this.tempContentList.length>0&&this.context2D&&function(e){var t=e.ctx,r=e.list;t.save(),(r||[]).forEach((function(e){"text"===e.type?(t.font="".concat(e.fontSize||12,"px Arial"),t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}},{key:"doAddContentToWebGlCanvas",value:function(){var e=this;this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((function(t){var r,i=t.x,a=t.y;if("rect"===t.type){var n=t.width,o=t.height,s=(r=t.color||"#008000",[parseInt(r.substring(1,3),16)/255,parseInt(r.substring(3,5),16)/255,parseInt(r.substring(5,7),16)/255,1]),l=t.lineWidth||4;if(!n||!o)return;e.webglRectRender.drawBox({x:i,y:a,width:n,height:o,lineColor:s,lineWidth:l,canvasWidth:e.$videoElement.width,canvasHeight:e.$videoElement.height})}else if("text"===t.type){var c=t.text||"";if(!c)return;var u=t.fontSize||20,d=t.color||"#008000";e.tempTextCanvas||e._initTempTextCanvas(),e.tempTextCanvasCtx.clearRect(0,0,e.tempTextCanvas.width,e.tempTextCanvas.height),e.tempTextCanvasCtx.font="".concat(u,"px Arial"),e.tempTextCanvasCtx.fillStyle=d,e.tempTextCanvasCtx.textBaseline="top",e.tempTextCanvasCtx.fillText(c,0,0),e.webglRender.drawDom(e.$videoElement.width,e.$videoElement.height,i,a,e.tempTextCanvas)}}))}}])}(ls),us=function(t){function r(e){var t;S(this,r),t=_(this,r),t.player=e,t.TAG_NAME="Video";var i=document.createElement("video"),a=document.createElement("canvas");i.muted=!0,i.style.position="absolute",i.style.top=0,i.style.left=0,t._delayPlay=!1,e.$container.appendChild(i),t.$videoElement=i,t.$canvasElement=a,t.canvasContext=a.getContext("2d"),t.mediaStream=null,t.vwriter=null,e.canVideoTrackWritter()&&Yn()&&Qn()&&(t.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),t.mediaStream=new MediaStream([t.trackGenerator]),i.srcObject=t.mediaStream,t.vwriter=t.trackGenerator.writable.getWriter()),t.fixChromeVideoFlashBug(),t.fixMobileAutoFullscreen(),t.resize(),t.eventListenList=[],t.isRenderRetryPlaying=!1,t.isRenderRetryPlayingTimes=0,t.isRetryPlaying=!1,t.isRetryPlayingTimes=0,t.canplayReceived=!1,t.progressProxyDestroy=null,t.checkVideoCanplayTimeout=null;var n=jo();t.supportVideoFrameCallbackHandle=null;var o=t.player.events.proxy,s=o(t.$videoElement,"canplay",(function(){t.player.debug.log("Video","canplay"),t.player.isDestroyedOrClosed()||(t.canplayReceived=!0,t._delayPlay?(t.clearCheckVideoCanplayTimeout(),t._play(),jo()?t.supportVideoFrameCallbackHandle||(t.supportVideoFrameCallbackHandle=t.$videoElement.requestVideoFrameCallback(t.videoFrameCallback.bind(t))):t.player.debug.warn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):t.$videoElement.paused&&t.player.isMSEPlaybackRateChangePause&&(t.player.debug.log("Video","canplay and video is paused and isMSEPlaybackRateChangePause is ".concat(t.player.isMSEPlaybackRateChangePause," so next try to play")),t.player.isMSEPlaybackRateChangePause=!1,t.$videoElement.play()))})),l=o(t.$videoElement,"waiting",(function(){t.player.debug.log("Video","waiting")})),c=o(t.$videoElement,"loadedmetadata",(function(){t.player.debug.log("Video","loadedmetadata")})),u=o(t.$videoElement,"timeupdate",(function(r){if(!t.player.isDestroyedOrClosed()){if(Io(n)){var i=parseInt(1e3*t.getCurrentTime(),10);(e.isWebrtcH264()||t.player.isOldHls()||t.player.isAliyunRtc())&&(t.player.emit(Ct.timeUpdate,i),e.handleRender(),e.updateStats({fps:!0,ts:i,dts:i}))}t.player.isMseDecoderUseWorker()&&(t.player.decoderWorker.updateVideoTimestamp(t.getCurrentTime()),t._handleUpdatePlaybackRate())}})),d=o(t.$videoElement,"error",(function(){var e={};if(t.player.isUseMSE()&&(e=t.player.getMseMineType()),t.player.debug.error("Video","Error Code "+t.$videoElement.error.code+" "+Pa[t.$videoElement.error.code]+"; Details: "+t.$videoElement.error.message+"; Video Info: "+JSON.stringify(t.videoInfo)+"; Mse Mine Type: "+e.video+"; "),t.player.isUseMSE()){t.$videoElement.error.code;var r=t.$videoElement.error.message;-1!==r.indexOf(Ba)&&(t.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==r.indexOf(Ia)&&(t.player.isMSEAudioDecoderError=!0)}t.player.isHlsCanVideoPlay()})),h=o(t.$videoElement,"stalled",(function(){t._detectAndFixStuckPlayback(!0)}));if(t.progressProxyDestroy=o(t.$videoElement,"progress",(function(){t._detectAndFixStuckPlayback()})),t.eventListenList.push(s,l,u,d,c,h),t.player.isUseMSE()){var p=o(t.$videoElement,wi,(function(){t.player.debug.log(t.TAG_NAME,"video playback Rate change",t.$videoElement&&t.$videoElement.playbackRate),t.$videoElement&&t.$videoElement.paused&&(t.player.debug.warn(t.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),t.player.isMSEPlaybackRateChangePause=!0)}));t.eventListenList.push(p),t.player.on(Ct.visibilityChange,(function(e){e&&setTimeout((function(){if(t.player.isPlaying()&&t.$videoElement){var e=t.getVideoBufferLastTime();e-t.$videoElement.currentTime>t.getBufferMaxDelayTime()&&(t.player.debug.log(t.TAG_NAME,"visibilityChange is true and lastTime is ".concat(e," and currentTime is ").concat(t.$videoElement.currentTime," so set currentTime to lastTime")),t.$videoElement.currentTime=e)}}),300)}))}return t.player.debug.log("Video","init"),t}return k(r,t),w(r,[{key:"destroy",value:function(){var t=A(v().mark((function t(){var i;return v().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(b(r,"destroy",this,3)([]),this.clearCheckVideoCanplayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((function(e){e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()&&(i=this.player.$container,i.style.backdropFilter="none",i.style.transform="none"),this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null,this.canvasContext=null,this.$videoElement){this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}if(this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),t.t0=this.vwriter,!t.t0){t.next=8;break}return t.next=7,this.vwriter.close();case 7:this.vwriter=null;case 8:this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((function(e){return e.stop()})),this.mediaStream=null),this.off(),this.player.debug.log("Video","destroy");case 12:case"end":return t.stop()}}),t,this)})));function i(){return t.apply(this,arguments)}return i}()},{key:"videoFrameCallback",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())this.player.debug.log("Video","videoFrameCallback() and isDestroyedOrClosed and return");else{this.player.handleRender();var r=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:r});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=Tn(),this.player.handlePlayToRenderTimes());var i=r+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:i,mseTs:r}),this.player.emit(Ct.timeUpdate,i),Io(this.getHasInit())&&t.width&&t.height){var a={width:t.width,height:t.height};this.updateVideoInfo(a),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(Ct.timeUpdate,r),Io(this.getHasInit())&&t.width&&t.height){var n={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(n.encTypeCode=jt),this.updateVideoInfo(n)}this.player.updateStats({fps:!0,ts:r,dts:r}),this.player.updateCurrentPts(r),this.doAddContentToWatermark()}else if(Bo(this.player._opt.useMSE)&&Io(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){var o=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(o)}else if(this.player._opt.mseDecoderUseWorker){var s=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(s)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}}},{key:"fixChromeVideoFlashBug",value:function(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){var e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}},{key:"fixMobileAutoFullscreen",value:function(){var e=On(),t=Mn();(e||t)&&(this.player.debug.log("Video","fixMobileAutoFullscreen and isIOS ".concat(e," and isAndroid ").concat(t)),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}},{key:"_detectAndFixStuckPlayback",value:function(e){var t=this.$videoElement,r=t.buffered,i=t.readyState;this.player.debug.log(this.TAG_NAME,"_detectAndFixStuckPlayback() and isStalled is ".concat(e," ,canplayReceived is ").concat(this.canplayReceived," ,videoReadyState is ").concat(i)),e||Io(this.canplayReceived)||i<2?r.length>0&&t.currentTime=3)return void(this.player.isWebrtcH264()?(this.player.debug.error("Video","_replay(webrtc H264) then but not playing and retry play times is ".concat(this.isRetryPlayingTimes," and emit error")),this.player.emitError(Lt.videoElementPlayingFailedForWebrtc)):(this.player.debug.error("Video","_replay then but not playing and retry play times is ".concat(this.isRetryPlayingTimes," and emit error to use canvas render")),this.player.emitError(Lt.videoElementPlayingFailed)));this.player.debug.warn("Video","_play then but not playing and retry play and isRetryPlayingTimes is ".concat(this.isRetryPlayingTimes)),this._play(),this.isRetryPlayingTimes++}else this.player.debug.log("Video","_replay() and isPlaying is ".concat(this.isPlaying()," and isRetryPlaying is ").concat(this.isRetryPlaying," and isDestroyedOrClosed is ").concat(this.player.isDestroyedOrClosed()," and return;"))}},{key:"pause",value:function(e){var t=this;this.player.debug.log(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):setTimeout((function(){t.$videoElement&&t.$videoElement.pause(),t._cancelVideoFrameCallback()}),100))}},{key:"clearView",value:function(){b(r,"clearView",this,3)([]),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}},{key:"screenshot",value:function(e,t,r,i){if(!this._canScreenshot())return this.player.debug.warn("Video","screenshot failed, video is not ready and stats is ".concat(this._getVideoReadyState())),null;e=e||Tn(),i=i||Ut.download;var a=.92;!pi[t]&&Ut[t]&&(i=t,t="png",r=void 0),"string"==typeof r&&(i=r,r=void 0),void 0!==r&&(a=Number(r));var n=this.$videoElement,o=this.$canvasElement;o.width=n.videoWidth,o.height=n.videoHeight,this.canvasContext.drawImage(n,0,0,o.width,o.height);var s=pi[t]||pi.png,l=o.toDataURL(s,a);if(this.canvasContext.clearRect(0,0,o.width,o.height),o.width=0,o.height=0,i===Ut.base64)return l;var c=En(l);if(i===Ut.blob)return c;if(i===Ut.download){var u=s.split("/")[1];os(c,e+"."+u)}}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(r,i){if(po(e)&&(e={filename:e}),!t._canScreenshot())return t.player.debug.warn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");var a=t.$videoElement;(e=e||{}).width=a.videoWidth,e.height=a.videoHeight,e.filename=e.filename||Tn(),e.format=e.format?pi[e.format]:pi.png,e.quality=Number(e.quality)||.92,e.type=e.type||Ut.download;var n=t.$canvasElement;n.width=a.videoWidth,n.height=a.videoHeight,t.canvasContext.drawImage(a,0,0,n.width,n.height);var o=n.toDataURL(e.format,e.quality);t.canvasContext.clearRect(0,0,n.width,n.height),n.width=0,n.height=0,io(o,e).then((function(t){if(e.type===Ut.base64)r(o);else{var i=En(t);if(e.type===Ut.blob)r(i);else if(e.type===Ut.download){r();var a=e.format.split("/")[1];os(i,e.filename+"."+a)}}})).catch((function(e){i(e)}))}))}},{key:"initCanvasViewSize",value:function(){this.resize()}},{key:"clear",value:function(){var e=this.$videoElement,t=e.buffered,r=t.length?t.end(t.length-1):0;e.currentTime=r}},{key:"render",value:function(e){var t,r,i=this;if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){var a=this._getVideoReadyState();if(this.player.debug.warn("Video","render() error, video is paused and readyState is "+a),4===a&&Io(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3)return this.player.debug.error("Video","render() error, video is paused and readyState is "+a+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render"),void this.player.emitError(Lt.videoElementPlayingFailed);this.$videoElement.play().then((function(){i.isRenderRetryPlayingTimes=0,i.isRenderRetryPlaying=!1,i.player.debug.log("Video","render() video is paused and replay success")})).catch((function(e){i.isRenderRetryPlaying=!1,i.isRenderRetryPlayingTimes++,i.player.debug.warn("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),wo(e.videoFrame);else if(e.output){var n=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=Tn());var o=Tn();o-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(n=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=o)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=Tn());var s=Tn();s-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(n=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=s)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=Tn());var l=Tn();if(l-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){var c=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=l,c&&(this.player.debug.log("Video","render() and ai occlusion detect result is true"),this.player.emit(Ct.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){var u=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(u&&u.data&&(this.player.emit(Ct.aiOcclusionDetectResult,{type:u.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debug.log("Video","render() and ai image detect result type is ".concat(u.type," and drop"))}try{var d=(t=n,r={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:e.ts},new VideoFrame(t,r));this.vwriter.write(d),wo(d)}catch(e){this.player.debug.error("Video","render error",e),this.player.emitError(Lt.wasmUseVideoRenderError,e)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debug.warn("Video","render and this.vwriter is null")}},{key:"_resize",value:function(){this.player.debug.log("Video","_resize()");var e=this.player.width,t=this.player.height,r=this.player._opt,i=r.rotate;if(r.hasControl&&!r.controlAutoHide){var a=r.playType===z?gr:mr;Bn()&&this.player.fullscreen&&r.useWebFullScreen?e-=a:t-=a}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==i&&90!==i||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");var n=(e-this.$videoElement.width)/2,o=(t-this.$videoElement.height)/2,s="contain";Io(r.isResize)&&(s="fill"),r.isFullResize&&(s="none");var l="";"none"===r.mirrorRotate&&i&&(l+=" rotate("+i+"deg)"),"level"===r.mirrorRotate?l+=" rotateY(180deg)":"vertical"===r.mirrorRotate&&(l+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=s),this.$videoElement.style.transform=l,this.$videoElement.style.padding="0",this.$videoElement.style.left=n+"px",this.$videoElement.style.top=o+"px"}},{key:"getType",value:function(){return he}},{key:"getCurrentTime",value:function(){return this.$videoElement.currentTime}},{key:"isPlaying",value:function(){return this.$videoElement&&Io(this.$videoElement.paused)&&Io(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}},{key:"_canScreenshot",value:function(){return this.$videoElement&&this.$videoElement.readyState>=1}},{key:"getPlaybackQuality",value:function(){var e=null;if(this.$videoElement){if(vo(this.$videoElement.getVideoPlaybackQuality)){var t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:Tn()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}},{key:"setRate",value:function(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}},{key:"rate",get:function(){var e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}},{key:"clearCheckVideoCanplayTimeout",value:function(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}},{key:"_cancelVideoFrameCallback",value:function(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}},{key:"_getBufferStore",value:function(){var e=this.$videoElement,t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}},{key:"_handleUpdatePlaybackRate",value:function(){var e=this.$videoElement,t=e.buffered;t.length&&t.start(0);var r=t.length?t.end(t.length-1):0,i=e.currentTime,a=r-i,n=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:a}),a>n)this.player.debug.log(this.TAG_NAME,"handleUpdatePlaybackRate and buffered is ".concat(r," and current is ").concat(i," , delay buffer is more than ").concat(n," is ").concat(a," and new time is ").concat(r)),e.currentTime=r,i=e.currentTime;else if(a<0){if(this.player.debug.warn(this.TAG_NAME,"handleUpdatePlaybackRate and delay buffer is ".concat(r," - current is ").concat(i," = ").concat(a," < 0 and check video is paused : ").concat(e.paused," ")),0===r)return void this.player.emit(Lt.mediaSourceBufferedIsZeroError,"video.buffered is empty");e.paused&&e.play()}var o=this._getPlaybackRate(r-i);e.playbackRate!==o&&(this.player.debug.log(this.TAG_NAME,"handleUpdatePlaybackRate and buffered is ".concat(r," and current time is ").concat(i," and delay is ").concat(r-i," set playbackRate is ").concat(o," ")),e.playbackRate=o)}},{key:"_getPlaybackRate",value:function(e){var t=this.$videoElement,r=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer,i=Math.max(r,1e3),a=i/2;return e*=1e3,1===t.playbackRate?e>i?1.2:1:e<=a?1:t.playbackRate}},{key:"getVideoCurrentTime",value:function(){var e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}},{key:"getVideoBufferLastTime",value:function(){var e=this.$videoElement,t=0;if(e){var r=e.buffered;r.length&&r.start(0),t=r.length?r.end(r.length-1):0}return t}},{key:"getVideoBufferDelayTime",value:function(){var e=this.$videoElement,t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}},{key:"checkSourceBufferDelay",value:function(){var e=this.$videoElement,t=0,r=0;return e.buffered.length>0&&(r=e.buffered.end(e.buffered.length-1),t=r-e.currentTime),t<0&&(this.player.debug.warn(this.TAG_NAME,"checkVideoSourceBufferDelay ".concat(t," < 0, and buffered is ").concat(r," ,currentTime is ").concat(e.currentTime," , try to seek ").concat(e.currentTime," to ").concat(r)),e.currentTime=r,t=0),t}},{key:"checkSourceBufferStore",value:function(){var e=this.$videoElement,t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}},{key:"getDecodePlaybackRate",value:function(){var e=0,t=this.$videoElement;return t&&(e=t.playbackRate),e}},{key:"getBufferMaxDelayTime",value:function(){var e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}},{key:"getReadyStateInited",value:function(){return this._getVideoReadyState()>=1}}])}(es),ds=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.controlHeight=gr,r.bufferList=[],r.playing=!1,r.playInterval=null,r.fps=1,r.preFps=1,r.streamFps=0,r.playbackRate=1,r._firstTimestamp=null,r._renderFps=0,r._startfpsTime=null,r._startFpsTimestamp=null,r._hasCalcFps=!1,r.player.on(Ct.playbackPause,(function(e){e?(r.pause(),r.player.playback.isPlaybackPauseClearCache&&r.clear()):r.resume()})),r.player.debug.log("CanvasPlaybackLoader","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this._stopSync(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this.bufferList=[],this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,b(t,"destroy",this,3)([]),this.player.debug.log("CanvasPlaybackLoader","destroy");case 1:case"end":return e.stop()}}),e,this)})));function r(){return e.apply(this,arguments)}return r}()},{key:"_initCanvasRender",value:function(){this.player._opt.useWCS?(this.renderType=br,Oo()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=wr,this._initContextGPU()):(this.renderType=_r,this._initContextGl())}},{key:"_sync",value:function(){var e=this;this._stopSync(),this._doPlay(),this.playInterval=setInterval((function(){e._doPlay()}),this.fragDuration)}},{key:"_doPlay",value:function(){if(this.bufferList.length>0&&!this.player.seeking){var e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}},{key:"_stopSync",value:function(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}},{key:"_doRender",value:function(e){var t=this;if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),wo(e);else if(vo(e.createImageBitmap))try{e.createImageBitmap().then((function(r){t.context2D.drawImage(r,0,0,t.$videoElement.width,t.$videoElement.height),wo(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),wo(e);else if(this.getCanvasType()===_r)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader","doRender webgl render context is lost ".concat(this.contextGl&&this.contextGl.isContextLost()," and error: ").concat(e.toString()))}else if(this.getCanvasType()===wr)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader","doRender webgpu render and error: ".concat(e.toString()))}}},{key:"rate",get:function(){return this.playbackRate}},{key:"fragDuration",get:function(){return Math.ceil(1e3/(this.fps*this.playbackRate))}},{key:"bufferSize",get:function(){return this.bufferList.length}},{key:"getStreamFps",value:function(){return this.streamFps}},{key:"initFps",value:function(){this._hasCalcFps?this.player.debug.log("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=Cn(this.player.playback.fps,1,100),this.fps=this.preFps)}},{key:"setFps",value:function(e){e!==this.fps?(e>100&&this.player.debug.warn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debug.warn("CanvasPlaybackLoader","setFps min",e),this.fps=Cn(e,1,100),this.player.debug.log("CanvasPlaybackLoader","setFps ".concat(this.preFps," -> ").concat(this.fps)),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader","setFps, same fps ".concat(e))}},{key:"setStreamFps",value:function(e){this.player.debug.log("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}},{key:"setRate",value:function(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}},{key:"render$2",value:function(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);var t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}},{key:"startRender",value:function(){for(;!(this.bufferList.length<=0);){var e=this.bufferList.shift();this._doRender(e.buffer)}}},{key:"pushData",value:function(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);var t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;var r=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(r||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader","buffer size is ".concat(this.bufferSize)),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){var i=To(this.bufferList);null!==i&&i!==this.preFps&&(this.player.debug.log("CanvasPlaybackLoader","calc fps is ".concat(i," pre fps is ").concat(this.preFps," and updatePreFps")),this.setStreamFps(i))}if(!r){var a=this.bufferList.length,n=a/(this.fps*this.playbackRate);this.player.debug.log("CanvasPlaybackLoader","rate is",n),n<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(n*this.playbackRate)),this.player.debug.warn("CanvasPlaybackLoader","rate is",n,"fps is",this.fps,"bufferListLength is",a))}}},{key:"initVideo",value:function(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}},{key:"initVideoDelay",value:function(){var e=this,t=this.player._opt.playbackDelayTime;t>0?this.delayTimeout=setTimeout((function(){e.initVideo()}),t):this.initVideo()}},{key:"clearView",value:function(){b(t,"clearView",this,3)([]),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}},{key:"clear",value:function(){this.player._opt.useWCS&&this.bufferList.forEach((function(e){e.buffer&&wo(e.buffer)})),this.bufferList=[]}},{key:"resume",value:function(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}},{key:"pause",value:function(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}])}(ls),hs=function(){function e(t){return S(this,e),new(e.getLoaderFactory(t._opt))(t)}return w(e,null,[{key:"getLoaderFactory",value:function(e){return e.useMSE?e.mseUseCanvasRender?cs:us:e.isHls&&Io(e.supportHls265)||e.isWebrtc&&Io(e.isWebrtcH265)?e.useCanvasRender?cs:us:e.isAliyunRtc?us:e.useWCS?e.playType===z?ds:!e.useOffscreen&&e.wcsUseVideoRender?us:cs:e.playType===z?ds:e.wasmUseVideoRender&&!e.useOffscreen?us:cs}}])}(),ps=function(e){function t(e){var r;S(this,t),r=_(this,t),r.bufferList=[],r.player=e,r.$audio=null,r.scriptNode=null,r.workletProcessorNode=null,r.workletWorkerCloseTimeout=null,r.hasInitScriptNode=!1,r.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),r.gainNode=r.audioContext.createGain();var i=r.audioContext.createBufferSource();return i.buffer=r.audioContext.createBuffer(1,1,22050),i.connect(r.audioContext.destination),i.noteOn?i.noteOn(0):i.start(0),r.audioBufferSourceNode=i,r.mediaStreamAudioDestinationNode=r.audioContext.createMediaStreamDestination(),r.gainNode.gain.value=0,r._prevVolume=null,r.playing=!1,r.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},r.init=!1,r.hasAudio=!1,r.audioResumeStateTimeout=null,r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),e.t0=this.audioContext,!e.t0){e.next=8;break}return e.next=7,this.audioContext.close();case 7:this.audioContext=null;case 8:return this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=kn,this.scriptNode=null),e.next=14,this._destroyWorklet();case 14:return this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=kn,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.off(),e.abrupt("return",!0);case 21:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_destroyWorklet",value:function(){var e=this;return new Promise((function(t,r){e.workletProcessorNode?(e.workletProcessorNode.port.postMessage({type:"destroy"}),e.workletWorkerCloseTimeout=setTimeout((function(){e.player.debug.log(e.TAG_NAME,"send close and wait 10ms destroy directly"),e.workletWorkerCloseTimeout&&(clearTimeout(e.workletWorkerCloseTimeout),e.workletWorkerCloseTimeout=null),t()}),10)):t()}))}},{key:"resetInit",value:function(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}},{key:"getAudioInfo",value:function(){return this.audioInfo}},{key:"updateAudioInfo",value:function(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=qt[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(Ct.audioInfo,this.audioInfo),this.init=!0)}},{key:"isPlaying",get:function(){return this.playing}},{key:"isMute",get:function(){return 0===this.gainNode.gain.value}},{key:"volume",get:function(){return this.gainNode.gain.value}},{key:"bufferSize",get:function(){return this.bufferList.length}},{key:"audioContextState",get:function(){var e=null;return this.audioContext&&(e=this.audioContext.state),e}},{key:"initScriptNode",value:function(){}},{key:"initMobileScriptNode",value:function(){}},{key:"initWorkletScriptNode",value:function(){}},{key:"getEngineType",value:function(){return""}},{key:"mute",value:function(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}},{key:"setVolume",value:function(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=Cn(e,0,1),null===this._prevVolume?this.player.emit(Ct.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(Ct.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(Ct.mute,!0),this.gainNode.gain.value=e,this.player.emit(Ct.volumechange,this.player.volume),this.player.emit(Ct.volume,this.player.volume),this._prevVolume=e)}},{key:"closeAudio",value:function(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}},{key:"audioEnabled",value:function(e){var t=this;e?this.isStateSuspended()&&(this.audioContext.resume().then((function(){t.player.emit(Ct.audioResumeState,{state:t.audioContextState,isRunning:t.isStateRunning()})})),this.audioResumeStateTimeout=setTimeout((function(){t.clearAudioResumeStateTimeout(),t.isStateSuspended()&&t.player.emit(Ct.audioResumeState,{state:t.audioContextState,isRunning:t.isStateRunning()})}),1e3)):this.isStateRunning()&&this.audioContext.suspend()}},{key:"isStateRunning",value:function(){return"running"===this.audioContextState}},{key:"isStateSuspended",value:function(){return"suspended"===this.audioContextState}},{key:"clearAudioResumeStateTimeout",value:function(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}},{key:"clear",value:function(){this.bufferList=[]}},{key:"play",value:function(e,t){}},{key:"pause",value:function(){this.playing=!1}},{key:"resume",value:function(){this.playing=!0}},{key:"setRate",value:function(e){}},{key:"getAudioBufferSize",value:function(){return 0}}])}(Ho),fs=function(){function e(t,r,i,a){S(this,e),this.player=t,this.audio=r,this.channel=i,this.bufferSize=a}return w(e,[{key:"destroy",value:function(){this.buffer=null,this.channel=null}},{key:"extract",value:function(e,t){for(var r=this.provide(t),i=0;i=o){try{for(var l=0;l2&&void 0!==arguments[2]?arguments[2]:0,i=2*(t=t||0);r>=0||(r=(e.length-i)/2);var a=2*r;this.ensureCapacity(r+this._frameCount);var n=this.endIndex;this.vector.set(e.subarray(i,i+a),n),this._frameCount+=r}},{key:"putBuffer",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,r>=0||(r=e.frameCount-t),this.putSamples(e.vector,e.position+t,r)}},{key:"receive",value:function(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}},{key:"receiveSamples",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=2*t,i=this.startIndex;e.set(this._vector.subarray(i,i+r)),this.receive(t)}},{key:"extract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=this.startIndex+2*t,a=2*r;e.set(this._vector.subarray(i,i+a))}},{key:"ensureCapacity",value:function(){var e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}},{key:"rewind",value:function(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}])}(),gs=function(){function e(t){S(this,e),t?(this._inputBuffer=new ms,this._outputBuffer=new ms):this._inputBuffer=this._outputBuffer=null}return w(e,[{key:"destroy",value:function(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}},{key:"inputBuffer",get:function(){return this._inputBuffer},set:function(e){this._inputBuffer=e}},{key:"outputBuffer",get:function(){return this._outputBuffer},set:function(e){this._outputBuffer=e}},{key:"clear",value:function(){this._inputBuffer.clear(),this._outputBuffer.clear()}}])}(),ys=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.reset(),r._rate=1,r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([])}},{key:"rate",set:function(e){this._rate=e}},{key:"reset",value:function(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}},{key:"clone",value:function(){var e=new t;return e.rate=this._rate,e}},{key:"process",value:function(){var e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);var t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}},{key:"transpose",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;for(var t=this._inputBuffer.vector,r=this._inputBuffer.startIndex,i=this._outputBuffer.vector,a=this._outputBuffer.endIndex,n=0,o=0;this.slopeCount<1;)i[a+2*o]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[r],i[a+2*o+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[r+1],o+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,n+=1,n>=e-1)break e;var s=r+2*n;i[a+2*o]=(1-this.slopeCount)*t[s]+this.slopeCount*t[s+2],i[a+2*o+1]=(1-this.slopeCount)*t[s+1]+this.slopeCount*t[s+3],o+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[r+2*e-2],this.prevSampleR=t[r+2*e-1],o}}])}(gs),vs=function(){function e(t){S(this,e),this._pipe=t}return w(e,[{key:"destroy",value:function(){}},{key:"pipe",get:function(){return this._pipe}},{key:"inputBuffer",get:function(){return this._pipe.inputBuffer}},{key:"outputBuffer",get:function(){return this._pipe.outputBuffer}},{key:"fillInputBuffer",value:function(){throw new Error("fillInputBuffer() not overridden")}},{key:"fillOutputBuffer",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:As;return i=_(this,t,[r]),i.callback=a,i.sourceSound=e,i.historyBufferSize=22050,i._sourcePosition=0,i.outputBufferPosition=0,i._position=0,i}return k(t,e),w(t,[{key:"destroy",value:function(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}},{key:"position",get:function(){return this._position},set:function(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");var t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}},{key:"sourcePosition",get:function(){return this._sourcePosition},set:function(e){this.clear(),this._sourcePosition=e}},{key:"onEnd",value:function(){this.callback()}},{key:"fillInputBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Float32Array(2*e),r=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=r,this.inputBuffer.putSamples(t,0,r)}},{key:"extract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);var r=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,r);var i=this.outputBufferPosition+r;return this.outputBufferPosition=Math.min(this.historyBufferSize,i),this.outputBuffer.receive(Math.max(i-this.historyBufferSize,0)),this._position+=r,r}},{key:"handleSampleData",value:function(e){this.extract(e.data,4096)}},{key:"clear",value:function(){b(t,"clear",this,3)([]),this.outputBufferPosition=0}}])}(vs),_s=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],ks=-10/1.5,ws=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r._quickSeek=!0,r.midBufferDirty=!1,r.midBuffer=null,r.refMidBuffer=null,r.overlapLength=0,r.autoSeqSetting=!0,r.autoSeekSetting=!0,r._tempo=1,r.setParameters(44100,0,0,8),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.clear(),b(t,"destroy",this,3)([])}},{key:"clear",value:function(){b(t,"clear",this,3)([]),this.clearMidBuffer(),this.refMidBuffer=null}},{key:"clearMidBuffer",value:function(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}},{key:"setParameters",value:function(e,t,r,i){e>0&&(this.sampleRate=e),i>0&&(this.overlapMs=i),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,r>0?(this.seekWindowMs=r,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}},{key:"tempo",get:function(){return this._tempo},set:function(e){var t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}},{key:"inputChunkSize",get:function(){return this.sampleReq}},{key:"outputChunkSize",get:function(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}},{key:"calculateOverlapLength",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}},{key:"checkLimits",value:function(e,t,r){return er?r:e}},{key:"calculateSequenceParameters",value:function(){var e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+ks*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}},{key:"quickSeek",set:function(e){this._quickSeek=e}},{key:"clone",value:function(){var e=new t;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}},{key:"seekBestOverlapPosition",value:function(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}},{key:"seekBestOverlapPositionStereo",value:function(){var e,t,r,i=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;it&&(t=r,e=i);return e}},{key:"seekBestOverlapPositionStereoQuick",value:function(){var e,t,r,i,a,n=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,i=0,a=0;n<4;n+=1){for(var o=0;_s[n][o]&&(a=i+_s[n][o],!(a>=this.seekLength));)r=this.calculateCrossCorrelationStereo(2*a,this.refMidBuffer),r>t&&(t=r,e=a),o+=1;i=e}return e}},{key:"preCalculateCorrelationReferenceStereo",value:function(){for(var e,t,r=0;r=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);var i=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(i,i+2*this.overlapLength)),this.skipFract+=this.nominalSkip,r=Math.floor(this.skipFract),this.skipFract-=r,this._inputBuffer.receive(r)}}}])}(gs),Ss=function(e,t){return(e>t?e-t:t-e)>1e-10},Es=function(){function e(){S(this,e),this.transposer=new ys(!1),this.stretch=new ws(!1),this._inputBuffer=new ms,this._intermediateBuffer=new ms,this._outputBuffer=new ms,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}return w(e,[{key:"destroy",value:function(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}},{key:"clear",value:function(){this.transposer.clear(),this.stretch.clear()}},{key:"clone",value:function(){var t=new e;return t.rate=this.rate,t.tempo=this.tempo,t}},{key:"rate",get:function(){return this._rate},set:function(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}},{key:"rateChange",set:function(e){this._rate=1+.01*e}},{key:"tempo",get:function(){return this._tempo},set:function(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}},{key:"tempoChange",set:function(e){this.tempo=1+.01*e}},{key:"pitch",set:function(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}},{key:"pitchOctaves",set:function(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}},{key:"pitchSemitones",set:function(e){this.pitchOctaves=e/12}},{key:"inputBuffer",get:function(){return this._inputBuffer}},{key:"outputBuffer",get:function(){return this._outputBuffer}},{key:"calculateEffectiveRateAndTempo",value:function(){var e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,Ss(this._tempo,e)&&(this.stretch.tempo=this._tempo),Ss(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}},{key:"process",value:function(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}])}(),Ts=function(){function e(t,r,i){S(this,e),this.player=t,this.audio=r,this.soundTouch=new Es,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new bs(i,this.soundTouch)}return w(e,[{key:"destroy",value:function(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}},{key:"setRate",value:function(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}},{key:"provide",value:function(e){for(var t=new Float32Array(2*e),r=this.filter.extract(t,e),i=new Float32Array(r),a=new Float32Array(r),n=0;n=100*this.playbackRate}},{key:"initProcessor",value:function(){this.processor=new fs(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new Ts(this.player,this,this.processor)}},{key:"getAutoAudioEngineType",value:function(){var e=this,t=this.player._opt.audioEngine||ra,r=function(){t=fo()&&Mn()?ia:(On()&&e.player._opt.supportLockScreenPlayAudio||So()&&e.supportAudioWorklet(),ra)};return this.player._opt.audioEngine?this.player._opt.audioEngine===ta&&So()&&this.supportAudioWorklet()?t=ta:this.player._opt.audioEngine===ia?t=ia:this.player._opt.audioEngine===ra?t=ra:r():r(),t}},{key:"getAudioBufferSizeByType",value:function(){var e=this.engineType;this.player._opt.hasVideo;var t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===ta?1024:e===ia?t||4800:1024}},{key:"supportAudioWorklet",value:function(){return this.audioContext&&this.audioContext.audioWorklet}},{key:"initScriptNode",value:function(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===ta?this.initWorkletScriptNode():this.engineType===ia?this.initIntervalScriptNode():this.engineType===ra&&this.initProcessScriptNode(),this.audioElementPlay())}},{key:"getEngineType",value:function(){return this.engineType}},{key:"isPlaybackRateSpeed",value:function(){return this.playbackRate>this.defaultPlaybackRate}},{key:"initProcessScriptNode",value:function(){var e=this,t=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);t.onaudioprocess=function(t){var r=t.outputBuffer;e.handleScriptNodeCallback(r)},t.connect(this.gainNode),this.scriptNode=t,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}},{key:"initIntervalScriptNode",value:function(){var e=this;this.scriptStartTime=0;var t=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((function(){if(0===e.bufferList.length||Io(e.playing)||e.isMute)e.playing&&Io(e.isMute)&&e.player.debug.log("AudioContext","interval script node and bufferList is ".concat(e.bufferList.length," or playing is ").concat(e.playing));else{var t=e.audioContext.createBufferSource(),r=e.audioContext.createBuffer(e.audioInfo.channels,e.audioBufferSize,e.audioContext.sampleRate);e.handleScriptNodeCallback(r,(function(){e.scriptStartTime=4)this.state=2;else if(2===this.state)for(var n=this.samplesArray[0],o=0;o2&&void 0!==arguments[2]&&arguments[2];t=t||kn;var a=e.length;i&&(r=e,a=this.audioBufferSize);var n=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&Bo(this.player.visibility)){this.calcPlaybackRateBySync();var o=this.player.getAudioSyncVideoDiff();if(o>this.player._opt.syncAudioAndVideoDiff)return this.player.debug.warn("AudioContext","audioSyncVideoOption more than diff :".concat(o,", waiting and bufferList is ").concat(this.bufferList.length)),i?r.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,n),void t()}var s=this._provide(a);if(0===s.size)return Io(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debug.warn("AudioContext","bufferList size is ".concat(this.bufferList.length," outputBufferLength is ").concat(a,",and bufferItem.size is 0")),i?r.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,n),void t();s&&s.ts&&(this.player.audioTimestamp=s.ts),i?r.port.postMessage({message:"data",buffer:s}):this.fillScriptNodeOutputBuffer(e,n,s),t()}else 0===this.bufferList.length&&this.playing&&Io(this.isMute)&&Io(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debug.warn("AudioContext","bufferList size is 0 and outputBufferLength is ".concat(a)),i?r.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,n),t()}},{key:"fillScriptNodeOutputBuffer",value:function(e,t,r){if(1===t){var i=e.getChannelData(0);r?0===r.size?i.fill(0):i.set(r.left):i.fill(0)}else if(2===t){var a=e.getChannelData(0),n=e.getChannelData(1);r?0===r.size?(a.fill(0),n.fill(0)):(a.set(r.left),n.set(r.right)):(a.fill(0),n.fill(0))}}},{key:"play",value:function(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),Io(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debug.warn("AudioContext","play has not init script node"))}},{key:"calcPlaybackRateBySync",value:function(){if(!this.isMute&&this.playing){var e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debug.warn("AudioContext","bufferList length ".concat(this.bufferList.length," more than ").concat(e,", and drop")),void this.clear();var t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===ia){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debug.warn("AudioContext","engine active , audioSyncVideoOption ".concat(-this.player._opt.syncAudioAndVideoDiff," less than diff :").concat(t,",\n and bufferlist is ").concat(this.bufferList.length));for(var r=this.player.getRenderCurrentPts();this.bufferList.length>0;){var i=this.bufferList[0],a=i.ts-r;if(a>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=i.ts,this.player.debug.log("AudioContext","engine active , audioSyncVideoOption\n item.ts is ".concat(i.ts," and currentVideoTimestamp is ").concat(r,", diff is ").concat(a," > -").concat(this.player._opt.syncAudioAndVideoDiff/2," and end"));break}this.bufferList.shift(),this.player.audioTimestamp=i.ts}}}else{var n=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?n===this.defaultPlaybackRate&&(this.player.debug.log("AudioContext","audioSyncVideoOption ".concat(-this.player._opt.syncAudioAndVideoDiff," less than diff :").concat(t,",\n speed up, playbackRate is ").concat(n,",\n and bufferList is ").concat(this.bufferList.length)),n=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&n!==this.defaultPlaybackRate&&(this.player.debug.log("AudioContext","diff is ".concat(t," > -").concat(this.player._opt.syncAudioAndVideoDiff/2," and speed to 1")),n=this.defaultPlaybackRate),this.updatePlaybackRate(n)}}}},{key:"calcPlaybackRateByBuffer",value:function(){if(!this.isMute&&this.playing){var e=this.playbackRate,t=1e3,r=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,r=this.player._opt.videoBufferMax);var i=Math.floor(t/this.oneBufferDuration),a=Math.floor(r/this.oneBufferDuration);if(this.bufferList.length>a)return this.player.debug.warn("AudioContext","bufferList length ".concat(this.bufferList.length," more than ").concat(a,", and drop")),void this.clear();this.getEngineType()!==ia&&(this.bufferList.length>i?(e=this.defaultPlaybackRate+.2,this.player.debug.log("AudioContext","bufferList length ".concat(this.bufferList.length," more than ").concat(i,", speed up, playbackRate is ").concat(e))):this.bufferList.length0?this.player.emit(Ct.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(Ct.mute,!0),this.$video.volume=e,this.player.emit(Ct.volumechange,this.player.volume),this.player.emit(Ct.volume,this.player.volume),this._prevVolume=e)}},{key:"clear",value:function(){}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"resume",value:function(){}},{key:"getEngineType",value:function(){return"audio"}},{key:"isPlaybackRateSpeed",value:function(){return!1}},{key:"getAudioBufferSize",value:function(){return 0}},{key:"setRate",value:function(){}},{key:"initScriptNode",value:function(){}},{key:"initScriptNodeDelay",value:function(){}},{key:"audioEnabled",value:function(){this.mute(!1)}}])}(Ho),Rs=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.delayTimeout=null,r.player.on(Ct.playbackPause,(function(e){r.listenPlaybackPause(e)})),r.player.debug.log("AudioPlaybackContext","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),e.next=3,b(t,"destroy",this,3)([]);case 3:return this.player.debug.log("AudioPlaybackLoader","destroy"),e.abrupt("return",!0);case 5:case"end":return e.stop()}}),e,this)})));function r(){return e.apply(this,arguments)}return r}()},{key:"listenPlaybackPause",value:function(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}},{key:"initScriptNodeDelay",value:function(){var e=this,t=this.player._opt.playbackDelayTime;t>0?this.delayTimeout=setTimeout((function(){e.initScriptNode()}),t):this.initScriptNode()}},{key:"setRate",value:function(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debug.log("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}])}(Cs),Ds=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="AudioPlayerLoader",r.isAudioPlayer=!0,r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,b(t,"destroy",this,3)([]);case 2:return this.player.debug.log(this.TAG_NAME,"destroy"),e.abrupt("return",!0);case 4:case"end":return e.stop()}}),e,this)})));function r(){return e.apply(this,arguments)}return r}()},{key:"play",value:function(e,r){Io(this.playing)||b(t,"play",this,3)([e,r])}},{key:"pause",value:function(){this.player.debug.log(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}},{key:"resume",value:function(){this.player.debug.log(this.TAG_NAME,"resume"),this.playing=!0}}])}(Cs),Ls=function(){function e(t){return S(this,e),new(e.getLoaderFactory(t._opt))(t)}return w(e,null,[{key:"getLoaderFactory",value:function(e){return e.playType===z?e.useMSE&&e.mseDecodeAudio?xs:Rs:e.playType===j?Ds:e.isHls&&Io(e.supportHls265)||e.isWebrtc&&Io(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc?xs:Cs}}])}(),Ps=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.playing=!1,r._requestAbort=!1,r._status=Ra,r.writableStream=null,r.abortController=new AbortController,r.streamRate=Ln((function(t){e.emit(Ct.kBps,(t/1024).toFixed(2))})),r.streamRateInterval=null,e.debug.log("FetchStream","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){var t=this;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.abort(),this.writableStream&&Io(this.writableStream.locked)&&this.writableStream.close().catch((function(e){t.player.debug.log("FetchStream","destroy and writableStream.close()",e)})),this.writableStream=null,this.off(),this._status=Ra,this.streamRate=null,this.stopStreamRateInterval(),this.player.debug.log("FetchStream","destroy"),!0));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"startStreamRateInterval",value:function(){var e=this;this.stopStreamRateInterval(),this.streamRateInterval=setInterval((function(){e.streamRate&&e.streamRate(0)}),1e3)}},{key:"stopStreamRateInterval",value:function(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}},{key:"fetchStream",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.player.demux;this.player._times.streamStart=Tn();var a=Object.assign({signal:this.abortController.signal},{headers:r.headers||{}});fetch(e,a).then((function(e){if(t._requestAbort)return t._status=Ra,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return t.player.debug.error("FetchStream","fetch response status is ".concat(e.status," and ok is ").concat(e.ok," and emit error and next abort()")),t.abort(),void t.emit(Lt.fetchError,"fetch response status is ".concat(e.status," and ok is ").concat(e.ok));if(t.emit(Ct.streamSuccess),t.startStreamRateInterval(),"undefined"!=typeof WritableStream)t.player.debug.log("FetchStream","use WritableStream() to read stream"),t.writableStream=new WritableStream({write:function(e){return t.abortController&&t.abortController.signal&&t.abortController.signal.aborted?(t.player.debug.log("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(t._status=La)):Bo(t._requestAbort)?(t.player.debug.log("FetchStream","writableStream.write() and this._requestAbort is true so return"),void(t._status=La)):"string"!=typeof e?(t._status=Da,t.streamRate&&t.streamRate(e.byteLength),i.dispatch(e)):void t.player.debug.warn("FetchStream",'writableStream.write() and value is "'.concat(e,'" string so return'))},close:function(){t._status=La,i.close(),t.emit(Ct.streamEnd,"fetch done")},abort:function(e){if(t.abortController&&t.abortController.signal&&t.abortController.signal.aborted)return t.player.debug.log("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(t._status=La);i.close();var r=e.toString();-1===r.indexOf(Bi)&&-1===r.indexOf(Ii)&&e.name!==Mi&&(t.abort(),t.emit(Lt.fetchError,e))}}),e.body.pipeTo(t.writableStream);else{t.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");var r=e.body.getReader(),a=function(){r.read().then((function(e){var r=e.done,n=e.value;return r?(t._status=La,i.close(),void t.emit(Ct.streamEnd,"fetch done")):t.abortController&&t.abortController.signal&&t.abortController.signal.aborted?(t.player.debug.log("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(t._status=La)):Bo(t._requestAbort)?(t.player.debug.log("FetchStream","reader.read() and this._requestAbort is true so return"),void(t._status=La)):void("string"!=typeof n?(t._status=Da,t.streamRate&&t.streamRate(n.byteLength),i.dispatch(n),a()):t.player.debug.warn("FetchStream",'reader.read() and value is "'.concat(n,'" string so return')))})).catch((function(e){if(t.abortController&&t.abortController.signal&&t.abortController.signal.aborted)return t.player.debug.log("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(t._status=La);i.close();var r=e.toString();-1===r.indexOf(Bi)&&-1===r.indexOf(Ii)&&e.name!==Mi&&(t.abort(),t.emit(Lt.fetchError,e))}))};a()}})).catch((function(e){t.abortController&&t.abortController.signal&&t.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),t.abort(),t.emit(Lt.fetchError,e))}))}},{key:"abort",value:function(){this._requestAbort=!0;var e=mo();if(this._status!==Da||Io(e)){if(this.abortController){try{this.abortController.abort()}catch(e){}this.abortController=null}}else this.abortController=null,this.player.debug.log("FetchStream","abort() and not abortController.abort() _status is ".concat(this._status," and _isChrome is ").concat(e))}},{key:"getStreamType",value:function(){return P}}])}(Ho),Bs=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.TAG_NAME="FetchWorkerLoader",r.player=e,r.playing=!1,r.fetchWorker=null,r.workerClearTimeout=null,r.workerUrl=null,r.destroyResolve=null,r.decoderWorkerCloseTimeout=null,r.abortController=new AbortController,r.streamRate=Ln((function(t){e.emit(Ct.kBps,(t/1024).toFixed(2))})),r.streamRateInterval=null,r._initFetchWorker(),e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,r){e.fetchWorker?(e.player.debug.log(e.TAG_NAME,"send destroy"),e.fetchWorker.postMessage({cmd:_t}),e.destroyResolve=t,e.decoderWorkerCloseTimeout=setTimeout((function(){e.player.debug.warn(e.TAG_NAME,"send close but not response and destroy directly"),e.decoderWorkerCloseTimeout&&(clearTimeout(e.decoderWorkerCloseTimeout),e.decoderWorkerCloseTimeout=null),e._destroy(),setTimeout((function(){t()}),0)}),2e3)):(e._destroy(),setTimeout((function(){t()}),0))}))}},{key:"_destroy",value:function(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_initFetchWorker",value:function(){var e=this,t=No(function(){function e(e){return!0===e||"true"===e}function t(e){return!1===e||"false"===e}var r="The user aborted a request",i="AbortError",a="AbortError",n="fetch",o="destroy",s="destroyEnd",l="buffer",c="fetchError",u="fetchClose",d="fetchSuccess",h="idle",p="buffering",f="complete",m=new(function(){function n(){S(this,n),this._requestAbort=!1,this._status=h,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}return w(n,[{key:"destroy",value:function(){this.abort(),this.writableStream&&t(this.writableStream.locked)&&this.writableStream.close().catch((function(e){})),this.writableStream=null,this._status=h}},{key:"fetchStream",value:function(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=Object.assign({signal:this.abortController.signal},{headers:o.headers||{}});fetch(t,s).then((function(t){if(n._requestAbort)return n._status=h,void t.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(t))return n.abort(),void postMessage({cmd:c,message:"fetch response status is ".concat(t.status," and ok is ").concat(t.ok)});if(postMessage({cmd:d}),"undefined"!=typeof WritableStream)n.writableStream=new WritableStream({write:function(t){n.abortController&&n.abortController.signal&&n.abortController.signal.aborted||e(n._requestAbort)?n._status=f:"string"!=typeof t&&(n._status=p,postMessage({cmd:l,buffer:t},[t.buffer]))},close:function(){n._status=f,postMessage({cmd:u})},abort:function(e){if(n.abortController&&n.abortController.signal&&n.abortController.signal.aborted)n._status=f;else{var t=e.toString();-1===t.indexOf(r)&&-1===t.indexOf(i)&&e.name!==a&&(n.abort(),postMessage({cmd:c,message:e.toString()}))}}}),t.body.pipeTo(n.writableStream);else{var o=t.body.getReader(),s=function(){o.read().then((function(t){var r=t.done,i=t.value;if(r)return n._status=f,void postMessage({cmd:u});n.abortController&&n.abortController.signal&&n.abortController.signal.aborted||e(n._requestAbort)?n._status=f:"string"!=typeof i&&(n._status=p,postMessage({cmd:l,buffer:i},[i.buffer]),s())})).catch((function(e){if(n.abortController&&n.abortController.signal&&n.abortController.signal.aborted)n._status=f;else{var t=e.toString();-1===t.indexOf(r)&&-1===t.indexOf(i)&&e.name!==a&&(n.abort(),postMessage({cmd:c,message:e.toString()}))}}))};s()}})).catch((function(e){n.abortController&&n.abortController.signal&&n.abortController.signal.aborted||"AbortError"!==e.name&&(n.abort(),postMessage({cmd:c,message:e.toString()}))}))}},{key:"abort",value:function(){if(this._requestAbort=!0,this._status!==p||t(m.isChrome)){if(this.abortController){try{this.abortController.abort()}catch(e){}this.abortController=null}}else this.abortController=null}}])}());self.onmessage=function(t){var r=t.data;switch(r.cmd){case n:m.isChrome=e(r.isChrome),m.fetchStream(r.url,JSON.parse(r.options));break;case o:m.destroy(),m=null,postMessage({cmd:s})}}}.toString()),r=new Blob([t],{type:"text/javascript"}),i=URL.createObjectURL(r),a=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((function(){window.URL.revokeObjectURL(e.workerUrl),e.workerUrl=null,e.workerClearTimeout=null}),_e),a.onmessage=function(t){var r=e.player.demux,i=t.data;switch(i.cmd){case wt:e.streamRate&&e.streamRate(i.buffer.byteLength),r.dispatch(i.buffer);break;case Tt:e.emit(Ct.streamSuccess),e._startStreamRateInterval();break;case Et:r.close(),e.emit(Ct.streamEnd,"fetch done");break;case St:r.close(),e.emit(Lt.fetchError,i.message);break;case kt:e._destroy()}},this.fetchWorker=a}},{key:"_startStreamRateInterval",value:function(){var e=this;this._stopStreamRateInterval(),this.streamRateInterval=setInterval((function(){e.streamRate&&e.streamRate(0)}),1e3)}},{key:"_stopStreamRateInterval",value:function(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}},{key:"fetchStream",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=Tn(),this.fetchWorker.postMessage({cmd:bt,url:e,isChrome:mo(),options:JSON.stringify(t)})}},{key:"getStreamType",value:function(){return P}}])}(Ho),Is=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.socket=null,r.socketStatus=Pt,r.wsUrl=null,r.requestAbort=!1,r.socketDestroyFnList=[],r.streamRate=Ln((function(t){e.emit(Ct.kBps,(t/1024).toFixed(2))})),r.streamRateInterval=null,e.debug.log("WebsocketStream","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debug.log("WebsocketStream","destroy");case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"startStreamRateInterval",value:function(){var e=this;this.stopStreamRateInterval(),this.streamRateInterval=setInterval((function(){e.streamRate&&e.streamRate(0)}),1e3)}},{key:"stopStreamRateInterval",value:function(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}},{key:"_createWebSocket",value:function(){var e=this,t=this.player,r=t.debug,i=t.events.proxy,a=t.demux;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";var n=i(this.socket,"open",(function(){r.log("WebsocketStream","socket open"),e.socketStatus=Bt,e.emit(Ct.streamSuccess),e.player.emit(Ct.websocketOpen),e.startStreamRateInterval()})),o=i(this.socket,"message",(function(t){"string"!=typeof t.data?(e.streamRate&&e.streamRate(t.data.byteLength),e._handleMessage(t.data)):e.player.debug.warn("WebsocketStream",'websocket handle message message is "'.concat(t.data,'" string so return'))})),s=i(this.socket,"close",(function(t){if(e.socketStatus!==Mt){if(r.log("WebsocketStream","socket close and code is ".concat(t.code)),1006===t.code&&r.error("WebsocketStream","socket close abnormally and code is ".concat(t.code)),Bo(e.requestAbort))return e.requestAbort=!1,void r.log("WebsocketStream","socket close and requestAbort is true");a.close(),e.socketStatus=It,e.player.emit(Ct.websocketClose,t.code),e.emit(Ct.streamEnd,t.code)}else r.log("WebsocketStream","socket close and status is error, so return")})),l=i(this.socket,"error",(function(t){r.error("WebsocketStream","socket error",t),e.socketStatus=Mt,e.emit(Lt.websocketError,t),a.close(),r.log("WebsocketStream","socket error:",t.isTrusted?"websocket user aborted":"websocket error")}));this.socketDestroyFnList.push(n,o,s,l)}},{key:"_closeWebSocket",value:function(){this.socketDestroyFnList.forEach((function(e){return e()})),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debug.log("WebsocketStream","_closeWebSocket() socket is null or socket status is ".concat(this.socket&&this.socket.readyState)):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=Pt,this.streamRate=null}},{key:"_handleMessage",value:function(e){var t=this.player.demux;t?t.dispatch(e):this.player.debug.warn("WebsocketStream","websocket handle message demux is null so return")}},{key:"fetchStream",value:function(e,t){this.player._times.streamStart=Tn(),this.wsUrl=e,this._createWebSocket()}},{key:"sendMessage",value:function(e){this.socket?this.socketStatus===Bt?this.socket.send(e):this.player.debug.error("WebsocketStream","websocket send message error and socket status is ".concat(this.socketStatus)):this.player.debug.error("WebsocketStream","websocket send message socket is null")}},{key:"resetFetchStream",value:function(){this._closeWebSocket(),this._createWebSocket()}},{key:"getStreamType",value:function(){return I}}])}(Ho),Ms=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,e.debug.log("HlsStream","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.off(),this.player.debug.log("HlsStream","destroy"),!0));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"fetchStream",value:function(e){var t=this,r=this.player,i=r.hlsDecoder;r.debug;this.player._times.streamStart=Tn(),i.loadSource(e).then((function(){t.player.debug.log("HlsStream","loadSource success"),t.emit(Ct.streamSuccess)})).catch((function(e){t.emit(Lt.hlsError,e)}))}},{key:"getStreamType",value:function(){return B}}])}(Ho),Us=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.webrctUrl=null,e.debug.log("WebrtcStream","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.webrctUrl=null,this.off(),this.player.debug.log("WebrtcStream","destroy"),!0));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"fetchStream",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.player,a=i.webrtc;i.debug;if(this.player._times.streamStart=Tn(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),-1===this.webrctUrl.indexOf("/webrtc/play")&&this.player.isWebrtcForM7S()){var n=new URL(this.webrctUrl),o="/webrtc/play"+n.pathname;this.webrctUrl=n.origin+o+n.search,this.player.debug.log("WebrtcStream","original url is ".concat(e,", and new url is: ").concat(this.webrctUrl))}a.loadSource(this.webrctUrl,r).then((function(){t.player.debug.log("WebrtcStream","loadSource success"),t.emit(Ct.streamSuccess)})).catch((function(e){t.player.debug.error("WebrtcStream","loadSource error",e),t.emit(Lt.webrtcError,e)}))}},{key:"getStreamType",value:function(){return M}}])}(Ho),Fs=function(t){function r(e){var t;return S(this,r),t=_(this,r),t.player=e,t.transport=null,t.wtUrl=null,t.streamRate=Ln((function(t){e.emit(Ct.kBps,(t/1024).toFixed(2))})),t.streamRateInterval=null,e.debug.log("WebTransportLoader","init"),t}return k(r,t),w(r,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.abort(),this.off(),this.player.debug.log("WebTransportLoader","destroy"),!0));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"startStreamRateInterval",value:function(){var e=this;this.stopStreamRateInterval(),this.streamRateInterval=setInterval((function(){e.streamRate&&e.streamRate(0)}),1e3)}},{key:"stopStreamRateInterval",value:function(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}},{key:"_createWebTransport",value:function(){var e=this,t=this.player,r=(t.debug,t.events.proxy,t.demux);try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((function(){e.emit(Ct.streamSuccess),e.startStreamRateInterval(),e.transport.createBidirectionalStream().then((function(e){e.readable.pipeTo(new WritableStream(r.input))}))})).catch((function(t){e.player.debug.warn("WebTransportLoader","_createWebTransport-ready",t)}))}catch(t){this.player.debug.warn("WebTransportLoader","_createWebTransport",t)}}},{key:"fetchStream",value:function(e){this.player._times.streamStart=Tn(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}},{key:"abort",value:function(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}},{key:"getStreamType",value:function(){return U}}])}(Ho),Os=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.workUrl=null,e.debug.log("WorkerStream","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.workUrl=null,this.off(),this.player.debug.log("WorkerStream","destroy"),!0));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"sendMessage",value:function(e){this.player.decoderWorker.workerSendMessage(e)}},{key:"fetchStream",value:function(e){this.workUrl=e,this.player._times.streamStart=Tn(),this.player.decoderWorker.workerFetchStream(e)}},{key:"getStreamType",value:function(){var e=this.player._opt.protocol;return F+" "+(e===l?P:I)}}])}(Ho),Ns=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.TAG_NAME="AliyunRtcLoader",r.player=e,e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.off(),this.player.debug.log(this.TAG_NAME,"destroy"),!0));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"fetchStream",value:function(e){var t=this,r=this.player.aliyunRtcDecoder;this.player._times.streamStart=Tn(),r.loadSource(e).then((function(){t.player.debug.log(t.TAG_NAME,"loadSource success"),t.emit(Ct.streamSuccess)})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource error",e),t.emit(Lt.aliyunRtcError,e)}))}},{key:"getStreamType",value:function(){return O}}])}(Ho),js=function(){function e(t){return S(this,e),new(e.getLoaderFactory(t._opt))(t)}return w(e,null,[{key:"getLoaderFactory",value:function(e){var t=e.protocol,r=e.useWasm,i=e.playType,a=e.useWCS,n=e.useMSE,o=e.demuxUseWorker,u=e.mainThreadFetchUseWorker;return t===l?i===j?Os:i===N?r&&!_o(e)||o?Os:u?Bs:Ps:a||n?o?Os:u?Bs:Ps:Os:t===s?i===j?Os:i===N?r&&!_o(e)||o?Os:Is:a||n?o?Os:Is:Os:t===c?Ms:t===x?Us:t===R?Fs:t===D?Ns:void 0}}])}(),zs=en((function(e){function t(e,a){if(!e)throw"First parameter is required.";a=new r(e,a=a||{type:"video"});var n=this;function o(t){t&&(a.initCallback=function(){t(),t=a.initCallback=null});var r=new i(e,a);(p=new r(e,a)).record(),h("recording"),a.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",a.type)}function s(e){if(e=e||function(){},p){if("paused"===n.state)return n.resumeRecording(),void setTimeout((function(){s(e)}),1);"recording"===n.state||a.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',n.state),a.disableLogs||console.log("Stopped recording "+a.type+" stream."),"gif"!==a.type?p.stop(t):(p.stop(),t()),h("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(n[e]=p[e])}));var r=p.blob;if(!r){if(!t)throw"Recording failed.";p.blob=r=t}if(r&&!a.disableLogs&&console.log(r.type,"->",v(r.size)),e){var i;try{i=d.createObjectURL(r)}catch(e){}"function"==typeof e.call?e.call(n,i):e(i)}a.autoWriteToDisk&&c((function(e){var t={};t[a.type+"Blob"]=e,L.Store(t)}))}else"function"==typeof e.call?e.call(n,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function c(e,t){if(!e)throw"Pass a callback function over getDataURL.";var r=t?t.blob:(p||{}).blob;if(!r)return a.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){c(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var i=new FileReader;i.readAsDataURL(r),i.onload=function(t){e(t.target.result)}}else{var n=function(e){try{var t=d.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),r=new Worker(t);return d.revokeObjectURL(t),r}catch(e){}}(l);n.onmessage=function(t){e(t.data)},n.postMessage(r)}}function u(e){e=e||0,"paused"!==n.state?"stopped"!==n.state&&(e>=n.recordingDuration?s(n.onRecordingStopped):(e+=1e3,setTimeout((function(){u(e)}),1e3))):setTimeout((function(){u(e)}),1e3)}function h(e){n&&(n.state=e,"function"==typeof n.onStateChanged.call?n.onStateChanged.call(n,e):n.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+a.type+" recorder.";function m(){!0!==a.disableLogs&&console.warn(f)}var g={startRecording:function(t){return a.disableLogs||console.log("RecordRTC version: ",n.version),t&&(a=new r(e,t)),a.disableLogs||console.log("started recording "+a.type+" stream."),p?(p.clearRecordedData(),p.record(),h("recording"),n.recordingDuration&&u(),n):(o((function(){n.recordingDuration&&u()})),n)},stopRecording:s,pauseRecording:function(){p?"recording"===n.state?(h("paused"),p.pause(),a.disableLogs||console.log("Paused recording.")):a.disableLogs||console.warn("Unable to pause the recording. Recording state: ",n.state):m()},resumeRecording:function(){p?"paused"===n.state?(h("recording"),p.resume(),a.disableLogs||console.log("Resumed recording.")):a.disableLogs||console.warn("Unable to resume the recording. Recording state: ",n.state):m()},initRecorder:o,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return n.recordingDuration=e,n.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){n.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),a.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:c,toURL:function(){if(p)return d.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(a.type,e):m()},setAdvertisementArray:function(e){a.advertisement=[];for(var t=e.length,r=0;r-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),m=!p&&!h&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),g=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);g&&!m&&-1!==navigator.userAgent.indexOf("CriOS")&&(g=!1,m=!0);var y=window.MediaStream;function v(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var r=(e.type||"video/webm").split("/")[1];if(-1!==r.indexOf(";")&&(r=r.split(";")[0]),t&&-1!==t.indexOf(".")){var i=t.split(".");t=i[0],r=i[1]}var a=(t||Math.round(9999999999*Math.random())+888888888)+"."+r;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,a);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,a);var n=document.createElement("a");n.href=d.createObjectURL(e),n.download=a,n.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(n),"function"==typeof n.click?n.click():(n.target="_blank",n.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),d.revokeObjectURL(n.href)}function b(){return"undefined"!=typeof window&&"object"==T(window.process)&&"renderer"===window.process.type||!("undefined"==typeof o||"object"!=T(o.versions)||!o.versions.electron)||"object"==("undefined"===typeof navigator?"undefined":T(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}function _(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function k(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===y&&"undefined"!=typeof webkitMediaStream&&(y=webkitMediaStream),void 0!==y&&void 0===y.prototype.stop&&(y.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=_,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var r=new EBML.Reader,i=new EBML.Decoder,a=EBML.tools,n=new FileReader;n.onload=function(e){i.decode(this.result).forEach((function(e){r.read(e)})),r.stop();var n=a.makeMetadataSeekable(r.metadatas,r.duration,r.cues),o=this.result.slice(r.metadataSize),s=new Blob([n,o],{type:"video/webm"});t(s)},n.readAsArrayBuffer(e)},t.bytesToSize=v,t.isElectron=b;var w={};function S(){if(f||g||h)return!0;var e,t,r=navigator.userAgent,i=""+parseFloat(navigator.appVersion),a=parseInt(navigator.appVersion,10);return(m||p)&&(e=r.indexOf("Chrome"),i=r.substring(e+7)),-1!==(t=i.indexOf(";"))&&(i=i.substring(0,t)),-1!==(t=i.indexOf(" "))&&(i=i.substring(0,t)),a=parseInt(""+i,10),isNaN(a)&&(i=""+parseFloat(navigator.appVersion),a=parseInt(navigator.appVersion,10)),a>=49}function E(e,t){var r,i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";"audio"===(t=t||{mimeType:"video/webm"}).type&&(_(e,"video").length&&_(e,"audio").length&&(navigator.mozGetUserMedia?(r=new y).addTrack(_(e,"audio")[0]):r=new y(_(e,"audio")),e=r),t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=m?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg"));var a,n=[];function o(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function s(e){return a&&a.mimeType?a.mimeType:e.mimeType||"video/webm"}function l(){n=[],a=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return n},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],c=[],n=[];var r=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",r),a&&(a=null),m&&!S()&&(r="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&r.mimeType&&(MediaRecorder.isTypeSupported(r.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",r.mimeType),r.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{a=new MediaRecorder(e,r),t.mimeType=r.mimeType}catch(t){a=new MediaRecorder(e)}r.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in a&&!1===a.canRecordMimeType(r.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",r.mimeType)),a.ondataavailable=function(e){if(e.data&&c.push("ondataavailable: "+v(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:s(r)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:s(r)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(n.push(e.data),o(),"function"==typeof t.ondataavailable)){var a=t.getNativeBlob?e.data:new Blob([e.data],{type:s(r)});t.ondataavailable(a)}},a.onstart=function(){c.push("started")},a.onpause=function(){c.push("paused")},a.onresume=function(){c.push("resumed")},a.onstop=function(){c.push("stopped")},a.onerror=function(e){e&&(e.name||(e.name="UnknownError"),c.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",r.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&a&&"inactive"===a.state)return delete t.timeslice,void a.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==a.state&&"stopped"!==a.state&&a.stop())},"number"==typeof t.timeSlice?(o(),a.start(t.timeSlice)):a.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,a&&(this.recordingCallback=e,"recording"===a.state&&a.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(n,{type:s(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){a&&"recording"===a.state&&a.pause()},this.resume=function(){a&&"paused"===a.state&&a.resume()},this.clearRecordedData=function(){a&&"recording"===a.state&&i.stop(l),l()},this.getInternalRecorder=function(){return a},this.blob=null,this.getState=function(){return a&&a.state||"inactive"};var c=[];this.getAllStates=function(){return c},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1),i=this,function r(){if(a&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(r,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function C(e,r){if(!_(e,"audio").length)throw"Your stream has no audio tracks.";var i,a=this,n=[],o=[],s=!1,l=0,c=2,u=(r=r||{}).desiredSampRate;function h(){if(!1===r.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function r(e,t){var r,i=e.numberOfAudioChannels,a=e.leftBuffers.slice(0),n=e.rightBuffers.slice(0),o=e.sampleRate,s=e.internalInterleavedLength,l=e.desiredSampRate;function c(e,t,r){var i=Math.round(e.length*(t/r)),a=[],n=Number((e.length-1)/(i-1));a[0]=e[0];for(var o=1;o96e3)&&(r.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),r.disableLogs||r.desiredSampRate&&console.log("Desired sample-rate: "+r.desiredSampRate);var A=!1;function b(){n=[],o=[],l=0,w=!1,s=!1,A=!1,f=null,a.leftchannel=n,a.rightchannel=o,a.numberOfAudioChannels=c,a.desiredSampRate=u,a.sampleRate=v,a.recordingLength=l,S={left:[],right:[],recordingLength:0}}function k(){i&&(i.onaudioprocess=null,i.disconnect(),i=null),m&&(m.disconnect(),m=null),b()}this.pause=function(){A=!0},this.resume=function(){if(!1===h())throw"Please make sure MediaStream is active.";if(!s)return r.disableLogs||console.log("Seems recording has been restarted."),void this.record();A=!1},this.clearRecordedData=function(){r.checkForInactiveTracks=!1,s&&this.stop(k),k()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var w=!1;i.onaudioprocess=function(e){if(!A)if(!1===h()&&(r.disableLogs||console.log("MediaStream seems stopped."),i.disconnect(),s=!1),s){w||(w=!0,r.onAudioProcessStarted&&r.onAudioProcessStarted(),r.initCallback&&r.initCallback());var t=e.inputBuffer.getChannelData(0),u=new Float32Array(t);if(n.push(u),2===c){var d=e.inputBuffer.getChannelData(1),p=new Float32Array(d);o.push(p)}l+=y,a.recordingLength=l,void 0!==r.timeSlice&&(S.recordingLength+=y,S.left.push(u),2===c&&S.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?i.connect(f.createMediaStreamDestination()):i.connect(f.destination),this.leftchannel=n,this.rightchannel=o,this.numberOfAudioChannels=c,this.desiredSampRate=u,this.sampleRate=v,a.recordingLength=l;var S={left:[],right:[],recordingLength:0};function E(){s&&"function"==typeof r.ondataavailable&&void 0!==r.timeSlice&&(S.left.length?(p({desiredSampRate:u,sampleRate:v,numberOfAudioChannels:c,internalInterleavedLength:S.recordingLength,leftBuffers:S.left,rightBuffers:1===c?[]:S.right},(function(e,t){var i=new Blob([t],{type:"audio/wav"});r.ondataavailable(i),setTimeout(E,r.timeSlice)})),S={left:[],right:[],recordingLength:0}):setTimeout(E,r.timeSlice))}}function x(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var r=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(r=!0)}));var i,a,n,o=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),s=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(o&&l&&l[2]&&(s=parseInt(l[2],10)),o&&s<52&&(r=!1),t.useWhammyRecorder&&(r=!1),r)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)i=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";i=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(n=!0,r&&!t.useWhammyRecorder){var e;"captureStream"in i?e=i.captureStream(25):"mozCaptureStream"in i?e=i.mozCaptureStream(25):"webkitCaptureStream"in i&&(e=i.webkitCaptureStream(25));try{var o=new y;o.addTrack(_(e,"video")[0]),e=o}catch(e){}if(!e)throw"captureStream API are NOT available.";(a=new E(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],h=(new Date).getTime(),d();t.initCallback&&t.initCallback()},this.getWebPImages=function(r){if("canvas"===e.nodeName.toLowerCase()){var i=p.frames.length;p.frames.forEach((function(e,r){var a=i-r;t.disableLogs||console.log(a+"/"+i+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(a,i);var n=e.image.toDataURL("image/webp",1);p.frames[r].image=n})),t.disableLogs||console.log("Generating WebM"),r()}else r()},this.stop=function(e){n=!1;var i=this;r&&a?a.stop(e):this.getWebPImages((function(){p.compile((function(r){t.disableLogs||console.log("Recording finished!"),i.blob=r,i.blob.forEach&&(i.blob=new Blob([],{type:"video/webm"})),e&&e(i.blob),p.frames=[]}))}))};var c=!1;function u(){p.frames=[],n=!1,c=!1}function d(){if(c)return h=(new Date).getTime(),setTimeout(d,500);if("canvas"===e.nodeName.toLowerCase()){var r=(new Date).getTime()-h;return h=(new Date).getTime(),p.frames.push({image:(i=document.createElement("canvas"),a=i.getContext("2d"),i.width=e.width,i.height=e.height,a.drawImage(e,0,0),i),duration:r}),void(n&&setTimeout(d,t.frameInterval))}var i,a;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var r=(new Date).getTime()-h;if(!r)return setTimeout(d,t.frameInterval);h=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:r}),n&&setTimeout(d,t.frameInterval)}})}this.pause=function(){c=!0,a instanceof E&&a.pause()},this.resume=function(){c=!1,a instanceof E?a.resume():n||this.record()},this.clearRecordedData=function(){n&&this.stop(u),u()},this.name="CanvasRecorder",this.toString=function(){return this.name};var h=(new Date).getTime(),p=new D.Video(100)}function R(e,t){function r(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?n?(l=(new Date).getTime(),setTimeout(r,100)):(l=(new Date).getTime(),s.paused&&s.play(),d.drawImage(s,0,0,u.width,u.height),c.frames.push({duration:t,image:u.toDataURL("image/webp")}),void(a||setTimeout(r,e,e))):setTimeout(r,e,e)}function i(e,t,r,i,a){var n=document.createElement("canvas");n.width=u.width,n.height=u.height;var o=n.getContext("2d"),s=[],l=-1===t,c=t&&t>0&&t<=e.length?t:e.length,d=0,h=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=r&&r>=0&&r<=1?r:0,g=i&&i>=0&&i<=1?i:0,y=!1;!function(e){var t=-1,r=e.length;!function i(){++t!==r?setTimeout((function(){e.functionToLoop(i,t)}),1):e.callback()}()}({length:c,functionToLoop:function(t,r){var i,a,n,c=function(){!y&&n-i<=n*g||(l&&(y=!0),s.push(e[r])),t()};if(y)c();else{var v=new Image;v.onload=function(){o.drawImage(v,0,0,u.width,u.height);var e=o.getImageData(0,0,u.width,u.height);i=0,a=e.data.length,n=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:r,id:163}})))}function r(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function i(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var r=0;r1?2*n[0].width:n[0].width;var s=1;3!==e&&4!==e||(s=2),5!==e&&6!==e||(s=3),7!==e&&8!==e||(s=4),9!==e&&10!==e||(s=5),a.height=n[0].height*s}else a.width=o.width||360,a.height=o.height||240;t&&t instanceof HTMLVideoElement&&h(t),n.forEach((function(e,t){h(e,t)})),setTimeout(d,o.frameInterval)}}function h(e,t){if(!i){var r=0,a=0,o=e.width,s=e.height;1===t&&(r=e.width),2===t&&(a=e.height),3===t&&(r=e.width,a=e.height),4===t&&(a=2*e.height),5===t&&(r=e.width,a=2*e.height),6===t&&(a=3*e.height),7===t&&(r=e.width,a=3*e.height),void 0!==e.stream.left&&(r=e.stream.left),void 0!==e.stream.top&&(a=e.stream.top),void 0!==e.stream.width&&(o=e.stream.width),void 0!==e.stream.height&&(s=e.stream.height),n.drawImage(e,r,a,o,s),"function"==typeof e.stream.onRender&&e.stream.onRender(n,r,a,o,s,t)}}function p(e){var r=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,r),r.className=t,r.muted=!0,r.volume=0,r.width=e.width||o.width||360,r.height=e.height||o.height||240,r.play(),r}function f(t){r=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,r.push(t)}}))}void 0!==s?u.AudioContext=s:"undefined"!=typeof webkitAudioContext&&(u.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){d()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var i=new c;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var a=p(t);a.stream=t,r.push(a),i.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var n=o.audioContext.createMediaStreamSource(t);o.audioDestination=o.audioContext.createMediaStreamDestination(),n.connect(o.audioDestination),i.addTrack(o.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(i)}))},this.releaseStreams=function(){r=[],i=!0,o.gainNode&&(o.gainNode.disconnect(),o.gainNode=null),o.audioSources.length&&(o.audioSources.forEach((function(e){e.disconnect()})),o.audioSources=[]),o.audioDestination&&(o.audioDestination.disconnect(),o.audioDestination=null),o.audioContext&&o.audioContext.close(),o.audioContext=null,n.clearRect(0,0,a.width,a.height),a.stream&&(a.stream.stop(),a.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){i=!1;var t=function(){var e;f(),"captureStream"in a?e=a.captureStream():"mozCaptureStream"in a?e=a.mozCaptureStream():o.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new c;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),a.stream=t,t}(),r=function(){u.AudioContextConstructor||(u.AudioContextConstructor=new u.AudioContext),o.audioContext=u.AudioContextConstructor,o.audioSources=[],!0===o.useGainNode&&(o.gainNode=o.audioContext.createGain(),o.gainNode.connect(o.audioContext.destination),o.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var r=o.audioContext.createMediaStreamSource(e);!0===o.useGainNode&&r.connect(o.gainNode),o.audioSources.push(r)}})),t)return o.audioDestination=o.audioContext.createMediaStreamDestination(),o.audioSources.forEach((function(e){e.connect(o.audioDestination)})),o.audioDestination.stream}();return r&&r.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function I(e,t){e=e||[];var r,i,a=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var a;r=new B(e,t.elementClass||"multi-streams-mixer"),(a=[],e.forEach((function(e){_(e,"video").forEach((function(e){a.push(e)}))})),a).length&&(r.frameInterval=t.frameInterval||10,r.width=t.video.width||360,r.height=t.video.height||240,r.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(r.getMixedStream()),(i=new E(r.getMixedStream(),t)).record()},this.stop=function(e){i&&i.stop((function(t){a.blob=t,e(t),a.clearRecordedData()}))},this.pause=function(){i&&i.pause()},this.resume=function(){i&&i.resume()},this.clearRecordedData=function(){i&&(i.clearRecordedData(),i=null),r&&(r.releaseStreams(),r=null)},this.addStreams=function(a){if(!a)throw"First parameter is required.";a instanceof Array||(a=[a]),e.concat(a),i&&r&&(r.appendStreams(a),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(r.getMixedStream()))},this.resetVideoStreams=function(e){r&&(!e||e instanceof Array||(e=[e]),r.resetVideoStreams(e))},this.getMixer=function(){return r},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function M(e,t){var r,i,a;function n(){return new ReadableStream({start:function(i){var a=document.createElement("canvas"),n=document.createElement("video"),o=!0;n.srcObject=e,n.muted=!0,n.height=t.height,n.width=t.width,n.volume=0,n.onplaying=function(){a.width=t.width,a.height=t.height;var e=a.getContext("2d"),s=1e3/t.frameRate,l=setInterval((function(){if(r&&(clearInterval(l),i.close()),o&&(o=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(n,0,0),"closed"!==i._controlledReadableStream.state)try{i.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),s)},n.play()}})}function o(e,l){if(!t.workerPath&&!l)return r=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){o(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var c=new Blob([l],{type:"text/javascript"});t.workerPath=d.createObjectURL(c)}t.workerPath||console.error("workerPath parameter is missing."),(i=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),i.addEventListener("message",(function(e){"READY"===e.data?(i.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),n().pipeTo(new WritableStream({write:function(e){r?console.error("Got image, but recorder is finished!"):i.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(a||s.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){s=[],a=!1,this.blob=null,o(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){a=!0},this.resume=function(){a=!1};var s=[];this.stop=function(e){r=!0;var t=this;!function(e){i?(i.addEventListener("message",(function(t){null===t.data&&(i.terminate(),i=null,e&&e())})),i.postMessage(null)):e&&e()}((function(){t.blob=new Blob(s,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){s=[],a=!1,this.blob=null},this.blob=null}t.DiskStorage=L,t.GifRecorder=P,t.MultiStreamRecorder=I,t.RecordRTCPromisesHandler=function(e,r){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var i=this;i.recordRTC=new t(e,r),this.startRecording=function(){return new Promise((function(e,t){try{i.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{i.recordRTC.stopRecording((function(r){i.blob=i.recordRTC.getBlob(),i.blob&&i.blob.size?e(r):t("Empty blob.",i.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{i.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{i.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{i.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(i.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(i.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(i.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(i.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(i.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=M})),Gs=function(){function e(){S(this,e)}return w(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,r=t.byteLength,i=new Uint8Array(r),a=0,n=0;n=2&&3===t[n]&&0===t[n-1]&&0===t[n-2]||(i[a]=t[n],a++);return new Uint8Array(i.buffer,0,a)}},{key:"parseSPS",value:function(t){var r=e._ebsp2rbsp(t),i=new rn(r);i.readByte();var a=i.readByte();i.readByte();var n=i.readByte();i.readUEG();var o=e.getProfileString(a),s=e.getLevelString(n),l=1,c=420,u=[0,420,422,444],d=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(l=i.readUEG(),3===l&&i.readBits(1),l<=3&&(c=u[l]),d=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var h=3!==l?8:12,p=0;p0&&L<16?(E=P[L-1],T=B[L-1]):255===L&&(E=i.readByte()<<8|i.readByte(),T=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var I=i.readBits(32),M=i.readBits(32);x=i.readBool(),R=M,D=2*I,C=R/D}}var U=1;1===E&&1===T||(U=E/T);var F=0,O=0;0===l?(F=1,O=2-b):(F=3===l?1:2,O=(1===l?2:1)*(2-b));var N=16*(v+1),j=16*(A+1)*(2-b);N-=(_+k)*F,j-=(w+S)*O;var z=Math.ceil(N*U);return i.destroy(),i=null,{profile_string:o,level_string:s,bit_depth:d,ref_frames:y,chroma_format:c,chroma_format_string:e.getChromaFormatString(c),frame_rate:{fixed:x,fps:C,fps_den:D,fps_num:R},sar_ratio:{width:E,height:T},codec_size:{width:N,height:j},present_size:{width:z,height:j}}}},{key:"parseSPS$2",value:function(t){for(var r=t.subarray(1,4),i="avc1.",a=0;a<3;a++){var n=r[a].toString(16);n.length<2&&(n="0"+n),i+=n}var o=e._ebsp2rbsp(t),s=new rn(o);s.readByte();var l=s.readByte();s.readByte();var c=s.readByte();s.readUEG();var u=e.getProfileString(l),d=e.getLevelString(c),h=1,p=420,f=[0,420,422,444],m=8,g=8;if((100===l||110===l||122===l||244===l||44===l||83===l||86===l||118===l||128===l||138===l||144===l)&&(h=s.readUEG(),3===h&&s.readBits(1),h<=3&&(p=f[h]),m=s.readUEG()+8,g=s.readUEG()+8,s.readBits(1),s.readBool()))for(var y=3!==h?8:12,v=0;v0&&U<16?(D=F[U-1],L=O[U-1]):255===U&&(D=s.readByte()<<8|s.readByte(),L=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){var N=s.readBits(32),j=s.readBits(32);B=s.readBool(),I=j,M=2*N,P=I/M}}var z=1;1===D&&1===L||(z=D/L);var G=0,H=0;0===h?(G=1,H=2-E):(G=3===h?1:2,H=(1===h?2:1)*(2-E));var V=16*(w+1),W=16*(S+1)*(2-E);V-=(T+C)*G,W-=(x+R)*H;var J=Math.ceil(V*z);return s.destroy(),s=null,{codec_mimetype:i,profile_idc:l,level_idc:c,profile_string:u,level_string:d,chroma_format_idc:h,bit_depth:m,bit_depth_luma:m,bit_depth_chroma:g,ref_frames:k,chroma_format:p,chroma_format_string:e.getChromaFormatString(p),frame_rate:{fixed:B,fps:P,fps_den:M,fps_num:I},sar_ratio:{width:D,height:L},codec_size:{width:V,height:W},present_size:{width:J,height:W}}}},{key:"_skipScalingList",value:function(e,t){for(var r=8,i=8,a=0,n=0;n=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}},{key:"look",value:function(e){var t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}},{key:"read_golomb",value:function(){var e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,w>>>16&255,w>>>8&255,255&w]),E=new Uint8Array(w+4);E.set(S,0),E.set(t.sps,4),t.sps=E}if(t.pps){var T=t.pps.byteLength,C=new Uint8Array([T>>>24&255,T>>>16&255,T>>>8&255,255&T]),x=new Uint8Array(T+4);x.set(C,0),x.set(t.pps,4),t.pps=x}return t}function Ws(e){var t=e.sps,r=e.pps,i=8+t.byteLength+1+2+r.byteLength,a=!1,n=Gs.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(a=!0,i+=4);var o=new Uint8Array(i);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;var s=t.byteLength;o[6]=s>>>8,o[7]=255&s;var l=8;o.set(t,8),l+=s,o[l]=1;var c=r.byteLength;o[l+1]=c>>>8,o[l+2]=255&c,o.set(r,l+3),l+=3+c,a&&(o[l]=252|n.chroma_format_idc,o[l+1]=248|n.bit_depth_luma-8,o[l+2]=248|n.bit_depth_chroma-8,o[l+3]=0,l+=4);var u=[23,0,0,0,0],d=new Uint8Array(u.length+o.byteLength);return d.set(u,0),d.set(o,u.length),d}function Js(e,t){var r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;var i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function qs(e){return 31&e[0]}function Ks(e){return e===$t}function Ys(e){return!function(e){return e===Kt||e===Yt}(e)&&!Ks(e)}function Qs(e){return e===Qt}var Xs=function(){function e(t){S(this,e),this.data=t,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}return w(e,[{key:"findNextStartCodeOffset",value:function(e){for(var t=e,r=this.data;;){if(t+3>=r.byteLength)return this.eofFlag=!0,r.byteLength;var i=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],a=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===i||1===a)return t;t++}}},{key:"readNextNaluPayload",value:function(){for(var e=this.data,t=null;null==t&&!this.eofFlag;){var r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;var i=31&e[r],a=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,i>=rr||0===a&&(t={type:i,data:e.subarray(r,n)})}return t}}])}(),Zs=w((function e(t){S(this,e);var r=t.data.byteLength;this.type=t.type,this.data=new Uint8Array(4+r),new DataView(this.data.buffer).setUint32(0,r),this.data.set(t.data,4)})),$s=function(e){for(var t=e,r=t.byteLength,i=new Uint8Array(r),a=0,n=0;n=2&&3===t[n]&&0===t[n-1]&&0===t[n-2]||(i[a]=t[n],a++);return new Uint8Array(i.buffer,0,a)},el=function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},tl=function(){function e(){S(this,e)}return w(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,r=t.byteLength,i=new Uint8Array(r),a=0,n=0;n=2&&3===t[n]&&0===t[n-1]&&0===t[n-2]||(i[a]=t[n],a++);return new Uint8Array(i.buffer,0,a)}},{key:"parseVPS",value:function(t){var r=e._ebsp2rbsp(t),i=new rn(r);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}},{key:"parseSPS",value:function(t){var r=e._ebsp2rbsp(t),i=new rn(r);i.readByte(),i.readByte();var a=0,n=0,o=0,s=0;i.readBits(4);var l=i.readBits(3);i.readBool();for(var c=i.readBits(2),u=i.readBool(),d=i.readBits(5),h=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),v=i.readByte(),A=i.readByte(),b=i.readByte(),_=i.readByte(),k=i.readByte(),w=[],S=[],E=0;E0)for(var T=l;T<8;T++)i.readBits(2);for(var C=0;C1&&i.readSEG();for(var O=0;O0&&se<=16?(re=le[se-1],ie=ce[se-1]):255===se&&(re=i.readBits(16),ie=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),ee=i.readBool(),ee&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()&&(ne=i.readBits(32),oe=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool())){var ue=!1,de=!1,he=!1;ue=i.readBool(),de=i.readBool(),(ue||de)&&(he=i.readBool(),he&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),he&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(var pe=0;pe<=l;pe++){var fe=i.readBool();ae=fe;var me=!0,ge=1;fe||(me=i.readBool());var ye=!1;if(me?i.readUEG():ye=i.readBool(),ye||(ge=i.readUEG()+1),ue){for(var ve=0;ve>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];for(var i=e[22],a=e.slice(23),n=0;n0)for(var n=r;n<8;n++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(var o=0;o0)for(var _=i;_<8;_++)r.readBits(2);for(var k=0;k1&&r.readSEG();for(var B=0;B0&&re<16?(X=ie[re-1],Z=ae[re-1]):255===re&&(X=r.readBits(16),Z=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),Y=r.readBool(),Y&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()&&(ee=r.readBits(32),te=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){var ne=!1,oe=!1,se=!1;ne=r.readBool(),oe=r.readBool(),(ne||oe)&&(se=r.readBool(),se&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),se&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(var le=0;le<=i;le++){var ce=r.readBool();$=ce;var ue=!1,de=1;ce||(ue=r.readBool());var he=!1;if(ue?r.readSEG():he=r.readBool(),he||(cpbcnt=r.readUEG()+1),ne)for(var pe=0;pe>8,c[14]=255&a.min_spatial_segmentation_idc,c[15]=252|3&a.parallelismType,c[16]=252|3&a.chroma_format_idc,c[17]=248|7&a.bit_depth_luma_minus8,c[18]=248|7&a.bit_depth_chroma_minus8,c[19]=0,c[20]=0,c[21]=(3&a.constant_frame_rate)<<6|(7&a.num_temporal_layers)<<3|(a.temporal_id_nested?1:0)<<2|3,c[22]=3,c[23]=128|or,c[24]=0,c[25]=1,c[26]=(65280&t.byteLength)>>8,c[27]=(255&t.byteLength)>>0,c.set(t,28),c[23+(5+t.byteLength)+0]=128|lr,c[23+(5+t.byteLength)+1]=0,c[23+(5+t.byteLength)+2]=1,c[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,c[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,c.set(i,23+(5+t.byteLength)+5),c[23+(5+t.byteLength+5+i.byteLength)+0]=128|ur,c[23+(5+t.byteLength+5+i.byteLength)+1]=0,c[23+(5+t.byteLength+5+i.byteLength)+2]=1,c[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,c[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,c.set(r,23+(5+t.byteLength+5+i.byteLength)+5);var u=[28,0,0,0,0],d=new Uint8Array(u.length+c.byteLength);return d.set(u,0),d.set(c,u.length),d}function ol(e,t){var r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;var i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function sl(e){return(126&e[0])>>1}function ll(e){return!function(e){return e>=32&&e<=40}(e)}function cl(e){return e>=16&&e<=21}var ul=function(){function e(t){S(this,e),this.data=t,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}return w(e,[{key:"findNextStartCodeOffset",value:function(e){for(var t=e,r=this.data;;){if(t+3>=r.byteLength)return this.eofFlag=!0,r.byteLength;var i=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],a=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===i||1===a)return t;t++}}},{key:"readNextNaluPayload",value:function(){for(var e=this.data,t=null;null==t&&!this.eofFlag;){var r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;var i=e[r]>>1&63,a=(128&e[r])>>>7,n=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=n,0===a&&(t={type:i,data:e.subarray(r,n)})}return t}}])}(),dl=w((function e(t){S(this,e);var r=t.data.byteLength;this.type=t.type,this.data=new Uint8Array(4+r),new DataView(this.data.buffer).setUint32(0,r),this.data.set(t.data,4)})),hl=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.TAG_NAME="recorderCommon",r.player=e,r.fileName="",r._isRecording=!1,r._recordingTimestamp=0,r.recordingInterval=null,r.sps=null,r.pps=null,r.vps=null,r.codecId=null,r.audioCodeId=null,r.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},r.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)},r}return k(t,e),w(t,[{key:"destroy",value:function(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}},{key:"isH264",get:function(){return this.codecId===jt}},{key:"isH265",get:function(){return this.codecId===zt}},{key:"setFileName",value:function(e){this.fileName=e}},{key:"isRecording",get:function(){return this._isRecording}},{key:"recording",get:function(){return this._isRecording}},{key:"recordTime",get:function(){return this._recordingTimestamp}},{key:"startRecord",value:function(){}},{key:"handleAddNaluTrack",value:function(e,t,r,i){}},{key:"handleAddAudioTrack",value:function(e,t){}},{key:"handleAddTrack",value:function(e){}},{key:"stopRecordAndSave",value:function(){}},{key:"startRecordingInterval",value:function(){}},{key:"isWasmMp4",value:function(){return!1}},{key:"stopRecordingInterval",value:function(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}},{key:"getToTalByteLength",value:function(){return 0}},{key:"_reset",value:function(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}},{key:"initMetaData",value:function(e,t){var r,i=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=i,t===jt)r=Vs(i);else if(t===zt){r=function(e){var t=23,r=e[t];if((63&r)!==or)return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ".concat(r)),{};t+=2,t+=1;var i=e[t+1]|e[t]<<8;t+=2;var a=e.slice(t,t+i);t+=i;var n=e[t];if((63&n)!==lr)return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ".concat(n)),{};t+=2,t+=1;var o=e[t+1]|e[t]<<8;t+=2;var s=e.slice(t,t+o);t+=o;var l=e[t];if((63&l)!==ur)return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ".concat(l)),{};t+=2,t+=1;var c=e[t+1]|e[t]<<8;t+=2;var u=e.slice(t,t+c),d=new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o]),h=new Uint8Array([c>>>24&255,c>>>16&255,c>>>8&255,255&c]),p=new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i]),f=new Uint8Array(o+4);f.set(d,0),f.set(s,4);var m=new Uint8Array(c+4);m.set(h,0),m.set(u,4);var g=new Uint8Array(i+4);return g.set(p,0),g.set(a,4),{sps:f,pps:m,vps:g}}(i);var a=rl(e);r=Object.assign(r,a)}r&&(r.vps&&(this.vps=r.vps),r.pps&&(this.pps=r.pps),r.sps&&(this.sps=r.sps),r.presentWidth&&(this.metaInfo.presentWidth=r.presentWidth),r.presentHeight&&(this.metaInfo.presentHeight=r.presentHeight),r.codecWidth&&(this.metaInfo.codecWidth=r.codecWidth),r.codecHeight&&(this.metaInfo.codecHeight=r.codecHeight),r.timescale&&(this.metaInfo.timescale=r.timescale),r.refSampleDuration&&(this.metaInfo.refSampleDuration=r.refSampleDuration),r.videoType&&(this.metaInfo.videoType=r.videoType))}},{key:"initAudioMetaData",value:function(e,t){this.audioCodeId=t;var r=e[0]>>1&1,i=null;t===Vt?(i=function(e){var t={},r=new pn(e);return r.read(16),t.object_type=fn(r),t.sample_rate=mn(r,t),t.chan_config=r.read(4),t.chan_config0){var n=a.getAudioTracks()[0];n&&n.enabled&&i.addTrack(n)}}this.recorder=zs(i,r)}catch(r){return t.error("RecorderRTC","startRecord error",r),void this.player.emitError(Ct.recordCreateError,r)}this.recorder&&(this._isRecording=!0,this.player.emit(Ct.recording,!0),this.recorder.startRecording(),t.log("RecorderRTC","start recording"),this.player.emit(Ct.recordStart),this.startRecordingInterval())}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(Ct.recordingTimestamp,e._recordingTimestamp)}),1e3)}},{key:"stopRecordAndSave",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ft,r=arguments.length>1?arguments[1]:void 0;return new Promise((function(i,a){e.recorder&&e._isRecording||a("recorder is not ready"),r&&e.setFileName(r),e.recorder.stopRecording((function(){e.player.debug.log("RecorderRTC","stop recording");var r=(e.fileName||Tn())+"."+H;if(e.recorder.getBlob(),t===Ot){var a=e.recorder.getBlob();i(a),e.player.emit(Ct.recordBlob,a)}else i(),e.recorder.save(r);e.player.emit(Ct.recordEnd),e._reset(),e.player.emit(Ct.recording,!1)}))}))}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}},{key:"getTotalDuration",value:function(){return this.recordTime}},{key:"getType",value:function(){return H}},{key:"initMetaData",value:function(){}}])}(hl),fl=function(){function e(){S(this,e)}return w(e,null,[{key:"init",value:function(){for(var t in e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=e.constants={};r.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),r.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),r.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),r.STSC=r.STCO=r.STTS,r.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),r.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),r.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),r.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,r=null,i=Array.prototype.slice.call(arguments,1),a=i.length,n=0;n>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);for(var o=8,s=0;s=Math.pow(2,32)-1?(o=16,s=new Uint8Array(i+o),s.set(new Uint8Array([0,0,0,1]),0),s.set(e.types.mdat,4),s.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(s=new Uint8Array(i+o),s[0]=i+8>>>24&255,s[1]=i+8>>>16&255,s[2]=i+8>>>8&255,s[3]=i+8&255,s.set(e.types.mdat,4));for(var l=0;l>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,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,0,0,0,3]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration,a=t.presentWidth,n=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,i>>>24&255,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,a>>>8&255,255&a,0,0,n>>>8&255,255&n,0,0]))}},{key:"edts",value:function(t,r){return e.box(e.types.edts,e.elst(t,r))}},{key:"elst",value:function(t,r){for(var i=0,a=0;a>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,1,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var r=t.timescale/t.refSampleDuration,i=r*t.duration/t.timescale;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}},{key:"hdlr",value:function(t){var r=null;return r=e.constants.HDLR_VIDEO,e.box(e.types.hdlr,r)}},{key:"minf",value:function(t){var r=null;return r=e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,r,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){for(var r=t.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:r[0].duration}],a=[r[0].duration],n=r.length,o=0;o>>24&255,r>>>16&255,r>>>8&255,255&r]),a=i.byteLength,n=new Uint8Array(a+8*r);n.set(i,0);for(var o=0;o>>24&255,t[o].num>>>16&255,t[o].num>>>8&255,255&t[o].num,t[o].sampleDelte>>>24&255,t[o].sampleDelte>>>16&255,t[o].sampleDelte>>>8&255,255&t[o].sampleDelte]),a),a+=8;return e.box(e.types.stts,n)}},{key:"stss",value:function(t){for(var r=[],i=t.length,a=0;a>>24&255,n>>>16&255,n>>>8&255,255&n]),s=o.byteLength,l=new Uint8Array(s+4*n);l.set(o,0);for(var c=0;c>>24&255,r[c]>>>16&255,r[c]>>>8&255,255&r[c]]),s),s+=4;return e.box(e.types.stss,l)}},{key:"stsc",value:function(t){var r=t.length,i=new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r]),a=i.byteLength,n=new Uint8Array(a+12*r);n.set(i,0);for(var o=0;o>>24&255,s>>>16&255,s>>>8&255,255&s,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c]),a),a+=12}return e.box(e.types.stsc,n)}},{key:"stsz",value:function(t){var r=t.length,i=new Uint8Array([0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r]),a=i.byteLength,n=new Uint8Array(a+4*r);n.set(i,0);for(var o=0;o>>24&255,s>>>16&255,s>>>8&255,255&s]),a),a+=4}return e.box(e.types.stsz,n)}},{key:"stco",value:function(t,r){var i=r[0].chunkOffset;return e.box(e.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"avc"===t.videoType?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t))}},{key:"mp3",value:function(t){var r=t.channelCount,i=t.sampleRate,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types[".mp3"],a)}},{key:"mp4a",value:function(t){var r=t.channelCount,i=t.sampleRate,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types.mp4a,a,e.esds(t))}},{key:"esds",value:function(t){var r=t.config||[],i=r.length,a=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(r).concat([6,1,2]));return e.box(e.types.esds,a)}},{key:"avc1",value:function(t){var r=t.avcc,i=t.codecWidth,a=t.codecHeight,n=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,i>>>8&255,255&i,a>>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,n,e.box(e.types.avcC,r))}},{key:"hvc1",value:function(t){var r=t.avcc,i=t.codecWidth,a=t.codecHeight,n=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,i>>>8&255,255&i,a>>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,n,e.box(e.types.hvcC,r))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){var r=t.id,i=new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,i)}},{key:"moof",value:function(t,r){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,r))}},{key:"mfhd",value:function(t){var r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,r)}},{key:"traf",value:function(t,r){var i=t.id,a=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),n=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,a,n,s,o)}},{key:"sdtp",value:function(t){for(var r=t.samples||[],i=r.length,a=new Uint8Array(4+i),n=0;n>>24&255,a>>>16&255,a>>>8&255,255&a,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var s=0;s>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.isNonSync,0,0,d>>>24&255,d>>>16&255,d>>>8&255,255&d],12+16*s)}return e.box(e.types.trun,o)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();fl.init();var ml=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="recorderMP4",r._reset(),e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this._reset(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_reset",value:function(){b(t,"_reset",this,3)([]),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}},{key:"startRecord",value:function(){var e=this.player.debug;this._isRecording=!0,this.player.emit(Ct.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(Ct.recordStart),this.startRecordingInterval()}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(Ct.recordingTimestamp,e.getTotalDuration())}),1e3)}},{key:"formatFmp4Track",value:function(e,t,r,i){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:r,cts:i,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}},{key:"formatAudioFmp4Track",value:function(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}},{key:"handleAddNaluTrack",value:function(e,t,r,i){this.cacheTrack.id&&r>=this.cacheTrack.dts?(this.cacheTrack.duration=r-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,r,i)}},{key:"handleAddAudioTrack",value:function(e,t){}},{key:"handleAddFmp4Track",value:function(e){if(this.isRecording)if(null!==this.sps&&null!==this.pps||!this.isH264)if(null!==this.sps&&null!==this.pps&&null!==this.vps||!this.isH265){var t=Object.assign({},e);t.pts=t.dts+t.cts;var r=t.data;if(t.isKeyframe)if(this.isH264){var i=new Uint8Array(this.sps.byteLength+this.pps.byteLength);i.set(this.sps,0),i.set(this.pps,this.sps.byteLength);var a=new Uint8Array(i.byteLength+r.byteLength);a.set(i,0),a.set(r,i.byteLength),t.data=a}else if(this.isH265){var n=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);n.set(this.vps,0),n.set(this.sps,this.vps.byteLength),n.set(this.pps,this.vps.byteLength+this.sps.byteLength);var o=new Uint8Array(n.byteLength+r.byteLength);o.set(n,0),o.set(r,n.byteLength),t.data=o}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}else this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");else this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");else this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ")}},{key:"handleAddFmp4AudioTrack",value:function(e){var t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}},{key:"getTotalDuration",value:function(){return this.totalDuration/1e3}},{key:"getType",value:function(){return G}},{key:"getToTalByteLength",value:function(){return this.totalByteLength+this.totalAudioByteLength}},{key:"stopRecordAndSave",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ft,r=arguments.length>1?arguments[1]:void 0;return new Promise((function(i,a){if(!e.isRecording)return e.player.debug.error(e.TAG_NAME,"stop recording fail, isRecording is false "),a("stop recording fail, isRecording is false ");if(0===e.bufferList.length)return e.player.debug.error(e.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),a("stop recording fail, this.bufferList.length is 0 ");r&&e.setFileName(r);var n=E({id:1,type:"video",sps:e.sps,pps:e.pps,samples:e.bufferList,sequenceNumber:e.bufferList.length,length:0,addSampleNum:1,duration:0},e.metaInfo),o=E({id:2,type:"audio",sequenceNumber:e.audioBufferList.length,samples:e.audioBufferList},e.audioMetaInfo),s=[n];o.samples.length>0&&s.push(o),e.player.debug.log(e.TAG_NAME,"trackList length is ".concat(s.length));var l=fl.generateInitSegment({timescale:1e3,duration:e.totalDuration},s,e.totalByteLength+e.totalAudioByteLength);e.player.debug.log(e.TAG_NAME,"stop recording");var c=new Blob([l],{type:"application/octet-stream"});t===Ot?(i(c),e.player.emit(Ct.recordBlob,c)):(i(),Xn((e.fileName||Tn())+"."+G,c)),e._reset(),e.player.emit(Ct.recording,!1)}))}}])}(hl),gl=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="FlvRecorderLoader",r.player=e,r._init(),r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this._init(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_init",value:function(){this.hasAudio=!1,this.hasVideo=!1,this.startTime=null,this.currentTime=0,this.prevTimestamp=0,this.totalByteLength=0,this.totalDuration=0,this.flvMetaData=null,this.aacSequenceHeader=null,this.videoSequenceHeader=null,this.bufferList=[]}},{key:"_reset",value:function(){b(t,"_reset",this,3)([]),this._init()}},{key:"startRecord",value:function(){var e=this.player.debug;this._isRecording=!0,this.player.emit(Ct.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(Ct.recordStart),this.startRecordingInterval()}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(Ct.recordingTimestamp,e.getTotalDuration())}),1e3)}},{key:"addMetaData",value:function(e){this.flvMetaData=e}},{key:"addAACSequenceHeader",value:function(e){this.aacSequenceHeader=e}},{key:"addVideoSequenceHeader",value:function(e){this.videoSequenceHeader=e}},{key:"addVideo",value:function(e,t){this._setStartTime(t);var r=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,lt,r)}},{key:"addAudio",value:function(e,t){this._setStartTime(t);var r=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,st,r)}},{key:"_setStartTime",value:function(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debug.log(this.TAG_NAME,"_setStartTime is ".concat(e)))}},{key:"_getBufferTs",value:function(e){e>this.currentTime&&(this.currentTime=e);var t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}},{key:"_createBufferItem",value:function(e,t,r){var i=this._createFlvPacket(e,t,r),a=this._createFlvTag(i);this.totalByteLength+=a.byteLength,this.bufferList.push(a)}},{key:"_createFlvTag",value:function(e){var t=11+e.header.length,r=new Uint8Array(t+4);r[0]=e.header.type;var i=new DataView(r.buffer);return r[1]=e.header.length>>16&255,r[2]=e.header.length>>8&255,r[3]=255&e.header.length,r[4]=e.header.timestamp>>16&255,r[5]=e.header.timestamp>>8&255,r[6]=255&e.header.timestamp,r[7]=e.header.timestamp>>24&255,r[8]=0,r[9]=0,r[10]=0,i.setUint32(t,t),r.set(e.payload.subarray(0,e.header.length),11),r}},{key:"_createFlvPacket",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:r,type:t},payload:e}}},{key:"stopRecordAndSave",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ft,r=arguments.length>1?arguments[1]:void 0;return new Promise((function(i,a){if(!e.isRecording)return e.player.debug.error(e.TAG_NAME,"stop recording fail, isRecording is false "),a("stop recording fail, isRecording is false ");if(0===e.bufferList.length)return e.player.debug.error(e.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),a("stop recording fail, this.bufferList.length is 0 ");r&&e.setFileName(r);var n=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);e.hasVideo&&(n[4]|=1),e.hasAudio&&(n[4]|=4);var o=[n];if(e.flvMetaData){var s=e._createFlvPacket(e.flvMetaData,ct),l=e._createFlvTag(s);o.push(l)}if(e.videoSequenceHeader){var c=e._createFlvPacket(e.videoSequenceHeader,lt),u=e._createFlvTag(c);o.push(u)}if(e.aacSequenceHeader){var d=e._createFlvPacket(e.aacSequenceHeader,st),h=e._createFlvTag(d);o.push(h)}var p=function(e){var t=e[0].constructor;return e.reduce((function(e,r){var i=new t((0|e.byteLength)+(0|r.byteLength));return i.set(e,0),i.set(r,0|e.byteLength),i}),new t)}(o.concat(e.bufferList));e.player.debug.log(e.TAG_NAME,"stop recording");var f=new Blob([p],{type:"application/octet-stream"});t===Ot?(i(f),e.player.emit(Ct.recordBlob,f)):(i(),Xn((e.fileName||Tn())+"."+V,f)),e._reset(),e.player.emit(Ct.recording,!1)}))}},{key:"getTotalDuration",value:function(){var e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}},{key:"getType",value:function(){return V}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}}])}(hl),yl={init:0,findFirstStartCode:1,findSecondStartCode:2},vl=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.isDestroyed=!1,r.reset(),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.isDestroyed=!1,this.off(),this.reset()}},{key:"reset",value:function(){this.stats=yl.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}},{key:"dispatch",value:function(e,t){var r=new Uint8Array(this.tempBuffer.length+e.length);for(r.set(this.tempBuffer,0),r.set(e,this.tempBuffer.length),this.tempBuffer=r;!this.isDestroyed;){if(this.state==yl.Init){for(var i=!1;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=yl.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,i=!0;break}this.parsedOffset++}else this.parsedOffset++;if(i)continue;break}if(this.state==yl.findFirstStartCode){for(var a=!1;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=yl.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,a=!0;break}this.parsedOffset++}else this.parsedOffset++;if(a)continue;break}if(this.state==yl.findSecondStartCode){var n=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",n,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=yl.findFirstStartCode}}}}])}(Ho),Al=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="recorderWasmMP4",r._reset(),r.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),r.wasmMp4Recorder.on("recordingTimestamp",(function(e){r._recordingTimestamp=e/1e3})),r.mp3Demuxer=null,e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_reset",value:function(){b(t,"_reset",this,3)([]),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}},{key:"getType",value:function(){return G}},{key:"isWasmMp4",value:function(){return!0}},{key:"getTotalDuration",value:function(){return this.totalDuration/1e3}},{key:"getToTalByteLength",value:function(){return this.totalByteLength+this.totalAudioByteLength}},{key:"startRecord",value:function(){var e=this,t=this.player.debug,r=this.player.getAudioInfo(),i=this.player.getVideoInfo(),a={};if(this.codecId){var n={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};a.video=n,this.hasVideo=!0}if(r.encTypeCode){var o={type:r.encTypeCode,sampleRate:r.sampleRate,channels:r.channels,extraData:this.audioMetaInfo.extraData,depth:r.depth};this.audioCodeId=r.encTypeCode,a.audio=o,this.hasAudio=!0}this.wasmMp4Recorder.startRecord(a).then((function(){e._isRecording=!0,e.player.emit(Ct.recording,!0),t.log(e.TAG_NAME,"start recording"),e.player.emit(Ct.recordStart),e.startRecordingInterval()})).catch((function(r){t.error(e.TAG_NAME,"startRecord error",r),e.player.emitError(Ct.recordCreateError,r)}))}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(Ct.recordingTimestamp,e.recordTime)}),1e3)}},{key:"stopRecordAndSave",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ft,r=arguments.length>1?arguments[1]:void 0;return new Promise((function(i,a){return e.isRecording?0===e.totalDuration?(e.player.debug.error(e.TAG_NAME,"stop recording fail, totalDuration is 0 "),a("stop recording fail, totalDuration is 0 ")):(r&&e.setFileName(r),void e.wasmMp4Recorder.stopRecord().then((function(r){t===Ot?(i(r),e.player.emit(Ct.recordBlob,r)):(i(),Xn((e.fileName||Tn())+"."+G,r))})).catch((function(t){e.player.debug.error(e.TAG_NAME,"stopRecord error",t),a(t)})).finally((function(){e._reset(),e.player.emit(Ct.recording,!1)}))):(e.player.debug.error(e.TAG_NAME,"stop recording fail, isRecording is false "),a("stop recording fail, isRecording is false "))}))}},{key:"handleAddAudioTrack",value:function(e,t){var r=this;this.audioCodeId===Wt?(this.mp3Demuxer||(this.mp3Demuxer=new vl(this.player),this.mp3Demuxer.on("data",(function(e,t){r._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}},{key:"_handleAddAudioTrack",value:function(e,t){Io(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}},{key:"handleAddNaluTrack",value:function(e,t,r,i){Io(this.hasVideo)||(this.cacheTrack.id&&r>=this.cacheTrack.dts?(this.cacheTrack.duration=r-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:r,cts:i})}}])}(hl),bl=function(){function e(t){return S(this,e),new(e.getLoaderFactory(t._opt))(t)}return w(e,null,[{key:"getLoaderFactory",value:function(e){if(e.recordType===G){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?Al:ml}else if(e.recordType===V)return gl;return pl}}])}();function _l(e,t,r){var i=e;if(t+r=128){t.push(String.fromCharCode(65535&n)),i+=2;continue}}}else if(r[i]<240){if(_l(r,i,2)){var o=(15&r[i])<<12|(63&r[i+1])<<6|63&r[i+2];if(o>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),i+=3;continue}}}else if(r[i]<248&&_l(r,i,3)){var s=(7&r[i])<<18|(63&r[i+1])<<12|(63&r[i+2])<<6|63&r[i+3];if(s>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),i+=4;continue}}t.push(String.fromCharCode(65533)),++i}return t.join("")}var wl=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}(),Sl=function(){function e(){S(this,e)}return w(e,null,[{key:"parseScriptData",value:function(t,r,i){var a={};try{var n=e.parseValue(t,r,i),o=e.parseValue(t,r+n.size,i-n.size);a[n.data]=o.data}catch(t){console.error("AMF",t.toString())}return a}},{key:"parseObject",value:function(t,r,i){var a=e.parseString(t,r,i),n=e.parseValue(t,r+a.size,i-a.size),o=n.objectEnd;return{data:{name:a.data,value:n.data},size:a.size+n.size,objectEnd:o}}},{key:"parseVariable",value:function(t,r,i){return e.parseObject(t,r,i)}},{key:"parseString",value:function(e,t,r){var i,a=new DataView(e,t,r).getUint16(0,!wl);return i=a>0?kl(new Uint8Array(e,t+2,a)):"",{data:i,size:2+a}}},{key:"parseLongString",value:function(e,t,r){var i,a=new DataView(e,t,r).getUint32(0,!wl);return i=a>0?kl(new Uint8Array(e,t+4,a)):"",{data:i,size:4+a}}},{key:"parseDate",value:function(e,t,r){var i=new DataView(e,t,r),a=i.getFloat64(0,!wl);return a+=60*i.getInt16(8,!wl)*1e3,{data:new Date(a),size:10}}},{key:"parseValue",value:function(t,r,i){var a,n=new DataView(t,r,i),o=1,s=n.getUint8(0),l=!1;try{switch(s){case 0:a=n.getFloat64(1,!wl),o+=8;break;case 1:a=!!n.getUint8(1),o+=1;break;case 2:var c=e.parseString(t,r+1,i-1);a=c.data,o+=c.size;break;case 3:a={};var u=0;for(9==(16777215&n.getUint32(i-4,!wl))&&(u=3);o2)return void e.player.emitError(Lt.audioChannelError,"audio channel is ".concat(i.channels,", max is 2"));e.player.audio&&(e.player.audio.updateAudioInfo(i),e.player._opt.playType===N?e.player.audio.initScriptNode():e.player._opt.playType===z&&e.player.audio.initScriptNodeDelay());break;case Te:if(!e.player.video)return void r.warn("decoderWorker","onmessage render but video is null");if(e.player.isPlayer()){if(Io(e.player.video.getHasInit()))return void r.warn("decoderWorker","onmessage render but video has not init");e.player.video.render(i),e.player.handleRender(),e.player.emit(Ct.timeUpdate,i.ts),e.player.updateStats({dfps:!0,buf:i.delay}),e.player._times.videoStart||(e.player._times.videoStart=Tn(),e.player.handlePlayToRenderTimes())}else e.player.isPlayback()&&(e.player.updateStats({dfps:!0}),Io(e.player.playbackPause)?(e.player.playback.isUseLocalCalculateTime&&e.player.playback.increaseLocalTimestamp(),e.player.playback.isUseFpsRender?e.player.video.pushData(i):e.player.video.render$2(i)):!e.player.playback.isPlaybackPauseClearCache&&e.player.playback.isCacheBeforeDecodeForFpsRender&&e.player.playback.isUseFpsRender&&e.player.video.pushData(i));break;case Ie:e.player.recorder&&e.player.recorder.isRecording&&e.player._opt.recordType===G&&e.player.recorder.handleAddNaluTrack(i.buffer,i.isIFrame,i.ts,i.cts);break;case De:e.player.recorder&&e.player.recorder.isRecording&&e.player._opt.recordType===G&&e.player.recorder.isWasmMp4()&&e.player.recorder.handleAddAudioTrack(i.buffer,i.ts);break;case Me:var a=e.player,n=a.webcodecsDecoder,o=a.mseDecoder;e.player.updateStats({buf:i.delay});var s=new Uint8Array(i.payload);e.player._opt.useWCS&&!e.player._opt.useOffscreen?n.decodeVideo(s,i.ts,i.isIFrame,i.cts):e.player._opt.useMSE&&o.decodeVideo(s,i.ts,i.isIFrame,i.cts);break;case Ue:if(e.player._opt.useMSE){var l=new Uint8Array(i.payload);e.player.mseDecoder.decodeAudio(l,i.ts,i.cts)}break;case Ce:if(!e.player.audio)return void r.warn("decoderWorker","onmessage playAudio but audio is null");(e.player.playing&&e.player.audio||!e.player.video)&&(e.player._opt.hasVideo||e.player.handleRender(),(e.player._opt.playType===N||e.player._opt.playType===z&&(Io(e.player.playbackPause)||!e.player.playback.isPlaybackPauseClearCache&&e.player.playback.isCacheBeforeDecodeForFpsRender&&e.player.playback.isUseFpsRender))&&e.player.audio.play(i.buffer,i.ts));break;case Oe:if(i.type===Ct.streamSuccess)e.player.stream?e.player.stream.emit(Ct.streamSuccess):r.warn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(i.type===Ct.streamRate)e.player.emit(Ct.kBps,(i.value/1024).toFixed(2));else if(i.type===Ct.streamEnd)e.player?(i.value===I&&e.player.emit(Ct.websocketClose,i.msg),e.player.stream?e.player.stream.emit(Ct.streamEnd,i.msg):r&&r.warn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):r&&r.warn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(i.type===Lt.websocketError)e.player&&e.player.stream?e.player.stream.emit(Lt.websocketError,i.value):r&&r.warn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(i.type===Lt.fetchError)e.player&&e.player.stream?e.player.stream.emit(Lt.fetchError,i.value):r&&r.warn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(i.type===Ct.streamAbps)e.player.updateStats({abps:i.value});else if(i.type===Ct.streamVbps)e.player._times.demuxStart||(e.player._times.demuxStart=Tn()),e.player.updateStats({vbps:i.value});else if(i.type===Ct.streamDts)e.player.updateStats({dts:i.value});else if(i.type===Ct.netBuf)e.player.updateStats({netBuf:i.value});else if(i.type===Ct.networkDelayTimeout)e.player.emit(Ct.networkDelayTimeout,i.value);else if(i.type===Ct.streamStats){var c=JSON.parse(i.value);e.player.updateStats({workerStats:c})}else i.type===Ct.websocketOpen&&e.player.emit(Ct.websocketOpen);break;case Ne:e.player&&(e.player.videoIframeIntervalTs=i.value);break;case je:e.player&&e.player.updateStats({isDropping:!0});break;case et:e.player.decoderCheckFirstIFrame();break;case Ge:e.player&&e.player.video&&e.player.video.setStreamFps(i.value);break;case Fe:i.message&&-1!==i.message.indexOf(at)&&e.player.emitError(Lt.wasmDecodeError,"");break;case He:e.player.emitError(Lt.wasmDecodeVideoNoResponseError);break;case Je:e.player.emitError(Lt.simdH264DecodeVideoWidthIsTooLarge);break;case Ve:e.player.emitError(Lt.wasmWidthOrHeightChange);break;case We:e.player.emitError(Lt.simdDecodeError);break;case ze:r.log("decoderWorker","onmessage:",ze);break;case qe:r.log("decoderWorker","onmessage:",qe),e._destroy();break;case Ke:e.player&&e.player.pushTempStream(i.buffer);break;case Ye:e.player&&e.player.emit(Ct.videoSEI,{ts:i.ts,data:new Uint8Array(i.buffer)});break;case Qe:if(e.player){if(e.player.isRecordTypeFlv()){var u=new Uint8Array(i.buffer);e.player.recorder.addMetaData(u)}var d=El(new Uint8Array(i.buffer));d&&d.onMetaData&&e.player.updateMetaData(d.onMetaData)}break;case Xe:if(e.player&&e.player.isRecordTypeFlv()){var h=new Uint8Array(i.buffer);e.player.recorder.addAACSequenceHeader(h,i.ts)}break;case Ze:if(e.player&&e.player.isRecordTypeFlv()){var p=new Uint8Array(i.buffer);e.player.recorder.addVideoSequenceHeader(p,i.ts)}break;case $e:if(e.player&&e.player.isRecordTypeFlv()&&e.player.recording){var f=new Uint8Array(i.buffer);i.type===ot?e.player.recorder.addVideo(f,i.ts):i.type===nt&&e.player.recorder.addAudio(f,i.ts)}break;case tt:e.player&&(e.player.debug.log("decoderWorker","onmessage:",tt),e.player.video.$videoElement.srcObject=i.mseHandle);break;case rt:e.player&&(e.player.debug.log("decoderWorker","onmessage:",rt,i.value),e.player._mseWorkerData.firstRenderTime=Number(i.value));break;case it:e.player&&(e.player.debug.log("decoderWorker","onmessage:",it,i.value,i.msg),e.player.emitError(i.value,i.msg));break;default:e.player[i.cmd]&&e.player[i.cmd](i)}}}},{key:"_initWork",value:function(){var e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||0,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:mo(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration};this.decoderWorker.postMessage({cmd:ut,opt:JSON.stringify(e)}),this.player._opt.isM7sCrypto&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}},{key:"decodeVideo",value:function(e,t,r){this.player._opt.playType===N?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,r):this._decodeVideo(e,t,r):this.player._opt.playType===z&&(this.player.video.rate>=this.player._opt.playbackForwardMaxRateDecodeIFrame?r&&(this.player.debug.log("decoderWorker","current rate is ".concat(this.player.video.rate,",only decode i frame")),this._decodeVideoNoDelay(e,t,r)):1===this.player.video.rate?this._decodeVideo(e,t,r):this._decodeVideoNoDelay(e,t,r))}},{key:"_decodeVideo",value:function(e,t,r){var i={type:ot,ts:Math.max(t,0),isIFrame:r};this.decoderWorker.postMessage({cmd:dt,buffer:e,options:i},[e.buffer])}},{key:"_decodeVideoNoDelay",value:function(e,t,r){this.decoderWorker.postMessage({cmd:pt,buffer:e,ts:Math.max(t,0),isIFrame:r},[e.buffer])}},{key:"decodeAudio",value:function(e,t){this.player._opt.playType===N?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===z&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}},{key:"_decodeAudio",value:function(e,t){var r={type:nt,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:dt,buffer:e,options:r},[e.buffer])}},{key:"_decodeAudioNoDelay",value:function(e,t){this.decoderWorker.postMessage({cmd:ht,buffer:e,ts:Math.max(t,0)},[e.buffer])}},{key:"updateWorkConfig",value:function(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:mt,key:e.key,value:e.value})}},{key:"workerFetchStream",value:function(e){var t=this.player._opt,r={protocol:t.protocol,isFlv:t.isFlv,isFmp4:t.isFmp4,isMpeg4:t.isMpeg4,isNakedFlow:t.isNakedFlow,isTs:t.isTs};this.decoderWorker.postMessage({cmd:yt,url:e,opt:JSON.stringify(r)})}},{key:"clearWorkBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:gt,needClear:e})}},{key:"workerSendMessage",value:function(e){this.decoderWorker.postMessage({cmd:vt,message:e})}},{key:"updateVideoTimestamp",value:function(e){this.decoderWorker.postMessage({cmd:At,message:e})}}])}(),xl="application/json, text/javascript",Rl="text/html",Dl=/^(?:text|application)\/xml/i,Ll=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Pl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Bl=/^\s*$/,Il={},Ml={},Ul="",Fl={type:"GET",beforeSend:Ol,success:Ol,error:Ol,complete:Ol,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:xl,xml:"application/xml, text/xml",html:Rl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:Ol,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function Ol(){}var Nl=function(e,t){"object"==T(e)&&(t=e,e=void 0);var r=ql({},t=t||{});for(var i in Fl)void 0===r[i]&&(r[i]=Fl[i]);try{var a={},n=new Promise((function(e,t){a.resolve=e,a.reject=t}));n.resolve=a.resolve,n.reject=a.reject,r.promise=n}catch(e){r.promise={resolve:Ol,reject:Ol}}var o=Pl.exec(window.location.href.toLowerCase())||[];r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,o[1]+"//");var s=r.url;r.crossDomain||(r.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(r.url)&&RegExp.$2!==window.location.href);var l=r.dataType;if("jsonp"===l){if(!/=\?/.test(r.url)){var c=(r.jsonp||"callback")+"=?";r.url=Vl(r.url,c)}return function(e){var t,r=e.jsonpCallback||"jsonp"+Ql(),i=window.document.createElement("script"),a={abort:function(){r in window&&(window[r]=Ol)}},n=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function o(r){window.clearTimeout(t),a.abort(),Gl(r.type,a,r.type,e),s()}function s(){i.clearAttributes?i.clearAttributes():i.onload=i.onreadystatechange=i.onerror=null,i.parentNode&&i.parentNode.removeChild(i),i=null,delete window[r]}return i.onerror=function(e){o(e)},window[r]=function(r){window.clearTimeout(t),jl(r,a,e),s()},Wl(e),i.src=e.url.replace(/=\?/,"="+r),i.src=Vl(i.src,"_="+(new Date).getTime()),i.async=!0,e.scriptCharset&&(i.charset=e.scriptCharset),n.insertBefore(i,n.firstChild),e.timeout>0&&(t=window.setTimeout((function(){a.abort(),Gl("timeout",a,"timeout",e),s()}),e.timeout)),e.promise.abort=function(){a.abort()},e.promise.xhr=a,e.promise}(r)}Wl(r);var u=r.accepts[l]||r.accepts["*"],d={};/^([\w-]+:)\/\//.test(r.url)?RegExp.$1:window.location.protocol;var h,p=Fl.xhr();r.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest"),r.ifModified&&(Il[s]&&(d["If-Modified-Since"]=Il[s]),Ml[s]&&(d["If-None-Match"]=Ml[s])),u&&(d.Accept=u,u.indexOf(",")>-1&&(u=u.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(u));var f=!/^(?:GET|HEAD)$/.test(r.type.toUpperCase());if((r.data&&f&&!1!==r.contentType||t.contentType)&&(d["Content-Type"]=r.contentType),!1===r.cache&&!f){var m=/([?&])_=[^&]*/;r.url=m.test(s)?s.replace(m,"$1_="+Ql()):s+(/\?/.test(s)?"&":"?")+"_="+Ql()}r.headers=ql(d,r.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(h);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(Ul=p.getAllResponseHeaders(),r.ifModified){var i=Hl("Last-Modified");i&&(Il[s]=i),(i=Hl("etag"))&&(Ml[s]=i)}l=l||function(e){return e&&(e===Rl?"html":e===xl?"json":Dl.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=Bl.test(e)?null:JSON.parse(e))}catch(e){t=e}t?Gl(t,"parseerror",p,r):jl(e,p,r)}else Gl(null,"error",p,r)}};var g=!("async"in r)||r.async;if(p.open(r.type,r.url,g,r.username,r.password),r.xhrFields)for(var y in r.xhrFields)p[y]=r.xhrFields[y];for(var y in r.mimeType&&p.overrideMimeType&&p.overrideMimeType(r.mimeType),r.headers)void 0!==r.headers[y]&&p.setRequestHeader(y,r.headers[y]+"");return!1===function(e,t){var r=t.context;if(!1===t.beforeSend.call(r,e,t))return!1}(p,r)?(p.abort(),!1):(r.timeout>0&&(h=window.setTimeout((function(){p.onreadystatechange=Ol,p.abort(),Gl(null,"timeout",p,r)}),r.timeout)),p.send(r.data?r.data:null),r.promise.abort=function(){p.abort()},r.promise)};function jl(e,t,r){var i=r.context,a="success";r.success.call(i,e,a,t),r.promise.resolve(e,a,t),zl(a,t,r)}function zl(e,t,r){var i=r.context;r.complete.call(i,t,e)}function Gl(e,t,r,i){var a=i.context;i.error.call(a,r,t,e),i.promise.reject(r,t,e),zl(t,r,i)}function Hl(e){var t;if(!Tl){for(Tl={};t=Ll.exec(Ul);)Tl[t[1].toLowerCase()]=t[2];t=Tl[e.toLowerCase()]}return null===t?null:t}function Vl(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Wl(e){!Kl(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var r=[];return r.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},Jl(r,e,t),r.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=Vl(e.url,e.data))}function Jl(e,t,r,i){var a=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var n in t){var o=t[n];i&&(n=r?i:i+"["+(a?"":n)+"]"),!i&&a?e.add(o.name,o.value):(r?a(o):Kl(o))?Jl(e,o,r,n):e.add(n,o)}}function ql(e){for(var t=Array.prototype.slice,r=t.call(arguments,1),i=0,a=r.length;i255)return!1;return!0}function $l(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!Zl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(Xl(e.length)&&Zl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ec(e){return new Uint8Array(e)}function tc(e,t,r,i,a){null==i&&null==a||(e=e.slice?e.slice(i,a):Array.prototype.slice.call(e,i,a)),t.set(e,r)}Nl.get=function(e,t,r,i){return Yl(t)&&(i=i||r,r=t,t=void 0),Nl({url:e,data:t,success:r,dataType:i})},Nl.post=function(e,t,r,i){return Yl(t)&&(i=i||r,r=t,t=void 0),Nl({type:"POST",url:e,data:t,success:r,dataType:i})},Nl.getJSON=function(e,t,r){return Yl(t)&&(r=t,t=void 0),Nl({url:e,data:t,success:r,dataType:"json"})},Nl.ajaxSetup=function(e,t){return t?ql(ql(e,Fl),t):ql(Fl,e)};var rc={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ic=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],r=0;r>4]+e[15&a])}return r.join("")}}}(),ac={16:10,24:12,32:14},nc=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],oc=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],sc=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],lc=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],cc=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],uc=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],dc=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],hc=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],pc=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],fc=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],mc=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],gc=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],yc=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],vc=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ac=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function bc(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=n[t],this._Kd[e-r][t%4]=n[t];for(var o,s=0,l=a;l>16&255]<<24^oc[o>>8&255]<<16^oc[255&o]<<8^oc[o>>24&255]^nc[s]<<24,s+=1,8!=a)for(t=1;t>8&255]<<8^oc[o>>16&255]<<16^oc[o>>24&255]<<24,t=a/2+1;t>2,u=l%4,this._Ke[c][u]=n[t],this._Kd[e-c][u]=n[t++],l++}for(var c=1;c>24&255]^yc[o>>16&255]^vc[o>>8&255]^Ac[255&o]},_c.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=bc(e),a=0;a<4;a++)i[a]^=this._Ke[0][a];for(var n=1;n>24&255]^cc[i[(a+1)%4]>>16&255]^uc[i[(a+2)%4]>>8&255]^dc[255&i[(a+3)%4]]^this._Ke[n][a];i=r.slice()}var o,s=ec(16);for(a=0;a<4;a++)o=this._Ke[t][a],s[4*a]=255&(oc[i[a]>>24&255]^o>>24),s[4*a+1]=255&(oc[i[(a+1)%4]>>16&255]^o>>16),s[4*a+2]=255&(oc[i[(a+2)%4]>>8&255]^o>>8),s[4*a+3]=255&(oc[255&i[(a+3)%4]]^o);return s},_c.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=bc(e),a=0;a<4;a++)i[a]^=this._Kd[0][a];for(var n=1;n>24&255]^pc[i[(a+3)%4]>>16&255]^fc[i[(a+2)%4]>>8&255]^mc[255&i[(a+1)%4]]^this._Kd[n][a];i=r.slice()}var o,s=ec(16);for(a=0;a<4;a++)o=this._Kd[t][a],s[4*a]=255&(sc[i[a]>>24&255]^o>>24),s[4*a+1]=255&(sc[i[(a+3)%4]>>16&255]^o>>16),s[4*a+2]=255&(sc[i[(a+2)%4]>>8&255]^o>>8),s[4*a+3]=255&(sc[255&i[(a+1)%4]]^o);return s};var kc=function(e){if(!(this instanceof kc))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new _c(e)};kc.prototype.encrypt=function(e){if((e=$l(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ec(e.length),r=ec(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Tc.prototype.setBytes=function(e){if(16!=(e=$l(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Tc.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Cc=function(e,t){if(!(this instanceof Cc))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Tc||(t=new Tc(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new _c(e)};Cc.prototype.encrypt=function(e){for(var t=$l(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-n%4*8&255;t[i+n>>>2]|=o<<24-(i+n)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=a,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-a%4*8&255;i.push((n>>>4).toString(16)),i.push((15&n).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new c.init(r,t/2)}},h=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],a=0;a>>2]>>>24-a%4*8&255;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new c.init(r,t)}},p=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},f=s.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,a=i.words,n=i.sigBytes,o=this.blockSize,s=n/(4*o),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,u=e.min(4*l,n);if(l){for(var d=0;d>>2]|=e[a]<<24-a%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.WordArray,i=e.enc;function a(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],a=0;a>>2]>>>16-a%4*8&65535;i.push(String.fromCharCode(n))}return i.join("")},parse:function(e){for(var r=e.length,i=[],a=0;a>>1]|=e.charCodeAt(a)<<16-a%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=a(e.charCodeAt(n)<<16-n%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var a=[],n=0,o=0;o>>6-o%4*2;a[n>>>2]|=s<<24-n%4*8,n++}return t.create(a,n)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var a=[],n=0;n>>2]>>>24-n%4*8&255)<<16|(t[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|t[n+2>>>2]>>>24-(n+2)%4*8&255,s=0;s<4&&n+.75*s>>6*(3-s)&63));var l=i.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e){var t=e.length,r=this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var n=0;n>>6-o%4*2;a[n>>>2]|=s<<24-n%4*8,n++}return t.create(a,n)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,a=t?this._safe_map:this._map;e.clamp();for(var n=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,l=0;l<4&&o+.75*l>>6*(3-l)&63));var c=a.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,a=t?this._safe_map:this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(a<<24|a>>>8)}var n=this._hash.words,o=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],v=e[t+7],A=e[t+8],b=e[t+9],_=e[t+10],k=e[t+11],w=e[t+12],S=e[t+13],E=e[t+14],T=e[t+15],C=n[0],x=n[1],R=n[2],D=n[3];C=c(C,x,R,D,o,7,s[0]),D=c(D,C,x,R,l,12,s[1]),R=c(R,D,C,x,p,17,s[2]),x=c(x,R,D,C,f,22,s[3]),C=c(C,x,R,D,m,7,s[4]),D=c(D,C,x,R,g,12,s[5]),R=c(R,D,C,x,y,17,s[6]),x=c(x,R,D,C,v,22,s[7]),C=c(C,x,R,D,A,7,s[8]),D=c(D,C,x,R,b,12,s[9]),R=c(R,D,C,x,_,17,s[10]),x=c(x,R,D,C,k,22,s[11]),C=c(C,x,R,D,w,7,s[12]),D=c(D,C,x,R,S,12,s[13]),R=c(R,D,C,x,E,17,s[14]),C=u(C,x=c(x,R,D,C,T,22,s[15]),R,D,l,5,s[16]),D=u(D,C,x,R,y,9,s[17]),R=u(R,D,C,x,k,14,s[18]),x=u(x,R,D,C,o,20,s[19]),C=u(C,x,R,D,g,5,s[20]),D=u(D,C,x,R,_,9,s[21]),R=u(R,D,C,x,T,14,s[22]),x=u(x,R,D,C,m,20,s[23]),C=u(C,x,R,D,b,5,s[24]),D=u(D,C,x,R,E,9,s[25]),R=u(R,D,C,x,f,14,s[26]),x=u(x,R,D,C,A,20,s[27]),C=u(C,x,R,D,S,5,s[28]),D=u(D,C,x,R,p,9,s[29]),R=u(R,D,C,x,v,14,s[30]),C=d(C,x=u(x,R,D,C,w,20,s[31]),R,D,g,4,s[32]),D=d(D,C,x,R,A,11,s[33]),R=d(R,D,C,x,k,16,s[34]),x=d(x,R,D,C,E,23,s[35]),C=d(C,x,R,D,l,4,s[36]),D=d(D,C,x,R,m,11,s[37]),R=d(R,D,C,x,v,16,s[38]),x=d(x,R,D,C,_,23,s[39]),C=d(C,x,R,D,S,4,s[40]),D=d(D,C,x,R,o,11,s[41]),R=d(R,D,C,x,f,16,s[42]),x=d(x,R,D,C,y,23,s[43]),C=d(C,x,R,D,b,4,s[44]),D=d(D,C,x,R,w,11,s[45]),R=d(R,D,C,x,T,16,s[46]),C=h(C,x=d(x,R,D,C,p,23,s[47]),R,D,o,6,s[48]),D=h(D,C,x,R,v,10,s[49]),R=h(R,D,C,x,E,15,s[50]),x=h(x,R,D,C,g,21,s[51]),C=h(C,x,R,D,w,6,s[52]),D=h(D,C,x,R,f,10,s[53]),R=h(R,D,C,x,_,15,s[54]),x=h(x,R,D,C,l,21,s[55]),C=h(C,x,R,D,A,6,s[56]),D=h(D,C,x,R,T,10,s[57]),R=h(R,D,C,x,y,15,s[58]),x=h(x,R,D,C,S,21,s[59]),C=h(C,x,R,D,m,6,s[60]),D=h(D,C,x,R,k,10,s[61]),R=h(R,D,C,x,p,15,s[62]),x=h(x,R,D,C,b,21,s[63]),n[0]=n[0]+C|0,n[1]=n[1]+x|0,n[2]=n[2]+R|0,n[3]=n[3]+D|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,a=8*t.sigBytes;r[a>>>5]|=128<<24-a%32;var n=e.floor(i/4294967296),o=i;r[15+(a+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),r[14+(a+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,l=s.words,c=0;c<4;c++){var u=l[c];l[c]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,i,a,n,o){var s=e+(t&r|~t&i)+a+o;return(s<>>32-n)+t}function u(e,t,r,i,a,n,o){var s=e+(t&i|r&~i)+a+o;return(s<>>32-n)+t}function d(e,t,r,i,a,n,o){var s=e+(t^r^i)+a+o;return(s<>>32-n)+t}function h(e,t,r,i,a,n,o){var s=e+(r^(t|~i))+a+o;return(s<>>32-n)+t}t.MD5=n._createHelper(l),t.HmacMD5=n._createHmacHelper(l)}(Math),r.MD5)})),en((function(e,t){var r,i,a,n,o,s,l,c;e.exports=(i=(r=c=Rc).lib,a=i.WordArray,n=i.Hasher,o=r.algo,s=[],l=o.SHA1=n.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],a=r[1],n=r[2],o=r[3],l=r[4],c=0;c<80;c++){if(c<16)s[c]=0|e[t+c];else{var u=s[c-3]^s[c-8]^s[c-14]^s[c-16];s[c]=u<<1|u>>>31}var d=(i<<5|i>>>27)+l+s[c];d+=c<20?1518500249+(a&n|~a&o):c<40?1859775393+(a^n^o):c<60?(a&n|a&o|n&o)-1894007588:(a^n^o)-899497514,l=o,o=n,n=a<<30|a>>>2,a=i,i=d}r[0]=r[0]+i|0,r[1]=r[1]+a|0,r[2]=r[2]+n|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=n._createHelper(l),r.HmacSHA1=n._createHmacHelper(l),c.SHA1)})),en((function(e,t){var r;e.exports=(r=Rc,function(e){var t=r,i=t.lib,a=i.WordArray,n=i.Hasher,o=t.algo,s=[],l=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,a=0;a<64;)t(i)&&(a<8&&(s[a]=r(e.pow(i,.5))),l[a]=r(e.pow(i,1/3)),a++),i++}();var c=[],u=o.SHA256=n.extend({_doReset:function(){this._hash=new a.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],a=r[1],n=r[2],o=r[3],s=r[4],u=r[5],d=r[6],h=r[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var f=c[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=c[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=m+c[p-7]+y+c[p-16]}var v=i&a^i&n^a&n,A=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+l[p]+c[p];h=d,d=u,u=s,s=o+b|0,o=n,n=a,a=i,i=b+(A+v)|0}r[0]=r[0]+i|0,r[1]=r[1]+a|0,r[2]=r[2]+n|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,a=8*t.sigBytes;return r[a>>>5]|=128<<24-a%32,r[14+(a+64>>>9<<4)]=e.floor(i/4294967296),r[15+(a+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=n._createHelper(u),t.HmacSHA256=n._createHmacHelper(u)}(Math),r.SHA256)})),en((function(e,t){var r,i,a,n,o,s;e.exports=(i=(r=s=Rc).lib.WordArray,a=r.algo,n=a.SHA256,o=a.SHA224=n.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=n._createHelper(o),r.HmacSHA224=n._createHmacHelper(o),s.SHA224)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.Hasher,i=e.x64,a=i.Word,n=i.WordArray,o=e.algo;function s(){return a.create.apply(a,arguments)}var l=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=s()}();var u=o.SHA512=t.extend({_doReset:function(){this._hash=new n.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],a=r[1],n=r[2],o=r[3],s=r[4],u=r[5],d=r[6],h=r[7],p=i.high,f=i.low,m=a.high,g=a.low,y=n.high,v=n.low,A=o.high,b=o.low,_=s.high,k=s.low,w=u.high,S=u.low,E=d.high,T=d.low,C=h.high,x=h.low,R=p,D=f,L=m,P=g,B=y,I=v,M=A,U=b,F=_,O=k,N=w,j=S,z=E,G=T,H=C,V=x,W=0;W<80;W++){var J,q,K=c[W];if(W<16)q=K.high=0|e[t+2*W],J=K.low=0|e[t+2*W+1];else{var Y=c[W-15],Q=Y.high,X=Y.low,Z=(Q>>>1|X<<31)^(Q>>>8|X<<24)^Q>>>7,$=(X>>>1|Q<<31)^(X>>>8|Q<<24)^(X>>>7|Q<<25),ee=c[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ae=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ne=c[W-7],oe=ne.high,se=ne.low,le=c[W-16],ce=le.high,ue=le.low;q=(q=(q=Z+oe+((J=$+se)>>>0<$>>>0?1:0))+ie+((J+=ae)>>>0>>0?1:0))+ce+((J+=ue)>>>0>>0?1:0),K.high=q,K.low=J}var de,he=F&N^~F&z,pe=O&j^~O&G,fe=R&L^R&B^L&B,me=D&P^D&I^P&I,ge=(R>>>28|D<<4)^(R<<30|D>>>2)^(R<<25|D>>>7),ye=(D>>>28|R<<4)^(D<<30|R>>>2)^(D<<25|R>>>7),ve=(F>>>14|O<<18)^(F>>>18|O<<14)^(F<<23|O>>>9),Ae=(O>>>14|F<<18)^(O>>>18|F<<14)^(O<<23|F>>>9),be=l[W],_e=be.high,ke=be.low,we=H+ve+((de=V+Ae)>>>0>>0?1:0),Se=ye+me;H=z,V=G,z=N,G=j,N=F,j=O,F=M+(we=(we=(we=we+he+((de+=pe)>>>0>>0?1:0))+_e+((de+=ke)>>>0>>0?1:0))+q+((de+=J)>>>0>>0?1:0))+((O=U+de|0)>>>0>>0?1:0)|0,M=B,U=I,B=L,I=P,L=R,P=D,R=we+(ge+fe+(Se>>>0>>0?1:0))+((D=de+Se|0)>>>0>>0?1:0)|0}f=i.low=f+D,i.high=p+R+(f>>>0>>0?1:0),g=a.low=g+P,a.high=m+L+(g>>>0

>>0?1:0),v=n.low=v+I,n.high=y+B+(v>>>0>>0?1:0),b=o.low=b+U,o.high=A+M+(b>>>0>>0?1:0),k=s.low=k+O,s.high=_+F+(k>>>0>>0?1:0),S=u.low=S+j,u.high=w+N+(S>>>0>>0?1:0),T=d.low=T+G,d.high=E+z+(T>>>0>>0?1:0),x=h.low=x+V,h.high=C+H+(x>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(u),e.HmacSHA512=t._createHmacHelper(u)}(),r.SHA512)})),en((function(e,t){var r,i,a,n,o,s,l,c;e.exports=(i=(r=c=Rc).x64,a=i.Word,n=i.WordArray,o=r.algo,s=o.SHA512,l=o.SHA384=s.extend({_doReset:function(){this._hash=new n.init([new a.init(3418070365,3238371032),new a.init(1654270250,914150663),new a.init(2438529370,812702999),new a.init(355462360,4144912697),new a.init(1731405415,4290775857),new a.init(2394180231,1750603025),new a.init(3675008525,1694076839),new a.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(l),r.HmacSHA384=s._createHmacHelper(l),c.SHA384)})),en((function(e,t){var r;e.exports=(r=Rc,function(e){var t=r,i=t.lib,a=i.WordArray,n=i.Hasher,o=t.x64.Word,s=t.algo,l=[],c=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){l[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var a=1,n=0;n<24;n++){for(var s=0,d=0,h=0;h<7;h++){if(1&a){var p=(1<>>24)|4278255360&(n<<24|n>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(x=r[a]).high^=o,x.low^=n}for(var s=0;s<24;s++){for(var h=0;h<5;h++){for(var p=0,f=0,m=0;m<5;m++)p^=(x=r[h+5*m]).high,f^=x.low;var g=d[h];g.high=p,g.low=f}for(h=0;h<5;h++){var y=d[(h+4)%5],v=d[(h+1)%5],A=v.high,b=v.low;for(p=y.high^(A<<1|b>>>31),f=y.low^(b<<1|A>>>31),m=0;m<5;m++)(x=r[h+5*m]).high^=p,x.low^=f}for(var _=1;_<25;_++){var k=(x=r[_]).high,w=x.low,S=l[_];S<32?(p=k<>>32-S,f=w<>>32-S):(p=w<>>64-S,f=k<>>64-S);var E=d[c[_]];E.high=p,E.low=f}var T=d[0],C=r[0];for(T.high=C.high,T.low=C.low,h=0;h<5;h++)for(m=0;m<5;m++){var x=r[_=h+5*m],R=d[_],D=d[(h+1)%5+5*m],L=d[(h+2)%5+5*m];x.high=R.high^~D.high&L.high,x.low=R.low^~D.low&L.low}x=r[0];var P=u[s];x.high^=P.high,x.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,n=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/n)*n>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,l=s/8,c=[],u=0;u>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new a.init(c,s)},clone:function(){for(var e=n.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=n._createHelper(h),t.HmacSHA3=n._createHmacHelper(h)}(Math),r.SHA3)})),en((function(e,t){var r;e.exports=(r=Rc,function(e){var t=r,i=t.lib,a=i.WordArray,n=i.Hasher,o=t.algo,s=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=a.create([0,1518500249,1859775393,2400959708,2840853838]),h=a.create([1352829926,1548603684,1836072691,2053994217,0]),p=o.RIPEMD160=n.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,a=e[i];e[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var n,o,p,b,_,k,w,S,E,T,C,x=this._hash.words,R=d.words,D=h.words,L=s.words,P=l.words,B=c.words,I=u.words;for(k=n=x[0],w=o=x[1],S=p=x[2],E=b=x[3],T=_=x[4],r=0;r<80;r+=1)C=n+e[t+L[r]]|0,C+=r<16?f(o,p,b)+R[0]:r<32?m(o,p,b)+R[1]:r<48?g(o,p,b)+R[2]:r<64?y(o,p,b)+R[3]:v(o,p,b)+R[4],C=(C=A(C|=0,B[r]))+_|0,n=_,_=b,b=A(p,10),p=o,o=C,C=k+e[t+P[r]]|0,C+=r<16?v(w,S,E)+D[0]:r<32?y(w,S,E)+D[1]:r<48?g(w,S,E)+D[2]:r<64?m(w,S,E)+D[3]:f(w,S,E)+D[4],C=(C=A(C|=0,I[r]))+T|0,k=T,T=E,E=A(S,10),S=w,w=C;C=x[1]+p+E|0,x[1]=x[2]+b+T|0,x[2]=x[3]+_+k|0,x[3]=x[4]+n+w|0,x[4]=x[0]+o+S|0,x[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var a=this._hash,n=a.words,o=0;o<5;o++){var s=n[o];n[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return a},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function g(e,t,r){return(e|~t)^r}function y(e,t,r){return e&r|t&~r}function v(e,t,r){return e^(t|~r)}function A(e,t){return e<>>32-t}t.RIPEMD160=n._createHelper(p),t.HmacRIPEMD160=n._createHmacHelper(p)}(),r.RIPEMD160)})),en((function(e,t){var r,i,a;e.exports=(i=(r=Rc).lib.Base,a=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),o=this._iKey=t.clone(),s=n.words,l=o.words,c=0;c>>2];e.sigBytes-=t}};i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:p,padding:f}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=a.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?n.create([1398893684,1701076831]).concat(r).concat(t):t).toString(l)},parse:function(e){var t,r=l.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=n.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},y=i.SerializableCipher=a.extend({cfg:a.extend({format:g}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var a=e.createEncryptor(r,i),n=a.finalize(t),o=a.cfg;return m.create({ciphertext:n,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),v=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,a){if(i||(i=n.random(8)),a)o=c.create({keySize:t+r,hasher:a}).compute(e,i);else var o=c.create({keySize:t+r}).compute(e,i);var s=n.create(o.words.slice(t),4*r);return o.sigBytes=4*t,m.create({key:o,iv:s,salt:i})}},A=i.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:v}),encrypt:function(e,t,r,i){var a=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=a.iv;var n=y.encrypt.call(this,e,t,a.key,i);return n.mixIn(a),n},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var a=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=a.iv,y.decrypt.call(this,e,t,a.key,i)}})}())})),en((function(e,t){var r;e.exports=((r=Rc).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var a,n=this._iv;n?(a=n.slice(0),this._iv=void 0):a=this._prevBlock,i.encryptBlock(a,0);for(var o=0;o>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var a=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,a=r.blockSize,n=this._iv,o=this._counter;n&&(o=this._counter=n.slice(0),this._iv=void 0),i(o);var s=o.slice(0);r.encryptBlock(s,0);for(var l=0;l>>2]|=a<<24-n%4*8,e.sigBytes+=a},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),en((function(e,t){var r;e.exports=((r=Rc).pad.Iso10126={pad:function(e,t){var i=4*t,a=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(a-1)).concat(r.lib.WordArray.create([a<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),en((function(e,t){var r;e.exports=((r=Rc).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),en((function(e,t){var r;e.exports=((r=Rc).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),en((function(e,t){var r;e.exports=((r=Rc).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),en((function(e,t){var r;e.exports=(r=Rc,function(e){var t=r,i=t.lib.CipherParams,a=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(a)},parse:function(e){var t=a.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,a=[],n=[],o=[],s=[],l=[],c=[],u=[],d=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var f=i^i<<1^i<<2^i<<3^i<<4;f=f>>>8^255&f^99,a[r]=f,n[f]=r;var m=e[r],g=e[m],y=e[g],v=257*e[f]^16843008*f;o[r]=v<<24|v>>>8,s[r]=v<<16|v>>>16,l[r]=v<<8|v>>>24,c[r]=v,v=16843009*y^65537*g^257*m^16843008*r,u[f]=v<<24|v>>>8,d[f]=v<<16|v>>>16,h[f]=v<<8|v>>>24,p[f]=v,r?(r=m^e[e[e[y^m]]],i^=e[e[i]]):r=i=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),n=this._keySchedule=[],o=0;o6&&o%r==4&&(c=a[c>>>24]<<24|a[c>>>16&255]<<16|a[c>>>8&255]<<8|a[255&c]):(c=a[(c=c<<8|c>>>24)>>>24]<<24|a[c>>>16&255]<<16|a[c>>>8&255]<<8|a[255&c],c^=f[o/r|0]<<24),n[o]=n[o-r]^c);for(var s=this._invKeySchedule=[],l=0;l>>24]]^d[a[c>>>16&255]]^h[a[c>>>8&255]]^p[a[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,l,c,a)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,p,n),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,a,n,o,s){for(var l=this._nRounds,c=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],h=e[t+3]^r[3],p=4,f=1;f>>24]^a[u>>>16&255]^n[d>>>8&255]^o[255&h]^r[p++],g=i[u>>>24]^a[d>>>16&255]^n[h>>>8&255]^o[255&c]^r[p++],y=i[d>>>24]^a[h>>>16&255]^n[c>>>8&255]^o[255&u]^r[p++],v=i[h>>>24]^a[c>>>16&255]^n[u>>>8&255]^o[255&d]^r[p++];c=m,u=g,d=y,h=v}m=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^r[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^r[p++],y=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^r[p++],v=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=v},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib,i=t.WordArray,a=t.BlockCipher,n=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=n.DES=a.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=o[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var a=this._subKeys=[],n=0;n<16;n++){var c=a[n]=[],u=l[n];for(r=0;r<24;r++)c[r/6|0]|=t[(s[r]-1+u)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(s[r+24]-1+u)%28]<<31-r%6;for(c[0]=c[0]<<1|c[0]>>>31,r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=a[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var a=r[i],n=this._lBlock,o=this._rBlock,s=0,l=0;l<8;l++)s|=c[l][((o^a[l])&u[l])>>>0];this._lBlock=o,this._rBlock=n^s}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),a=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(i.create(t)),this._des2=d.createEncryptor(i.create(r)),this._des3=d.createEncryptor(i.create(a))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=a._createHelper(f)}(),r.TripleDES)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,a=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],a=0;a<256;a++)i[a]=a;a=0;for(var n=0;a<256;a++){var o=a%r,s=t[o>>>2]>>>24-o%4*8&255;n=(n+i[a]+s)%256;var l=i[a];i[a]=i[n],i[n]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var e=this._S,t=this._i,r=this._j,i=0,a=0;a<4;a++){r=(r+e[t=(t+1)%256])%256;var n=e[t];e[t]=e[r],e[r]=n,i|=e[(e[t]+e[r])%256]<<24-8*a}return this._i=t,this._j=r,i}e.RC4=t._createHelper(a);var o=i.RC4Drop=a.extend({cfg:a.cfg.extend({drop:192}),_doReset:function(){a._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)n.call(this)}});e.RC4Drop=t._createHelper(o)}(),r.RC4)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,a=[],n=[],o=[],s=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],a=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)a[r]^=i[r+4&7];if(t){var n=t.words,o=n[0],s=n[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=c>>>16|4294901760&u,h=u<<16|65535&c;for(a[0]^=c,a[1]^=d,a[2]^=u,a[3]^=h,a[4]^=c,a[5]^=d,a[6]^=u,a[7]^=h,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),a[0]=r[0]^r[5]>>>16^r[3]<<16,a[1]=r[2]^r[7]>>>16^r[5]<<16,a[2]=r[4]^r[1]>>>16^r[7]<<16,a[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)a[i]=16711935&(a[i]<<8|a[i]>>>24)|4278255360&(a[i]<<24|a[i]>>>8),e[t+i]^=a[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],a=65535&i,s=i>>>16,l=((a*a>>>17)+a*s>>>15)+s*s,c=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=l^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(s)}(),r.Rabbit)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,a=[],n=[],o=[],s=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var a=0;a<4;a++)l.call(this);for(a=0;a<8;a++)i[a]^=r[a+4&7];if(t){var n=t.words,o=n[0],s=n[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=c>>>16|4294901760&u,h=u<<16|65535&c;for(i[0]^=c,i[1]^=d,i[2]^=u,i[3]^=h,i[4]^=c,i[5]^=d,i[6]^=u,i[7]^=h,a=0;a<4;a++)l.call(this)}},_doProcessBlock:function(e,t){var r=this._X;l.call(this),a[0]=r[0]^r[5]>>>16^r[3]<<16,a[1]=r[2]^r[7]>>>16^r[5]<<16,a[2]=r[4]^r[1]>>>16^r[7]<<16,a[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)a[i]=16711935&(a[i]<<8|a[i]>>>24)|4278255360&(a[i]<<24|a[i]>>>8),e[t+i]^=a[i]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],a=65535&i,s=i>>>16,l=((a*a>>>17)+a*s>>>15)+s*s,c=((4294901760&i)*i|0)+((65535&i)*i|0);o[r]=l^c}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(s)}(),r.RabbitLegacy)})),en((function(e,t){var r;e.exports=(r=Rc,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,a=16,n=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]],s={pbox:[],sbox:[]};function l(e,t){var r=t>>24&255,i=t>>16&255,a=t>>8&255,n=255&t,o=e.sbox[0][r]+e.sbox[1][i];return o^=e.sbox[2][a],o+=e.sbox[3][n],o}function c(e,t,r){for(var i,n=t,o=r,s=0;s1;--s)n^=e.pbox[s],o=l(e,n)^o,i=n,n=o,o=i;return i=n,n=o,o=i,o^=e.pbox[1],n^=e.pbox[0],{left:n,right:o}}function d(e,t,r){for(var i=0;i<4;i++){e.sbox[i]=[];for(var s=0;s<256;s++)e.sbox[i][s]=o[i][s]}for(var l=0,u=0;u=r&&(l=0);for(var d=0,h=0,p=0,f=0;f>>2]|=e[r]<<24-r%4*8;return Dc.lib.WordArray.create(t,e.length)}var Bc=16,Ic=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Mc=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Uc(e){for(var t=[],r=0,i=e.length;r>>6),t.push(128|63&a);else if(a<=55295||a>=57344&&a<=65535)t.push(224|a>>>12),t.push(128|a>>>6&63),t.push(128|63&a);else{if(!(a>=65536&&a<=1114111))throw t.push(a),new Error("input is not supported");r++,t.push(240|a>>>18&28),t.push(128|a>>>12&63),t.push(128|a>>>6&63),t.push(128|63&a)}}return t}function Nc(e){for(var t=[],r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function jc(e,t){var r=31&t;return e<>>32-r}function zc(e){return(255&Ic[e>>>24&255])<<24|(255&Ic[e>>>16&255])<<16|(255&Ic[e>>>8&255])<<8|255&Ic[255&e]}function Gc(e){return e^jc(e,2)^jc(e,10)^jc(e,18)^jc(e,24)}function Hc(e){return e^jc(e,13)^jc(e,23)}function Vc(e,t,r){for(var i=new Array(4),a=new Array(4),n=0;n<4;n++)a[0]=255&e[4*n],a[1]=255&e[4*n+1],a[2]=255&e[4*n+2],a[3]=255&e[4*n+3],i[n]=a[0]<<24|a[1]<<16|a[2]<<8|a[3];for(var o,s=0;s<32;s+=4)o=i[1]^i[2]^i[3]^r[s+0],i[0]^=Gc(zc(o)),o=i[2]^i[3]^i[0]^r[s+1],i[1]^=Gc(zc(o)),o=i[3]^i[0]^i[1]^r[s+2],i[2]^=Gc(zc(o)),o=i[0]^i[1]^i[2]^r[s+3],i[3]^=Gc(zc(o));for(var l=0;l<16;l+=4)t[l]=i[3-l/4]>>>24&255,t[l+1]=i[3-l/4]>>>16&255,t[l+2]=i[3-l/4]>>>8&255,t[l+3]=255&i[3-l/4]}function Wc(e,t,r){for(var i=new Array(4),a=new Array(4),n=0;n<4;n++)a[0]=255&e[0+4*n],a[1]=255&e[1+4*n],a[2]=255&e[2+4*n],a[3]=255&e[3+4*n],i[n]=a[0]<<24|a[1]<<16|a[2]<<8|a[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(var o,s=0;s<32;s+=4)o=i[1]^i[2]^i[3]^Mc[s+0],t[s+0]=i[0]^=Hc(zc(o)),o=i[2]^i[3]^i[0]^Mc[s+1],t[s+1]=i[1]^=Hc(zc(o)),o=i[3]^i[0]^i[1]^Mc[s+2],t[s+2]=i[2]^=Hc(zc(o)),o=i[0]^i[1]^i[2]^Mc[s+3],t[s+3]=i[3]^=Hc(zc(o));if(0===r)for(var l,c=0;c<16;c++)l=t[c],t[c]=t[31-c],t[31-c]=l}function Jc(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=i.padding,n=void 0===a?"pkcs#7":a,o=i.mode,s=i.iv,l=void 0===s?[]:s,c=i.output,u=void 0===c?"string":c;if("cbc"===o&&("string"==typeof l&&(l=Uc(l)),16!==l.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=Uc(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Oc(e):Uc(e):g(e),("pkcs#5"===n||"pkcs#7"===n)&&0!==r)for(var d=Bc-e.length%Bc,h=0;h=Bc;){var A=e.slice(v,v+16),b=new Array(16);if("cbc"===o)for(var _=0;_e)return this.preDelayTimestamp-e>1e3&&this.player.debug.warn("CommonDemux","getDelay() and preDelayTimestamp is ".concat(this.preDelayTimestamp," > timestamp is ").concat(e," more than ").concat(this.preDelayTimestamp-e,"ms and return ").concat(this.delay)),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){var r=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;r>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=r-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-r)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}},{key:"getDelayNotUpdateDelay",value:function(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===nt)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debug.warn("CommonDemux","getDelayNotUpdateDelay() and preDelayTimestamp is ".concat(this.preDelayTimestamp," > timestamp is ").concat(e," more than ").concat(this.preDelayTimestamp-e,"ms and return -1")),-1;if(this.firstTimestamp){var r=-1;if(e){var i=Date.now()-this.startTimestamp,a=e-this.firstTimestamp;r=i>=a?i-a:a-i}return r}return-1}},{key:"resetDelay",value:function(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}},{key:"resetAllDelay",value:function(){this.resetDelay(),this.preDelayTimestamp=null}},{key:"initInterval",value:function(){var e=this;this.player.isUseHls265()?this.player.debug.log("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(F)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debug.log("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debug.log("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((function(){var t=(new Date).getTime();e.preLoopTimestamp||(e.preLoopTimestamp=t);var r=t-e.preLoopTimestamp;e.updateHistoryIntervalDiffTimeList(r),r>100&&e.player.debug.warn("CommonDemux","loop demux diff time is ".concat(r)),e._loop(),e.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debug.log("CommonDemux","initInterval() and is worker stream so return")}},{key:"clearStopInterval",value:function(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}},{key:"updateHistoryIntervalDiffTimeList",value:function(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}},{key:"isHistoryIntervalDiffTimeAllLarge",value:function(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(var e=0;er+t&&i)this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux","_loop delay is ".concat(this.delay,", set dropping is true")),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debug.warn("CommonDemux","_loop delay is ".concat(this.delay," bufferList is ").concat(this.bufferList));break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}},{key:"_doDecode",value:function(e,t,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=this.player,o={ts:r,cts:a,type:t,isIFrame:!1};this.player.isPlayer()?(t===ot&&n._opt.playType===N&&this.calcNetworkDelay(r),n._opt.useWCS&&!n._opt.useOffscreen||n._opt.useMSE?(t===ot&&(o.isIFrame=i),this.pushBuffer(e,o)):t===ot?n.decoderWorker&&n.decoderWorker.decodeVideo(e,r,i):t===nt&&n._opt.hasAudio&&n.decoderWorker&&n.decoderWorker.decodeAudio(e,r)):this.player.isPlayback()&&(t===ot&&(o.isIFrame=i),this.player.isPlaybackOnlyDecodeIFrame()?t===ot&&i&&this.pushBuffer(e,o):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,o):this.pushBuffer(e,o,!1))}},{key:"_doDecodeByHls",value:function(e,t,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,n=!1;if(t===nt&&ln(e)&&(this.player.debug.log("CommonDemux","hls pushBuffer audio ts is ".concat(r,", isAacCodecPacket is true")),n=!0,this.player.isRecordTypeFlv())){var o=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(o,r)}var s=!1;if(t===ot&&i&&Po(e)&&(this.player.debug.log("CommonDemux","hls pushBuffer video ts is ".concat(r,", isVideoSequenceHeader is true")),s=!0,this.player.isRecordTypeFlv())){var l=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(l,r)}this.player.recording&&Io(s)&&Io(n)&&this.handleRecording(e,t,r,i,a),t===ot?this._doDecoderDecode({ts:r,cts:a,payload:e,type:ot,isIFrame:i}):t===nt&&this._doDecoderDecode({ts:r,payload:e,type:nt})}},{key:"_doDecodeByFmp4",value:function(e,t,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,r,i,a)}},{key:"_doDecodeByTs",value:function(e,t,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,r,i,a)}},{key:"_doDecodeByPs",value:function(e,t,r,i){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,r,i,a)}},{key:"_decodeNext",value:function(e){var t=e.ts;if(0!==this.bufferList.length){var r=this.bufferList[0],i=r.ts-t,a=e.type===ot&&r.type===nt,n=e.type===ot&&Po(e.payload);(i<=20||a||n)&&(this.player.debug.log("CommonDemux","decode data type is ".concat(e.type," and\n ts is ").concat(t," next data type is ").concat(r.type," ts is ").concat(r.ts,"\n diff is ").concat(i," and isVideoAndNextAudio is ").concat(a," and isVideoSqeHeader is ").concat(n)),this.bufferList.shift(),this._doDecoderDecode(r))}}},{key:"_doDecoderDecode",value:function(e){var t=this.player,r=t.webcodecsDecoder,i=t.mseDecoder;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===nt?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?i.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===ot&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?r.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}},{key:"pushBuffer",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.player._opt.videoBuffer,a=this.player._opt.videoBufferDelay,n=this.player.isPlayer();if(t.type===nt&&ln(e)){if(this.player.debug.log("CommonDemux","pushBuffer() audio ts is ".concat(t.ts,", isAacCodecPacket is true")),this.player.isRecordTypeFlv()){var o=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(o,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:nt})}else if(t.type===ot&&t.isIFrame&&Po(e)){if(this.player.debug.log("CommonDemux","pushBuffer() video ts is ".concat(t.ts,", isVideoSequenceHeader is true")),this.player.isRecordTypeFlv()){var s=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(s,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:ot,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),n){if(this.preTimestampDuration>0&&this.preTimestamp>0&&t.type===ot){var l=t.ts-this.preTimestamp,c=this.preTimestampDuration+this.preTimestampDuration/2;l>=c&&this.player.debug.log("CommonDemux","pushBuffer() video\n ts is ".concat(t.ts,", preTimestamp is ").concat(this.preTimestamp,",\n diff is ").concat(l," and preTimestampDuration is ").concat(this.preTimestampDuration," and maxDiff is ").concat(c,"\n maybe trigger black screen or flower screen"))}if(this.preTimestamp>0&&t.tsve&&(this.player.debug.warn("CommonDemux","pushBuffer() video\n ts is ".concat(t.ts,", preTimestamp is ").concat(this.preTimestamp,",\n diff is ").concat(this.preTimestamp-t.ts," more than 3600000\n and resetAllDelay()")),this.resetAllDelay()),t.ts<=this.preTimestamp&&this.preTimestamp>0&&t.type===ot&&(this.player.debug.warn("CommonDemux","pushBuffer() video and isIFrame is ".concat(t.isIFrame," and\n ts is ").concat(t.ts," less than (or equal) preTimestamp is ").concat(this.preTimestamp," and\n payloadBufferSize is ").concat(e.byteLength," and prevPayloadBufferSize is ").concat(this.prevPayloadBufferSize)),this.player._opt.isDropSameTimestampGop&&Io(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){var u=this.hasIframeInBufferList(),d=Io(this.isPushDropping);return this.player.debug.log("CommonDemux","pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ".concat(u," and isNotPushDropping is ").concat(d," and next drop buffer")),void(u&&d?this.dropBuffer$2():this.clearBuffer(!0))}if(this.player.isDemuxDecodeFirstIIframeInit()){var h=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=h;var p=a+i;this.player._opt.useMSE?h>p&&this.delay0&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux","useMSE, pushLatestDelay is ".concat(h," > ").concat(a+i,", bufferList is ").concat(this.bufferList.length,", delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2()):h>p&&this.delay0&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux","useWCS, pushLatestDelay is ".concat(h," > ").concat(a+i,",bufferList is ").concat(this.bufferList.length,", delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&Io(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux","useMSE, page visibility is false and\n history interval diff is ".concat(this.historyIntervalDiffTimeList.join(",")," and\n bufferList is ").concat(this.bufferList.length,",\n delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux","useWCS, page visibility is false and\n history interval diff is ".concat(this.historyIntervalDiffTimeList.join(",")," and\n bufferList is ").concat(this.bufferList.length,",\n delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2()))}t.type===ot&&(this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts)}if(r?t.type===nt?this.bufferList.push({ts:t.ts,payload:e,type:nt}):t.type===ot&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:ot,isIFrame:t.isIFrame}):t.type===ot?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:ot,isIFrame:t.isIFrame}):t.type===nt&&this._doDecoderDecode({ts:t.ts,payload:e,type:nt}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&(Zn(this.playbackStreamVideoFps)||Zn(this.playbackStreamAudioFps))){var f=this.playbackStreamVideoFps,m=this.playbackStreamAudioFps;if(Zn(this.playbackStreamVideoFps)&&(f=To(this.bufferList,ot),f>0&&(this.playbackStreamVideoFps=f,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=m?f+m:f,Io(this.player._opt.hasAudio)&&(this.player.debug.log(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),Zn(this.playbackStreamAudioFps)&&(m=To(this.bufferList,nt),m>0&&(this.playbackStreamAudioFps=m,this.playbackStreamFps=f?f+m:m,this.initPlaybackCacheLoop())),Zn(this.playbackStreamVideoFps)&&Zn(this.playbackStreamAudioFps)){var g=this.bufferList.map((function(e){return{type:e.type,ts:e.ts}}));this.player.debug.log("CommonDemux","playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ".concat(m,", streamVideoFps is ").concat(f,", bufferListLength is ").concat(this.bufferList.length," and ts list is ").concat(JSON.stringify(g)))}var y=this.getAudioBufferLength()>0,v=y?60:40;this.bufferList.length>=v&&(this.debug.warn("CommonDemux","playbackCacheBeforeDecodeForFpsRender, bufferListLength is ".concat(this.bufferList.length," more than ").concat(v,", and hasAudio is ").concat(y," an set streamFps is 25")),this.playbackStreamVideoFps=f,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),y?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}}},{key:"dropBuffer$2",value:function(){if(this.bufferList.length>0){var e=this.bufferList.findIndex((function(e){return Bo(e.isIFrame)&&e.type===ot}));if(this.isAllIframeInBufferList())for(var t=0;t=this.getNotDroppingDelayTs()){this.player.debug.log("CommonDemux","dropBuffer$2() isAllIframeInBufferList() is true, and index is ".concat(t," and tempDelay is ").concat(i," and notDroppingDelayTs is ").concat(this.getNotDroppingDelayTs())),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});var a=this.bufferList.length;this.bufferList=this.bufferList.slice(e);var n=this.bufferList.shift();this.resetAllDelay(),this.getDelay(n.ts,n.type),this._doDecoderDecode(n),this.isPushDropping=!1,this.player.debug.log("CommonDemux","dropBuffer$2() iFrameIndex is ".concat(e,",and old bufferList length is ").concat(a," ,and new bufferList length is ").concat(this.bufferList.length," and new delay is ").concat(this.delay," "))}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}},{key:"clearBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debug.log("CommonDemux","clearBuffer,buffer length is ".concat(this.bufferList.length,", need clear is ").concat(e," and _opt.checkFirstIFrame is ").concat(this.player._opt.checkFirstIFrame)),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),Bo(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}},{key:"calcNetworkDelay",value:function(e){if(this.player.isDemuxDecodeFirstIIframeInit()&&e>0){null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=Tn()):et?r-t:0;i>this.player._opt.networkDelay&&this.player._opt.playType===N&&(this.player.debug.warn("CommonDemux","delay is more than networkDelay and now dts:".concat(e,",start dts is ").concat(this.bufferStartDts,", vs start is ").concat(t,",local diff is ").concat(r," ,delay is ").concat(i,", _opt.networkDelay is ").concat(this.player._opt.networkDelay)),this.player.emit(Ct.networkDelayTimeout,i)),this.player.updateStats({netBuf:i})}}},{key:"calcIframeIntervalTimestamp",value:function(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs2&&void 0!==arguments[2]&&arguments[2],a=4;eo(this.nalUnitSize)&&(a=this.nalUnitSize);var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(!(e.length<4)){for(var r,i=e.length,a=[],n=0;n+t>>=8),n+=t,r){if(n+r>i)break;a.push(e.subarray(n,n+r)),n+=r}return a}}(e.slice(5),a);if(Io(i)){var o=this.player.getVideoInfo();o&&o.encType&&(i=o.encType===Ht)}n.forEach((function(e){var a=i?e[0]>>>1&63:31&e[0];(i&&(a===fr||a===pr)||Io(i)&&a===$t)&&r.player.emit(Ct.videoSEI,{ts:t,data:e})}))}},{key:"handleRecording",value:function(e,t,r,i,a){if(this.player.isRecordTypeFlv()){var n=new Uint8Array(e);t===ot?this.player.recorder.addVideo(n,r):t===nt&&this.player.recorder.addAudio(n,r)}else if(this.player.isRecordTypeMp4()){var o=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===ot)this.player.recorder.handleAddNaluTrack(o.slice(5),i,r,a);else if(t===nt){var s=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(cn(s)?s.slice(2):s.slice(1),r)}}else t===ot&&this.player.recorder.handleAddNaluTrack(o.slice(5),i,r,a)}}},{key:"updateNalUnitSize",value:function(e){var t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});var r=t===zt;this.nalUnitSize=function(e,t){var r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}(e,r),this.player.debug.log(this.TAG_NAME,"demux() isVideoSequenceHeader is true and isHevc is ".concat(r," and nalUnitSize is ").concat(this.nalUnitSize))}},{key:"cryptoPayload",value:function(e,t){var r=e,i=this.player;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){var a=this.player.video.getVideoInfo();a.encTypeCode?r=function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);for(var a=e.byteLength,n=5;na)break;var s=e[n+4],l=!1;if(i?(s=s>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(s)):(s&=31,l=1===s||5===s),l){var c=e.slice(n+4+2,n+4+o),u=new xc.ModeOfOperation.ctr(t,new xc.Counter(r)),d=u.decrypt(c);u=null,e.set(d,n+4+2)}n=n+4+o}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,a.encTypeCode===zt):i.debug.warn(this.TAG_NAME,"videoInfo.encTypeCode is ".concat(a.encTypeCode))}else i.debug.error(this.TAG_NAME,"isM7sCrypto cryptoKey.length is ".concat(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength," or cryptoIV.length is ").concat(i._opt.cryptoIV&&i._opt.cryptoIV.byteLength," null"));else if(i._opt.isSm4Crypto)i._opt.sm4CryptoKey&&t?r=function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=e.byteLength,a=5;ai)break;var o=e[a+4],s=!1;if(r?(o=o>>>1&63,s=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,s=1===o||5===o),s){var l=Jc(e.slice(a+4+2,a+4+n),t,0,{padding:"none",output:"array"});e.set(l,a+4+2)}a=a+4+n}return e}(e,i._opt.sm4CryptoKey):i._opt.sm4CryptoKey||i.debug.error(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(i._opt.isXorCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){var n=this.player.video.getVideoInfo();r=function(e,t,r){for(var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e.byteLength,n=5;na)break;var s=e[n+4],l=!1;if(i?(s=s>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(s)):(s&=31,l=1===s||5===s),l){var c=Kc(e.slice(n+4,n+4+o),t,r);e.set(c,n+4)}n=n+4+o}return e}(e,i._opt.cryptoKey,i._opt.cryptoIV,n.encTypeCode===zt)}else i.debug.error(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return r}},{key:"cryptoPayloadAudio",value:function(e){var t=e,r=this.player;return r._opt.isM7sCrypto&&(r._opt.cryptoKey&&r._opt.cryptoKey.byteLength>0&&r._opt.cryptoIV&&r._opt.cryptoIV.byteLength>0?e[0]>>4===Vt&&(t=function(e,t,r){if(e.byteLength<=30)return e;var i=e.slice(32),a=new xc.ModeOfOperation.ctr(t,new xc.Counter(r)),n=a.decrypt(i);return a=null,e.set(n,32),e}(e,r._opt.cryptoKey,r._opt.cryptoIV)):r.debug.error(this.TAG_NAME,"isM7sCrypto cryptoKey.length is ".concat(r._opt.cryptoKey&&r._opt.cryptoKey.byteLength," or cryptoIV.length is ").concat(r._opt.cryptoIV&&r._opt.cryptoIV.byteLength," null"))),t}},{key:"_decodeEnhancedH265Video",value:function(e,t){var r=e[0],i=48&r,a=15&r,n=e.slice(1,5),o=new ArrayBuffer(4),s=new Uint32Array(o),l="a"==String.fromCharCode(n[0]);if(a===Fa){if(i===ja){var c=e.slice(5);if(l);else{var u=new Uint8Array(5+c.length);u.set([28,0,0,0,0],0),u.set(c,5),this.updateNalUnitSize(u),this.player.debug.log(this.TAG_NAME,"demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ".concat(this.nalUnitSize)),this._doDecode(u,ot,0,!0,0)}}}else if(a===Oa){var d=e,h=0,p=i===ja;p&&this.calcIframeIntervalTimestamp(t),l||(s[0]=e[4],s[1]=e[3],s[2]=e[2],s[3]=0,h=s[0],d=ol(e.slice(8),p),d=this.cryptoPayload(d,p),this._doDecode(d,ot,t,p,h))}else if(a===Na){var f=i===ja,m=e.slice(5);f&&this.calcIframeIntervalTimestamp(t);var g=ol(m,f);g=this.cryptoPayload(g,f),this._doDecode(g,ot,t,f,0)}}},{key:"_isEnhancedH265Header",value:function(e){return 128==(128&e)}}])}(Ho),Xc=function(e,t,r,i){return new(r||(r=Promise))((function(a,n){function o(e){try{l(i.next(e))}catch(e){n(e)}}function s(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))},Zc=Symbol(32),$c=Symbol(16),eu=Symbol(8),tu=function(){function e(t){S(this,e),this.g=t,this.consumed=0,t&&(this.need=t.next().value)}return w(e,[{key:"setG",value:function(e){this.g=e,this.demand(e.next().value,!0)}},{key:"consume",value:function(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}},{key:"demand",value:function(e,t){return t&&this.consume(),this.need=e,this.flush()}},{key:"read",value:function(e){return Xc(this,void 0,void 0,v().mark((function t(){var r=this;return v().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(t.t0=this.lastReadPromise,!t.t0){t.next=4;break}return t.next=4,this.lastReadPromise;case 4:return t.abrupt("return",this.lastReadPromise=new Promise((function(t,i){var a;r.reject=i,r.resolve=function(e){delete r.lastReadPromise,delete r.resolve,delete r.need,t(e)},r.demand(e,!0)||null===(a=r.pull)||void 0===a||a.call(r,e)})));case 5:case"end":return t.stop()}}),t,this)})))}},{key:"readU32",value:function(){return this.read(Zc)}},{key:"readU16",value:function(){return this.read($c)}},{key:"readU8",value:function(){return this.read(eu)}},{key:"close",value:function(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}},{key:"flush",value:function(){if(this.buffer&&this.need){var e=null,t=this.buffer.subarray(this.consumed),r=0,i=function(e){return t.length<(r=e)};if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Zc){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===$c){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===eu){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}}},{key:"write",value:function(e){var t=this;if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((function(e){return t.pull=e}));this.flush()}},{key:"writeU32",value:function(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}},{key:"writeU16",value:function(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}},{key:"writeU8",value:function(e){this.malloc(1)[0]=e,this.flush()}},{key:"malloc",value:function(e){if(this.buffer){var t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{var i=new Uint8Array(r);i.set(this.buffer),this.buffer=i}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}])}();tu.U32=Zc,tu.U16=$c,tu.U8=eu;var ru,iu=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="FlvDemux",r.input=new tu(r.demux()),e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.input=null,this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"dispatch",value:function(e){this.input?this.input.write(e):this.player&&this.player.debug.warn(this.TAG_NAME,"dispatch() this.input is null")}},{key:"demux",value:v().mark((function e(){var t,r,i,a,n,o,s,l,c,u,d,h,p,f,m,g,y,A,b;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,9;case 2:t=new ArrayBuffer(4),r=new Uint8Array(t),i=new Uint32Array(t),a=this.player;case 3:if(this.input){e.next=5;break}return e.abrupt("return");case 5:return r[3]=0,e.next=8,15;case 8:return n=e.sent,o=n[4],r[0]=n[7],r[1]=n[6],r[2]=n[5],s=i[0],r[0]=n[10],r[1]=n[9],r[2]=n[8],r[3]=n[11],l=i[0],e.next=16,s;case 16:if(c=e.sent.slice(),a){e.next=19;break}return e.abrupt("return");case 19:e.t0=o,e.next=e.t0===st?22:e.t0===lt?24:e.t0===ct?44:48;break;case 22:return a._opt.hasAudio&&(a.updateStats({abps:c.byteLength}),c.byteLength>0)&&(u=c,Bo(this.player._opt.m7sCryptoAudio)&&(u=this.cryptoPayloadAudio(c)),this._doDecode(u,nt,l)),e.abrupt("break",49);case 24:if(!(a._opt.hasVideo&&c.length>=6)){e.next=42;break}if(d=l,a.updateStats({vbps:c.byteLength,dts:d}),a._times.demuxStart||(a._times.demuxStart=Tn()),h=c[0],!this._isEnhancedH265Header(h)){e.next=32;break}this._decodeEnhancedH265Video(c,d),e.next=40;break;case 32:if(p=15&h,f=(h>>4&15)===oa,m=p===jt,!Io(p===zt||m)){e.next=37;break}return e.abrupt("return",void this.player.debug.warn(this.TAG_NAME,"demux() codecId is ".concat(p," and ignore")));case 37:f&&(this.calcIframeIntervalTimestamp(l),null===this.nalUnitSize&&Po(c)&&this.updateNalUnitSize(c)),i[0]=c[4],i[1]=c[3],i[2]=c[2],i[3]=0,g=i[0],y=this.cryptoPayload(c,f),this._doDecode(y,ot,l,f,g);case 40:e.next=43;break;case 42:c.length<6&&a.debug.warn(this.TAG_NAME,"payload.length is ".concat(c.length," less than 6 and ignore"));case 43:return e.abrupt("break",49);case 44:return this.player.isRecordTypeFlv()&&(A=new Uint8Array(c),this.player.recorder.addMetaData(A)),b=El(c),b&&b.onMetaData&&a.updateMetaData(b.onMetaData),e.abrupt("break",49);case 48:a.debug.log(this.TAG_NAME,"demux() type is ".concat(o));case 49:e.next=3;break;case 51:case"end":return e.stop()}}),e,this)}))},{key:"close",value:function(){this.input=null}},{key:"getInputByteLength",value:function(){var e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}])}(Qc),au=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="M7sDemux",e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"dispatch",value:function(e){var t=this.player,r=new DataView(e),i=r.getUint8(0),a=r.getUint32(1,!1),n=new ArrayBuffer(4),o=new Uint32Array(n);switch(i){case nt:if(t._opt.hasAudio){var s=new Uint8Array(e,5);t.updateStats({abps:s.byteLength}),s.byteLength>0&&this._doDecode(s,i,a)}break;case ot:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=Tn()),r.byteLength>=11){var l=new Uint8Array(e,5),c=a;t.updateStats({vbps:l.byteLength,dts:c});var u=l[0];if(this._isEnhancedH265Header(u))this._decodeEnhancedH265Video(l,a);else{var d=r.getUint8(5)>>4==1;d&&this.calcIframeIntervalTimestamp(a),o[0]=l[4],o[1]=l[3],o[2]=l[2],o[3]=0;var h=o[0],p=this.cryptoPayload(l,d);this._doDecode(p,i,a,d,h)}}else this.player.debug.warn(this.TAG_NAME,"dispatch","dv byteLength is",r.byteLength,"and return")}}}])}(Qc),nu=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),e.debug.log("WebTransportDemux","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.player.debug.log("WebTransportDemux","destroy"),b(t,"destroy",this,3)([])}}])}(iu),ou=en((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports})),su=(ru=ou)&&ru.__esModule&&Object.prototype.hasOwnProperty.call(ru,"default")?ru.default:ru,lu=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),su(m(r),"TAG_NAME","NakedFlowDemux"),r.lastBuf=null,r.vps=null,r.sps=null,r.pps=null,r.streamVideoType=null,r.streamAudioType=null,r.tempNaluBufferList=new Uint8Array(0),r.localDts=0,r.isSendSeqHeader=!1,r.isSendAACSeqHeader=!1,e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"dispatch",value:function(e){this.player;var t=new Uint8Array(e);this.extractNALu$2(t)}},{key:"addNaluToBuffer",value:function(e){var t=e.byteLength+this.tempNaluBufferList.byteLength,r=new Uint8Array(t);r.set(this.tempNaluBufferList,0),r.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=r}},{key:"downloadNakedFlowFile",value:function(){var e=new Blob([this.tempNaluBufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}},{key:"getNaluDts",value:function(){var e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e),this.localDts}},{key:"getNaluAudioDts",value:function(){var e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}},{key:"extractNALu",value:function(e){for(var t,r,i=0,a=e.byteLength,n=0,o=[];i1)for(var c=0;c>1,r!==or&&r!==lr&&r!==ur||(t=Ht)),t}(r)),this.streamVideoType===Gt){var i=this.handleAddNaluStartCode(r),a=this.extractNALu(i);if(0===a.length)return void this.player.debug.warn(this.TAG_NAME,"handleVideoNalu","naluList.length === 0");var n=[];if(a.forEach((function(e){var r=qs(e);r===Yt||r===Kt?t.handleVideoH264Nalu(e):Ys(r)&&n.push(e)})),1===n.length)this.handleVideoH264Nalu(n[0]);else{var o=function(e){if(0===e.length)return!1;for(var t=qs(e[0]),r=1;r>6,a=(60&r[2])>>2,n=(1&r[2])<<2|(192&r[3])>>6,o=new Uint8Array([175,0,i<<3|(14&a)>>1,(1&a)<<7|n<<3]);this.isSendAACSeqHeader=!0,this._doDecode(o,nt,0,!1,0)}var s=this.getNaluAudioDts(),l=new Uint8Array(t.length+2);l.set([175,1],0),l.set(t,2),this._doDecode(l,nt,s,!1,0)}}},{key:"handleAudioG711ANalu",value:function(e){if(e&&!(e.byteLength<1)){this.streamAudioType||(this.streamAudioType=Jt.ALAW);var t=new Uint8Array(e),r=this.getNaluAudioDts(),i=new Uint8Array(t.length+1);i.set([114],0),i.set(t,1),this._doDecode(i,nt,r,!1,0)}}},{key:"handleAudioG711UNalu",value:function(e){if(e&&!(e.byteLength<1)){this.streamAudioType||(this.streamAudioType=Jt.MULAW);var t=new Uint8Array(e),r=this.getNaluAudioDts(),i=new Uint8Array(t.length+1);i.set([130],0),i.set(t,1),this._doDecode(i,nt,r,!1,0)}}},{key:"handleVideoH264Nalu",value:function(e){var t=qs(e);switch(t){case Kt:this.sps=e;break;case Yt:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){var r=Ws({sps:this.sps,pps:this.pps}),i=this.getNaluDts();this._doDecode(r,ot,i,!0,0),this.sps=null,this.pps=null}if(Ys(t)){this.player._times.demuxStart||(this.player._times.demuxStart=Tn());var a=Qs(t),n=this.getNaluDts(),o=function(e,t){var r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;var i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}(e,a);this._preDoDecode(o,ot,n,a,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH264Nalu is avc seq head nalType is ".concat(t))}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;var s=Ws({sps:this.sps,pps:this.pps});this._doDecode(s,ot,0,!0,0),this.sps=null,this.pps=null}}},{key:"handleVideoH264NaluList",value:function(e,t,r){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=Tn());var i=this.getNaluDts(),a=Js(e.reduce((function(e,t){var r=_n(e),i=_n(t),a=new Uint8Array(r.byteLength+i.byteLength);return a.set(r,0),a.set(i,r.byteLength),a})),t);this._preDoDecode(a,ot,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}},{key:"handleVideoH265Nalu",value:function(e){var t=sl(e);switch(t){case or:this.vps=e;break;case lr:this.sps=e;break;case ur:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){var r=nl({vps:this.vps,sps:this.sps,pps:this.pps}),i=this.getNaluDts();this._doDecode(r,ot,i,!0,0),this.vps=null,this.sps=null,this.pps=null}if(ll(t)){this.player._times.demuxStart||(this.player._times.demuxStart=Tn());var a=cl(t),n=this.getNaluDts(),o=function(e,t){var r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;var i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}(e,a);this._preDoDecode(o,ot,n,a,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;var s=nl({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(s,ot,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}},{key:"handleVideoH265NaluList",value:function(e,t,r){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=Tn());var i=this.getNaluDts(),a=ol(e.reduce((function(e,t){var r=_n(e),i=_n(t),a=new Uint8Array(r.byteLength+i.byteLength);return a.set(r,0),a.set(i,r.byteLength),a})),t);this._preDoDecode(a,ot,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}},{key:"_preDoDecode",value:function(e,t,r,i,a){this.player.updateStats({vbps:e.byteLength,dts:r}),i&&this.calcIframeIntervalTimestamp(r),this._doDecode(e,ot,r,i,a)}},{key:"getInputByteLength",value:function(){var e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}}])}(Qc),cu=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.player=e,e.debug.log("EmptyDemux","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.player.debug.log("EmptyDemux","destroy")}}])}(Qc),uu=en((function(e,t){var r,a,n,o=(r=new Date,a=4,n={setLogLevel:function(e){a=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=a&&console.debug("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=a&&console.info("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=a&&console.warn("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=a&&console.error("["+o.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},n);o.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+o.getDurationString(e.start(i))+","+o.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=o;var s=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};s.prototype.getPosition=function(){return this.position},s.prototype.getEndPosition=function(){return this.buffer.byteLength},s.prototype.getLength=function(){return this.buffer.byteLength},s.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},s.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},s.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},s.prototype.readUint8=function(){return this.readAnyInt(1,!1)},s.prototype.readUint16=function(){return this.readAnyInt(2,!1)},s.prototype.readUint24=function(){return this.readAnyInt(3,!1)},s.prototype.readUint32=function(){return this.readAnyInt(4,!1)},s.prototype.readUint64=function(){return this.readAnyInt(8,!1)},s.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),a=new Uint8Array(this._buffer);new Uint8Array(i,0,a.length).set(a),this.buffer=i,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return l.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),l.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return l.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),l.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return l.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),l.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return l.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),l.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return l.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),l.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return l.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),l.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,r,i,a){var n=new Uint8Array(e,t,a),o=new Uint8Array(r,i,a);n.set(o)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;ra;i--,a++){var n=t[a];t[a]=t[i],t[i]=n}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var u=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(u.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},u.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},u.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,a,n)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},u.prototype.logBufferLevel=function(e){var t,r,i,a,n,s=[],l="";for(i=0,a=0,t=0;t0&&(l+=n.end-1+"]");var c=e?o.info:o.debug;0===this.buffers.length?c("MultiBufferStream","No more buffer in memory"):c("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+a+" bytes), continuous ranges: "+l)},u.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},u.prototype.findPosition=function(e,t,r){var i,a=null,n=-1;for(i=!0===e?0:this.bufferIndex;i=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+n),n):-1},u.prototype.findEndContiguousBuf=function(e){var t,r,i,a=void 0!==e?e:this.bufferIndex;if(r=this.buffers[a],this.buffers.length>a+1)for(t=a+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=d;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(o.error("BoxParser","Box of type '"+u+"' has a size "+c+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:u,size:c,hdr_size:l,start:s}):0!==c&&s+c>e.getEndPosition()?(e.seek(s),o.info("BoxParser","Not enough data in stream to parse the entire '"+u+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:u,size:c,hdr_size:l,start:s}):t?{code:h.OK,type:u,size:c,hdr_size:l,start:s}:(h[u+"Box"]?i=new h[u+"Box"](c):"uuid"!==u?(o.warn("BoxParser","Unknown box type: '"+u+"'"),(i=new h.Box(u,c)).has_unparsed_data=!0):h.UUIDBoxes[n]?i=new h.UUIDBoxes[n](c):(o.warn("BoxParser","Unknown uuid type: '"+n+"'"),(i=new h.Box(u,c)).uuid=n,i.has_unparsed_data=!0),i.hdr_size=l,i.start=s,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(o.info("BoxParser","'"+d+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(a=e.getPosition()-(i.start+i.size))<0?(o.warn("BoxParser","Parsing of box '"+d+"' did not read the entire indicated box data size (missing "+-a+" bytes), seeking forward"),e.seek(i.start+i.size)):a>0&&(o.error("BoxParser","Parsing of box '"+d+"' read "+a+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&e.readUint8()));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=a>>1&31,i.bsmod=(1&a)<<4|n>>4&15,i.acmod=n>>1&7,i.lfeon=1&n,i.num_dep_sub=o>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&o)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),a=Math.min(127&i,r.length-1);if(a?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[a]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,a;this.configurationVersion=e.readUint8(),a=e.readUint8(),this.general_profile_space=a>>6,this.general_tier_flag=(32&a)>>5,this.general_profile_idc=31&a,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),a=e.readUint8(),this.constantFrameRate=a>>6,this.numTemporalLayers=(13&a)>>3,this.temporalIdNested=(4&a)>>2,this.lengthSizeMinusOne=3&a,this.nalu_arrays=[];var n=e.readUint8();for(t=0;t>7,o.nalu_type=63&a;var s=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&n)<<8|e.readUint8():o.property_index=127&n}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&a,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&a,i.subsegment_duration=e.readUint32(),a=e.readUint32(),i.starts_with_SAP=a>>31&1,i.SAP_type=a>>28&7,i.SAP_delta_time=268435455&a}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var o=i.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var a=!1,n="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||a)&&(n="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+n,a=!0);t+=n}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,a=[],n=0;for(n|=this.vvcC.ptl_frame_only_constraint<<7,n|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,a.push(n),n&&(i=e),n=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",s=0,l=0;for(e=0;e<=i;++e)for(s=s<<8|a[e],l+=8;l>=5;)r+=o[s>>l-5&31],s&=(1<<(l-=5))-1;l&&(r+=o[31&(s<<=5-l)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>c&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>c?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>c&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var a={};this.extractedTracks.push(a),a.id=e,a.user=t,a.trak=i,i.nextSample=0,a.nb_samples=1e3,a.samples=[],r&&r.nbSamples&&(a.nb_samples=r.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,!1)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&o.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},y.prototype.getInfo=function(){var e,t,r,i,a,n,o={},s=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(s+1e3*this.moov.mvhd.creation_time),o.modified=new Date(s+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+n.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(n.id,n.user,n.samples),n.samples=[],n!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var r=[];return y._sweep.call(this,e,r,t),r},y._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;y._sweep.call(this.boxes[i],e,t,r)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},y.prototype.releaseUsedSamples=function(e,t){var r=0,i=this.getTrackById(e);i.lastValidSample||(i.lastValidSample=0);for(var a=i.lastValidSample;ae*a.timescale){c=i-1;break}t&&a.is_sync&&(l=i)}for(t&&(c=l),e=r.samples[c].cts,r.nextSample=c;r.samples[c].alreadyRead===r.samples[c].size&&r.samples[c+1];)c++;return n=r.samples[c].offset+r.samples[c].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(e,s)+" and offset: "+n),{offset:n,time:e/s}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var r,i,a,n=this.moov,s={offset:1/0,time:1/0};if(this.moov){for(a=0;athis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){o=l;break}switch(o){case"Visual":if(a.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),n.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var d=new h.avcCBox;d.parse(new s(t.avcDecoderConfigRecord)),n.addBox(d)}else if(t.hevcDecoderConfigRecord){var p=new h.hvcCBox;p.parse(new s(t.hevcDecoderConfigRecord)),n.addBox(p)}break;case"Audio":a.add("smhd").set("balance",t.balance||0),n.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":a.add("hmhd");break;case"Subtitle":a.add("sthd"),"stpp"===t.type&&n.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:a.add("nmhd")}t.description&&n.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){n.addBox(e)})),a.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var f=a.add("stbl");return f.add("stsd").addEntry(n),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,r){var i=r||{},a={},n=this.getTrackById(e);if(null!==n){a.number=n.samples.length,a.track_id=n.tkhd.track_id,a.timescale=n.mdia.mdhd.timescale,a.description_index=i.sample_description_index?i.sample_description_index-1:0,a.description=n.mdia.minf.stbl.stsd.entries[a.description_index],a.data=t,a.size=t.byteLength,a.alreadyRead=a.size,a.duration=i.duration||1,a.cts=i.cts||0,a.dts=i.dts||0,a.is_sync=i.is_sync||!1,a.is_leading=i.is_leading||0,a.depends_on=i.depends_on||0,a.is_depended_on=i.is_depended_on||0,a.has_redundancy=i.has_redundancy||0,a.degradation_priority=i.degradation_priority||0,a.offset=0,a.subsamples=i.subsamples,n.samples.push(a),n.samples_size+=a.size,n.samples_duration+=a.duration,void 0===n.first_dts&&(n.first_dts=i.dts),this.processSamples();var o=this.createSingleSampleMoof(a);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),a}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),a=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(a.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,r,i,a,n;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=a[o].grouping_type+"/0",(s=new c(a[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=s))}else for(o=0;o=2&&(l=i[o].grouping_type+"/0",s=new c(i[o].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=s))},y.setSampleGroupProperties=function(e,t,r,i){var a,n;for(a in t.sample_groups=[],i){var o;t.sample_groups[a]={},t.sample_groups[a].grouping_type=i[a].grouping_type,t.sample_groups[a].grouping_type_parameter=i[a].grouping_type_parameter,r>=i[a].last_sample_in_run&&(i[a].last_sample_in_run<0&&(i[a].last_sample_in_run=0),i[a].entry_index++,i[a].entry_index<=i[a].sbgp.entries.length-1&&(i[a].last_sample_in_run+=i[a].sbgp.entries[i[a].entry_index].sample_count)),i[a].entry_index<=i[a].sbgp.entries.length-1?t.sample_groups[a].group_description_index=i[a].sbgp.entries[i[a].entry_index].group_description_index:t.sample_groups[a].group_description_index=-1,0!==t.sample_groups[a].group_description_index&&(o=i[a].fragment_description?i[a].fragment_description:i[a].description,t.sample_groups[a].group_description_index>0?(n=t.sample_groups[a].group_description_index>65535?(t.sample_groups[a].group_description_index>>16)-1:t.sample_groups[a].group_description_index-1,o&&n>=0&&(t.sample_groups[a].description=o.entries[n])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[a].description=o.entries[o.default_group_description_index-1]))}},y.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eA&&(b++,A<0&&(A=0),A+=n.sample_counts[b]),t>0?(e.samples[t-1].duration=n.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,T.dts=e.samples[t-1].dts+e.samples[t-1].duration):T.dts=0,o?(t>=_&&(k++,_<0&&(_=0),_+=o.sample_counts[k]),T.cts=e.samples[t].dts+o.sample_offsets[k]):T.cts=T.dts,s?(t==s.sample_numbers[w]-1?(T.is_sync=!0,w++):(T.is_sync=!1,T.degradation_priority=0),c&&c.entries[S].sample_delta+E==t+1&&(T.subsamples=c.entries[S].subsamples,E+=c.entries[S].sample_delta,S++)):T.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,T,T.number),T.degradation_priority=h?h.priority[t]:0,c&&c.entries[S].sample_delta+E==t&&(T.subsamples=c.entries[S].subsamples,E+=c.entries[S].sample_delta),(u.length>0||d.length>0)&&y.setSampleGroupProperties(e,T,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,r,i,a,n,o,s,l,c,u,d,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(d,u,u.sbgps,d.mdia.minf.stbl.sgpds,u.sgpds),t=0;t0?f.dts=d.samples[d.samples.length-2].dts+d.samples[d.samples.length-2].duration:(u.tfdt?f.dts=u.tfdt.baseMediaDecodeTime:f.dts=0,d.first_traf_merged=!0),f.cts=f.dts,g.flags&h.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[r]),m=o,g.flags&h.TRUN_FLAGS_FLAGS?m=g.sample_flags[r]:0===r&&g.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var v=!!(u.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),A=!!(u.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(g.flags&h.TRUN_FLAGS_DATA_OFFSET),_=0;_=v?u.tfhd.base_data_offset:A||0===t?c.start:s,f.offset=0===t&&0===r?b?_+g.data_offset:_:s,s=f.offset+f.size,(u.sbgps.length>0||u.sgpds.length>0||d.mdia.minf.stbl.sbgps.length>0||d.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(d,f,f.number_in_traf,u.sample_groups_info)}}if(u.subs){d.has_fragment_subsamples=!0;var k=u.first_sample_index;for(t=0;t-1))return null;var n=(r=this.stream.buffers[a]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=n)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===n)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+n+" full size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,n),i.alreadyRead+=n,r.usedBytes+=n,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.alreadyRead=0,r.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec();return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=n.ipro.protections[n.iinf.item_infos[e].protection_index-1]),n.iinf.item_infos[e].item_type?r.type=n.iinf.item_infos[e].item_type:r.type="mime",r.content_type=n.iinf.item_infos[e].content_type,r.content_encoding=n.iinf.item_infos[e].content_encoding;if(n.grpl)for(e=0;e0&&h.property_index-1-1))return null;var s=(t=this.stream.buffers[n]).byteLength-(a.offset+a.alreadyRead-t.fileStart);if(!(a.length-a.alreadyRead<=s))return o.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+a.alreadyRead+" offset: "+(a.offset+a.alreadyRead-t.fileStart)+" read size: "+s+" full extent size: "+a.length+" full item size: "+r.size+")"),l.memcpy(r.data.buffer,r.alreadyRead,t,a.offset+a.alreadyRead-t.fileStart,s),a.alreadyRead+=s,r.alreadyRead+=s,t.usedBytes+=s,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+a.alreadyRead+" offset: "+(a.offset+a.alreadyRead-t.fileStart)+" read size: "+(a.length-a.alreadyRead)+" full extent size: "+a.length+" full item size: "+r.size+")"),l.memcpy(r.data.buffer,r.alreadyRead,t,a.offset+a.alreadyRead-t.fileStart,a.length-a.alreadyRead),t.usedBytes+=a.length-a.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=a.length-a.alreadyRead,a.alreadyRead=a.length}}return r.alreadyRead===r.size?r:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>c&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var v={createFile:function(e,t){var r=void 0===e||e,i=new y(t);return i.discardMdatData=!r,i}};t.createFile=v.createFile}));function du(e){return e.reduce((function(e,t){return 256*e+t}))}function hu(e){var t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every((function(e,t){return e===i[t]}))}uu.Log,uu.MP4BoxStream,uu.DataStream,uu.MultiBufferStream,uu.MPEG4DescriptorParser,uu.BoxParser,uu.XMLSubtitlein4Parser,uu.Textin4Parser,uu.ISOFile,uu.createFile;var pu=function(){function e(){S(this,e),this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}return w(e,[{key:"destroy",value:function(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}},{key:"transport",value:function(e){var t=this;if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;var r=new Uint8Array(e);if(this.A){if(!(this.c=e[a]&&t=6?(a=5,r=new Array(4),s=n-3):(a=2,r=new Array(2),s=n):-1!==l.indexOf("android")?(a=2,r=new Array(2),s=n):(a=5,s=n,r=new Array(4),n>=6?s=n-3:1===o&&(a=2,r=new Array(2),s=n)),r[0]=a<<3,r[0]|=(15&n)>>>1,r[1]=(15&n)<<7,r[1]|=(15&o)<<3,5===a&&(r[1]|=(15&s)>>>1,r[2]=(1&s)<<7,r[2]|=8,r[3]=0),this.config=r,this.sampling_rate=Lu[n],this.sampling_index=n,this.channel_count=o,this.object_type=a,this.original_object_type=i,this.codec_mimetype="mp4a.40."+a,this.original_codec_mimetype="mp4a.40."+i})),Iu=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.player=e,r.TAG_NAME="TsLoaderV2",r.first_parse_=!0,r.tsPacketSize=0,r.syncOffset=0,r.pmt_=null,r.config_=null,r.media_info_=new Pu,r.timescale_=90,r.duration_=0,r.pat_={version_number:0,network_pid:0,program_map_pid:{}},r.current_program_=null,r.current_pmt_pid_=-1,r.program_pmt_map_={},r.pes_slice_queues_={},r.section_slice_queues_={},r.video_metadata_={vps:null,sps:null,pps:null,details:null},r.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},r.last_pcr_=null,r.audio_last_sample_pts_=void 0,r.aac_last_incomplete_data_=null,r.has_video_=!1,r.has_audio_=!1,r.video_init_segment_dispatched_=!1,r.audio_init_segment_dispatched_=!1,r.video_metadata_changed_=!1,r.audio_metadata_changed_=!1,r.loas_previous_frame=null,r.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},r.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},r._remainingPacketData=null,r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,b(t,"destroy",this,3)([])}},{key:"probe",value:function(e){var t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){for(var a=Math.min(1e3,t.byteLength-3*i),n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})}},{key:"_initPmt",value:function(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}},{key:"dispatch",value:function(e){var t=new Uint8Array(e);this._remainingPacketData&&(t=gu(this._remainingPacketData,t),this._remainingPacketData=null);var r=t.buffer,i=this.parseChunks(r);i?this._remainingPacketData=t.subarray(i):t.length>>6;i[1];var o=(31&i[1])<<8|i[2],s=(48&i[3])>>>4,l=15&i[3],c=!(!this.pmt_||this.pmt_.pcr_pid!==o),u={},d=4;if(2==s||3==s){var h=i[4];if(h>0&&(c||3==s)&&(u.discontinuity_indicator=(128&i[5])>>>7,u.random_access_indicator=(64&i[5])>>>6,u.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4)){var p=300*(i[6]<<25|i[7]<<17|i[8]<<9|i[9]<<1|i[10]>>>7)+((1&i[10])<<8|i[11]);this.last_pcr_=p}if(2==s||5+h===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}d=5+h}if(1==s||3==s)if(0===o||o===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[o]===Eu){var f=188-d;this.handleSectionSlice(e,t+d,f,{pid:o,payload_unit_start_indicator:n,continuity_conunter:l,random_access_indicator:u.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[o]){var m=188-d,g=this.pmt_.pid_stream_type[o];o!==this.pmt_.common_pids.h264&&o!==this.pmt_.common_pids.h265&&o!==this.pmt_.common_pids.adts_aac&&o!==this.pmt_.common_pids.loas_aac&&o!==this.pmt_.common_pids.ac3&&o!==this.pmt_.common_pids.eac3&&o!==this.pmt_.common_pids.opus&&o!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[o]&&!0!==this.pmt_.timed_id3_pids[o]&&!0!==this.pmt_.synchronous_klv_pids[o]&&!0!==this.pmt_.asynchronous_klv_pids[o]||this.handlePESSlice(e,t+d,m,{pid:o,stream_type:g,payload_unit_start_indicator:n,continuity_conunter:l,random_access_indicator:u.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}},{key:"handleSectionSlice",value:function(e,t,r,i){var a=new Uint8Array(e,t,r),n=this.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){var o=a[0];if(null!=n&&0!==n.total_length){var s=new Uint8Array(e,t+1,Math.min(r,o));n.slices.push(s),n.total_length+=s.byteLength,n.total_length===n.expected_length?this.emitSectionSlices(n,i):this.clearSlices(n,i)}for(var l=1+o;l=n.expected_length&&this.clearSlices(n,i),l+=u.byteLength}}else if(null!=n&&0!==n.total_length){var d=new Uint8Array(e,t,Math.min(r,n.expected_length-n.total_length));n.slices.push(d),n.total_length+=d.byteLength,n.total_length===n.expected_length?this.emitSectionSlices(n,i):n.total_length>=n.expected_length&&this.clearSlices(n,i)}}},{key:"handlePESSlice",value:function(e,t,r,i){var a=new Uint8Array(e,t,r),n=a[0]<<16|a[1]<<8|a[2];a[3];var o=a[4]<<8|a[5];if(i.payload_unit_start_indicator){if(1!==n)return void this.player.debug.warn(this.TAG_NAME,"handlePESSlice: packet_start_code_prefix should be 1 but with value ".concat(n));var s=this.pes_slice_queues_[i.pid];s&&(0===s.expected_length||s.expected_length===s.total_length?this.emitPESSlices(s,i):this.clearSlices(s,i)),this.pes_slice_queues_[i.pid]=new xu,this.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null!=this.pes_slice_queues_[i.pid]){var l=this.pes_slice_queues_[i.pid];l.slices.push(a),i.payload_unit_start_indicator&&(l.expected_length=0===o?0:o+6),l.total_length+=a.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,i):l.expected_length>0&&l.expected_length>>6,l=t[8];2!==s&&3!==s||(n=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,o=3===s?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:n);var c,u=9+l;if(0!==a){if(a<3+l)return void this.player.debug.warn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");c=a-3-l}else c=t.byteLength-u;var d=t.subarray(u,u+c);switch(e.stream_type){case yu:case vu:this.parseMP3Payload(d,n);break;case Au:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(d,n):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(d,n):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(d,n):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(d,e.pid,i):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(d,n,o,e.pid,i):this.parsePESPrivateDataPayload(d,n,o,e.pid,i);break;case bu:this.parseADTSAACPayload(d,n);break;case _u:this.parseLOASAACPayload(d,n);break;case ku:this.parseAC3Payload(d,n);break;case wu:this.parseEAC3Payload(d,n);break;case Su:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(d,n,o,e.pid,i):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(d,n,o,e.pid,i);break;case Tu:this.parseH264Payload(d,n,o,e.random_access_indicator);break;case Cu:this.parseH265Payload(d,n,o,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Au){var h,p=6;h=0!==a?a:t.byteLength-p;var f=t.subarray(p,p+h);this.parsePESPrivateDataPayload(f,void 0,void 0,e.pid,i)}}else this.player.debug.error(this.TAG_NAME,"parsePES: packet_start_code_prefix should be 1 but with value ".concat(r))}},{key:"parsePAT",value:function(e){var t=e[0];if(0===t){var r=(15&e[1])<<8|e[2];e[3],e[4];var i=(62&e[5])>>>1,a=1&e[5],n=e[6];e[7];var o=null;if(1===a&&0===n)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=i;else if(o=this.pat_,null==o)return;for(var s=r-5-4,l=-1,c=-1,u=8;u<8+s;u+=4){var d=e[u]<<8|e[u+1],h=(31&e[u+2])<<8|e[u+3];0===d?o.network_pid=h:(o.program_pmt_pid[d]=h,-1===l&&(l=d),-1===c&&(c=h))}1===a&&0===n&&(null==this.pat_&&this.player.debug.log(this.TAG_NAME,"Parsed first PAT: ".concat(JSON.stringify(o))),this.pat_=o,this.current_program_=l,this.current_pmt_pid_=c)}else Log.e(this.TAG,"parsePAT: table_id ".concat(t," is not corresponded to PAT!"))}},{key:"parsePMT",value:function(e){var t=e[0];if(2===t){var r,i=(15&e[1])<<8|e[2],a=e[3]<<8|e[4],n=(62&e[5])>>>1,o=1&e[5],s=e[6];if(e[7],1===o&&0===s)r=this._initPmt(),r.program_number=a,r.version_number=n,this.program_pmt_map_[a]=r;else if(r=this.program_pmt_map_[a],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];for(var l=(15&e[10])<<8|e[11],c=12+l,u=i-9-l-4,d=c;d0){for(var v=d+5;v0)for(var T=d+5;T1&&(this.player.debug.warn(this.TAG_NAME,"AAC: Detected pts overlapped, expected: ".concat(n,"ms, PES pts: ").concat(a,"ms")),a=n)}}for(var o,s=new vn(e),l=null,c=a;null!=(l=s.readNextAACFrame());){i=1024/l.sampling_frequency*1e3;var u={codec:"aac",data:l};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u)),o=c;var d=Math.floor(c),h=new Uint8Array(l.data.length+2);h.set([175,1],0),h.set(l.data,2);var p={payload:h,length:h.byteLength,pts:d,dts:d,type:nt};this.audio_track_.samples.push(p),this.audio_track_.length+=h.byteLength,c+=i}s.hasIncompleteData()&&(this.aac_last_incomplete_data_=s.getIncompleteData()),o&&(this.audio_last_sample_pts_=o)}}},{key:"parseLOASAACPayload",value:function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var r=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);r.set(this.aac_last_incomplete_data_,0),r.set(e,this.aac_last_incomplete_data_.byteLength),e=r}var i,a;if(null!=t&&(a=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,a=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debug.warn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;var n=this.audio_last_sample_pts_+i;Math.abs(n-a)>1&&(this.player.debug.warn(this.TAG,"AAC: Detected pts overlapped, expected: ".concat(n,"ms, PES pts: ").concat(a,"ms")),a=n)}}for(var o,s=new An(e),l=null,c=a;null!=(l=s.readNextAACFrame(Zn(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=l,i=1024/l.sampling_frequency*1e3;var u={codec:"aac",data:l};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:l.audio_object_type,sampling_freq_index:l.sampling_freq_index,sampling_frequency:l.sampling_frequency,channel_config:l.channel_config},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u)),o=c;var d=Math.floor(c),h=new Uint8Array(l.data.length+2);h.set([175,1],0),h.set(l.data,2);var p={payload:h,length:h.byteLength,pts:d,dts:d,type:nt};this.audio_track_.samples.push(p),this.audio_track_.length+=h.byteLength,c+=i}s.hasIncompleteData()&&(this.aac_last_incomplete_data_=s.getIncompleteData()),o&&(this.audio_last_sample_pts_=o)}}},{key:"parseAC3Payload",value:function(e,t){}},{key:"parseEAC3Payload",value:function(e,t){}},{key:"parseOpusPayload",value:function(e,t){}},{key:"parseMP3Payload",value:function(e,t){if(!this.has_video_||this.video_init_segment_dispatched_){var r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],a=[11025,12e3,8e3,0],n=e[1]>>>3&3,o=(6&e[1])>>1;e[2];var s=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,c=0,u=34;switch(n){case 0:c=a[s];break;case 2:c=i[s];break;case 3:c=r[s]}switch(o){case 1:u=34;break;case 2:u=33;break;case 3:u=32}var d={};d.object_type=u,d.sample_rate=c,d.channel_count=l,d.data=e;var h={codec:"mp3",data:d};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:u,sample_rate:c,channel_count:l},this.dispatchAudioInitSegment(h)):this.detectAudioMetadataChange(h)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(h));var p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:nt};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}}},{key:"detectAudioMetadataChange",value:function(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debug.log(this.TAG_NAME,"Audio: Audio Codecs changed from ".concat(this.audio_metadata_.codec," to ").concat(e.codec)),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){var t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debug.log(this.TAG_NAME,"AAC: AudioObjectType changed from ".concat(this.audio_metadata_.audio_object_type," to ").concat(t.audio_object_type)),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debug.log(this.TAG_NAME,"AAC: SamplingFrequencyIndex changed from ".concat(this.audio_metadata_.sampling_freq_index," to ").concat(t.sampling_freq_index)),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debug.log(this.TAG_NAME,"AAC: Channel configuration changed from ".concat(this.audio_metadata_.channel_config," to ").concat(t.channel_config)),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){var r=e.data;if(r.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debug.log(this.TAG_NAME,"AC3: Sampling Frequency changed from ".concat(this.audio_metadata_.sampling_frequency," to ").concat(r.sampling_frequency)),!0;if(r.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debug.log(this.TAG_NAME,"AC3: Bit Stream Identification changed from ".concat(this.audio_metadata_.bit_stream_identification," to ").concat(r.bit_stream_identification)),!0;if(r.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debug.log(this.TAG_NAME,"AC3: BitStream Mode changed from ".concat(this.audio_metadata_.bit_stream_mode," to ").concat(r.bit_stream_mode)),!0;if(r.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debug.log(this.TAG_NAME,"AC3: Channel Mode changed from ".concat(this.audio_metadata_.channel_mode," to ").concat(r.channel_mode)),!0;if(r.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debug.log(this.TAG_NAME,"AC3: Low Frequency Effects Channel On changed from ".concat(this.audio_metadata_.low_frequency_effects_channel_on," to ").concat(r.low_frequency_effects_channel_on)),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){var i=e.meta;if(i.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debug.log(this.TAG_NAME,"Opus: SamplingFrequencyIndex changed from ".concat(this.audio_metadata_.sample_rate," to ").concat(i.sample_rate)),!0;if(i.channel_count!==this.audio_metadata_.channel_count)return this.player.debug.log(this.TAG_NAME,"Opus: Channel count changed from ".concat(this.audio_metadata_.channel_count," to ").concat(i.channel_count)),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){var a=e.data;if(a.object_type!==this.audio_metadata_.object_type)return this.player.debug.log(this.TAG_NAME,"MP3: AudioObjectType changed from ".concat(this.audio_metadata_.object_type," to ").concat(a.object_type)),!0;if(a.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debug.log(this.TAG_NAME,"MP3: SamplingFrequencyIndex changed from ".concat(this.audio_metadata_.sample_rate," to ").concat(a.sample_rate)),!0;if(a.channel_count!==this.audio_metadata_.channel_count)return this.player.debug.log(this.TAG_NAME,"MP3: Channel count changed from ".concat(this.audio_metadata_.channel_count," to ").concat(a.channel_count)),!0}return!1}},{key:"dispatchAudioInitSegment",value:function(e){var t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;var r="";if("aac"===this.audio_metadata_.codec){var i="aac"===e.codec?e.data:null,a=new Bu(i);t.audioSampleRate=a.sampling_rate,t.audioSampleRateIndex=a.sampling_index,t.channelCount=a.channel_count,t.codec=a.codec_mimetype,t.originalCodec=a.original_codec_mimetype,t.config=a.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,r=Vt;var n=sn({profile:this.player._opt.mseDecodeAudio?a.object_type:a.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader","profile: ".concat(a.object_type,", sampleRate: ").concat(t.audioSampleRateIndex,", channel: ").concat(t.channelCount)),this._doDecodeByTs(n,nt,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,r=Wt);0==this.audio_init_segment_dispatched_&&this.player.debug.log(this.TAG_NAME,"Generated first AudioSpecificConfig for mimeType: ".concat(t.codec)),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var o=this.media_info_;o.hasAudio=!0,o.audioCodec=t.originalCodec,o.audioSampleRate=t.audioSampleRate,o.audioChannelCount=t.channelCount,o.hasVideo&&o.videoCodec?o.mimeType='video/mp2t; codecs="'.concat(o.videoCodec,",").concat(o.audioCodec,'"'):o.mimeType='video/mp2t; codecs="'.concat(o.audioCodec,'"'),r&&this.player.audio.updateAudioInfo({encTypeCode:r,channels:t.channelCount,sampleRate:t.audioSampleRate})}},{key:"dispatchPESPrivateDataDescriptor",value:function(e,t,r){}},{key:"parsePESPrivateDataPayload",value:function(e,t,r,i,a){var n=new Du;if(n.pid=i,n.stream_id=a,n.len=e.byteLength,n.data=e,null!=t){var o=Math.floor(t/this.timescale_);n.pts=o}else n.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=r){var s=Math.floor(r/this.timescale_);n.dts=s}}},{key:"parseTimedID3MetadataPayload",value:function(e,t,r,i,a){this.player.debug.log(this.TAG_NAME,"Timed ID3 Metadata: pid=".concat(i,", pts=").concat(t,", dts=").concat(r,", stream_id=").concat(a))}},{key:"parseSynchronousKLVMetadataPayload",value:function(e,t,r,i,a){this.player.debug.log(this.TAG_NAME,"Synchronous KLV Metadata: pid=".concat(i,", pts=").concat(t,", dts=").concat(r,", stream_id=").concat(a))}},{key:"parseAsynchronousKLVMetadataPayload",value:function(e,t,r){this.player.debug.log(this.TAG_NAME,"Asynchronous KLV Metadata: pid=".concat(t,", stream_id=").concat(r))}},{key:"parseSMPTE2038MetadataPayload",value:function(e,t,r,i,a){this.player.debug.log(this.TAG_NAME,"SMPTE 2038 Metadata: pid=".concat(i,", pts=").concat(t,", dts=").concat(r,", stream_id=").concat(a))}},{key:"getNearestTimestampMilliseconds",value:function(){return null!=this.audio_last_sample_pts_?Math.floor(this.audio_last_sample_pts_):null!=this.last_pcr_?Math.floor(this.last_pcr_/300/this.timescale_):void 0}},{key:"_preDoDecode",value:function(){var e=this,t=this.video_track_,r=this.audio_track_,i=t.samples;r.samples.length>0&&(i=t.samples.concat(r.samples),i=i.sort((function(e,t){return e.dts-t.dts}))),i.forEach((function(t){var r=new Uint8Array(t.payload);delete t.payload,t.type===ot?e._doDecodeVideo(E(E({},t),{},{payload:r})):t.type===nt&&e._doDecodeAudio(E(E({},t),{},{payload:r}))})),t.samples=[],t.length=0,r.samples=[],r.length=0}},{key:"_doDecodeVideo",value:function(e){var t=new Uint8Array(e.payload),r=null;r=e.isHevc?ol(t,e.isIFrame):Js(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:r.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);var i=this.cryptoPayload(r,e.isIFrame);this._doDecodeByTs(i,ot,e.dts,e.isIFrame,e.cts)}},{key:"_doDecodeAudio",value:function(e){var t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});var r=t;Bo(this.player._opt.m7sCryptoAudio)&&(r=this.cryptoPayloadAudio(t)),this._doDecodeByTs(r,nt,e.dts,!1,0)}},{key:"getInputByteLength",value:function(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}])}(Qc),Mu=function(){function e(t){return S(this,e),new(e.getLoaderFactory(t))(t)}return w(e,null,[{key:"getLoaderFactory",value:function(e){var t=e._opt.demuxType;return t===J?au:t===W||e.isWebrtcH265()?iu:t===Y?nu:t===Q?lu:t===X?fu:t===Z?mu:t===ee?Iu:cu}}])}(),Uu=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.TAG_NAME="Webcodecs",r.hasInit=!1,r.isDecodeFirstIIframe=!!Io(e._opt.checkFirstIFrame),r.isInitInfo=!1,r.prevTimestamp=null,r.decodeDiffTimestamp=null,r.prevDts=null,r.decoder=null,r.isWidthOrHeightChanged=!1,r.initDecoder(),e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.decoder&&(Io(this.isDecodeStateClosed())&&this.decoder.close(),this.decoder=null),this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.hasInit=!1,this.isInitInfo=!1,this.isDecodeFirstIIframe=!1,this.isWidthOrHeightChanged=!1,this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"initDecoder",value:function(){var e=this;this.decoder=new VideoDecoder({output:function(t){e.handleDecode(t)},error:function(t){e.handleError(t)}})}},{key:"handleDecode",value:function(e){this.isInitInfo||(this.player.video.updateVideoInfo({width:e.codedWidth,height:e.codedHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=Tn(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),Io(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):Io(this.player.playback.isPlaybackPauseClearCache)&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp}))}},{key:"handleError",value:function(e){this.player.debug.error(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);var t=e.toString();-1!==t.indexOf(xi)?this.player.emitError(Lt.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(Ri)||-1!==t.indexOf(Di)||-1!==t.indexOf(Li)?this.player.emitError(Lt.webcodecsDecodeError,t):-1!==t.indexOf(Pi)&&this.player.emitError(Lt.webcodecsH265NotSupport)}},{key:"decodeVideo",value:function(e,t,r,i){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&r&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debug.warn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(r&&0===e[1]){var a=15&e[0],n={};a===jt?n=Vs(e.slice(5)):a===zt&&(n=rl(e));var o=this.player.video.videoInfo;o&&o.width&&o.height&&n&&n.codecWidth&&n.codecHeight&&(n.codecWidth!==o.width||n.codecHeight!==o.height)&&(this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed,\n old width is ".concat(o.width,", old height is ").concat(o.height,",\n new width is ").concat(n.codecWidth,", new height is ").concat(n.codecHeight,",\n and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emitError(Lt.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(Po(e))return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is too small , payload length is ".concat(e.byteLength));var s=!1,l=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=l,s=!0);var c=l-this.prevTimestamp;this.decodeDiffTimestamp=c,c>500&&!s&&this.player.isPlayer()&&this.player.debug.warn(this.TAG_NAME,"decodeVideo diff time is ",c);var u=e.slice(5),d=new EncodedVideoChunk({data:u,timestamp:t,type:r?xr:Rr});this.player.emit(Ct.timeUpdate,t);try{this.decoder.decode(d)}catch(e){this.player.debug.error(this.TAG_NAME,"VideoDecoder",e);var h=e.toString();(-1!==h.indexOf(Ti)||-1!==h.indexOf(Ci))&&this.player.emitError(Lt.webcodecsDecodeError)}this.prevTimestamp=(new Date).getTime()}else this.player.debug.log(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(r&&e[1]===ji){var p=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:p}),p===zt&&!Kn()){var f=Fn();return this.player.debug.warn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",f.type,f.version),void this.player.emitError(Lt.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=Tn());var m=null,g=null,y=e.slice(5);if(p===jt?(g=Vs(y),m={codec:g.codec,description:y}):p===zt&&(g=il(y),m={codec:g.codec,description:y}),!m||m&&!m.codec)return this.player.debug.warn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(m)),void this.player.emitError(Lt.webcodecsDecodeConfigureError);g&&g.codecWidth&&g.codecHeight&&(m.codedHeight=g.codecHeight,m.codedWidth=g.codecWidth),this.player.recorder&&this.player._opt.recordType===G&&this.player.recorder.initMetaData(e,p),this.player.debug.log(this.TAG_NAME,"decoder.configure() and codec is ".concat(m.codec));try{this.decoder.configure(m),this.hasInit=!0}catch(e){this.player.debug.log(this.TAG_NAME,"configure error",e.code,e),-1!==e.toString().indexOf(Pi)?this.player.emitError(Lt.webcodecsH265NotSupport):this.player.emitError(Lt.webcodecsDecodeConfigureError)}}}},{key:"getDecodeDiffTimes",value:function(){return this.decodeDiffTimestamp}},{key:"isDecodeStateClosed",value:function(){return"closed"===this.decoder.state}},{key:"isDecodeStateConfigured",value:function(){return"configured"===this.decoder.state}},{key:"isDecodeStateUnConfigured",value:function(){return"unconfigured"===this.decoder.state}}])}(Ho),Fu={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"},Ou=Object.keys(Fu).reduce((function(e,t){return e[t]='\n \n ').concat(Fu[t]?''.concat(Fu[t],""):"","\n"),e}),{});function Nu(e,t){var r=!1;return e.forEach((function(e){r||e.startTimestamp<=t&&e.endTimestamp>t&&(r=!0)})),r}function ju(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=e.length,a=t.length,n=Math.max(i,a),o=2e3,s=Math.ceil(n/o),l=0,c=0;function u(){for(var a="",n="",d=0;d\n ').concat(h.title,"\n \n "));var p=t[c];p&&(n+='\n

').concat(p.title,"
\n ")),c+=1}a&&r.$playbackTimeListOne.insertAdjacentHTML("beforeend",a),n&&r.$playbackTimeListSecond.insertAdjacentHTML("beforeend",n),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[],r=(e[0]||{}).startTimestamp,i=0;i<1440;i++){var a=i%60==0,n=!1;r&&(n=Nu(e,so(r,i))),t.push({title:no(i),timestamp:i,dataType:"min",hasRecord:n,isStart:a})}return t}(e);ju(r,function(){for(var e=[],t=0;t<24;t++){var r=t+":00";t<10&&(r="0"+r),e.push({title:r,hour:t,min:0,second:0})}return e}(),t)}function Gu(e,t){var r=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],r=(e[0]||{}).startTimestamp,i=0;i<1440;i++){var a=60*i,n=a%1800==0,o=!1;r&&(o=Nu(e,lo(r,a))),t.push({title:oo(a),timestamp:a,dataType:"second",hasRecord:o,isStart:n});var s=60*i+30;n=s%1800==0,r&&(o=Nu(e,lo(r,s))),t.push({title:oo(s),timestamp:s,dataType:"second",hasRecord:o,isStart:n})}return t}(e);ju(r,function(){for(var e=[],t=0;t<24;t++){var r=t+":00",i=t+":30";t<10&&(r="0"+r,i="0"+i),e.push({title:r,hour:t,min:0,second:0}),e.push({title:i,hour:t,min:30,second:0})}return e}(),t)}function Hu(e,t){var r=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],r=(e[0]||{}).startTimestamp,i=0;i<144;i++)for(var a=0;a<60;a++){var n=10*a+600*i,o=n%600==0,s=!1;r&&(s=Nu(e,lo(r,n))),t.push({title:oo(n),timestamp:n,dataType:"second",isStart:o,hasRecord:s})}return t}(e);ju(r,function(){for(var e=[],t=0;t<24;t++){var r=t+":00";t<10&&(r="0"+r),e.push({title:r,hour:t,min:0,second:0});for(var i=1;i<6;i++){var a=i+"0";e.push({title:r.replace(":00",":"+a),hour:t,min:10*i,second:0})}}return e}(),t)}function Vu(e,t){var r=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[],r=(e[0]||{}).startTimestamp,i=0;i<288;i++)for(var a=0;a<60;a++){var n=5*a+300*i,o=n%300==0,s=!1;r&&(s=Nu(e,lo(r,n))),t.push({title:oo(n),timestamp:n,dataType:"second",isStart:o,hasRecord:s})}return t}(e);ju(r,function(){for(var e=[],t=0;t<24;t++){var r=t+":00";t<10&&(r="0"+r),e.push({title:r,hour:t,min:0,second:0}),e.push({title:r.replace(":00",":05"),hour:t,min:5,second:0});for(var i=1;i<6;i++){var a=i+"0",n=i+"5";e.push({title:r.replace(":00",":"+a),hour:t,min:10*i,second:0}),e.push({title:r.replace(":00",":"+n),hour:t,min:10*i+5,second:0})}}return e}(),t)}function Wu(e){var t=Math.floor(e/3600),r=Math.floor((e-3600*t)/60),i=Math.floor(e-3600*t-60*r);return(t>0?[t,r,i]:[r,i]).map((function(e){return e<10?"0".concat(e):String(e)})).join(":")}function Ju(e,t,r){var i=e.$playbackProgress,a=i.getBoundingClientRect(),n=a.left,o=Cn((Bn()?r.touches[0].clientX:r.pageX)-n,0,i.clientWidth),s=parseInt(o/i.clientWidth*t,10);return{second:s,time:Wu(s),width:o,percentage:Cn(o/i.clientWidth,0,1)}}function qu(e,t){return e.classList.add(t)}function Ku(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function Yu(e,t,r){return e&&e.style&&eo(t)&&(e.style[t]=r),e}function Qu(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function Xu(e){var t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var Zu=function(e,t){var r=e.events.proxy,i=document.createElement("object");i.setAttribute("aria-hidden","true"),i.setAttribute("tabindex",-1),i.type="text/html",i.data="about:blank",xn(i,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});var a=e.width,n=e.height,o=Vn((function(){e.width===a&&e.height===n||(a=e.width,n=e.height,e.emit(Ct.resize),d())}),500);r(i,"load",(function(){r(i.contentDocument.defaultView,"resize",(function(){o()}))})),e.$container.appendChild(i),e.on(Ct.destroy,(function(){e.$container.removeChild(i)})),e.on(Ct.volumechange,(function(){!function(e){if(0===e)xn(t.$volumeOn,"display","none"),xn(t.$volumeOff,"display","flex"),xn(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){var r=Rn(t.$volumePanel,"height")||60,i=Rn(t.$volumeHandle,"height"),a=r-(r-i)*e-i;xn(t.$volumeHandle,"top","".concat(a,"px")),xn(t.$volumeOn,"display","flex"),xn(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(Ct.loading,(function(r){xn(t.$loading,"display",r?"flex":"none"),(Io(e._opt.backgroundLoadingShow)&&Bo(r)||Io(r))&&xn(t.$poster,"display","none"),r&&(xn(t.$playBig,"display","none"),xn(t.$tipsMessage,"display","none")),r||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&xn(t.$extendDom,"display","block"),r||e.getRenderType()===de&&Io(e._opt.useMSE)&&s()})),e.on(Ct.removeLoadingBgImage,(function(){s()}));var s=function(){t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debug&&e.debug.log("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",xn(t.$loadingBg,"display","none"))},l=function(t){e.fullscreen?go(t)===e.$container&&c():c()},c=function(r){var i=$n(r)?r:e.fullscreen;xn(t.$fullscreenExit,"display",i?"flex":"none"),xn(t.$fullscreen,"display",i?"none":"flex")},u=function(){return e._opt.playType===z&&e._opt.playbackConfig.showControl},d=function(r){Bn()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((function(){if(e.fullscreen){var i=u()?gr:mr,a=e.height/2-e.width+i/2,n=e.height/2-i/2;if(t.$controls.style.transform="translateX(".concat(-a,"px) translateY(-").concat(n,"px) rotate(-90deg)"),t.$zoomControls){var o=156,s=30,l=e.width/2+o/2-s/2;t.$zoomControls.style.transform="translateX(".concat(-l,"px) translateY(").concat(e.height/2,"px) rotate(-90deg)")}if(t.$recording){var c=101,d=20,h=e.width/2+c/2-d/2;t.$recording.style.transform="translateX(".concat(-h,"px) translateY(").concat(e.height/2,"px) rotate(-90deg)")}}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)");r&&r()}),10)};try{tn.on("change",l),e.events.destroys.push((function(){tn.off("change",l)}))}catch(e){}e.on(Ct.webFullscreen,(function(e){Bn()&&(c(e),d((function(){p()})))})),e.on(Ct.recording,(function(){e.playing&&(xn(t.$record,"display",e.recording?"none":"flex"),xn(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(xn(t.$recording,"display",e.recording?"flex":"none"),Io(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=ao(0))))})),e.on(Ct.recordingTimestamp,(function(e){t.$recordingTime&&(t.$recordingTime.innerHTML=ao(e))})),e.on(Ct.zooming,(function(){e.playing&&(xn(t.$zoom,"display",e.zooming?"none":"flex"),xn(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&xn(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(Ct.playing,(function(e){h(e)}));var h=function(r){r||e.isPlayFailedAndPaused&&Io(e._opt.playFailedAndPausedShowPlayBtn)?(xn(t.$play,"display","none"),xn(t.$playBig,"display","none")):(xn(t.$play,"display","flex"),xn(t.$playBig,"display","block")),xn(t.$pause,"display",r?"flex":"none"),xn(t.$screenshot,"display",r?"flex":"none"),xn(t.$record,"display",r?"flex":"none"),xn(t.$qualityMenu,"display",r?"flex":"none"),xn(t.$volume,"display",r?"flex":"none"),xn(t.$ptz,"display",r?"flex":"none"),xn(t.$zoom,"display",r?"flex":"none"),xn(t.$scaleMenu,"display",r?"flex":"none"),xn(t.$faceDetect,"display",r?"flex":"none"),xn(t.$objectDetect,"display",r?"flex":"none"),xn(t.$occlusionDetect,"display",r?"flex":"none"),xn(t.$controlHtml,"display",r?"flex":"none"),e.isPlayback()&&xn(t.$speedMenu,"display",r?"flex":"none"),c(),t.extendBtnList.forEach((function(e){e.$iconWrap&&xn(e.$iconWrap,"display",r?"flex":"none"),e.$activeIconWrap&&xn(e.$activeIconWrap,"display","none")})),e._opt.showPerformance?xn(t.$performanceActive,"display",r?"flex":"none"):(xn(t.$performance,"display",r?"flex":"none"),xn(t.$performanceActive,"display","none")),xn(t.$poster,"display","none"),xn(t.$ptzActive,"display","none"),xn(t.$recordStop,"display","none"),xn(t.$zoomStop,"display","none"),xn(t.$faceDetectActive,"display","none"),xn(t.$objectDetectActive,"display","none"),r||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";var t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),xn(t.$zoomControls,"display","none"),xn(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),p(),r&&f()};e.on(Ct.playbackPause,(function(e){h(!e)})),e.on(Ct.kBps,(function(r){var i=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";var t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"],r=0,i=parseFloat(e);r=Math.floor(Math.log(i)/Math.log(1024));var a=i/Math.pow(1024,r);return a=a.toFixed(2),a+(t[r]||t[0])}(r);t.kbpsShow=i,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=i),p())}));var p=function(){if(u()&&e._opt.playbackConfig.controlType===ye.normal){var r=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;Bn()&&e.webFullscreen&&(r=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=r+"px"}},f=function(){if(u()&&e._opt.playbackConfig.controlType===ye.normal){var r=t.$playbackCurrentTime.style.left,i=parseInt(r,10),a=t.controlsPlaybackTimeInner.width;i=i-a/2>0?parseInt(i-a/2,10):0,t.$playbackTimeInner.scrollLeft=i}};if(u()){var m=function(){if(u()){var r=0,i=e.playback&&e.playback.playingTimestamp;if(i){var a=new Date(i),n=a.getHours(),o=a.getMinutes(),s=a.getSeconds();e.playback.is60Min?r=60*n+o:e.playback.is30Min?r=2*(60*n+o)+parseInt(s/30,10):e.playback.is10Min?r=6*(60*n+o)+parseInt(s/10,10):e.playback.is5Min?r=12*(60*n+o)+parseInt(s/5,10):e.playback.is1Min&&(r=60*(60*n+o)+parseInt(s,10)),t.$playbackCurrentTime.style.left=r+"px"}}},g=function(e){t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Gr&&t.$playbackNarrow.classList.add("disabled"),e===Wr&&t.$playbackExpand.classList.add("disabled")};e.on(Ct.playbackTime,(function(r){if(e._opt.playbackConfig.controlType===ye.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=jn(r,"{h}:{i}:{s}")),m();else if(e._opt.playbackConfig.controlType===ye.simple){var i=(a=r,n=e.playback.totalDuration,Cn(a/n,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left="calc(".concat(100*i,"% - 7px)"),t.$playbackProgressTime.innerText="".concat(Wu(r)," / ").concat(Wu(e.playback.totalDuration))}var a,n})),e.on(Ct.playbackPrecision,(function(r,i){u()&&e._opt.playbackConfig.controlType===ye.normal&&(t.$playbackTimeScroll.classList.remove(Jr.oneHour,Jr.halfHour,Jr.fiveMin,Jr.tenMin),t.$playbackTimeScroll.classList.add(Jr[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((function(){switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Gr:zu(i,t);break;case Hr:Gu(i,t);break;case Vr:Hu(i,t);break;case Wr:Vu(i,t)}m(),e._opt.playbackConfig.showPrecisionBtn&&g(r),f()}),16))})),e.on(Ct.resize,(function(){p()})),e.on(Ct.playbackTimeScroll,(function(){f()})),p()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(Ct.streamQualityChange,(function(e){y(e)}));var y=function(e){t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((function(t){var r=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),r===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(function(){var r=e._opt.qualityConfig||[],i="";r.forEach((function(e){i+='\n
').concat(e,"
\n ")})),i&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&y(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(Ct.viewResizeChange,(function(e){v(e)}));var v=function(r){var i=e._opt.scaleConfig[r];t.$scaleText.innerText=i,t.$scaleMenuItems.forEach((function(e){var t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),Gn(t)===Gn(r)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(function(){var r=e._opt.scaleConfig||[],i="";r.forEach((function(e,t){i+='\n
').concat(e,"
\n ")})),i&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),v(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(Ct.playbackRateChange,(function(e){A(e)}));var A=function(r){var i=e._opt.playbackConfig.rateConfig.find((function(e){return Gn(e.value)===Gn(r)}));i&&(t.$speedText.innerText=i.label,t.$speedMenuItems.forEach((function(e){var t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),Gn(t)===Gn(r)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(function(){var r=e._opt.playbackConfig.rateConfig,i="";r.forEach((function(e,t){i+='\n
').concat(e.label,"
\n ")})),i&&(t.$speedMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();var b=e.playback?e.playback.playbackRate:1;A(b)}e.on(Ct.stats,(function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){xn(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";var i=Pn,a=Fo(),n=e.getCpuLevel(),o=eo(n)&&-1!==n?"".concat(xa[n]):"",s=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},c=e._times||{},u=e.getRenderType(),d=e.getCanvasRenderType(),h=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType(),g=e.getRecordingDuration(),y=e.getRecordingByteLength(),v=e.isAudioPlaybackRateSpeed(),A=e.videoIframeIntervalTs;g=ao(g),y=Wn(y);var b=e.isPlayback()?"录播":"直播",_=r.isDropping,k=e._opt.useMSE&&e._opt.mseDecodeAudio,w=e.control?e.control.kbpsShow:"0 KB/s",S=e.getVideoPlaybackQuality(),E='\n
\n 版本 '.concat(i,"\n
\n ").concat(e._opt.isMulti?'\n
\n UUid '.concat(e._opt.debugUuid,"\n
\n "):"","\n ").concat(e.isInMulti()?'\n
\n 窗口下标 '.concat(e._opt.multiIndex,"\n
\n "):"","\n ").concat(a?'\n
\n 内存大小限制 '.concat(Wn(a.jsHeapSizeLimit),'\n
\n
\n 可使用的内存 ').concat(Wn(a.totalJSHeapSize),'\n
\n
\n 已使用的内存 ').concat(Wn(a.usedJSHeapSize),"\n
\n "):"","\n ").concat(o?'\n
\n CPU压力情况 '.concat(o,"\n
\n "):"","\n\n ").concat(a&&a.usedJSHeapSize>a.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':"",'\n
\n 播放模式 ').concat(b,"\n
\n ").concat(e.isPlayback()?'\n
\n 播放倍率 '.concat(e.playback.rate,'倍\n
\n
\n 播放模式 ').concat(e.playback.isUseFpsRender?"固定FPS":"动态FPS","\n
\n ").concat(e.playback.isUseFpsRender?'\n
\n 固定FPS '.concat(e.video.getStreamFps(),"\n
\n "):"","\n "):"",'\n
\n 解封装模式 ').concat(te[p],'\n
\n
\n 解码模式 ').concat(h,'\n
\n
\n 渲染组件 ').concat(u,"\n
\n ").concat(u===de?'\n
\n 渲染引擎 '.concat(d,"\n
\n "):"",'\n
\n 网络请求组件 ').concat(f,'\n
\n
\n 视频格式 ').concat(s.encType||"-",'\n
\n
\n 视频(宽x高) ').concat(s.width||"-","x").concat(s.height||"-","\n
\n ").concat(e.isPlayer()?'\n
\n 视频GOP(ms) '.concat(A||"-","\n
\n "):"",'\n
\n 音频格式 ').concat(Jt[l.encType]||"-",'\n
\n
\n 音频引擎 ').concat(m||"-",'\n
\n
\n 音频通道 ').concat(l.channels||"-",'\n
\n
\n 音频采样率 ').concat(l.sampleRate||"-","\n
\n ").concat(e.isPlayer()?'\n
\n 播放器初始化(ms) '.concat(c.playTimestamp,'\n
\n
\n 开始请求地址(ms) ').concat(c.streamTimestamp,'\n
\n
\n 请求响应(ms) ').concat(c.streamResponseTimestamp,'\n
\n
\n 解封装(ms) ').concat(c.demuxTimestamp,'\n
\n
\n 解码(ms) ').concat(c.decodeTimestamp,'\n
\n
\n 页面开始渲染(ms) ').concat(c.videoTimestamp,'\n
\n
\n 初始化到页面渲染(ms) ').concat(c.allTimestamp,"\n
\n ").concat(e.recording?'\n
\n 视频录制时间 '.concat(g,'\n
\n
\n 视频录制大小 ').concat(y,"\n
\n "):"","\n "):"",'\n
\n 音频码率(bit) ').concat(r.abps,'\n
\n
\n 视频码率(bit) ').concat(r.vbps,'\n
\n
\n 视频帧率(fps) ').concat(r.fps,'\n
\n
\n 视频峰值帧率(fps) ').concat(r.maxFps,'\n
\n
\n 解码帧率(fps) ').concat(r.dfps,'\n
\n
\n 音频缓冲帧 ').concat(r.audioBuffer,'\n
\n
\n 音频缓冲时长(ms) ').concat(r.audioBufferDelayTs,"\n
\n ").concat(e.isPlayer()?'\n
\n 视频待解码帧 '.concat(r.demuxBuffer,"\n
\n "):'\n
\n 缓存时长(ms) '.concat(r.playbackCacheDataDuration,'\n
\n
\n 视频待渲染帧 ').concat(r.playbackVideoBuffer,'\n
\n
\n 视频待解码帧 ').concat(r.demuxBuffer,'\n
\n
\n 音频待解码帧 ').concat(r.audioDemuxBuffer,"\n
\n "),'\n
\n 待解封装数据(byte) ').concat(r.streamBuffer,"\n
\n ").concat(e._opt.useMSE?'\n
\n MSE缓冲时长(ms) '.concat(r.mseDelay,'\n
\n
\n MSE待解码帧 ').concat(r.msePendingBuffer,'\n
\n
\n MSE缓存时长(s) ').concat(r.mseStore,'\n
\n
\n MSE解码间隔(ms) ').concat(r.mseDecodeDiffTimes,'\n
\n
\n MSE解码时间(ms) ').concat(r.mseTs,'\n
\n
\n MSE播放模式 ').concat(r.mseDecodePlaybackRate>1?"加速":"正常","\n
\n "):"","\n ").concat(e._opt.useWCS?'\n
\n WCS解码间隔(ms) '.concat(r.wcsDecodeDiffTimes,"\n
\n "):"","\n ").concat(e.isOldHls()?'
\n HLS缓冲时长(ms) '.concat(r.hlsDelay,"\n
\n "):"","\n ").concat(e.isUseHls265()?'
\n HLS缓冲时长(ms) '.concat(r.hlsDelay,'\n
\n
\n HLS待解码帧 ').concat(r.hlsDemuxLength,'\n
\n
\n HLS待解码视频帧 ').concat(r.hlsDemuxVideoLength,'\n
\n
\n HLS待解码音频帧 ').concat(r.hlsDemuxAudioLength,"\n
\n "):"","\n ").concat(e.isPlayer()&&S?'\n
\n Video已渲染帧 '.concat(S.renderedVideoFrames,'\n
\n
\n Video已丢弃帧 ').concat(S.droppedVideoFrames,"\n
\n "):"","\n ").concat(e.isPlayer()?'\n
\n 网络延迟(ms) '.concat(r.netBuf,'\n
\n
\n 缓冲时长(ms) ').concat(r.buf,'\n
\n
\n 最新缓冲时长(ms) ').concat(r.pushLatestDelay,"\n
\n "):"","\n ").concat(e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?'\n
\n video显示时间(s) '.concat(r.videoCurrentTime,'\n
\n
\n video间隔时间(s) ').concat(r.videoCurrentTimeDiff,'\n
\n
\n videoBuffer缓存时间(ms) ').concat(r.mseVideoBufferDelayTime,"\n
\n "):"",'\n
\n 视频显示时间(ms) ').concat(r.currentPts||r.ts,"\n
\n ").concat(e._opt.hasAudio&&e.isAudioNotMute()&&Io(k)?'\n
\n 音频显示时间(ms) '.concat(r.audioTs,"\n
\n ").concat(e._opt.hasVideo?'\n
\n 音视频同步时间戳(ms) '.concat(r.audioSyncVideo,"\n
\n "):"",'\n
\n 音频播放模式 ').concat(v?"加速":"正常","\n
\n "):"",'\n
\n 视频解码时间(ms) ').concat(r.dts,"\n
\n ").concat(e.isPlayer()?'\n
\n 解码前-解码后延迟(ms) '.concat(r.delayTs,'\n
\n
\n 总延迟(网络+解码)(ms) ').concat(r.totalDelayTs,"\n
\n "):"","\n ").concat(e.isPlayer()&&r.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':"","\n ").concat(e.isPlayer()?'\n
\n 是否播放流畅 '.concat(r.videoSmooth,"\n
\n "):"","\n ").concat(e.isPlayer()?'\n
\n 是否在丢帧 '.concat(_,"\n
\n "):"",'\n
\n 网速 ').concat(w,'\n
\n
\n 播放时长(s) ').concat(ao(r.pTs),'\n
\n
\n ');t.$performancePanel.insertAdjacentHTML("beforeend",E)}else t.$performancePanel.innerHTML="",xn(t.$performancePanel,"display","none")})),e.on(Ct.togglePerformancePanel,(function(e){xn(t.$performance,"display",e?"none":"flex"),xn(t.$performanceActive,"display",e?"flex":"none")})),e.on(Ct.faceDetectActive,(function(e){xn(t.$faceDetect,"display",e?"none":"flex"),xn(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(Ct.objectDetectActive,(function(e){xn(t.$objectDetect,"display",e?"none":"flex"),xn(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(Ct.occlusionDetectActive,(function(e){xn(t.$occlusionDetect,"display",e?"none":"flex"),xn(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function $u(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===r&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}$u('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunNt9fP+FIno7/98/tFY+Y8ffBUlLrmkl2Cr96guTv27BMxP5iLCqUvi68+tpqhJKPNXBH3SjACnfimm/7Wmsl3fI/FP75lh457oPH+1Da3M+1T8481QcT0T7UetevR618LDPdH4hTlyHLGH3LoZEk6d4PlvyVW8pfNeMwzcDwa/kCKXoTzk9tfB455o1mXyEIOa+0PrFvcFt+fIU8QM/k6guOQifzNFHkN5l/flgsOJVHibfMR9l2nhBqem+VXyFZ/xghkMTp3il8lnDPKiGQROhs2lzjEuKcVW1uWk4ybk2Eq63pxk3CK/RZLiJO+Ti/vZXw3ZX1E+kon7jv+JJMY/+Q15uIRWIKmRthZk4VTDTsnFKYZtSsItWiskObq1Pjm4f8gqIrUF5W8ycAl+nAKIT/iCf1zSKFAgkW4/7drifrLmgsHF2k87alvhblFAcbJttWuDU/VtCiyyedMXbjGfCg6n6H1+cHE+TQFGFx/3jksa2xRoZO2cZ9xsUJn6e8aOeMX1aGco4Biw1jzilm0KPNJb3nBxvhI8rrtVTlCLK5ptCiEyBS+474POhr2c+NA9Lqm/QaHEiXzONW42yN5Q2ydG3OLU4MvI7+XEdImbCWvgSkN3zB1O1YYptOhoNnRNcDM2hRjGMTc4VZsOE9fVZOioyYyjUKPJrKPGNW44XFxX41rXEPc4vFTdS9iLTnFJ4wyFHAO2U1zcSoWNU7RLDnFTb1DocaLoDJfgc+HjYo3uTjTArW9TBJHdcYJTtdEocJ0NCnE97nGBIon0RQc4YzgaXIfdHhdBHdmrJuNtceubFFFkdtrhVG0lKlx3XUrsxz22KbIwLrbBTQ1Hhxsotsb18FR0OIWvtcT9Z5sijOyfW+KM6ShxXXYrXMJKRYlTtIUWuLubFGlknrXAGaPR4jrt5riERRFH7XGtwc1sRo3LHGuKi/qo7j+uhJOr9flKMBW4QR2uxk1NR4/rKjbGRdpXG/bXKtxrAEdVHNfTDXHLf0TAvbLVCJfU5hBwMSvXABfPE0To4w1wP25i4DLPG+CmRjFwncV6nIpQSF4UE7MOd7hAIJG+VIe7u4GCG3pWh0uPouA6C/txMFOuetIR3JSrmnQEN+WqJh2BVbmaSreLS+JMudKky9Xg4jYBRXq8BndoEwmXOVKDWx5GwnVs1eD0OSRcLF+N67EIKrS1Klx8GwuXHa/C/biBhRt6XoVbnsbCdW1V4bDyoZIRZZwKlg8iI8wKLl5Aw73oEWXcoQ003NCRCm59GA3XsVPBTa2g4bqLFZyWQsMp1h6uJ09woa/t4tCaV6WBEWSy7qYrQSbrbroS2MVNzUUOAXbWSnel0sU+AUbpsl/gEjYizlgo4w5vI+Kyl8o4xEryopYI3N1hRFzHszJueRQR17lVxqXnEHGxQhmHd06yd15CgBcQlcsIYokCJi69IHDxbUycOGki9toGJm7otMC9/ism7tXfBA6zBperMIHW4HIVJsDrwsrVIYE2CNEibIHDbBDlFkFJ0AYhWkSOemxUnLFGqN2r1L8ItXuV+hfFN1FxmXH6wwYqbuivdAgXd4RQ+36p8xNq3y91flqfRsV17dD6KCquc4eWcXFbtLyCiusu0hQ0bg4VFytSGhdXICOFilNs0nFx+QOcZ5xGsGEd4DzjOC6OH+A847QD3P9jtuJ2CGjcQeP3gYM+2YQ+TYe+wMG+NETGQd+OgL6RA30LDPrm4eu/ouJe/Q37hjX0rX7oH0mgf16C/mEO+idN6B+DoX9Gx34AAfrRDeiHXqAfF0Lt/OUHrVAfUcucRn+4D/qxSOgHSqEfxcV+iBn68W/EV3AqD85Dv3IA/bIG9GsumC8IaSb+q1XYL6VBv84H/SIk9Cuk0C/fQr+2jP3CN/Sr8tCLDEAvzwC9sAX0kiDYi6lAL0MDvYAP9NJH0ItGYS+3Bb1QGVaP2LfEG/TieNDLCmIvyAi9lCX0IqDQy6diLzwLvWQv9GLH0MtER76rRqWxPgdemtwYf9kWdYdeDh97IwHoLRigN6/A3vYDesMU6K1msDfpgd7eiOmjSEf1ZdpSC3ozMuht3LA3wIPeOjDSTRdfKb7M21VCb/QJvUUq9uay0NvyYm9oHFFKdDvaChp6E23s7cehN25nh5G3vE8aZ8LGDdjMIY49zoc9dPpFx7ikHnIh7sjnHOPYTMj36oxjzDlO1UI9Xe9oUICb49iMDTBwzXCqFuKsG2gycM1wYtaFlrCK3mTgmuJU7UzkA9cUx2bDGjpFH2FucUk9pA57onGNa4lj31uhnJzEtA+ZexxLh3KpkykwL7g4D+GUuJuPe8Kx5RCuJtJbzBuuJ/hyMmCtecSx2aBzIqaNMK+4pBHwtU7WznnGiZwI9Oykq1U2tMWxxSD7hKL3MT84VQ/wwGbzpi8c+47fCsp2kt9g/nDsp6AyNqb1Mb+4pBFQKU7bpm8cS/DjQdg+aXT/wTWOzfLL8m2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyLKvj3zXVfeqQElMljINx3MK4xVQ3xj2Ry7N/6CiMOIfYyVUXWxUyBx7HuZRbcHt9bf/Lb9zsHlzKzabauJaK47iVcC7jJujS33/joKkmxDnM4QiJ4xDjZuT+DXQW3jgxV012qcPuiePhCGfchlv1/P0D6Czmqmuq2gPGkbIS8Q4ZsNU3dGP3Y2+cW1RyKpkrbAnwqhi3iXHFHrU3bFVV5c3vBsCsOALjkXErAW85F3rjFvBm5Kos+TngCOXYG7fA1ojFER7GPUHbmer0tfGPANeROM6pjvDMQSkrsWQ1d564Fbr61964TvSqDa6O0ELmAtvGuc2rrpQrn/aa/qCpYq+6mSpOVhnjWBy38u2JXFl9yL8acg6CV3Ur5yxVZfW4AsRxG+XKssz6n3njVMYR4Eg8sj1yi3tgtroxrpyhG38gc+h8PYddPQ551dVQW5jju2/cG7kXdB946Uy9cbDnQOpxuCCHcq5dHDcht8D2/K67VxPNGtLJd7qDTcgb1zLGbXEcY9z0Fd39GReTzIH1B/2lcxrGTYxjXnXyqxNyef8zpipVlfDsyCCmDkuumhGvWq6W+vyisqxvDJwwOxJQO6fNmjaQcRt0ZdR2dwWOFZViuculNWtgBZjk+DNq1cq45y+Lf5NxE25B3oEyLueFJWqtT+Ciqr8r48jsCAyAG+2Na53MAdQxX16VhHEL4Z7Ilc2dGad28pskaULiEdDlyijjdqa6gBeNtwSu63AnP3V6NUnAG9cu1RHOuL2hVi5qr6+9Za4qV0dCGcfCEfDIufWRFbsZvKy7KeNgW7XHvRqxWfOGLhO6XCrjoiiPb/rGdZ75uGRfj9u3B1sWAEtdLuxVF/Cq9HaMe4A4TptkZYwLqI44rmGDbUe5E8hZcg54zquRbHXu5NN6HKuO7N84YqwbdGV/Q8YF5arUN7CJTNLkgplD5T5xG+OOI2ehAhxv00ocOlpWwhHwljns5uNg6bxCb9wbueSupip6VTnj2jGudSvnOeqrVo6h7vl2nHM2K8AkV1WyfDYDvHUcWF+1VBl3EDlLKdc2dQ6aNbhXw2eAt14Nf+MqFse5rDuS8tucHUmhqaJppYF6B8440h7E8cjhqMTiLtcaAL+ga9jWZb35hpbHceyNI9WRSmHcE7n4jqbqTp2D2nnzgm154mB1hJQy1cwBIpd3twCOrjnEoDsoTZ2jepybb2VKrhpx3zB92Z29Khpl1ZN8MHWzJV1CdYQHJEeqTMbqcfEMW+obLBwES83w7AgvY0YlMNT3N96GcXEHGQdxG2t3CQ5kDkoFeO8esHd4fc193jinAtxvXhUN3Ywz5VAFGM3cENfgVM4x5YICYRumqu5yIVMdJuhaLXMAFWBKOIhbWFBiO44Dg4Usxx/cCrDyxqESMIYuu4lX1fYcGnVaaVmtKXZxHOzW5Bvfqtk3iLAFuVaLew4HluDUzIH1VYMZF+AgLMZxcAYY1uNYBTgrwPDIaqxOQ1p540IchBFTJW9c2ofNAO99Q+sYaugbJ35Vd4sKsPbGqVM33KsWmdpXLeXqufsVNwhH8FyhOh8n74foKb5WVDr0zFky1Rgt+iaJZyJTWErKMynpqsqgVy4q0xv0VTvZq0pJPq5jzn41zzzVET0aCYjmTO05OLaaBEwWqhvSenUkKtVw5P0N96mOpNr2YCPuh4AJCGEAoioDver7628Sx8WAcU2i1eM259AWhZBzuQEJieN07JR6sCHgXoSLnepI7yo9NqgCLE5A6K4hjHGKsVqK49JYEGyBg4XIq2b7FREUx5Xu2LkXOtmz2pJBW5sOqdjJF3sOjHG5fz7OT7n8DtURwjjPtBKtx7VLOa6Q4zh5Wkn8xhvU4xbG9al/s2bAbxwYkJO7XCGME43VIuMc56Dnqi7hpPE4cVopBLnibozTp5X4DHAQ49iwfsCX3IhxYFoJB8C0y7Xr1iwBSZXDulIUjF11G6+qr5aPALlCmTrfyWfQzCEK49xoPMnnjFMaq3QlX9tzQPuq0QFbLeNbMU6cHRn3Sb60HwJ6NXAhKQi61nzpPAbtQaY8jUUgQnRHSodxZSjjoig161W7HePIRGZDJzJHQXiEzE4DpRtSjotCHzkUkhj2qqJi4V54T1S6cWwVp/nhjAP1JQuDhbs4TtFW0spKTgW4UHJVFv4GQpcZA64jkt1xDNS8lDEv9Y3z5KpRGY4biIINMC7e2lxKNFJDqUfQquGZA2yrHoINUM7G6ZX1iVM2RKDUI08dssVUfduDRyI5QDkbFWCnscrWVWV1/RZ2uaRc9UyKL1LO0r7q1qwBm761WsmEUjdge9ApAB9iHHWslq4kMalHTbHQieO0zXKljHmIc4XdOE695yCpsg7eOE7t5B/4Uqv1uDSGKhDYq0r6yQWYj5NnRw5BNxjOHJAKRJB+nJqr4jcuOki4qOzs5qrgulSDJzJHUcyrCNMdOc44ty5nel815KDZ4HTypeoILAEfZJxbCjYkSpVKgZx/IpOfXgnarDkKXWIrHAm7kiTqxw1er+oQzg2Bj32FTcYJ2kpCIx9PK2XMq1ZCz+EM46LYZK4qaCsdmo+TqiOV5FWPITdYLZ2jOqYa/6LN8kJSZT1dxkSTJEYKmZ2/OuI5aIYYh+UzKn3TN9A9mLjL1cl6LexKkqof575xVJWVx3HRefdgUbGQNGs2U2Ul4HYQ60o+HeBzjCtt9VXVqXMpc3DEzh2NzEJSnr7OuG35wUTpPGjqXN3lQgdE0AWRA2sOHls1eO2yh/uqWM1LbUgvQzeatOhR5NZM39QIBNyQbviBVajYItbOYa56knCbrRrUj0vxTn5QVQlOnUtdrjKKztuqpbMEJ27WtCG3BzX9uMPfYqsmlW7SPnRfFeSqwTrAp9641VZtXi1PlX1VN44THzlvPe4k45aZLys9h+7cvuqsAqEpBAm6I9HJN24pZ9oIRzp5XzVUsVCZOnd0Ry4zbu52GdMBDn7j+NVyYXaEneW6+sbNrQcjtwdJCTh4WmlrSLcF3axRZ4AvMC6zxjj9annty1X9M8BoefBMQGKudB5UjnMnMltQV1JuD5JK5jnGTUU52zeke+4cfMJ7ygxwSZuDJ6EbzDEuZF+VNLnczCETlPdkdf3Tj5yhAHhNVdV9VXgJGV9JyqWjjRdS1fWRs6vmRctK1KuiLD/b22q2KyvlWJT1HOPeo3IWqyNwlwtrxJNrlwW69ZNr0qKnoBsfNrWVcH+w9gzIFXxDeisr5cxSrzCusFVWkpVukH7coF/0zQRt0a2QGZ1HLrfAuIfDOL/uiLOTz9UMMiTmtXMOVXmxW/P+OqM6wPBKEmLcbuiGMw4lq9cmIPbewa5iIb3LdYxxKHMouYDcSeRqcxd9+dS5VFWCGZd3e9DtR5+21dbYRd/1EAaagUC6IzDLV7YHj4pSKbmDkZRLnmRNcHeQ3azZdvLJ9qCUOVyhXGVmQUSpx9GWAzNW6Y0DmYMzrbTeHjzxxTeI41zktugXtQezAsRxon7caUt9VZZMMQ7pAPMnjnTyB5lxJHPgU+enGTeajONUHWB46wfW41jmAE79nHerNiYyFeXpBu/keycyM8983CWv+sxWLe2rsgpwH7qRxPuqb7pl6IKe61RPYpcbvefQy3e58LSSbwY4B071CuNKk31VtswlTyuJ+6oZuss1h3HVCTEDluZb7Ks6prqrjijlOLTLxRlXUhng85RLo+77por7qp5c1fUN8I1Tbw9eqce9ArkvA6eqxOOr5UQGgrdVC1l5GszHnYSuNsC4OKgeF6au73S5Mt983IU3bvwqcN3jAe9y9VgkvvHPskp7DuI9h7PfYOGNw3EcH7rx91XRPbNPT2TOEbCNNw7uJOGhG+naD8+5PG/cJcI9gYu/CxuYVuqd+6reHbgBWqrvavlV5LLvAqfdc6AFYElcyW1IS0eScqg7ch65/MvABXW5ElWvZXDiOL2Tz3VHzn7Vt4F7iNuDobMjwp7DUh3hfKs+EQCbAs43O9KgG9KDrK6vMe5qIPdd4NS7XFLi4NxzADf0eEPa8aqX1lV35REjb5zac1geuYVwtfjGbTmXsJH0qf7g14Hz9xzE9iD0qigewTv5F71qaeKNwz0HXI+jb5zLODABQWaAP+MbXA2SbxdH9KlzMjw9jvAUMr72o6363hQ4VyQ+lU+vkH70ALVFM2cnP8f1uOojhLPgVZnWI7y9Enjtcr+TT/qDJdj0LW9tqlgFQtUdYQfNQupxnHE3dw5aripmDgOcOt90gHOpOvKRF85EOCJKPSrVEa/y9D9QLDQEXKco3UiqVPtdrjZIIxNuSEeX+qomc9U+3S/WUIUgvD2o7nJ9UnfECnAPWQUiSOu8HYKERz6oO2IDuE7THcHOATIO9xzQhnT1IcblVhjnagRp8QjZVw1gHOFb9ZnSuY1OvutVe3/86w4Be7XOc6GvetsuF47jAq5dElFWn9a5oJF5YUDOBHCdds9BzRw2xrWy1jl946qrC6tfb0i7uWoKZ0eaoJs1e8LR+6pQPy66GMiNhqaV4ljbc/DqjrTC1fL8n/RVa0ummiI1r0a/yyUPT2dcXBR08s9Cl9gVpdKvEvgO00LB7qta585g4eP7jIuDxEXdaSV87TID91WdiUx67uf011lkHBTea/R6HN1XhTdr0AmROw9Pd1h5euurJvxKEh2e9uyrfnYn38q4vnp7cLchXXuVbtxdLoFx1UVtpWnv0uLNGudquTCROXj2HHI6riRK791zJakjIxDKRGatMI5fu8z81y4vzU5bE2yJmYLyFsc1jaythPcc+CW4j2grGVi71GTQgnLV1tFrQduDUj3uWvwb27p2Sefjel/PAXXy+QywoFh4IZKrTF67lC6I1H6NTHEGOBeWB88LoVm6dimoGaxO1a+RiafOpX3V8r7yGayOuZfPgGsOQhy3V4Fgew7wSlJ5hXG1aY1Msj2IK8B0BAK8cYIIxBXG9bZuD6ZUlCqk5zC0x/Yczh9YtSVK9ZA3pAN6Dqq6vnAo9ANx3Ndl0LazXPK0kq/n4J06F+45XMkc7Ajv0Sy/VzZrpAsiLUnyhZ38fQX4vOqIOXX9o9cutRlgfZfrSuZgTVxU9KrKPQdQOgd3CZB7OO9VzcnZ4pYDHddnkoVSrprlAXe5ynN5gxF1/Vi7ocenp7XdcueJyxSt8wtjhRYku2EcB3Hb1LxqHMb9192VJTmuw7DxSsfxdv/Tvn7TSceiAEpylqYnH/lWsWBRXABMVLHQ8B4cjvWUfN1xTYU6wJEqqy7y1ynBEIGt8ycqBxe2BGh3JEt3hO3HtXjm0KFJ/kHIOTDCmEUM2RFMH9ygn8N+WoNmDpcLZEgfFuz2pQPMKof7eHBME0RsxAVX3OFS1Y/Zj77jtGQ34nLRWjVeHtFF/pOIc2EvRdf1m/2UKy11s+8qtXzmAKQMhiNNTDefqiWtFIlkQqEbNJFuO7g6oqr84p8PC710IxN0R0bK5VIFV2svTx9CnCPTxspm1iiGiBKeptmh26tAYOXpp+y3HSGuqUwnONzIZN7bRAdYp4bDZpee5qq5OsAKcdTQISjykUjmM/aq3lRZK3rH6a5SOMmPZw5BQ47yQ05rvm3NVVXhkLCs0YqF2EN60A4iw8Ev1dtcNXvmsGK+qukh/QIRtEHE06cK1fXtKRfLqoTLRadcw8Ev1ZkTXBXzVdkdt5k1PvtQo/24I604520lvq0EFAvxXLXlytPHpjUXcRU4tTuiJvkx4EbugxHojrRJTn4p5jY3gcspucLQKW0lVnNhFQhF5ir+VhsvgZsN/Tji9cOcVybD6wcOuQ5MuXpxirhyt0tTea9NTPKLEVf7CdzMaZdZbpd0Pw6LZ1wiN7PhWGpwk1Uz/BzQDsSEnOB6vXT+cLscntoB3sQZ4qiaV/qOixjSJYgrBNwwu0OcSYKzzbe1ExwYrF6InFdpVp3EG+IIJSlsnWv9uEQ/DrMH497IcOgt4hNxC9vXv2b5ElhU32fuuF78IQ4r3XyreV3NST5V86K16uG6YRF3iIt1gJscxRbgE9oG88E2oa5fdMu14h9x5pZX2I9DuaGn+nGXmOdw6PHrvh+X9OWagGdNbzCkI5uk7NhpwHliSDf2sIY4wQHl6ZysWvoaqcUz4hLyGUrsfF85QIZIvASsh1zZsYsA54qTDyuHSAViM7wH+x6NarDWeRHiFpHT3HE1g5zldsk6wEDOdiiwJejFJeKYvaqtWEhFqShfFSkWHikaPHZH0qJUxEOvnK9a4CE9ibvACVQsbMLKwWTWGP6qMeKOAW6o3AWOXHHZ/TiD55BGXHZW3UScfqqPVdbGMjSLa1VVcRG+KmRI53fOOxGnn2piedpgSK9GB5h0MssBVzsM3AwdfXPuuFh3ZGLaonBUk3/J9eIfcXDmcC1RLEwotgTvuDzIDY3LwM1z0kMam/1gjcyWjQePq7VscjrE2YuFxNHMLFWB1vlwKDO4rlX1tj7ROidZNc1XzZJPZh/q73O5BPBVo90R5PaTyKqYPVhcdK3iGXHxJB8RRLT14KZYl1FW7RJa5zkf6uw2cJJ8x5kbmcDsx+yO6NglQreInO+Oy9oBNry348qh2M5hFTkH4sysihA3WXNVvAIciQSVtH2d745kdZUYQ9pa1o8QNxzLqO4m+eFcNRk6BLmWiHZ3gK+a+FZH8Y444q9qbuuTmcMLlad7Ee+Iq9gOcNJ7cFqZDjCXOs98AV9m8Y84OFitI7fLK0VcwHPoqZ+Dks+wPtRhEf+IS4kZ1ElqOZrW3CBH+ar2O24U34GT8rmqntWsif24jjFrrCtuEjkD4qC2kpqrjrQ9cpDLZXlIt+I+cEl/VernsB7Zj9PTQZIYKjkX4iCz5go7mYpZY2qdI77qH+M9MtRyGsQZXC5rrzBWnt77OQCNzKB2YIi7ipwDcZXJ5YJS54p32UM/h84WAmZZdZMTBE435LLt3sm2foajbyqtTnKCwCkVCFMlHnKSpkhev4UdYHDHke5IK2cIXKACYbuWm7UqVp7uzDsOI66bzxE4ogKBZg5ZtWqCIR2+4wDiLtl2s84m+VW8ra+YNXZ3BHaA4VwVvn8vjcipEJezr8/UDOgOMDeYYv24ZGXvtzuS0Y9jO8AT3QHmnPzhz9G4OZs5QKIvFgJW40FYqraAWRP4OQSRK4qbM55Dxpeqd4B/uiNTmj1oVg5ZhZbvKZdi1mBHMyIuanPydXdk97GW4U28GZqFSjdL8h2nkgN+x7E7bo+40rj50AHOkTq3NYIQ4tpolRXKi36/Q0rj5m2uWkV81ZS6/hRvK/XRyIHRHIby95v/d1y9WEk1lmW1uVx4XekWua4SOSHiKuZnZu3HYXV9yh6EPIc74NojBuQe9uMqUz+ujp4jI+2dt6w7Qp3ghuw+krNaNctBrwYqaNB7MHgAdyk/h5K+pdfx4GzusoafKujHRR3gDu/HhfpxfxF3lTMGbrZtCdB+XIi4KDegmQPagbh1zsufIY4QV2ltJcVXDTn5EeKKuFyqcmgrOWng9g05pZG5RFvnd8SNtDuiPKRbw9H3/ztumkVOjrg5ra2kEIe7IxBx4e7IA3DjMwf3eMfhh9xovH/73dZ5n9cBHrpFzhs4hbhgB5iqeaH5IGDWtCazZuhnOXHg5jmdVX9mDte0u9TjAQz9HB6Iu4zPHt2v7kgNe+cb3FbqeVa9qBfw39C1jZw9cMBDmr7jwqHDylzL+5Sfw2V9wcn9Iy5qZFoTaZRV9b7+k1nB55Sr2gEOaysFiFO+tCSrhqsj2yzyjyAu3lYCHnojyap85gAdfV9wu3l+x2V0R36INSvWAUbvuMvzydRprWogTmfVO+AI4uB+XF/JvxK4UHekMZRucHdkQhsQvdqPuwGurV95cl+LhUR3hPfjTN5lkFa78bUH97StdEdcOJC277h0bvgO24ty6RkQV5OtG5Pn0GIy19S8/OCeKofojlu47gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM0SURBVHgBtVa/SyNREJ7dBLVQELU4bdwrtFJOUCxsXEG0Ue4OK6tLKhEb/QsO/4LzChVtvGvE0sPOxtiYJuFyJBBICtOlSSAQCEnIj5tvyC676ybZYPLB4y373ptv5puZt6uQB1xeXup+v/9zs9lc4qHxK621VFAUJYbRaDSeDw4O7rvZUroQBXw+3zcm0ckbMkx8enh4+It6IWQijYlueiByI95g4oxzQXW+OD8/X1JV9e87yACNbbxeXV0dOxcUJxnn6okfx6l/OOHcnr0hhIzsFcg06jNa8obwbErKOfs+CDIhUdUbxrhJiGrknAW8HB4bGyNN02h+fp6mp6dpcnLStj46OkpbW1vOY1q5XJZ8iqTX19dPnYpkZmZGSObm5qharVI+n5cZ5ENDQzKy2SxFIhFaW1ujTCZDqVTKaabA+z4qrdy9uhHB0PLyskSTSCRkVCoV16gRLfYODw/T7e2tOOQE5zKocmRf3Mggzd7eHvEtQnd3dxSNRl3JgGKxaEaE6HEO553gOllXuQ3W3ch2d3fFyMvLS1siKxYXF0XWh4cHOYfzUMgKpE1t3Y026LouhxCVF8DBhYUFcz9m5HF7e9u5VUOV2pp8dnaWpqamPJMBKysrEh2kNRAOh2VG/q14c7XhILzb3993zYMT2IOCcTo4MTEhkqKgrPCx1gGePxgv6vW6EKJYNjc3qVQqSSG0A+RPJpPiKACS1dVVaQ9UdSwWs+33c6n+47ZYchqKx+NCvLOzI80NiWAMEkFyeM75lx5FdFhD4SCXIEJluxRbTLm4uDjmcv3RLgIYgrfILZBOpymXy0m+UImIDLLCATyHQiFbLq1gB/90bHwrcNPAILwGAaREcz8+Pso6CNsRGZDGx0eS8xXqRgh5DYkgIwZuFQPdyGACfwJ+PHGhnHKUOnkEetS4U72Co/uNWdoC3yovUVqBiD1EZW4fGRk5MwkBjjKIBRoAarXa12AwWLARIpdY4McC9RcnR0dHZjPabhosMOkG9S9S2/8MMLDfRKhljawjoYU4wNXby79OgavxJwrEyFlPhBZinasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYEFDc5rQ0BDoaMgRGhoKaMhdCHDve+6QZVhgMfglm9mdn/e9v3kz6xEusL+/79c0bcvj8fjpc8V6gCY9VXqK3W73MZFIpN3I80wj03X9il79wh2q/X7fJAXvTdNszkQaDAZXaHF0BrIRcvLKERE/OQ3qYwh/06shXg8vRPl8PlEqlZ4nktoIV8QcgBxwItbfitBOvL6+XioWi2XZp8kXIryaN6FNdpSM8spvthRWUmPaJ25vb4vV1VVRqVSGBCwtLYm1tTUeW1hY4KfVak2hFe+J+B+5+QkfnL2Hh4fI1KAq/OLiQlxeXorl5WWxsbEhNjc3RbvdFrVajVvMkcTlclmk02nRaDTGETfJ1Z+wlTxWLP84zQoEAkwEodlslh+QqZDWY36hUGByp3m9Xu88Ho+HNaokfidCCAIh2kgkMlYQAOtyuZy4vb1lBW9ubnidCioa37klkw0nQrgWgpLJJMfXDUAOBbEO66GAAkOS+tSRk5MTXgjr4FIAMXULrIObz87O1CHv8fHxR03thXAkDhbahezt7TlpzkA8sc7uUngIQIhUgNRr70AWQsu7u7uBEPTBdaqboQTcCIUgXL4DUBzjTrHVDcP4BmVlR6fTYVLg9PSU9yC2CIghEG7HHIC2GluJOGYyGR6DYiDCGEKD/iErNS2sU238QnH9rGqDopDP5zm+EIJ3aL6zs8NEUAKCQSiVwxp4BFaHQqGRwkJoRqPRkEZ7tCjGAAJQHED28PDAVkirsX1kUcAc7FEXWc5c7+iQTltnpyMgHNYgUSSZBL5BhqTBHkVMAZnxKsijMbQ6Vf+/FFe/mFLs6/X6IJZ20t3dXXb34uIihwFuTqVSI3Mt0nPia3LtpVLot461V0FWLiiBZwzMWCx2xOSy5+DgIEya/BRvA1xfvlKxr+JjUBwola/Fy81u7iDCX5JwiJSPHNJm3sQWoTnUp06a57XFIrxW+0dug8guutM8EvEHpxPIJRDDH6qFA2UmrSSrg0SO5HJLjhDdUxue+bLtQG7QqR8ggVvC4beCFHumRMSxVJxEJvEfnFm91YrgD/sAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANwSURBVHgBtZa/SyNBFMffboJaKAS10SZ7hXqFegGbCyjmUPTAH3eHlZWmULG6u/Kqi/9BLEQRIdoKigf2l1Q2ChGtBLmtFAQloPgL1HvfRyZuJhuzBvOFzezOj/eZee/NZAzyoMXFxYjf7+99enqK8GNxlZVtyhiGYXOZ5vo/MzMzW17sGaVgPp/vN2DkTbZpmqs8wfloNJqh10AZZjEs8QpYAfzx8TE6Ozub9AQFkGf7l55dWLbYTmxqamruRehbAl8CG5UEOvTNmWSmekHCVAgIJVgB9eHHD1bJSTPp7NXe3k68Hejg4CBvdF1dHTU0NFBVVRVdXl7S/f09nZ+fl2BS4Pb29geXMXyIe5eXlxM6FMaHh4dpY2ODGhsbybIsamlpyUFQog/geE5PT2l3d5eurq6KgTPc7x22kpGN5T+3Xl1dXdTa2ipGDw8P5bm7uyvoB3hTU5P0t22b9vb2ZFIu+smxjSOmEbfW2tpaAcJgMpkUQ25ACG4+Ojqi7e1tqq6uprGxMRmvi8P1BaXJLyE34MjIiBja2dmhzs5O8iLAMUGMw3h4yCkOobDYs+YHfXAkEpGBWJ1KJMTUqzAObh4cHNSbAisrK0FTrw0Gg5I4GKiEBAmHwwUzV2pubpZJOV0KD0EIkS6TlxxwViALMcvx8fGcEdQhKzs6OvIGYxLIcEwIxuFSvEP19fXSjpzQ5RsdHf3M5XtV8fDwIFDs0f7+frq+vpYtAjAMwu3oA/X09MgqEcf9/X1pQ/wBQhuyPZ1O56/SNOO+oaGhMAM+6rM5Ozuj4+NjiS+M4B2ZGQqFBHRyckLd3d2USqWor6+Pbm5uZAySqa2tjdbX1+VbU2Z6evoX3JumIoIBHA6ATUxMyCl1cXEhQOxD1ON9c3NT9qjufl2K5a+pqdliA4liHWEc7kOiwMXOvYpvwJA02KOILwS3FoGuoTTlWDKMJJUQ4qwfDmoyAwMDkkiYIBIOsS2iJH7k7MW1JPu3VpbUyYWVw91u4oWtcjyjOSi0tLQU54bvVBnh+vKJry82PnKHAydFDI1UATFwTgHzoIgtZvPW4Cxw1VlX0YtZFhjT6wvOXrgBK+ZnjcqXimHMrbHUZXuSV43kCpE3IUTzvPfjr75s61pYWAgx/Ctndy9/WlxaCsKPzZs+xc8Ww9IvwZT+A8hTw5fcMmXrAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;transition:all .2s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:width .5s ease-in}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;animation-name:rotation;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrhx5A3hFMjEAQBDwMwzOmAi3LWhBCLDTr5/t+ycSubdtLnPOncX1iAfQAlmXdNBmkru2RVgBSSspg+5kQ4lRjv1iAIAgqRFTIMIju0i2AWNvrAKSUowDwLqP4tACm9rWmbABCiFxXKimlhu0BtPFHtdc19wj4vn/Wtu3XnPOfWVByA5BSngCAuwCwryb8Hud8EhGNltANB/B9/5BlWXcA4GCMx/8g4jjn/H7aaGwYgOd5BxhjcwCgPd/0QcRVAJhM2l3rO3cdQEq5GxFvEdH5VsLX7aKIH8MwLLmu+zapb9cAFhcXt/f3988AwJip8Jj2L2zbLg0MDHxr/NY1gCAIpohIJ2V2BwC0iUd9fX2lQqFQ6cQvtJbICSGOxHhlVOdKjuPMl8vlqzrxI6IdWUAQ8Um1Wp0ZGhryiYghYrUtgDQionxJT0al1IwGkVJeBAANvieNDQB4joglzvmilHIXAIwrpX67rmuUamfKcxoTvnoQ3/dP27Z9g4j2J4C81KBCiC9LS0suY2yMiC7rttoZuQBEQhsiopfT6wAwUvv+hjE2XSwWP0kpRxBxgohO1kPmDhAHEgTBUaVU1XGc98vLy8eVUhoqbpPLPwIx6/wqEV2ovX8AALzZ/Ng0EWgQGa1iLQ8xPYCUyx8YHjt7EWjm2I7sAy0it7ERqNWEDkeiklIJg8pFWwC1ZC6SM9NYc1oXgcaiVlxVYmVlZW8YhlMAcCnFvOkEQPqqRBqASLTneTsZY3pjapZSpwF4Y1nW7ODg4Ie202kTgGiwSqWyrVqtXgOA6Zj0OhGAiF4R0azrup87dqDJAlA/eLlcnkDESQCI0us4gOdEdNtxnK+tfkHjA027AJEgKeUVANBROVd7p3fixwAwJ4T43kp4nR2zylynAOoE/JuAiPiDcx6kFb5pAEwF5zKJ2xXZrH9uc6BTUD0AAGh639Xo6bjUI+G/NglS+p3Y87wCY+y/2ozJSGkuRDLekQFjbEexWPxVryfpjuxhllKhNtwtAESc55xHx9M1hsR0WlcOlFLHTLyv26Ypi5hesyql5oeHh3VBeN2T6TxgCtXN9j2Abno3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfEP6nlNIgi6eFChCB4UChaU0h7aQ1GQrnFSdw9e/JNs9LTFzPvJZI27m8xk5k02m13I3sK+33vfz/u9N+/7fo+wzP9ometHF6DTGfTMQF+mYNqwd6sKlFLcK++P3WsWF8nkUyr9stAeTcXN624xrgDVAUgcVxmk1lbaGPIFyFocou9fSonYzvo4d4BsYQLgaIhB0EYA174bAFaNWpuFhrthxDsxQQCMrKXUPwGbvfr2BSglYh39UjmwXYCwy2kh4jqegd5M/itdaL8+i5vPwwB1DMDIWNuJcBbA545wAs4V4+YIiJQ+oYsOYGTzGwniDIANLjP+hkCHiglzNGg2Fg3AGB3/Ugj9NBO2+4ujSSaMeJ2uc+PbDhC5aK1GhU6CeY+/8IZz9E+CnSomBn7zim0bQF/m4QqbPkgDOKgufH4EAzdZaKny3vUP6vtqG0BvtnCUwY4p01oFcOIZuCJ7elKvvo9OtLyESMN7IzeViA3VC3TshiY4Wkz2j0Uyj3+aMX5shAIhuia4kn6Z+DSPu6xjiCotAQQRMeuXaJJYpqsgOetbcBV8TZA+ANxgotRU3Hz48SWr7800DjHL6VJyQMlqh/I5jYZvFsTI5XcRa0cA/sLDv98iieMv98X++Sj7aEBCPwjwD9W2LNMdAqhJnQMyc5D9DGBwRhzukK4fK/647q9I1hoE6DDAO+ZBdh6gEaQ3V9hi27JS3tf/u3Hhv20kpQPldsgthQw0fOcnpc3fVK2EhosEmE33x9LJwKxM54Lj/Ap0SeoCBPz+qVw7uxnwmdQFOge8R1n0DDg1ISaxqSbJy0oE2pTvqhStbOK5FQy2ka6vOTVkoL6o5VaVWHX+yVoh7KMAvvPbNq1mQNmNBgGoiV55fry3R+jOweRpqQMBMO4wxImp5Cd/tGynVQBqg0UvT3z4eroyDMaxenvdHIBvE/GJYnzgb69MtjUDboMa2ceHCTQCoGqvPQBuSOZT5WT/fb8luOgANUFGxkoQYVja+Lq2iQm4ygKnS3tj//oJf9+PamUuzBJqJsY59Jz/9wh6+iJpFoIKXzIAqoI7solbFdksvmN7YKGgugAMNH3vqp9pN+vhtq5VMqT2PpAbjwrW59VmVAYL8iASCfdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1kUx//nvthx4cJqX3RgGLsQBNG1tq8Z7axkwM0sxIX4hbhwIygibfPMeyapunY5iymzGAURZjEDAwoVm8SPhSiIKAjtQtAmiooLiyb3yEtNm76+5L37kjQp5C2Te879/+65H+eeS1jlH61y/egCtDuCNSOQyH3cWirNHVIXKO6kYvqdenbxqVlLxS8J8Txp6Ne9bDwBnA5IiIRKJ5W2LDHsB2BmC6zqmxk3UkP6AbedJ4CZfTsNcL9qJ077VgHU8r0MID5V2EsCk2HEBwbIFdT8M/aGBkgaelt3KtOB7QKEnU9NsGt7BMyp2cOa4P8tY3M+DE/bAC7cK+xnxmUwtjvCCXzFHtRHiEhpC11xADOTjwG4BCLDY8S/MvhsyoheDRqNFQMwc292QmppEPb7i6MZgEdqna7V9i0HSNx/95MscRLgo/7CXS0IWS6VrFRs8+1ati0DSEzm18kesgGcURa+3OAfSGklY5ueuP9qGYCZzceZySKC1gQAgPkvXtNjpXatn258CmlYSOSSg/qwW+B8usH9SSM6Ec/lTxM7iR/3hgEh4Jpk2Kkh/UVikiP2MBUbAggiYjFfchajtB0QM/fuOFg64D8H8QHQTQ3CsowNT8cffdLnPn8+KyXPpWKb1FLtYJ0tbbU84asCyRYOEmiMwTtq+P63JJAYH9AfxTOFbUTlNXRyPlmTdpsAKlIXQZyDDJJGGbx7/l++BSHM5EDfg7HMm91CRM6B+fdqyA4AWA5iZd/++hWymDaid+OZ/G8EGgXB65DrhAi4Jw3NsORj5VRC4A8AW+tN2Q6KwKJM54b2HcD3EtMFCLojqVw7uxHwGdVQ992OjkC5JqSJPRXw2qlEsMpFo1OonMx9/7gE211z8iirLC1qeVUlxrLvtwgU4wBO+K2bpgCoVSX8ASqiRx682hgp/jBaL6UOBsC3pMTFdCyaaUI6HRyg0llicnptqWfdeTBMd3pdH4D/kyQupgf7HtaKZIj7gDpAdefxzOw5IjECoJxeewEQ6CZBpmwj+thvCq44QEWQmZ09BYjzLHFk4SQm/C2KIm3/svGZn/AFP+qVucYi4BbmbLnOb5rGr+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFVaHGNmoBMTUmaPwD2iIhqKR8WEBFGkLFUjbtzDtvpjYrVhpCXAtm1867x5zxvnXm9c28mR13b7LpdO65557fveeez0GYp1Gr1d4VRdF7lL3rui/n8/lX5mMr/H8wDcPwIgC4QkQuAwAVWv9eA4BJy/8sAHg7ALysf4i4DwAe9Tzvj/3uP2cA5XL5CsdxNiLi5QBwUkQeQcRHrNB/JaKZZuGYeRAA3gsAZ4nIBkTcAABLROS3xpjdpVLp0bmA6RlApVI5FxE3OY4zGkXRdkTc6/v+c3PZPAiC80Vkveu6Nxlj9ojIjmKx+GIvvLoGcODAgTctXbp0CwBsEpGHEXEbEf25l83a0TLzh0RkMyJ+AgB2TE1N3b5q1ap/dcO7KwC6AQDsRMQhAPiu53m7umHeK00YhlcDwC0iMg0A13ZzQJkAlKmI3A8ADyDi9Z7nnehVsF7owzA8Q0R+BABXIeJY1mF1BMDM3wSAcRHZ5Pv+nb0I0i9tEARfRcQdxphvFYvF8Xb82gJg5gsA4FkiyrylfoQVEScIgttyudxLhULhwSQvZhYAuJCI9qftkyrckSNHzs7lckdFZJ3v+0/0I2CntRMTEwNDQ0P3i8inAeCUPmLP8/Y2rwmCYC0iPl6v19+3fPnyvyT5nQZAmQ4ODv5aRF70fX/zfAk/OTk5PD09rcbg4/EeiPgPEfkUET2dALENEc+dmZm5cuXKlf9unjsNADNvBYD1AHAJEf1zPgCUy+UljuPsQsSPpfD/m95Is29h5rcAwO8AYC8R3doWgDopx3H2I+IXs17/XIEdOnTobcPDw3ry6zrwCKMo+kypVDoU01hreK8x5oJmZ9dyA0EQ/AwAhnzfH5urgJ3WVSqVd7iuu8vGTB23SLM+QRCoOZ/2ff8Ls2oXf9DYJpfLPSgiH+nGgfQKcGJi4szBwUE9+Uuy1orIQREZKxaL5WZadaiI+Ey9XtfbacROszfAzL8wxtQ62dysjdvNM7MGcSq8Rq1ZY/+pU6fGVqxYcSyNsFKpjDuOkyeizycBHBeRjb7v/z5rh17ma7XaSBRFuwHg/C7WPYWIV3fy9kEQXIyIu4no3bMAqtXqZcaYnUREXWzSNQkzFwBAhf9wF4v2RlG0sVQqncyiZWZ2HOfaQqGwr6FCYRhuE5E3E9F1WYuT83qluVzu74VCYWfzXLlcLuqDBYAPZvEUkYeIaBQR61m0Os/M9yDiG57nbW4AYOZnAeDWpAPJYsbMNwLAD5TOdd2L8/n8Hyy/FfbkV2bxaKgB4s89z5u1LFlrmPlSANhKRBfGAPTBrCGiatbieN7GSpoaDut3IvLa4sWLi8uWLXvVbvBUFi+NchFR00/V6+16ollr7AGpaj5JRCMxAL06VaGWNLATM2ZW4dc00yDinZ7nbdLvrLXQaDZ1iMi9vu9/ySb/BwHgTAC4kYh2ZIGw6ekbRJRDy+AlIjoja2E8X6vVilEUtdhoOzdBROdY4fcYY0Ydx0kDcQ8RXd90m+qVH9P/qwPTf9WcK5+YJmnemfmE67rnIDOfBwA/JaJuLEWDHzNrAPZwGmCNGnO53HYAWA4Aoykgvk9EX0uuDcPwBhG5KwahAjOzqqHqewNYMwhm/hMAXDMnAEEQaP76vTY39v4oiiZd1/0VALyzGYSI3OH7vubVqYOZ9fE3NEENin1LDdqkgZkFMBcVqlarG4wxv0mR4nUiWqLfHz58eGTRokXfdl33tnw+n+pVu1XZNLpZFbIq0fKIm6yIOhX10K8g4t1E9IDSa84wMDBwHBG1WNU8NIObDReY+RYA0EqDhhJqbQ4SkRYI+hotj9gCaDGj1Wp1lTHm+ZRdvk5EDdVh5h9qiaWZBhHXe57XCLKYWVXoygSPk0SksX1fw3r4FjPa4shsVqanP5DcyRhzebFY3Hf06NG31ut1fWQNT4uIWzzPu0M/d3gjTxPR6r6k/+/htDqyMAy/Y4zRPOCmmLn1zprYJ8eriLja87yJSqXyScdxHtKSi4YCVvgxRLyvjZCpFqhXQEEQbHccZ9rzvG/EsdBFIqKmVK1AYzQJl8Z/NH4PzHxV/NkCuAsRb0hb1C4x7xUAMx9GxGu0ONycD0yKyGcTuegLAJD26K4joh+nbczMe7QolZwTkZt939/Wq7BJeq2nIuIviUgr3v9LaDSdFJFjKR7vtMcYOxXVRWPMpY7jCBE1PGiz84k3F5G7fd//Sr/CW80YR8SROK2cvYFOKSUzr0PED2hGZYw5ISLHrafUx9QI2uICmFY1RORsx3FmEPE5EXne8zz1mn2Pjiml1d+ekvrmqHO+K3hWvvZJvb2ensoqCwmgq7KK1eGttnuyNqsSvVAAtGINAE9oF6hjYUsB2EaG6vWx2La3U96FAmAt28jU1NTqZOMjtbhrGxovZJXVFwJAXGYHgPPS6lVtS+dxY6PT41wIAFpe79To6Fj7j9PCdmX2TvF6vzYzLqtrgyX2MWk8M5sXcaNDRLQjeft8Vaxj4bQSLSJbEFHjsraNjZg+E4AS2obHTzRb0kxsvirXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABphJREFUaEO9WmnIVVUUXSuiuahopOLLIqTBBgtCC01Ty8JmS/sRVESBNgiVJVZaaag0WBlGYNEPrSyiQdTKskEjpNKSCBqlzAqJSAsbYMV67vt13/3uffe+93pvw+Mb7rn77HXOPntY5xEdEkkHAjgk1G8k+VMnpuL/oVTSaQDOBnBmGG3DfwHwXeg/DMC+ADbGZwWAZSRXtTt/ywAk2eDLAIwAsAXAkvjY6O9J/pk2TtLOAA4FYDDnxmdPAG8AeJbkslbANA1A0gkAbgJwKYA5AJaS/KCVySWdCmA0gFsAPAfgIZLrmtFVGYCk3QBMDeNfAjCb5MfNTFY0VtJJAG4FcL5BALiX5B9VdFcCEBPMB7ALgPtIPlNFebNjJI0DcDuAbQCuq7JApQBC6SIAiwFMJPlzs4Y1M17SAQAeBTAWwPiyxWoIQNJdAKbZbUjObcaQdsdKujHcaTpJ25ArhQAkDQKwmmTpLrVjrKQdANwJ4FOSL2R1SRKAwSTfz5sn1zhJhwP4BsAokq+3Y2CjdyXtBMDueRGAv32ISS7NhN+RAF4D0I/kt1l9fQCE0lcArCPpyNARkbQrAAeD81IT/ArgQpIrMyBmA3D4HkPyr/SzPAAzIzYPJflbJ6yX5ARm48/J0f+DdySdWyTtBeDtyDlTCgFEkrKvXVV2+lsFJmmfMH5UAx1fAriY5CfJmIiGCwAMSie7uh2Q9KRjPcnxrRpY4vP7hfGumcqkT/SR5POyjeSVycu9AKK2cRQ4vUoCKZs9J5ocFMYPrfDu2sgBn2fOgjP2e7E7tdopDeBpAF83irkVJs4dIslFnH3eVWuZ2IWdwDbkDZTknHAEySuyADa5uiT5TtkMzTyX1ONqE4ALtzJ5C8C4Rtle0pCoXg/uBSDJPjmf5FFlMzTzXNKRYfzJFd5z/PcCujRvKJK+iFppRc2FJDnO7k5yQtnLOb7tLf2RpIu9XpHUP9zmxAo6X3R5TvKfCmNt7zwAvztPJQBWA5iSTSBlyiRNAvBAjBtC8t1YkGNi5Y8r0xHPn0pHlrJ3JJ0BYCbJwQkAH5jhJL8qezl5HrWSW0NnVItbyP4kN8cE9ucycVh0+2m/nlM184drvkmyJwHgrbML1bWBjWaXZOOHZ8bMJeluzdts13I1WyQLSF4dzb/DpsPsJJJuaBpKtKd2oR0ZClwJug6vJOHfdTE6XlxPckAY7xbRbWceiHkkJ6Z201l5efw93T8dzkNP7d/Z8C7JfckAAxgI4AmSVSJFTZkkF2BuK/OkX/TKRweALIj7Sd6cfVHS9QAeTkAEALuh/d1Sl5klfQjgmlYBuEqdVQDg2KBTXgawfwbEDJLuq3NFkg9/zRMcUOIsJTuQrVB7AZiAataFTIu8mmPFVpKuNL1LTmB3u1kpyqqV/LUY7HYXisnqDnEqijipOEObVXuEpPtiG+dGxP83WZUWd3C95YIkN+hmGlxKONqsJel6pi2pO8RhUF0YlXQKgDU5s9xGsuY6kh4MiiU9bHRCUEmyC43J6NhC0rV9W5IXRusSWaywV98rnZURJFdI2huAD1mSaaeSnBHgis7ISpLD2rJ+++L1SWT3RB9ghqwmkgzKjX1WNgMYRnK9pAsAuAxYTNLRxu+5l1hYYGRuBGoWkCQzgu4L7kjOgP3WodRRIAGQGJen33VLch7GJr8HAIdCh8Q8yW3MWwDwWS2EkqvS/YBJ2UsyvehHAPIO3QSSj+VNLMkJzKRUViaTdNHYlgSf+jxJk8R1DY3byQ05GS/vMNaSSvii/VEkaxlUUjr5JMY6gt3QluX/eYZLlJ6k+KvUUkpyqj8+OirH300pALWiLSHAJJnVMK/kusqs9RqSTjptS3C0+S1lrF5TTX266uw0gxf2FTf1McDkUWVapZsAKtEqAcIu4FJhZBkT3S0AwVib4lxCspjYCgC+yLBf+0DXYnuRdBGAI5trK+efuouPInLXodMhtCGt3g0AKZp9YB5f1Yhe923JokaHs0sATK8XXnSUXXAkbWEuzd6oXm83ZkpKaPVpSY7J01l6eZFcdESX5cu3jjDWiXHBRLvpcV1WeLGRjC8FEAfbienx6JZmdZC5tttOBuBkeW3ehUZ2FyoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaXfZefc0983MMjv7Zt7MLrvvn93MPec753v33HPuPfcRhukZt+3YeCndCQpeCO3kmWVTTg+HKbocoKHWjpnEuBfMd4GgnJ7ADAcCJzx8iUlE0AGcBOMkiPYz4c1kNPzXodofNAE9fvheQCyBoLvBOA/wHunSHq7CiXM9+BdWGj39nGuxq8dWYyJdxCSh8UKAFoIwBpL/CMidTmzam4MhUzaBmpYjNwmNVoFEA9jdSEx7zzZFPhiM8dotiduYeAFIWw2Wu6TLm7pW1n9SDlbJBK7d+rev/c8du5aAVQC/Lok2dEWNv5djrJBsTat9s2BeA9AiBjaN1s499eXyW/9bCnZJBNIG0AbQKCb8OhkN7ygFvFyZUGvHQ8R4DOBuSWgs5QUFEkiD8nYAuyuJmk5Hw2fKdawc+fGtHeN6mbcAWMxES4NeVlECequ9DoxmMK9yYpHny3FkqLJ6PPFTEG0CyyedWH1zIbyCBPQ2ewYk3ndMI3CWhuTsOhb6uMQTEBWfOdGpr+Zj6ZbNELjdaTQO+tnxda6m9R/XCa74AoLnO42RfUNysJjyuvYqffyo7QA/AKCXQYuSZnhvrorelpgHSW9LSn2jK3r9P/PhBhLY1V6ld1b/HuBPHDOyZricn/jsidEXRnXvIOD+SzaoS7r8/a4Vxrv9SFiJDQDd5NT13IeGGy7mjg0gELLs9QQsQAp3OiuN/wwHgbrfHh4ju8UOEH3XB/9LkvxAbm3RW+yrUIE/MbA3aRqPFyTgFakKcZCJfhK0+gdLbKz1aUjDaJWG5xfCYKADcB9MmtM+zcpksuELMiVn5Ba7fjOgxxMvgjDKMSNLB+tgMb0xW4/UVUpth7dnCnp8so9uJbaD0e3EIj/OqvcR8PY2VPGqJL6jlAISZD9//Op4+zWSqncwcGewLh8il5eeXVF/OFc2XVDpPXDqwezeqY9AyLJfIpbHiuXcYMP+EnqLPREVUGEzMxCDcFC6vUu7mqYf95PV40eamcSUpGn8SI1fmgHLPiUFL+lqjPw50EgZAjVbjk0Wwt0J4LYgNQYOVBE9VKza17QlZglJOx3T+Hofgdq2o3dJKduSpmEEGSlnfOxWe6pwsZOA75Sgt1dUu0s6H552Pkg2ZNm2EKLxbOPU/d4M6FbHBma+IhkzYkHK+ePpKa34d9Kc2pY7VmcdrpfQVNh8OxCT+TVnutGAOZQKlAUQittxIrrgmOE1aQJx+30p8Xh+AQkC01vtR8B4VskxtFlJc8pfPLw2ezokVNjcEIThjRP9zomG+zJLkE7NZnu2EFjvxIzbMzNgH3c1zD233DgapJwd17fYM0DYD8Lo9G/s9GpX1p9ffm2nZ0DDgUAstcsVNAGMWQBtVG80UAeACk3NxTuOaUzOEkg5KVwx4BhYBE237P0A5vYTIXreiYZXpWf1SDNIrCsIwfyCE4s8rA7/qV73EIBrADzimMamQBItdrVegQuOaVSQAui96H6WjBnjAhUzAnXWsXoJt1+Ozgy1O6Zxo+e8JnbBlQ1+JBiIJ02jqW824/Z8EN5KT6R8Uv1R6dzDyTz56T0Ut89UVmk3Ut1W+xZXYlsyapSSKTy4Osu+XwKv+xFWu0aBio1gXA+BhgEkGL9xYsbP8nVrrY4VDG7JklAOhyz7AAGzc3/L6oVa7Y80gWWDIhCKJ9YQ0TO+MybwTVHpnnB7tDcIuDqXBDM/nYxF1haaabX4ZS+8SFAJRa2lrGx+gukjMJgQCllHFxLkH3wc+coxjTHq95otn08mUflLltoTXU1TfKtqqSHrJ9cXQt6Cs+x+izgni6iicgrg0wBtdkxjtwfmHUSqTgGkmlW5jzrB9W0Xai37MQYWAZioml0ADjmmcfNQHPd0cxdxhkC/NFrXdvRWKeWH+YYY+HnSNLzQ0S37OXgtlpyHaYETC3sNqlrLfoOB+/IwzjumcdVQCQxMo/mFzHvD1ertV+UbIynvPttUv7/muS9qRHVK5Xqv0hLT2rOx8NPq/0JrhIF3k6YxZ6gEfApZx68Aqc4Bq7PgqjqDMMPHWCcTzUlGw+211pHvMcRrquXimEZDxvmlRPSyr5MFMlC5hHQrsREQ3Y4Z/oVXyNLNWd7mmMb0LFiOc374Ddn1oFv24r61obCsRAuBVvgpFTqYl0/A/pyJlqnm8KXtdKt9glz+Qe5ZtNayP2ZgwKJjRiwZMyw/w7pl71JNqQHrh/nRZCyyoVxn8+W9fqpGrzhRY5IXupdCJvEiwMfzK57vYswc99KxKGdDCHaihldB+xWfDDiDNyfNyMqhOu8lD6860+TssbKkI6WuSj3oW0yYSZBnwHxKEc3dtGUbYF5Xg/k6CNHDTB9o4A87zfBHl8P5okfKNLvyDvV+BC6Ho4Uwih7qlVK5bZWRJFBSWyUTw+sJtLCSMC+oEz1SBNIda+xj8J6ijS1FQF1kdLtjVYE6ns3thaZ0pAhkMtvkUdq5OfkXHwWau96FxsdBbfWRIJBts0vCLX79qoKt8+zFRrH2+ogQsGwudtFR/IIjeyws0GYvtl8fajbKttVBaM7WGD/MwMuL7EUHwBuRoqeGq2PdV1C9TjSvBWh1sYuNrHwgAS+9pi88tgIYx0TPDFfnOhO2jwI4Iym13O9CI38WSiLgKe1qrwp1VjePxDVrsq6nOf8io1BIlk4gg5B/0S01emew/VSvz+ny3BG56M5/A6odz6T9kIB5DHwFxtsssbuUTw1IYDEI8wm4koF9xO7LI/apgd9UquYwS74HzHeU+LHHeyToLdWcHWq2KjuESjU4Up/b/B9u0kgtWdqPkwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8ZeZuyFmHDk9OmpH2+7my4UB7fmj9wwderpWZBDs4mwHOoPmAzwn1hiV7I9+NpIwNQMwOjtvwWC1gLUwVJuIfA+s73lnZE4N3pP3M6gZSTEeoB3Q/JWs735w1psVQ0g/t6xq+T5uogkrCXQKyDebIaCf63FWTlZI525FUydDF4hGFtFYzYZnzvz82psVwVAOSCI7QA3MuMJU9d2VmO8VhnDsh8gwuMAnWfIh6p5QL4AlFEAO5ixp45yj8T1lkytgdUiH7dOBLMceIYIKwGs9ntYFQFELDtGQJyJ1yZDwadqCWS0spF05qfEtJWl7Eq2N8fL2SsLwLBOtgEybeqa7yyNJthYjEVucSYqRN1HCX3GS6W2DMtmQIRMfUaflx/P4GJ9x6+Tsu6/xGJpIjzjzdEEWEk3tvtQvZzVsgPM9zEwJJhXJMLBfcU60dTJJUzyDSGyX+pqu/Z/pfYuAxA7xPXytP17YvowEdY6xyr4dekjEydxo0oG9170QadY8neS7drbl4KwNzPxLWKqdk/XTTRYPHYZgGgqs0kSLQsExJ1dd8w4MxYAOlP25AaCCv5uD/vHIHP3FdeW2IGTU3I5+WfBvC8RDm4oC0AVKRbUR6Af+u3+kQJ7rPfwNXVi4k4CLS1vg/+Vy/H9m+Y1/82VUdmQwc+T5LbiYnfJDBhW5gWAGk1dWz3SACvpxd8705QbHNwJ5kV+9r2yj2HZOwA+b+rBH7j6wwDyZxt6CcThagqIXwCl47GeTIusJ7Vs7vTTZfDBHGVXPxGa+Y9i2ULFTrHk+92z00UAlv1bSPmfSjnXz3G58c6ej2c1TGjYCYLub4P6JAZXd+szD3vJRnr74xDiy0ld+74aHwZgpOzjknhVtx78i7+T6iU2Wp/OEZzdBcLtVWj1BJB7oFK132hl5gmmXWZYu3YYQDQ9sIiZt5u69pUqnFQtErH6rycWKvhv+ioR9l2QWLU5rJ31kzUs+59E9FAi1LTfmYFo2t7MzFebevBhP+XScTWlVCdOmG3a9uKxSMq+QRB2MvANX5vML4shraNrAWV9ZQEYVuZZIvosEdI6HQCGlUmzpA2lBcTPWLTPXscSv3DkmOeZ4WCv+ho7cPLGXC63i0A3+dnIj9NvTL1pOLP46UR67fkkeJOpB0MFAPZhxoSFSX3av/2U3XHD6m9j0H4CTSz89kmgoeGG+NwpA3kH6PGzxcAOAbQyMI8IW9QT9dNR4xHr1PWEobdMXZvjAIik7OzpM01Xl14DKxkzLHs/gIXFMgR6KqE3rXVsqqUlRKy8DX7e1IM/2nCgvzmQFQdBaAFjnRnWtvqBcK6nUwY+S4a1OlLswfnc5x+ZejDop+iOq/VNhEtytLOKwIeSevBmFXxgQt3u3FC2wwsEMT+bCAcfGbZn9S8liNcdG1J2qf8qnTsps/ApTe+Glck0Bq66mWJ99m3MeC4R0vwzRcFYpM++lyRe8QKsTo1STtgC4KsiQB2lIAj4eULXflaqG7UG1jD4aReECthI2z1gzC/+zdWLpu33ifDgiAAYVn8nIJ70BBAQX/siK480CLwKJq0YBIG7E3owUm6mnc0/JJ2VoBKK2ksXZ6DkhOoCGMkSilr2cgb+4BHIOVPXJqvfN1rH5giqT0gORLv1azyrarVL1ktueAl5beKiLKL4nuMg9BPxtkQouEfJOxeR1ubjAKaXbOJ0Qm8aPi5E0gOPE7ACzLMAtBJwMKFrt44mcKV7ySZWPxjWpWk0lrLnSsK7pY4Y9FhSb3KWjpG2fwmGk3HcD5NYlgzNcAgqI22/CsY9JTbOmro2ZbQALkujpYWs8IRVSa8vdUa53OLEvJb9sZ5Pp3F9tsettAyKJPWm7vwDKbNHCG+bIW3BqAFcVsj6BkzkuNEMa+td4woUQG0ezgYCCCyI69MPRdL93yYWLyvKJRnWOpy1n7ZXC8aLXkGWy0C1AjJS9hYE6LzZ1mTkK7EiZ6V4ztS1G11jbnCegRB3uPshms6sdL87+8nKPE2gNV565S7mNQOw7L9DyAcVOXzxOG3ZRyBz3y2+ixqW/QEAj01HD5t606+8HEdS9u4CKVUyLB819ebNtQZbKq/4VIjA70xdm63GigBkXmDJhy+reB6b0b3u5fO0nA8hOKlrTgUtLj7Dmxu8LakHfzLa4J0Zdo4oNMe9VlZ1pYyoUk/i62DSAc6wlMfzpf7ioc0lwAqsxnUEugDB7yCLd8127f0rEXzFK2U+e9R2qfcCcCUCLWej4qXeAVAjrTKeAKqiVRQItQQgaLng3BI/Jnq8ACjGWlLgTUjeW5HYUgCcRsZgfY9UG7qQ28tN6XgBUJlNCJoj6gcXlDY+PMndwmb5wI9WHw8ALs0O4tu8+KoK9Hq+sVGJXh8PAHl6vXyjo3KDo3AtLEezVzqvjzYbubQ6A3G3xpQ5nlR25TY6iLGF6kRyrBhrNwrFRHNWRpiwvlJjw5WvqvuSb3gEfs2gIAFPjhVznU+VeJTAGSFyP/ZqaJQ+7qoAKCXV+OBTdnw82qw0TYuXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1RJREFUaEPtmT1oFEEUx9/bFLFKJzG2WiknZObFxlO8RtFC8SuFWlrYGBtRRNCghV9YmFQWgoVaaAS1ULRRRKvbmYBBQezVYBOIGFMkT0ZuYXPufOxdspuDO7jibmfe/H/z3sy8eYvQ4R/scP3QBSjbg8EemJyc3La4uHgUETcx82YAWNum+N8A8IWZrxLR41ZtBQForUeY+Xarg/j6MfMVIrroa5f13AuglOJWDLfQ56aU8mzefk4ApdR9ADiW12ir7RFxXAgxkqe/FUBrvYeZXzQbY+bh3t7ed5VKZTrPQM2eNHYQ8VGGjTtSypOhtq0AcRyPIeKptCEppTfkbAM3AxhbcRwfyYJg5nEiCvKEVZBS6hUA7EoEIeJ+IcTz0JlpbpcFYNrYIBDxlhDijG88lwd+IGJ/YoCZ1xPRd5/BUA/Mzc31VavVWRcEM18jovOuMV0eWLL7tBM+RoBS6isAbEzERFFUHRwc/JD8dnjishDikg2iSIAJADiU8uhdIjqRFuZYEweI6Gmuc8AWs6EhVK/XR3t6eg4zMyKiEQ/MvOSwQsS3iHhhZmbmY61W++UIp/dSyu2FAmit3zDzTjMoItaFEFuVUt8AYCB0ElLtZqWUfYUCZHlQKXUQAJ60AAC2Nbhia8AWglprAoB7jYQwmGXVACSKzRqJomgLAJjvBh/JqgPwCQ7dRAoPIZ/w5HkXIHQGQlOHvCd56PjdEOpoD6TShT/MfD19OXeFQCPnOYeIaxYWFiaGhoZGQ9Pv5nZthVA6XWjkOsMJRGj+b/IhIURtVQCkIUJvYKUCONLf/+67tjuw+T+rLlTYLmSDCDmwbOIbF6CgC1Vba8B3m3JBuMQXDuC4iGQy+MSXAhAKESK+NAAfRKj4UgFsEHnElw5gBGit9wFAUqy9kbco1vY2Gsfxsha2QrbV1K42gIimAPDvw8zTRLQuy0ZhpcU8AMZ7zPws1ee1lHJ3LoDlLu7mAcioZFuLvYWV130AU1NT/fPz8zuyqtWIuFcI8TKXBxo7QaEvOCyQD6SUx20T4K33F/iKKVOj7yrqBWhsiSv6ki8zNBBPCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABm1JREFUaEPVWWuIVVUUXmvfYRosHzUZUUqKjkSXSe5Z+5qJhfawLELCR5ohPhKjjB4EWgkpkopRSWEPS1Mqy7Gkd0iPGaKy6ey9Z3z0opwEQytSMiS5NZ4Ve7j3dubMOfecO96buf/cx17rW+vba52919oH4RQfeIr7DxUjoLW+BhHHAsAAZh5gPwGghpl/TKVSHZ7n7T9+/Ph+ANg/atQo+1mRcUIEtNYzAWAiM09ExLPK8KgNADYw8wYp5Z9l6PUQ7RWBvON3AMClJ2Kcmb9DxAKR33qDVRYBrfUNzLwQESf0xliUDjPvR8T1RLSsXNzEBIwxc5l5fYSBnxGxxfO8bQCwN5VKHc7lcofr6+tzR44cGcTMg4UQgxDRfp8IAJdH4KwlooXlkEhEQGv9EAAsDQF+GwDWEdE75Rg1xlwFADcx83QAOCOg29SvX79ZDQ0NuSSYsQS01h8BwBUBsF45HnTIGHMBM9uFmR2Ya0bEWxzHORBHoiQBY8xmZp4RAFlNRIvigMuZN8asYOb7Azq7hBCTMpnMvlJYkQSMMUuYeblf2fO8ZdlsNiyVyvE3VNZ13XFCiGb/JCK+6DjOrLIJ2N0GAN4KKG4hIpuzVRtKqf6I+HvAwAIiWhdlNDQCSqntga3yUyK6rGqe+4Db2tqu8zzv3cJfiPiLfQYdx/k6zH4PAvlD6iWf8B7P8yZls9mO/4KAtaG1fhgAHvCReN1xnClJCXweOGFLhrAapJqamlLDhg372H9eMPNMKeXmoL1uEVBKTUXEJp+QJiJZDSfjMIOZgIibHMcJbrfdq1Gt9WMAcI8P/D9f/YJtpVQfW7n6isSDRHReyQhorXcCwMV5oWN1dXWD0un04bjVqta81to+i7bi7RpCiAmZTOYDv71iCu3cuXNQZ2env07fRkSTq+VcEtyQ7XwNEfkz5N8Ucl13khDiDR/b+ZlM5vkkhqopo5Q65Euj74loRGgElFJ3IuIThUnP8xqz2eyeajqXBFtrvR0AiuU7EXXbeIo/tNaPAMB9BVBmrpVS/l3KiDFmBjNPKbMbK0A+6zjOq3EktNavAUAxlUsR2AIA0ywgM3dIKYfFgRtjmph5apxc2Dwz/ySlHBynq7V+wV+tliLwPgBcmwdsJaLRceDGmD3MnI6Ti5j/g4j6x+lqrZ8EgGKTE0nAGPM0M9+Wj8BhKWV9HLjrukuFEPMBoMf+HKdrm3oimhcnFyy1IwkopRYj4soCYF1dXf3JPAMKfiilNiFisaSOJOC67nQhxCu+h3i0lLI1boWqPW+M6WDmoXk7+4io8L3rr+IuZIwZycztPocWEdHqajtYCl8pdSEifuOT2UhEc/w63fZUrfWvADCwixlii+M4408mAa31AgB4xufDHCLaGElAKbUZEf09cAMR/XCySGit7TXO3IJ9IcTQYI8cLKfvQsQ1BYVq9sBxi9La2jqipqbmMwA4Oy8bWtoHCTiIaBua0/JKB5hZSikPxhms9LxSah0i2i26MHoUct0eYt+2tRIRF5/MKGit7YFqD9auYU9tRBwfls49emJjzEBm3gEAxVKCmadJKbdWepWj8LTWHwLAlb75hUS0Nkw+6lbidkTspoCI6aibgUoSU0otR8QlBUxE3Oo4TleNlpiAFQwWUfa/XC7XZ8yYMccq6bAfS2v9OADcHUidqUT0RdkE8iS+BIBsQHkkEe2qNAml1HOIeGsA914isqQiR5LL3aMAcHoAYTIR2av0Ex7t7e3ne563mplvDoIh4le2xC+VurEE8pGwh1m3/sBec3ie96iUcndvWLS3t4/o7OycK4SYw8znRKZIDIlEBPIk7IrfGDB01JIAgJZsNtuShIjruplUKmWdtidsMLK2lFmFiPP8fUapSCQmYJ2L6cDsNfh7iLiXme1VjG3GOwFguOd5DYg4HAAa7O/Q3QTRXiavchxnhzHmIgCw3V6xWYoiURYBa9h13atTqdTssJxNEoEImQeJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABS1JREFUaEPVmgmoVVUUhr+fosKC5ogGSsqIpKQwMqjIBpsICdMGQ7ISo4wGApugJCoxLClssElpNEuaI5okKjOI5onKhEQrSiKiaKA/Vu3zOu+8c88593qvj7fgcO99e6/h33udtdda+4khThri9tM1ALaPAQ4Btso9GwNfAyuBb7JHUnzvCq0XANuTgePSs00bFr0L3BuPpF/b4BswtSMAyfDzgYPXRznweQ7ID53IaguA7ROBGcC4TpRV8IRL3SNpVrtyGwOwfVYoaaHgW2AZsBT4CliXnt+BXYBd02d8D5c7rIWc+ZJigRpTIwC2rwauKZH6NLBA0jONNQK2jwJOAU4FtijwPgpMkRTga6kWgO2XgSMKkjoyvGiN7d3SwpxZGHsVOEPSmjoElQBsPwScVhAyR9LMOsHtjNu+Hri8wPMBMF7SqipZLQHYvgq4tsA8S1KZK7Vjb+lc24cDsfJ5ul/SlLYBpGjzVIFxsaTw2Z6R7S2BnwoKpkta0Epp6Q7YfqEQKl+XdGjPLM8Jtn088GzuT9/FOyjpkzL9AwCkQ+qB3OSPki9GOrBByPZ1wBU5ZY9LOrkpgDcLJ2zlFvYCke2NgFcK58VkSRFU+lG/HbA9EYg4nNE7kkb3wsg6mSWesEhSMdz2z0Zt3wRcnBO+wVc/0217WMpesyRxraSd6nbgfWC/NOm3OP4lRVowKGQ73sXIeDMaJ+nFvDF9LmQ78pR8nr5U0oRBsTwpLQnn8yTlPeR/F7I9HngiZ/A0SXcPJoDQbftHIHOjLyTt1WoHLgBuyQ3uKylC6KBS8UyS1C/w5F3oRuDSnLWbSPqzynrbkSdFfG6nGstE3inpkbrVsf0Y0OfKVQAWA5OSwJWS9mggPEJuhN5OaLWkqBMqyfZ9QF/4rALwPHBskrZC0pgGwsPFRtbNazH+s6TIfeoA3JqqwH/nVQG4HTg3SVsnadsGwiMznQYMiM91vKmgP7tuXjHVrgJwGXBDTuC2g3kGZHbYXhQVWva7CkCkyg/nAIyRtKJuhXo9bjuSyOFJzypJ2ff/XCqHdBTwXs6gmZLm9NrAKvm29wY+zc1ZKGlqnqeYzH0PbJ8mLJM0dpABTAfuyNkwVdLCKgDFGniEpC8HC4TtaONEOyej4cUaubgDFwLzcgw9q4HrFsV2pAxvANuluaWpfRHAAUAUNJsmpmhrjJa0tk5ht8dtRx0cITqjAYlcv5c49zJHKI2QmtEG3wXbcaDGwZrRamBsmTuX1cTxEi8H8qnEJElLur3KreTZfgk4Mjc+Q9L8svmtuhLnAUWGka06A90EZjt6UdGTymiJpCxHG6CqqrHVL4lKnMMkRaXWE7J9M3BRwXUmSnqrlcK61uLbwIEF5lGSou3XVbJ9F3BOQeglkgJUS2rS3P0F2LwgYYKkaKWvN9neGYgT//QSYR9Hil/lurUAQqjtOMyK9UEkWXMlfdgJihTn45CK1GCHChmVIBoBSCBixU8qKIrdmRuXG5LigqOWbO+fjA7jizsbqcxsINLsfJ3REkRjAAlEVQUWbfDncjc0UYz/BewJjCh8lgGNZvJsSctt75MabLUg2gKQQBydSrwyn63dgRYTrpQUdwR91BRE2wAyDbYPSk2nuPOKVW6X4t15EHhS0mdlzE1AdAygsFpxwX0CEJcUuwM7lhgULhW5VRgeHYnXmiBuAeI2SXHN272b+gKgzRKQrYFIBNdI+qOJwQ13oi8/68oOdGpYO3xpJ2LV/45zI/t3hSEDoBXYIQ/gH99H3EBePlczAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmTJl2cyWTaAOBA+TDzgYjYDAB/y4eZ5fNjc3Pze7NmzfqlUYEbFwBr7TUAcAEzXwAA2bROIeKnzrkNALBeKWXTysXx1QXAGHMVANwEACePxzgzjyLi057nrczn81vr0VUTAGOMRPtmRDy7HmOVZBDxL+fcyr6+vgc7OjqGatGdGoC19hZmfrKC8t9LafEWAGzLZDL9g4OD/S0tLYM7d+6cyszTPM+biojy97kAcGoFPV8ODw8vbG9v354WRCoAxpiXAUDyPUrvAcAqIno/rUHhs9aeCQALmflyAJgUlkXEf5xzp6U9G4kAjDHcKMejeqy1xzDz/QBwXYyNViL6ISkwVQEYY74AgLkRJcuJ6M4kxbWsW2sfZua7ozJNTU1HtLW1/VFNV0UAxpjlAHBHWNg590ChUJCINZyKxeLpnud1RhSvmzJlyiWtra2DFS+AuAW5bQDg3cja60QkObvHSGstj588fGVi5heVUktqAqC1Xh+5Kj8nolP2mOchxd3d3ec55z6I2JpPROvj7I9JodIj9UqIebNz7qJCodD3fwAQG8aYhwDgnpC99UQ0Py2ALyMv7DIiWvV/OS921qxZk5k+ffon4fcCEZf4vv9i1I/ddkBrfSUivhpiMkSkanXeWnsFAFwCADNHR0fX1nPwYzJhAxGdkwTgJUQM38l1Rd8Y8yYAXFoytoOIjqo1CFrriQDwCyIeEsh6nndsPp//KayrvANbt25tHhgY+AsA9i8x/JvNZqfmcrn+Wo1bazuZ+fRAjogSH8w4G8YYOYtSOAZ0GxE9EQvAGCMRk8gF9BYRLajVeeFvIIDdrnOpt3zfnxcLwFr7CDPfFdqupfl8/oW9CUBsa63/DKXRz0R0TCUAzzDzDcGic25WoVDYvLcBGGPk/i+X7wMDA/vNmzdvJPCrnJvW2leZ+cpggZknKKWGqwGw1l7IzOcg4swoX/gMyNbH6HnO9/3XkgJkjFkLAOVUzmQyM2bPnr1lDABjjJTE58sCM/cppaanUK4BgJL44taZebtSalqSrDHmpXC1ysynKKU+j9uBj5hZ6nShLiJqT1Jurd3MzLkkvgrrfxPRwUmyxpinAODmSqkdTqE3mPmy0g70K6VakpQXi8X7Pc9bCgBHJvHGrEsjtCxJLlpqDw8PTwt3bGEAzzNzuerLZrMt9bwB4lCjrtHSLbQaEa8NgGaz2cm5XO6fuDPwGADcHjrE7UqprqQIxa03EoC1to+Zjy3ZGZN25R3QWt+IiCtDDt1JRNLU1EyNAqC1PgERvws58DYRSY1VpjKA3t7eaUNDQz+Xtybm1UuLpFEAjDFyRp4N2a1cSsTlLgCkaqyjwBoIQMrnRYH+0dHR/Jw5c3pid6B0YO5GxIdDV1ZdPbC19nLn3GOIOAUA1hLR4rS7F/B1dXUd39TUJEOFQ+U7RNzo+/5ZUT3RfsBHRGloZCgrtIOZlVLqt1odGC+/1noVIsoVHdAiIpJHbTcaU+ZqrR9BxHJRtycnEZVAGmOkfVwXOo9bJk+efGLcdGIMAGvtYcz8FQCUSwlm7lBKvTHeqKaVN8ZsBIAz0qRybKMRc6VKDuZ83/82rRP18mmtH0TE+0LyHxNRUOKMUVuxU7LWlkuLQGpwcHDi3Llz/63XuSQ5Y8zjAHBrwMfM/cy8oFAoxFWzu9iSRou/xtQ5bUT0dZIzta5rrZ+XyUNYDhFv931/RTVdVQF0d3e3OufKtXdI0QIiklH6uKmnp+co59zycC8SOrzfAEBHtdRNbLaLxeIMz/O+H3N9Ia52zq1QSvXWg6Knp+f4kZGRRZ7nXc/Mh1fSgYhVQSQCEMW9vb1HDA0NyS0UHS/KLF+2+NNqeRp2rlgs5jOZjDgtL+wBEcdlEv0oIi4O9xnVQKQCIEZkTuN53uqgZ4iJmMxrPkTEbXL4AECaceldj3POtSLicVKayP9x0UZEGSY/6vv+V9ZaaVHXpAGRGkBgtFgsnpXJZK6Ly9l6Uqkkcy8RlUsY+S4tiJoBBE5qrU9CxKvlZ1YA2G3UkRJIr4wxnXPvKKXGnLG0IOoGEHZSnn5EvIiZTwKAowEgrh39U2orRJRDLxOJz9IAjdsJAHiGiORn3sb8Uh91ZNOmTQeMjIwcjYgHIeJvEyZM2JHL5Wr6+TSsMwoCEVf4vr+re2zIDqSJ5Hh5BAQzS9R/IiJpf3fRPgOg4jsx3sjsbfn/AH37LF5g3/BiAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABYZJREFUaEPVmXmoVVUUxn8f0WRzVkJlIWVGUmIJWWADTVaUldFclCnSQBQYNv1RSCWGVFRSlkRh0GBS2YBmJWGJUBHNNJiYWQSZfwTRxBfrce5jv/3Ovefc++4z3oKLD/fea61v7bXXdMQQJw1x/ekKANs7AOcA44Ddkt/2wJbk9z2wTNIP3TLcgADYvhw4q/gFiLq0ClgBLJf0Ud1DZfs6AmD7UuA64JiBCAf+BR4GHpH0TSe82gJgO6x9PXBqJ8JanPktQABzJP3VDu/aAGzfADzYhPnPQLjFUuA7YHPx+xPYHxhZ/Bt/nw4c14TP+8CFkjbWBVELgO2ngfD3nJYBCyW9Wldg7LN9cigKXATsnJ39HTi+7tuoBGDb3VI852P7QOBO4MoSGaMlfVtlmJYAbL8HHJsxmSdpdhXjdtZt3wPcWnJmhKRfWvFqCsD2PODm7PBdksJiXSfbJwDvZIzfAM6VFG+plEoBFNHmlezEc5LCZweNbEcSjMSX0iJJ09sFsDwLlaslTRo0zRPGts8AXstkTZYUOvWjfjdQJKnFyc7PgCmS1m0NACHD9t3AbYm8yNiT6wKIWJxm2JmSFm4t5QsA2wBvZ/liuqRFuR59bsD2JcAzyaYPJU1oV3nbF8fjAw4DlnTy8Es8YYWk06oAPJnF5I6sb/tF4LxC2CZJ+3VghGFAVK17JmdHSVqf8uq9AdtR+kZNsmOx4Y9I/5KiLGiLbEc4jLDYQ5IqE2aZANvxFqNwbNBNkh5oBiAsFpZr0FJJU9vSvNjcRQBRPKbhfJWkE5sBuBe4JVmcIemJ/xNAyLb9a+JGGyRF+dFLqQstAK5J1g6XFCG0berWDRQA8py0raR/et2z8YftiD4RhRq0naS/W2lv+2wgIkNEm5x630BRaufrj0l6tso6tpcAqSuPkfR1GYAoic8sFtZJOqgG8w+Ao6r2NVnfKCn6hJZkO4+MkyStLgPwJhB1etBaSRNrMA8XG1u1r8n6Fkl7VJ21/VDRBTa29nHt9A28AJxf7NosaXgN5lGZzgD2rdpbsh6N0MyqcyWl9si0Y0sBPA6kVd/wTnJAKNTlR/wUcEUCdBdJ0bX1UArgPmBWsnGipLVVFipb7zKAKCJHFXL6uV0K4NpiMtDQabakaGrapm4BsH0o8GWiwEuSosbqpRRARIQNyVq/rFcXSRcBxBt5NJHbvJQo812gVmOdA+sigCifpyX8x0v6uPQGCgDRWEeD3aCOemDb0XrGm9q1KKevrnt7jX22DwFiqLBX8X8rJZ2S88n7gSOBaGiiMg3aBEyQ9FO7Cgx0v+1ooiJEN2iapEhqfaispcyLuo5uYSAAbEf7GBOJBkXpcETZdKIMwN7AGiAtJS6QFIluq5DtlcBJdVy52VglD6nBa6ykLwYbge05wB2JnLckNUqcfuJbDbbS0qJxcJik6NQGhWzfD9yYMI9ucKqkGByXUtVo8ceSOmecpE+6jcB2XsqEiFmS5reSVQVgNNBbeyeMwioxSh8w2Y6GPzJ+2os0+H4OxPtr6rqVzbbtMcBXJZpGkTVf0qedoCjifCSpq4B9WvBoCaISQDC2PQKIN5GPF6MqjCuOsqOpn6bK2R5fKB3K75QpHpPouUAkvrTPaAqiFoACRMxpwuqNniE3WsxrXk++0EQzHr3rwVGSZP+WGTymD3MlrbEdLerzdUDUBtCQaDvSeXyQKPPZTrwpztwuKS1h4tZrgWgbQALkaOCy4hNrn1FHTRTxdmKQ8LKksjdWC0THADK/jtQ/BQhQBwBl7Wi4VNRWoXhMJN6tA7TJTSyQFJ95u/OlPlfEdjzOALI7EIVgzEfb+nyaGSh3p4h+Pd1jV26gjiUHuqe4ibD6eklRqvfQkAHQzABDHsB/7aMVT352GH8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{display:block;position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');var ed=function(){function e(t){var r,i=this;S(this,e),this.player=t,this.TAG_NAME="Control",this.extendBtnList=[],function(e,t){e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");var r=e._opt,i=r.operateBtns,a='\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n '.concat(r.playbackConfig.showPrecisionBtn?'\n
\n
'.concat(Ou.narrow,'
\n
').concat(Ou.expand,"
\n
\n "):"","\n
\n ");e.$container.insertAdjacentHTML("beforeend","\n ".concat(r.background?'
'):"",'\n
\n \n
\n ').concat(r.loadingIcon?'\n
\n '.concat(Ou.loading,'\n
').concat(r.loadingText,"
\n
\n "):"","\n ").concat(r.hasControl&&i.play?'
':"","\n ").concat(r.hasControl&&i.ptz?'\n
\n
\n
\n
\n
\n
\n ').concat(r.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':"",'\n
\n
\n ').concat(r.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':"","\n ").concat(r.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':"","\n ").concat(r.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':"","\n ").concat(r.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':"","\n ").concat(r.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':"","\n\n ").concat(r.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':"","\n
\n
\n "):"","\n ").concat(r.hasVideo?'\n
\n
'.concat(Ou.narrow,'
\n
电子放大
\n
').concat(Ou.expand,'
\n
').concat(Ou.zoomStop,'
\n
\n
\n
\n
00:00:00
\n
').concat(Ou.recordStop,"
\n
\n "):"","\n\n ").concat(r.hasControl?'\n
\n
\n
\n '.concat(r.showBandwidth?'
':"",'\n
\n
').concat(r.controlHtml,"
\n
\n ").concat(r.playType===z&&r.playbackConfig.showControl&&r.playbackConfig.controlType===ye.normal?a:"","\n ").concat(r.playType===z&&r.playbackConfig.showControl&&r.playbackConfig.controlType===ye.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':"",'\n
\n ').concat(r.playType===z&&r.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(i.close?'
'.concat(Ou.close,"
"):"","\n ").concat(i.logSave?'
'.concat(Ou.logSave,"
"):"","\n ").concat(i.performance?'
'.concat(Ou.performance,'
').concat(Ou.performanceActive,"
"):"","\n ").concat(i.aiFace?'
'.concat(Ou.face,'
').concat(Ou.faceActive,"
"):"","\n ").concat(i.aiObject?'
'.concat(Ou.object,'
').concat(Ou.objectActive,"
"):"","\n ").concat(i.aiOcclusion?'
'.concat(Ou.occlusion,'
').concat(Ou.occlusionActive,"
"):"","\n ").concat(i.quality?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(i.scale?'\n
\n
\n
\n
\n
\n
\n ':"","\n ").concat(i.audio?'\n
\n
\n '.concat(Ou.audio,"\n ").concat(Ou.mute,'\n
\n
\n
\n
\n
\n
\n
\n
\n '):"","\n ").concat(i.play?'
'.concat(Ou.play,'
').concat(Ou.pause,"
"):"","\n ").concat(i.screenshot?'
'.concat(Ou.screenshot,"
"):"","\n ").concat(i.record?'
'.concat(Ou.record,'
').concat(Ou.recordStop,"
"):"","\n ").concat(i.ptz?'
'.concat(Ou.ptz,'
').concat(Ou.ptzActive,"
"):"","\n ").concat(i.zoom?'
'.concat(Ou.zoom,'
').concat(Ou.zoomStop,"
"):"","\n ").concat(i.fullscreen?'
'.concat(Ou.fullscreen,'
').concat(Ou.fullscreenExit,"
"):"","\n
\n
\n
\n "):"",'\n
\n
\n
\n
\n
\n
\n
\n
\n ')),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster")}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg")}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image")}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading")}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text")}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play")}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big")}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording")}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time")}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop")}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause")}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls")}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom")}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left")}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right")}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume")}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap")}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text")}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel")}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle")}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio")}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen")}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit")}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record")}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop")}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot")}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed")}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html")}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time")}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner")}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll")}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list")}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap")}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap")}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time")}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text")}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns")}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow")}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand")}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz")}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active")}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls")}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active")}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control")}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow")}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand")}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow")}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far")}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near")}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far")}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near")}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play")}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause")}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open")}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close")}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open")}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close")}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text")}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu")}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list")}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text")}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu")}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list")}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom")}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop")}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow")}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand")}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2")}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close")}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls")}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel")}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance")}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active")}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face")}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active")}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object")}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active")}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion")}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active")}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus")}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text")}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu")}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list")}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave")}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple")}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip")}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover")}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played")}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator")}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time")}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message")}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close")}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content")})}(t,this),t._opt.extendOperateBtns.length>0&&t._opt.extendOperateBtns.forEach((function(e){i.addExtendBtn(e)})),t._opt.extendDomConfig&&t._opt.extendDomConfig.html&&this.addExtendDom(t._opt.extendDomConfig),r=this,Object.defineProperty(r,"controlsRect",{get:function(){return r.$controls.getBoundingClientRect()}}),Object.defineProperty(r,"controlsInnerRect",{get:function(){return r.$controlsInner.getBoundingClientRect()}}),Object.defineProperty(r,"controlsLeftRect",{get:function(){return r.$controlsLeft.getBoundingClientRect()}}),Object.defineProperty(r,"controlsRightRect",{get:function(){return r.$controlsRight.getBoundingClientRect()}}),Object.defineProperty(r,"controlsPlaybackTimeInner",{get:function(){return r.$playbackTimeInner&&r.$playbackTimeInner.getBoundingClientRect()||{}}}),Object.defineProperty(r,"controlsPlaybackBtnsRect",{get:function(){return r.$controlsPlaybackBtns&&r.$controlsPlaybackBtns.getBoundingClientRect()||{width:0}}}),Zu(t,this),function(e,t){var r=e.events.proxy,i=(e.debug,e._opt),a=i.operateBtns;function n(e){var r=t.$volumePanel.getBoundingClientRect(),i=r.bottom,a=r.height,n=t.$volumeHandle.getBoundingClientRect(),o=n.height;return Cn(i-e.y-o/2,0,a-o/2)/(a-o)}if(In()&&r(window,["click","contextmenu"],(function(r){r.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1})),r(t.$controls,"click",(function(e){e.stopPropagation()})),a.play&&(r(t.$pause,"click",(function(t){i.playType===z&&i.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:vo(a.pauseFn)?a.pauseFn():e.pauseForControl()})),r(t.$play,"click",(function(t){i.playType===z&&e.playbackPause?e.playbackPause=!1:vo(a.playFn)?a.playFn():e.playForControl().then((function(){e.resumeAudioAfterPause()}))}))),r(t.$playBig,"click",(function(t){i.playType===z&&e.playbackPause?e.playbackPause=!1:vo(a.playFn)?a.playFn():e.playForControl().then((function(){e.resumeAudioAfterPause()}))})),a.screenshot&&r(t.$screenshot,"click",(function(t){t.stopPropagation(),vo(a.screenshotFn)?a.screenshotFn():e.video.screenshot()})),a.audio&&(In()&&(r(t.$volume,"mouseover",(function(){t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),r(t.$volume,"mouseout",(function(){t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),r(t.$volumePanel,"click",(function(t){t.stopPropagation(),e.volume=n(t)})),r(t.$volumeHandle,"mousedown",(function(e){e.stopPropagation(),t.isVolumeDroging=!0})),r(t.$volumeHandle,"mousemove",(function(r){t.isVolumeDroging&&(e.volume=n(r))})),r(document,"mouseup",(function(){t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),r(t.$volumeOn,"click",(function(r){r.stopPropagation(),xn(t.$volumeOn,"display","none"),xn(t.$volumeOff,"display","block");var i=e.volume;e.volume=0,e._lastVolume=In()?i:1})),r(t.$volumeOff,"click",(function(r){r.stopPropagation(),xn(t.$volumeOn,"display","block"),xn(t.$volumeOff,"display","none"),e.volume=In()?e.lastVolume||.5:1}))),a.record&&(r(t.$record,"click",(function(t){t.stopPropagation(),vo(a.recordFn)?a.recordFn():e.recording=!0})),r(t.$recordStop,"click",(function(t){t.stopPropagation(),vo(a.recordStopFn)?a.recordStopFn():e.recording=!1}))),r(t.$recordingStop,"click",(function(t){t.stopPropagation(),vo(a.recordStopFn)?a.recordStopFn():e.recording=!1})),a.fullscreen&&(r(t.$fullscreen,"click",(function(t){t.stopPropagation(),vo(a.fullscreenFn)?a.fullscreenFn():e.fullscreen=!0})),r(t.$fullscreenExit,"click",(function(t){t.stopPropagation(),vo(a.fullscreenExitFn)?a.fullscreenExitFn():e.fullscreen=!1}))),a.ptz){if(r(t.$ptz,"click",(function(e){e.stopPropagation(),xn(t.$ptzActive,"display","flex"),xn(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),r(t.$ptzActive,"click",(function(e){e.stopPropagation(),xn(t.$ptz,"display","flex"),xn(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")})),t.$ptzArrows.forEach((function(a){if(i.ptzClickType===me)r(a,"click",(function(r){r.stopPropagation();var a=r.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-".concat(a)),t.$ptzControlCircular.classList.add("jb-pro-ptz-control-".concat(a)),e.emit(Ct.ptz,Mo(a)),setTimeout((function(){t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Kr.forEach((function(e){t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-".concat(e)),t.$ptzControlCircular.classList.remove("jb-pro-ptz-control-".concat(e))})),e.emit(Ct.ptz,Yr)}),1e3*i.ptzStopEmitDelay)}));else if(i.ptzClickType===ge){var n=!1;r(a,"mousedown",(function(r){r.stopPropagation(),n=!0;var i=r.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-".concat(i)),t.$ptzControlCircular.classList.add("jb-pro-ptz-control-".concat(i)),e.emit(Ct.ptz,Mo(i))}));var o=function(){n=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),Kr.forEach((function(e){t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-".concat(e)),t.$ptzControlCircular.classList.remove("jb-pro-ptz-control-".concat(e))})),e.emit(Ct.ptz,Yr)};r(a,"mouseup",(function(e){e.stopPropagation(),n&&o()})),r(window,"mouseup",(function(e){e.stopPropagation(),n&&o()}))}})),i.ptzZoomShow)if(i.ptzClickType===me)r(t.$ptzExpand,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,Xr),setTimeout((function(){e.emit(Ct.ptz,Yr)}),1e3*i.ptzStopEmitDelay)})),r(t.$ptzNarrow,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,Zr),setTimeout((function(){e.emit(Ct.ptz,Yr)}),1e3*i.ptzStopEmitDelay)}));else if(i.ptzClickType===ge){var o=!1,s=!1;r(t.$ptzExpand,"mousedown",(function(t){t.stopPropagation(),o=!0,e.emit(Ct.ptz,Xr)})),r(t.$ptzNarrow,"mousedown",(function(t){t.stopPropagation(),s=!0,e.emit(Ct.ptz,Zr)}));var l=function(){o=!1,s=!1,e.emit(Ct.ptz,Yr)};r(t.$ptzExpand,"mouseup",(function(e){e.stopPropagation(),o&&l()})),r(t.$ptzNarrow,"mouseup",(function(e){e.stopPropagation(),s&&l()})),r(window,"mouseup",(function(e){e.stopPropagation(),(o||s)&&l()}))}if(i.ptzApertureShow)if(i.ptzClickType===me)r(t.$ptzApertureFar,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,$r),setTimeout((function(){e.emit(Ct.ptz,Qr)}),1e3*i.ptzStopEmitDelay)})),r(t.$ptzApertureNear,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,ei),setTimeout((function(){e.emit(Ct.ptz,Qr)}),1e3*i.ptzStopEmitDelay)}));else if(i.ptzClickType===ge){var c=!1,u=!1;r(t.$ptzApertureFar,"mousedown",(function(t){t.stopPropagation(),c=!0,e.emit(Ct.ptz,$r)})),r(t.$ptzApertureNear,"mousedown",(function(t){t.stopPropagation(),u=!0,e.emit(Ct.ptz,ei)}));var d=function(){c=!1,u=!1,e.emit(Ct.ptz,Qr)};r(t.$ptzApertureFar,"mouseup",(function(e){e.stopPropagation(),c&&d()})),r(t.$ptzApertureNear,"mouseup",(function(e){e.stopPropagation(),u&&d()})),r(window,"mouseup",(function(e){e.stopPropagation(),(c||u)&&d()}))}if(i.ptzFocusShow)if(i.ptzClickType===me)r(t.$ptzFocusFar,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,ti),setTimeout((function(){e.emit(Ct.ptz,Qr)}),1e3*i.ptzStopEmitDelay)})),r(t.$ptzFocusNear,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,ri),setTimeout((function(){e.emit(Ct.ptz,Qr)}),1e3*i.ptzStopEmitDelay)}));else if(i.ptzClickType===ge){var h=!1,p=!1;r(t.$ptzFocusFar,"mousedown",(function(t){t.stopPropagation(),h=!0,e.emit(Ct.ptz,ti)})),r(t.$ptzFocusNear,"mousedown",(function(t){t.stopPropagation(),p=!0,e.emit(Ct.ptz,ri)}));var f=function(){h=!1,p=!1,e.emit(Ct.ptz,Qr)};r(t.$ptzFocusFar,"mouseup",(function(e){e.stopPropagation(),h&&f()})),r(t.$ptzFocusNear,"mouseup",(function(e){e.stopPropagation(),p&&f()})),r(window,"mouseup",(function(e){e.stopPropagation(),(h||p)&&f()}))}if(i.ptzCruiseShow&&(r(t.$ptzCruisePlay,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,ii)})),r(t.$ptzCruisePause,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,ai)}))),i.ptzFogShow&&(r(t.$ptzFogOpen,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,ni)})),r(t.$ptzFogClose,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,oi)}))),i.ptzWiperShow&&(r(t.$ptzWiperOpen,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,si)})),r(t.$ptzWiperClose,"click",(function(t){t.stopPropagation(),e.emit(Ct.ptz,li)}))),i.ptzSupportDraggable){var m=function(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})};t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},r(t.$ptzControl,Bn()?"touchstart":"mousedown",(function(e){e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";var r=Ao(e),i=r.posX,a=r.posY;t.tempPtzPosition={x:i,y:a}})),r(t.$ptzControl,Bn()?"touchmove":"mousemove",(function(e){if(t.isPtzControlDroging){e.stopPropagation();var r=Ao(e),i=r.posX,a=r.posY,n=t.tempPtzPosition.x-i,o=t.tempPtzPosition.y-a;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-n+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-o+"px",t.tempPtzPosition={x:i,y:a}}})),r(t.$ptzControl,Bn()?"touchend":"mouseup",(function(e){e.stopPropagation(),m()})),r(window,Bn()?"touchend":"mouseup",(function(e){e.stopPropagation(),m()}))}}if(a.performance&&(r(t.$performance,"click",(function(t){t.stopPropagation(),e.togglePerformancePanel(!0)})),r(t.$performanceActive,"click",(function(t){t.stopPropagation(),e.togglePerformancePanel(!1)}))),a.logSave&&r(t.$logSave,"click",(function(t){t.stopPropagation(),e.downloadMemoryLog()})),a.aiFace&&(r(t.$faceDetect,"click",(function(t){t.stopPropagation(),e.faceDetect(!0)})),r(t.$faceDetectActive,"click",(function(t){t.stopPropagation(),e.faceDetect(!1)}))),a.aiObject&&(r(t.$objectDetect,"click",(function(t){t.stopPropagation(),e.objectDetect(!0)})),r(t.$objectDetectActive,"click",(function(t){t.stopPropagation(),e.objectDetect(!1)}))),a.aiOcclusion&&(r(t.$occlusionDetect,"click",(function(t){t.stopPropagation(),e.occlusionDetect(!0)})),r(t.$occlusionDetectActive,"click",(function(t){t.stopPropagation(),e.occlusionDetect(!1)}))),e._opt.hasControl&&e._opt.controlAutoHide){r(e.$container,"mouseover",(function(){e.fullscreen||(xn(t.$controls,"display","block"),y())})),r(e.$container,"mousemove",(function(){e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(xn(t.$controls,"display","block"),y()))})),r(e.$container,"mouseout",(function(){v(),xn(t.$controls,"display","none")}));var g=null,y=function(){v(),g=setTimeout((function(){xn(t.$controls,"display","none")}),5e3)},v=function(){g&&(clearTimeout(g),g=null)}}if(e._opt.playType===z){var A=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(r(t.$speedMenu,"mouseover",(function(){t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),r(t.$speedMenu,"mouseout",(function(){t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),r(t.$speedMenuList,"click",(function(t){var r=go(t);if(r.matches("div.jb-pro-speed-menu-item")){var i=r.dataset;e.emit(Ct.playbackPreRateChange,i.speed)}}))),A===ye.normal?(r(t.$playbackNarrow,"click",(function(t){t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),r(t.$playbackExpand,"click",(function(t){t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),r(t.$playbackTimeList,"click",(function(t){var r=go(t);r.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(r.dataset)})),e._opt.playbackConfig.supportWheel&&r(t.$playbackTimeInner,"wheel",(function(t){t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):A===ye.simple&&(t.isDroging=!1,r(t.$playbackProgress,"click",(function(r){if(r.target!==t.$playbackProgressIndicator){var i=0,a=0;if(e.isInWebFullscreen())i=r.touches[0].clientY/e.height,a=i*e.playback.totalDuration;else{var n=Ju(t,e.playback.totalDuration,r);i=n.percentage,a=n.second}e.playback&&e.playback.seek({time:a})}})),r(t.$playbackProgress,"mousemove",(function(r){xn(t.$playbackProgressTip,"display","block");var i=Ju(t,e.playback.totalDuration,r),a=i.width,n=i.time;t.$playbackProgressTip.innerHTML=n;var o=t.$playbackProgressTip.clientWidth;a<=o/2?xn(t.$playbackProgressTip,"left",0):a>t.$playbackProgress.clientWidth-o/2?xn(t.$playbackProgressTip,"left",t.$playbackProgress-o+"px"):xn(t.$playbackProgressTip,"left",a-o/2+"px")})),r(t.$playbackProgress,"mouseout",(function(){xn(t.$playbackProgressTip,"display","none")})),r(t.$playbackProgressIndicator,"mousedown",(function(e){t.isDroging=!0})),r(t.$playbackProgress,"mousemove",(function(r){if(t.isDroging){var i=Ju(t,e.playback.totalDuration,r),a=i.second;i.percentage;e.playback&&e.playback.seek({time:a})}})),r(t.$playbackProgress,"mouseup",(function(e){t.isDroging&&(t.isDroging=!1)})))}a.quality&&(r(t.$qualityMenu,"mouseover",(function(){t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),r(t.$qualityMenu,"mouseout",(function(){t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),r(t.$qualityMenuList,"click",(function(t){var r=go(t);if(r.matches("div.jb-pro-quality-menu-item")){var i=r.dataset;e.streamQuality=i.quality}}))),a.scale&&(r(t.$scaleMenu,"mouseover",(function(){t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),r(t.$scaleMenu,"mouseout",(function(){t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),r(t.$scaleMenuList,"click",(function(t){var r=go(t);if(r.matches("div.jb-pro-scale-menu-item")){var i=r.dataset;e.setScaleMode(i.scale)}}))),a.zoom&&(r(t.$zoom,"click",(function(t){t.stopPropagation(),e.zooming=!0})),r(t.$zoomStop,"click",(function(t){t.stopPropagation(),e.zooming=!1}))),r(t.$zoomExpand,"click",(function(t){t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),r(t.$zoomNarrow,"click",(function(t){t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),r(t.$zoomStop2,"click",(function(t){t.stopPropagation(),e.zooming=!1})),a.close&&r(t.$close,"click",(function(t){t.stopPropagation(),e.doDestroy()})),r(t.$tipsMessageClose,"click",(function(e){e.stopPropagation(),t.$tipsMessageContent.innerHTML="",xn(t.$tipsMessage,"display","none")}))}(t,this),t._opt.hotKey&&function(e,t){var r=e.events.proxy,i={};function a(e,t){i[e]?i[e].push(t):i[e]=[t]}a(Nr,(function(){e.fullscreen&&(e.fullscreen=!1)})),a(jr,(function(){e.volume+=.05})),a(zr,(function(){e.volume-=.05})),r(window,"keydown",(function(e){if(t.isFocus){var r=document.activeElement.tagName.toUpperCase(),a=document.activeElement.getAttribute("contenteditable");if("INPUT"!==r&&"TEXTAREA"!==r&&""!==a&&"true"!==a){var n=i[e.keyCode];n&&(e.preventDefault(),n.forEach((function(e){return e()})))}}}))}(t,this),this.btnIndex=0,this.initLoadingBackground(),ho(t._opt.loadingIconStyle)&&this.initLoadingIconStyle(t._opt.loadingIconStyle),ho(t._opt.ptzPositionConfig)&&this.updatePtzPosition(t._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debug.log("Control","init")}return w(e,[{key:"destroy",value:function(){if(this.$performancePanel&&(this.$performancePanel.innerHTML="",!Xu(this.$performancePanel))){var e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}if(this.$poster&&!Xu(this.$poster)){var t=this.player.$container.querySelector(".jb-pro-poster");t&&this.player.$container&&this.player.$container.removeChild(t)}if(this.$loading&&!Xu(this.$loading)){var r=this.player.$container.querySelector(".jb-pro-loading");r&&this.player.$container&&this.player.$container.removeChild(r)}if(this.$loadingBg&&!Xu(this.$loadingBg)){var i=this.player.$container.querySelector(".jb-pro-loading-bg");i&&this.player.$container&&this.player.$container.removeChild(i)}if(this.$controls&&!Xu(this.$controls)){var a=this.player.$container.querySelector(".jb-pro-controls");a&&this.player.$container&&this.player.$container.removeChild(a)}if(this.$playBig&&!Xu(this.$playBig)){var n=this.player.$container.querySelector(".jb-pro-play-big");n&&this.player.$container&&this.player.$container.removeChild(n)}if(this.$recording&&!Xu(this.$recording)){var o=this.player.$container.querySelector(".jb-pro-recording");o&&this.player.$container&&this.player.$container.removeChild(o)}if(this.$ptzControl&&!Xu(this.$ptzControl)){var s=this.player.$container.querySelector(".jb-pro-ptz-controls");s&&this.player.$container&&this.player.$container.removeChild(s)}if(this.$zoomControls&&!Xu(this.$zoomControls)){var l=this.player.$container.querySelector(".jb-pro-zoom-controls");l&&this.player.$container&&this.player.$container.removeChild(l)}if(this.$contextmenus&&(this.$contextmenus.innerHTML="",!Xu(this.$contextmenus))){var c=this.player.$container.querySelector(".jb-pro-contextmenus");c&&this.player.$container&&this.player.$container.removeChild(c)}if(this.$tipsMessage&&!Xu(this.$tipsMessage)){var u=this.player.$container.querySelector(".jb-pro-tips-message");u&&this.player.$container&&this.player.$container.removeChild(u)}if(this.$extendDom&&!Xu(this.$extendDom)){var d=this.player.$container.querySelector(".jb-pro-extend-dom");d&&this.player.$container&&this.player.$container.removeChild(d)}this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debug.log("Control","destroy")}},{key:"getBtnIndex",value:function(){return this.btnIndex++}},{key:"autoSize",value:function(){var e=this.player;e.$container.style.padding="0 0";var t=e.width,r=e.height,i=t/r,a=e.video.$videoElement.width/e.video.$videoElement.height;if(i>a){var n=(t-r*a)/2;e.$container.style.padding="0 ".concat(n,"px")}else{var o=(r-t/a)/2;e.$container.style.padding="".concat(o,"px 0")}}},{key:"initLoadingBackground",value:function(){var e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debug.log("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||Bn()?(e.getRenderType()===de||e.getRenderType()===he)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),Yu(this.$loadingBg,"display","block"),e._opt.loadingBackground="",e._opt.loadingBackgroundWidth=0,e._opt.loadingBackgroundHeight=0)}},{key:"initLoadingIconStyle",value:function(e){var t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&Yu(t,"width","".concat(e.width,"px")),e.height&&Yu(t,"height","".concat(e.height,"px")),e.background&&Yu(t,"backgroundImage",'url("'.concat(e.background,'")')),!1===e.hasAnimation&&(Yu(t,"animationName","none"),Yu(t,"animationDuration",0),Yu(t,"animationTimingFunction","ease"),Yu(t,"animationIterationCount",1)))}},{key:"_initLoadingBackgroundForRatio",value:function(){var e=this.player._opt.aspectRatio.split(":").map(Number),t=this.player.width,r=this.player.height,i=this.player._opt,a=0;i.hasControl&&!i.controlAutoHide&&(a=i.playType===z?gr:mr,r-=a);var n=this.player._opt.loadingBackgroundWidth,o=this.player._opt.loadingBackgroundHeight,s=n/o,l=e[0]/e[1];if(this.$loadingBgImage.src=this.player._opt.loadingBackground,s>l){var c=l*o/n;this.$loadingBgImage.style.width=100*c+"%",this.$loadingBgImage.style.height="calc(100% - ".concat(a,"px)"),this.$loadingBgImage.style.padding="0 ".concat((t-t*c)/2,"px")}else{var u=n/l/o;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height="calc(".concat(100*u,"% - ").concat(a,"px)"),this.$loadingBgImage.style.padding=(r-r*u)/2+"px 0"}}},{key:"_initLoadingBackground",value:function(){var e=this.player,t=e.height,r=e._opt;r.hasControl&&!r.controlAutoHide&&(t-=r.playType===z?gr:mr);var i=e.width,a=t,n=r.rotate;270!==n&&90!==n||(i=t,a=e.width),this.$loadingBgImage.width=i,this.$loadingBgImage.height=a,this.$loadingBgImage.src=e._opt.loadingBackground;var o=(e.width-i)/2,s=(t-a)/2,l="contain";r.isResize||(l="fill"),r.isFullResize&&(l="none");var c="";"none"===r.mirrorRotate&&n&&(c+=" rotate("+n+"deg)"),"level"===r.mirrorRotate?c+=" rotateY(180deg)":"vertical"===r.mirrorRotate&&(c+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=c,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=o+"px",this.$loadingBgImage.style.top=s+"px"}},{key:"_validateExtendBtn",value:function(e){var t=!0;return e.name||(this.player.debug.warn("Control","extend button name is required"),t=!1),t&&-1!==this.extendBtnList.findIndex((function(t){return t.name===e.name}))&&(this.player.debug.warn("Control","extend button name: ".concat(e.name," is already exist")),t=!1),t&&(e.icon||(this.player.debug.warn("Control","extend button icon is required"),t=!1)),t}},{key:"addExtendBtn",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=Ro(aa);if(t=Object.assign({},r,t),this._validateExtendBtn(t)){var i=t.name||"",a=this.$controlsRight,n=t.activeIcon&&t.activeClick,o='\n
\n ').concat(t.icon?'
\n \n ').concat(t.iconTitle?'\n '.concat(t.iconTitle,"\n "):"","\n
"):"","\n ").concat(t.activeIcon?'
\n \n ').concat(t.activeIconTitle?'\n '.concat(t.activeIconTitle,"\n "):"","\n
"):"","\n
\n "),s=Array.from(a.children)[t.index];s?s.insertAdjacentHTML("beforebegin",o):Ku(a,o);var l=a.querySelector(".jb-pro-controls-item-wrap-".concat(i)),c=t.icon?a.querySelector(".jb-pro-icon-extend-".concat(i)):null,u=t.icon?a.querySelector(".jb-pro-control-extend-".concat(i)):null,d=t.activeIcon?a.querySelector(".jb-pro-icon-extend-".concat(i,"-active")):null,h=t.activeIcon?a.querySelector(".jb-pro-control-extend-".concat(i,"-active")):null,p=this.player,f=p.events.proxy;p.debug;t.icon&&(Yu(c,"background","url(".concat(t.icon,") no-repeat center")),Yu(c,"background-size","100% 100%"),Yu(u,"display","none"),t.iconHover&&(f(c,"mouseover",(function(){Yu(c,"background","url(".concat(t.iconHover,") no-repeat center")),Yu(c,"background-size","100% 100%")})),f(c,"mouseout",(function(){Yu(c,"background","url(".concat(t.icon,") no-repeat center")),Yu(c,"background-size","100% 100%")})))),t.activeIcon&&(Yu(d,"background","url(".concat(t.activeIcon,") no-repeat center")),Yu(d,"background-size","100% 100%"),Yu(h,"display","none"),t.activeIconHover&&(f(d,"mouseover",(function(){Yu(d,"background","url(".concat(t.activeIconHover,") no-repeat center")),Yu(d,"background-size","100% 100%")})),f(d,"mouseout",(function(){Yu(d,"background","url(".concat(t.activeIcon,") no-repeat center")),Yu(d,"background-size","100% 100%")})))),t.click&&c&&f(c,"click",(function(r){r.preventDefault(),n&&(Yu(u,"display","none"),Yu(h,"display","flex")),e.player.isInMulti()?t.click.call(e.player,r,e.player._opt.multiIndex):t.click.call(e.player,r)})),t.activeClick&&d&&f(d,"click",(function(r){r.preventDefault(),Yu(u,"display","flex"),Yu(h,"display","none"),e.player.isInMulti()?t.activeClick.call(e.player,r,e.player._opt.multiIndex):t.activeClick.call(e.player,r)})),this.extendBtnList.push({name:i,$iconContainer:l,$iconWrap:u,$activeIconWrap:h})}}},{key:"addExtendDom",value:function(e){if(this.player.debug.log(this.TAG_NAME,"addExtendDom"),e.html){var t='\n
\n '.concat(e.html,"\n
\n ");this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom")}),e.showBeforePlay&&Yu(this.$extendDom,"display","block")}}},{key:"toggleExtendDom",value:function(e){this.$extendDom&&($n(e)||(e="none"===this.$extendDom.style.display),Yu(this.$extendDom,"display",e?"block":"none"))}},{key:"updateExtendDom",value:function(e){this.player.debug.log(this.TAG_NAME,"updateExtendDom"),this.$extendDom&&(this.$extendDom.innerHTML=e)}},{key:"removeExtendDom",value:function(){this.player.debug.log(this.TAG_NAME,"removeExtendDom"),this.$extendDom&&(this.$extendDom.innerHTML="")}},{key:"updateLoadingText",value:function(e){this.$loadingText&&(this.$loadingText.innerText=e)}},{key:"getExtendBtnList",value:function(){return this.extendBtnList}},{key:"showTipsMessage",value:function(e,t){var r=this.$tipsMessage,i=this.$tipsMessageContent;if(r){var a='\n
'.concat(e,"
\n ").concat(t?'
Error Type:'.concat(t,"
"):"","\n ");i.innerHTML=a,Yu(r,"display","block")}}},{key:"hideTipsMessage",value:function(){var e=this.$tipsMessage;e&&($tipsMessageContent.innerHTML="",Yu(e,"display","none"))}},{key:"updatePtzPosition",value:function(e){var t=this.$ptzControl;if(ho(e)&&t){var r="auto";e.left&&(r=Number(e.left)===e.left?e.left+"px":e.left),Yu(t,"left",r);var i="auto";e.top&&(i=Number(e.top)===e.top?e.top+"px":e.top),Yu(t,"top",i);var a="auto";e.bottom&&(a=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),Yu(t,"bottom",a);var n="auto";e.right&&(n=Number(e.right)===e.right?e.right+"px":e.right),Yu(t,"right",n)}}}])}();$u(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var td=function(e){var t=e._opt,r=e.debug,i=e.events.proxy;if(t.supportDblclickFullscreen&&i(e.$container,"dblclick",(function(t){var r=go(t).nodeName.toLowerCase();"canvas"!==r&&"video"!==r||(e.fullscreen=!e.fullscreen)})),i(document,"visibilitychange",(function(){e.visibility="visible"===document.visibilityState,r.log("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(r.log("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),In()&&i(document,["click","contextmenu"],(function(t){Qu(t,e.$container)?(Bo(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(Ct.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(Ct.blur))})),t.isCheckInView){var a=Vn((function(){e.emit(Ct.inView,function(e){var t=e.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,i=window.innerWidth||document.documentElement.clientWidth,a=t.top<=r&&t.top+t.height>=0,n=t.left<=i&&t.left+t.width>=0;return a&&n}(e.$container))}),200);i(window,"scroll",(function(){return a()}))}if(t.autoResize){var n=Vn((function(){e.resize()}),500);i(window,["resize","orientationchange"],(function(){n()})),screen&&screen.orientation&&screen.orientation.onchange&&i(screen.orientation,"change",(function(){n()}))}},rd=function(){function e(){S(this,e)}return w(e,null,[{key:"init",value:function(){for(var t in e.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=e.constants={};r.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),r.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),r.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),r.STSC=r.STCO=r.STTS,r.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),r.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),r.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),r.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,r=null,i=Array.prototype.slice.call(arguments,1),a=i.length,n=0;n>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);for(var o=8,s=0;s>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,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]))}},{key:"trak",value:function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration,a=t.presentWidth,n=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,i>>>24&255,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,a>>>8&255,255&a,0,0,n>>>8&255,255&n,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var r=t.timescale,i=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}},{key:"hdlr",value:function(t){var r=null;return r="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,r)}},{key:"minf",value:function(t){var r=null;return r="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,r,e.dinf(),e.stbl(t))}},{key:"dinf",value:function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.audioType?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"avc"===t.videoType?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t))}},{key:"mp3",value:function(t){var r=t.channelCount,i=t.audioSampleRate,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types[".mp3"],a)}},{key:"mp4a",value:function(t){var r=t.channelCount,i=t.audioSampleRate,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types.mp4a,a,e.esds(t))}},{key:"esds",value:function(t){var r=t.config||[],i=r.length,a=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(r).concat([6,1,2]));return e.box(e.types.esds,a)}},{key:"avc1",value:function(t){var r=t.avcc,i=t.codecWidth,a=t.codecHeight,n=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,i>>>8&255,255&i,a>>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return e.box(e.types.avc1,n,e.box(e.types.avcC,r))}},{key:"hvc1",value:function(t){var r=t.avcc,i=t.codecWidth,a=t.codecHeight,n=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,i>>>8&255,255&i,a>>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return e.box(e.types.hvc1,n,e.box(e.types.hvcC,r))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){var r=t.id,i=new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,i)}},{key:"moof",value:function(t,r){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,r))}},{key:"mfhd",value:function(t){var r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,r)}},{key:"traf",value:function(t,r){var i=t.id,a=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),n=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,a,n,s,o)}},{key:"sdtp",value:function(t){var r=new Uint8Array(5),i=t.flags;return r[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,e.box(e.types.sdtp,r)}},{key:"trun",value:function(t,r){var i=new Uint8Array(28);r+=36,i.set([0,0,15,1,0,0,0,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);var a=t.duration,n=t.size,o=t.flags,s=t.cts;return i.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12),e.box(e.types.trun,i)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();rd.init();var id=[44100,48e3,32e3,0],ad=[22050,24e3,16e3,0],nd=[11025,12e3,8e3,0],od=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],sd=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],ld=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],cd=function(t){function r(e){var t;return S(this,r),t=_(this,r),t.TAG_NAME="MediaSource",t.player=e,t._resetInIt(),t._useManagedMediaSource="ManagedMediaSource"in self&&!("MediaSource"in self),t.mediaSource=t._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource,t.isDecodeFirstIIframe=!!Io(e._opt.checkFirstIFrame),t.mediaSourceObjectURL=null,t._useManagedMediaSource||(t.mediaSourceObjectURL=window.URL.createObjectURL(t.mediaSource)),t.isSupportVideoFrameCallback=jo(),t.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(t.$videoElement=document.createElement("video"),t._useManagedMediaSource?(t.$videoElement.disableRemotePlayback=!0,t.$videoElement.srcObject=t.mediaSource):t.$videoElement.src=t.mediaSourceObjectURL,t.initVideoEvents()):(t._useManagedMediaSource?(t.player.video.$videoElement.disableRemotePlayback=!0,t.player.video.$videoElement.srcObject=t.mediaSource):t.player.video.$videoElement.src=t.mediaSourceObjectURL,t.$videoElement=t.player.video.$videoElement),t._bindMediaSourceEvents(),t.audioSourceBufferCheckTimeout=null,t.audioSourceNoDataCheckTimeout=null,t.hasPendingEos=!1,t.player.isPlayback()&&t.player.on(Ct.playbackPause,(function(r){Io(r)?(Bo(e._opt.checkFirstIFrame)&&(t.player.debug.log(t.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),t.isDecodeFirstIIframe=!1),t.clearUpAllSourceBuffer(),t.$videoElement.play()):(t.$videoElement.pause(),t.cacheTrack={})})),t._useManagedMediaSource?t.player.debug.log(t.TAG_NAME,"init and using ManagedMediaSource"):t.player.debug.log(t.TAG_NAME,"init"),t}return k(r,t),w(r,[{key:"destroy",value:function(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((function(e){return e()})),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"needInitAudio",value:function(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}},{key:"_resetInIt",value:function(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}},{key:"state",get:function(){return this.mediaSource&&this.mediaSource.readyState}},{key:"isStateOpen",get:function(){return this.state===Fr}},{key:"isStateClosed",get:function(){return this.state===Or}},{key:"isStateEnded",get:function(){return this.state===Ur}},{key:"duration",get:function(){return this.mediaSource&&this.mediaSource.duration||-1},set:function(e){this.mediaSource.duration=e}},{key:"_bindMediaSourceEvents",value:function(){var e=this,t=this.player,r=(t.debug,t.events.proxy),i=r(this.mediaSource,mi,(function(){e.player.debug.log(e.TAG_NAME,"sourceOpen"),e._onMediaSourceSourceOpen(),e.player.emit(Ct.mseSourceOpen)})),a=r(this.mediaSource,fi,(function(){e.player.debug.log(e.TAG_NAME,"sourceClose"),e.player.emit(Ct.mseSourceClose)})),n=r(this.mediaSource,gi,(function(){e.player.debug.log(e.TAG_NAME,"sourceended"),e.player.emit(Ct.mseSourceended)}));this.eventListenList.push(i,a,n);var o=r(this.$videoElement,ki,(function(t){if(Io(e.isSupportVideoFrameCallback))if(e.player.checkIsInRender())e.player.handleRender();else{var r=parseInt(t.timeStamp,10);e.player.debug.log(e.TAG_NAME,"mseUseCanvasRender is ".concat(e.player._opt.mseUseCanvasRender," and\n $videoElement ts is ").concat(r,", but not in render and vbps is ").concat(e.player._stats.vbps," and fps is ").concat(e.player._stats.fps))}}));if(this.eventListenList.push(o),this._useManagedMediaSource){var s=r(this.mediaSource,yi,(function(){e.player.debug.log(e.TAG_NAME,"ManagedMediaSource startstreaming"),e.player.emit(Ct.mseSourceStartStreaming)})),l=r(this.mediaSource,vi,(function(){e.player.debug.log(e.TAG_NAME,"ManagedMediaSource endstreaming"),e.player.emit(Ct.mseSourceEndStreaming)})),c=r(this.mediaSource,Ai,(function(){e.player.debug.log(e.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(s,l,c)}}},{key:"_onMediaSourceSourceOpen",value:function(){this.sourceBuffer||(this.player.debug.log("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debug.log("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}},{key:"initVideoEvents",value:function(){var e=this,t=this.player.events.proxy;this.player.on(Ct.visibilityChange,(function(t){t&&setTimeout((function(){if(e.player.isPlaying()&&e.$videoElement){var t=e.getVideoBufferLastTime();t-e.$videoElement.currentTime>e.getMseBufferMaxDelayTime()&&(e.player.debug.log(e.TAG_NAME,"visibilityChange is true and lastTime is ".concat(t," and currentTime is ").concat(e.$videoElement.currentTime," so set currentTime to lastTime")),e.$videoElement.currentTime=t)}}),300)}));var r=t(this.$videoElement,bi,(function(){e.player.debug.log(e.TAG_NAME,"video canplay"),e.$videoElement.play().then((function(){e.player.emit(Ct.removeLoadingBgImage),jo()?e.supportVideoFrameCallbackHandle||(e.supportVideoFrameCallbackHandle=e.$videoElement.requestVideoFrameCallback(e.videoFrameCallback.bind(e))):e.player.isUseHls265()&&(e._stopCanvasRender(),e.canvasRenderInterval=setInterval((function(){e.player.video.render({$video:e.$videoElement,ts:parseInt(1e3*e.$videoElement.currentTime,10)||0})}),40)),e.player.debug.log(e.TAG_NAME,"video play")})).catch((function(t){e.player.debug.error(e.TAG_NAME,"video play error ",t),e.player.emitError(Lt.mediaSourceUseCanvasRenderPlayFailed,t)}))})),i=t(this.$videoElement,_i,(function(){e.player.debug.log(e.TAG_NAME,"video waiting")})),a=t(this.$videoElement,ki,(function(t){parseInt(t.timeStamp,10),e.$videoElement.paused&&(e.player.debug.warn(e.TAG_NAME,"video is paused and next try to replay"),e.$videoElement.play().then((function(){e.player.debug.log(e.TAG_NAME,"video is paused and replay success")})).catch((function(t){e.player.debug.warn(e.TAG_NAME,"video is paused and replay error ",t)})))})),n=t(this.$videoElement,wi,(function(){e.player.debug.log(e.TAG_NAME,"video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate),e.$videoElement&&e.$videoElement.paused&&e.player.debug.warn(e.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(r,i,a,n)}},{key:"videoFrameCallback",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed");else{var r=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:r}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:r}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}}},{key:"decodeVideo",value:function(e,t,r,i){var a=this.player;if(a)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&r&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(r&&0===e[1]){var n=15&e[0],o={};n===jt?o=Vs(e.slice(5)):n===zt&&(o=rl(e));var s=this.player.video.videoInfo;s&&s.width&&s.height&&o&&o.codecWidth&&o.codecHeight&&(o.codecWidth!==s.width||o.codecHeight!==s.height)&&(this.player.debug.warn(this.TAG_NAME,"\n decodeVideo: video width or height is changed,\n old width is ".concat(s.width,", old height is ").concat(s.height,",\n new width is ").concat(o.codecWidth,", new height is ").concat(o.codecHeight,",\n and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emitError(Lt.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(Po(e))return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is too small , payload length is ".concat(e.byteLength));var l=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t),l=t-this.firstRenderTime,l<0&&(this.player.debug.warn(this.TAG_NAME,"decodeVideo\n local dts is < 0 , ts is ".concat(t," and prevTs is ").concat(this.prevTs,",\n firstRenderTime is ").concat(this.firstRenderTime," and mseCorrectTimeDuration is ").concat(this.player._opt.mseCorrectTimeDuration)),l=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debug.warn(this.TAG_NAME,"decodeVideo is max diff , ts is ".concat(t," and prevTs is ").concat(this.prevTs,", diff is ").concat(this.prevTs-t," and emit replay")),void this.player.emitError(Lt.mediaSourceTsIsMaxDiff,"decodeVideo is max diff, prevTs is ".concat(this.prevTs," and ts is ").concat(t));if(null!==this.prevDts&&l<=this.prevDts){if(this.player.debug.warn(this.TAG_NAME,"\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ".concat(l," and prev dts is ").concat(this.prevDts," ,\n and now ts is ").concat(t," and prev ts is ").concat(this.prevTs," ,\n and diff is ").concat(t-this.prevTs," and firstRenderTime is ").concat(this.firstRenderTime," and isIframe is ").concat(r,",\n and mseCorrectTimeDuration is ").concat(this.player._opt.mseCorrectTimeDuration,",\n and prevPayloadBufferSize is ").concat(this.prevPayloadBufferSize," and payload size is ").concat(e.byteLength)),l===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(l=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debug.warn(this.TAG_NAME,"decodeVideo is max diff , ts is ".concat(t," and prevTs is ").concat(this.prevTs,", diff is ").concat(this.prevTs-t," and emit replay")),void this.emit(Lt.mediaSourceTsIsMaxDiff,"decodeVideo is max diff, prevTs is ".concat(this.prevTs," and ts is ").concat(t))}}this.player.isPlayer()?this._decodeVideo(e,l,r,i,t):this.player.isPlayback()&&Io(this.player.playbackPause)&&(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,l,r,i,t)),this.prevDts=l,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debug.log(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(r&&e[1]===ji){var c=15&e[0];if(a.video.updateVideoInfo({encTypeCode:c}),c===zt&&Io(qn()))return void this.player.emitError(Lt.mediaSourceH265NotSupport);a._times.decodeStart||(a._times.decodeStart=Tn()),this.hasInit=this._decodeConfigurationRecord(e,t,r,c)}else this.player.debug.warn(this.TAG_NAME,"decodeVideo has not init , isIframe is ".concat(r," , payload is ").concat(e[1]))}},{key:"decodeAudio",value:function(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(Io(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{var r=t;if(ln(e))return void this.player.debug.log(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,null!==this.firstRenderTime&&null!==this.prevTs)){var i=Math.abs(this.firstRenderTime-this.prevTs);i>300&&(this.firstAudioTime-=i,this.player.debug.warn(this.TAG_NAME,"video\n firstAudioTime is ".concat(this.firstRenderTime," and current time is ").concat(this.prevTs,"\n play time is ").concat(i," and firstAudioTime ").concat(t," - ").concat(i," = ").concat(this.firstAudioTime)))}if(r=t-this.firstAudioTime,r<0&&(this.player.debug.warn(this.TAG_NAME,"decodeAudio\n local dts is < 0 , ts is ".concat(t," and prevTs is ").concat(this.prevAudioTs,",\n firstAudioTime is ").concat(this.firstAudioTime)),r=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debug.warn(this.TAG_NAME,"decodeAudio is max diff , ts is ".concat(t," and prevTs is ").concat(this.prevAudioDts,", diff is ").concat(this.prevAudioDts-t," and emit replay")),void this.player.emitError(Lt.mediaSourceTsIsMaxDiff,"decodeAudio is max diff, prevTs is ".concat(this.prevAudioDts," and ts is ").concat(t));null!==this.prevAudioTs&&r<=this.prevAudioDts&&(this.player.debug.warn(this.TAG_NAME,"\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ".concat(r," and prev dts is ").concat(this.prevAudioDts," ,\n and now ts is ").concat(t," and prev ts is ").concat(this.prevAudioTs," ,\n and diff is ").concat(t-this.prevAudioTs)),r=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&Io(this.player.playbackPause))&&this._decodeAudio(e,r,t),this.prevAudioTs=t,this.prevAudioDts=r}else this.player.debug.log(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}},{key:"_checkTsIsMaxDiff",value:function(e){return this.prevTs>0&&eve}},{key:"_checkAudioTsIsMaxDiff",value:function(e){return this.prevAudioTs>0&&eve}},{key:"_decodeConfigurationRecord",value:function(e,t,r,i){var a=e.slice(5),n={};if(i===jt?n=Vs(a):i===zt&&(n=il(a)),uo(n)||0===n.codecWidth&&0===n.codecHeight)return this.player.debug.warn(this.TAG_NAME,"_decodeConfigurationRecord",n),this.player.emitError(Lt.mediaSourceDecoderConfigurationError),!1;this.player.recorder&&this.player._opt.recordType===G&&this.player.recorder.initMetaData(e,i);var o={id:Ma,type:"video",timescale:1e3,duration:0,avcc:a,codecWidth:n.codecWidth,codecHeight:n.codecHeight,videoType:n.videoType},s=rd.generateInitSegment(o);this.isAvc=i===jt;var l=n.codec;return this.videoMimeType=l?'video/mp4; codecs="'.concat(n.codec,'"'):this.isAvc?Dr:Lr,this._initSourceBuffer(),this.appendBuffer(s.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}},{key:"_decodeAudioConfigurationRecord",value:function(e,t){var r=e[0]>>4,i=r===Wt,a=r===Vt;if(Io(a||i))return this.player.debug.warn(this.TAG_NAME,"_decodeAudioConfigurationRecord audio codec is not support , codecId is ".concat(r," ant auto wasm decode")),this.player.emit(Lt.mediaSourceAudioG711NotSupport),!1;var n={id:Ua,type:"audio",timescale:1e3},o={};if(ln(e)){if(o=function(e){var t=new Uint8Array(e),r=null,i=0,a=0,n=0,o=null;if(i=a=t[0]>>>3,n=(7&t[0])<<1|t[1]>>>7,n<0||n>=hn.length)console.error("Flv: AAC invalid sampling frequency index!");else{var s=hn[n],l=(120&t[1])>>>3;if(!(l<0||l>=8)){5===i&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);var c=self.navigator.userAgent.toLowerCase();return-1!==c.indexOf("firefox")?n>=6?(i=5,r=new Array(4),o=n-3):(i=2,r=new Array(2),o=n):-1!==c.indexOf("android")?(i=2,r=new Array(2),o=n):(i=5,o=n,r=new Array(4),n>=6?o=n-3:1===l&&(i=2,r=new Array(2),o=n)),r[0]=i<<3,r[0]|=(15&n)>>>1,r[1]=(15&n)<<7,r[1]|=(15&l)<<3,5===i&&(r[1]|=(15&o)>>>1,r[2]=(1&o)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:s,channelCount:l,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+a}}console.log("Flv: AAC invalid channel configuration")}}(e.slice(2)),!o)return!1;n.audioSampleRate=o.sampleRate,n.channelCount=o.channelCount,n.config=o.config,n.refSampleDuration=1024/n.audioSampleRate*n.timescale}else{if(!i)return!1;if(o=function(e){if(e.length<4)console.error("Invalid MP3 packet, header missing!");else{var t=new Uint8Array(e.buffer),r=null;if(255===t[0]){var i=t[1]>>>3&3,a=(6&t[1])>>1,n=(240&t[2])>>>4,o=(12&t[2])>>>2,s=3!=(t[3]>>>6&3)?2:1,l=0,c=0;switch(i){case 0:l=nd[o];break;case 2:l=ad[o];break;case 3:l=id[o]}switch(a){case 1:n0&&(u+=";codecs=".concat(l)),Io(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:r,channels:n.channelCount,sampleRate:n.audioSampleRate}),this.isAudioInitInfo=!0),this.audioMimeType=u,this.isAAC=a,this._initAudioSourceBuffer(),this.appendAudioBuffer(c.buffer),!0}},{key:"_initSourceBuffer",value:function(){var e=this,t=this.player,r=t.debug,i=t.events.proxy;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),r.log(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(i){return r.error(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",i.code,i),this.player.emitError(Lt.mseAddSourceBufferError,i),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){var a=i(this.sourceBuffer,"error",(function(t){e.mediaSourceBufferError=!0,r.error(e.TAG_NAME,"mseSourceBufferError this.sourceBuffer",t),e.player.emitError(Lt.mseSourceBufferError,t)})),n=i(this.sourceBuffer,"updateend",(function(){e._hasPendingRemoveRanges()?e._doRemoveRanges():e._hasPendingSegments()?e._doAppendSegments():e.hasPendingEos&&(e.player.debug.log(e.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),e.endOfStream())}));this.eventListenList.push(a,n)}}else r.log(this.TAG_NAME,"_initSourceBuffer and this.isStateOpen is ".concat(this.isStateOpen," and this.isAvc === null is ").concat(null===this.isAvc))}},{key:"_initAudioSourceBuffer",value:function(){var e=this,t=this.player,r=t.debug,i=t.events.proxy;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),r.log(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(i){return r.error(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",i.code,i),this.player.emitError(Lt.mseAddSourceBufferError,i),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){var a=i(this.audioSourceBuffer,"error",(function(t){e.mediaSourceBufferError=!0,r.error(e.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",t),e.player.emitError(Lt.mseSourceBufferError,t)})),n=i(this.audioSourceBuffer,"updateend",(function(){e._hasPendingRemoveRanges()?e._doRemoveRanges():e._hasPendingSegments()?e._doAppendSegments():e.hasPendingEos&&(e.player.debug.log(e.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),e.endOfStream())}));this.eventListenList.push(a,n),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((function(){e._clearAudioNoDataCheckTimeout(),e.player.emit(Lt.mediaSourceAudioNoDataTimeout)}),1e3))}}else r.log(this.TAG_NAME,"_initAudioSourceBuffer and this.isStateOpen is ".concat(this.isStateOpen," and this.audioMimeType is ").concat(this.audioMimeType))}},{key:"_decodeVideo",value:function(e,t,r,i,a){var n=this.player,o=e.slice(5),s=o.byteLength;if(0!==s){var l=(new Date).getTime(),c=!1;this.prevTimestamp||(this.prevTimestamp=l,c=!0);var u=l-this.prevTimestamp;this.decodeDiffTimestamp=u,u>500&&!c&&this.player.isPlayer()&&n.debug.warn(this.TAG_NAME,"_decodeVideo now time is ".concat(l," and prev time is ").concat(this.prevTimestamp,", diff time is ").concat(u," ms"));var d=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){var h=8+this.cacheTrack.size,p=new Uint8Array(h);p[0]=h>>>24&255,p[1]=h>>>16&255,p[2]=h>>>8&255,p[3]=255&h,p.set(rd.types.mdat,4),p.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts;var f=rd.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};var m=new Uint8Array(f.byteLength+p.byteLength);m.set(f,0),m.set(p,f.byteLength),this.appendBuffer(m.buffer),n.emit(Ct.timeUpdate,a),n.isPlayer()?n.isUseHls265()?n.updateStats({dfps:!0,mseTs:t}):n.updateStats({fps:!0,dfps:!0,ts:a,mseTs:t}):n.isPlayback()&&n.playback.updateStats({ts:a}),n._times.videoStart||(n._times.videoStart=Tn(),n.handlePlayToRenderTimes())}else n.debug.log(this.TAG_NAME,"cacheTrack = {} now dts is ".concat(t,", and ts is ").concat(a," cacheTrack dts is ").concat(this.cacheTrack&&this.cacheTrack.dts)),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=Ma,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=s,this.cacheTrack.dts=t,this.cacheTrack.cts=i,this.cacheTrack.isKeyframe=r,this.cacheTrack.data=o,this.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},!this.isInitInfo&&d.videoWidth>0&&d.videoHeight>0&&(n.debug.log(this.TAG_NAME,"updateVideoInfo: ".concat(d.videoWidth,",").concat(d.videoHeight)),n.video.updateVideoInfo({width:d.videoWidth,height:d.videoHeight}),n.video.initCanvasViewSize(),this.isInitInfo=!0),n._opt.mseUseCanvasRender&&Io(this.isSupportVideoFrameCallback)&&Io(n.isUseHls265())&&n.video.render({$video:d,ts:t}),this.prevTimestamp=(new Date).getTime()}else n.debug.warn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return")}},{key:"_stopCanvasRender",value:function(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}},{key:"_decodeAudio",value:function(e,t,r){var i=this.player,a=this.isAAC?e.slice(2):e.slice(1),n=a.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){var o=8+this.cacheAudioTrack.size,s=new Uint8Array(o);s[0]=o>>>24&255,s[1]=o>>>16&255,s[2]=o>>>8&255,s[3]=255&o,s.set(rd.types.mdat,4),s.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;var l=rd.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};var c=new Uint8Array(l.byteLength+s.byteLength);c.set(l,0),c.set(s,l.byteLength),this.appendAudioBuffer(c.buffer)}else i.debug.log(this.TAG_NAME,"cacheAudioTrack = {} now dts is ".concat(t," cacheAudioTrack dts is ").concat(this.cacheAudioTrack&&this.cacheAudioTrack.dts)),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=Ua,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=n,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=a,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}},{key:"appendBuffer",value:function(e){if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"appendBuffer() player is destroyed");else{var t=this.player,r=t.debug;t.events.proxy;this.mediaSourceAddSourceBufferError?r.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?r.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?r.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?r.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),Io(this.getSourceBufferUpdating())&&this.isStateOpen&&Io(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(Lt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded?(this.mediaSourceBufferError=!0,this.player.emitError(Lt.mseSourceBufferError,"mediaSource is end")):this._hasPendingRemoveRanges()&&r.log(this.TAG_NAME,"video has pending remove ranges and video length is ".concat(this.pendingRemoveRanges.length,", audio length is ").concat(this.pendingAudioRemoveRanges.length)))}}},{key:"appendAudioBuffer",value:function(e){if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"appendAudioBuffer() player is destroyed");else{var t=this.player,r=t.debug;t.events.proxy;this.mediaSourceAddSourceBufferError?r.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?r.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?r.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?r.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),Io(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&Io(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(Lt.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded?(this.mediaSourceBufferError=!0,this.player.emitError(Lt.mseSourceBufferError,"mediaSource is end")):this._hasPendingRemoveRanges()&&r.log(this.TAG_NAME,"audio has pending remove ranges and video length is ".concat(this.pendingRemoveRanges.length,", audio length is ").concat(this.pendingAudioRemoveRanges.length)))}}},{key:"getSourceBufferUpdating",value:function(){return this.sourceBuffer&&this.sourceBuffer.updating}},{key:"getAudioSourceBufferUpdating",value:function(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}},{key:"stop",value:function(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}},{key:"checkSourceBufferDelay",value:function(){var e=this.$videoElement,t=0,r=0;return e.buffered.length>0&&(r=e.buffered.end(e.buffered.length-1),t=r-e.currentTime),t<0&&(this.player.debug.warn(this.TAG_NAME,"checkMSESourceBufferDelay ".concat(t," < 0, and buffered is ").concat(r," ,currentTime is ").concat(e.currentTime," , try to seek ").concat(e.currentTime," to ").concat(r)),e.currentTime=r,t=0),t}},{key:"checkSourceBufferStore",value:function(){var e=this.$videoElement,t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}},{key:"getDecodeDiffTimes",value:function(){return this.decodeDiffTimestamp}},{key:"removeBuffer",value:function(e,t){var r=yo();if(this.player.debug.log(this.TAG_NAME,"removeBuffer() start is ".concat(e," and end is ").concat(t," and _isMacOsFirefox is ").concat(r)),this.isStateOpen&&Io(r)){if(Io(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(Io(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debug.warn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}},{key:"clearUpAllSourceBuffer",value:function(){if(this.sourceBuffer){for(var e=this.sourceBuffer.buffered,t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debug.log(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debug.warn(this.TAG_NAME,"endOfStream() error",e)}}}},{key:"abortSourceBuffer",value:function(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debug.log(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}Io(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debug.log(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}Io(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}},{key:"removeSourceBuffer",value:function(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debug.log(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.error(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debug.log(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debug.error(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}},{key:"_hasPendingSegments",value:function(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}},{key:"getPendingSegmentsLength",value:function(){return this.pendingSegments.length}},{key:"_handleUpdatePlaybackRate",value:function(){if(this.$videoElement){var e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;var t=e.buffered;t.length&&t.start(0);var r=t.length?t.end(t.length-1):0,i=e.currentTime,a=r-i,n=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:a}),a>n)this.player.debug.log(this.TAG_NAME,"handleUpdatePlaybackRate and buffered is ".concat(r," and current is ").concat(i," , delay buffer is more than ").concat(n," is ").concat(a," and new time is ").concat(r)),e.currentTime=r,i=e.currentTime;else if(a<0){if(this.player.debug.warn(this.TAG_NAME,"handleUpdatePlaybackRate and delay buffer is ".concat(r," - current is ").concat(i," = ").concat(a," < 0 and check video is paused : ").concat(e.paused," ")),0===r)return void this.player.emit(Lt.mediaSourceBufferedIsZeroError,"video.buffered is empty");e.paused&&e.play()}var o=this._getPlaybackRate(r-i);e.playbackRate!==o&&(this.player.debug.log(this.TAG_NAME,"handleUpdatePlaybackRate and buffered is ".concat(r," and current time is ").concat(i," and delay is ").concat(r-i," set playbackRate is ").concat(o," ")),e.playbackRate=o)}}},{key:"_handleUpdateBufferDelayTime",value:function(){var e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}},{key:"_checkVideoPlayCurrentTime",value:function(){var e=this.checkSourceBufferStore();if(e<0){var t=this.getVideoBufferStartTime();this.player.debug.warn(this.TAG_NAME,"checkVideoPlayCurrentTime store is ".concat(e," < 0 and set currentTime ").concat(this.$videoElement.currentTime," to ").concat(t)),this.$videoElement.currentTime=t}}},{key:"_doAppendSegments",value:function(){var t=this;if(this.isStateClosed||this.isStateEnded)this.player.debug.log(this.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==this.sourceBuffer){if(this.needInitAudio()&&null===this.audioSourceBuffer)return this.player.debug.log(this.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===this.audioSourceBufferCheckTimeout&&(this.audioSourceBufferCheckTimeout=setTimeout((function(){t._clearAudioSourceBufferCheckTimeout(),t.player.emit(Lt.mediaSourceAudioInitTimeout)}),1e3)));if(Io(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){var r=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(r)}catch(e){this.player.debug.error(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(Lt.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(Lt.mediaSourceAppendBufferError)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(Ct.mseSourceBufferError,e))}}if(Io(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){var i=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(i)}catch(e){this.player.debug.error(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(Lt.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(Lt.mediaSourceAppendBufferError)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(Ct.mseSourceBufferError,e))}}}else this.player.debug.log(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}},{key:"_doCleanUpSourceBuffer",value:function(){if(this.$videoElement){var e=this.$videoElement.currentTime;if(this.sourceBuffer){for(var t=this.sourceBuffer.buffered,r=!1,i=0;i=this.player._opt.mseAutoCleanupMaxBackwardDuration){r=!0;var o=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:a,end:o})}}else n=this.player._opt.mseAutoCleanupMaxBackwardDuration){l=!0;var h=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:u,end:h})}}else d0||this.pendingAudioRemoveRanges.length>0}},{key:"_doRemoveRanges",value:function(){if(this.sourceBuffer&&Io(this.getSourceBufferUpdating()))for(var t=this.pendingRemoveRanges;t.length&&Io(this.getSourceBufferUpdating());){var r=t.shift();try{this.sourceBuffer.remove(r.start,r.end)}catch(e){this.player.debug.warn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}if(this.audioSourceBuffer&&Io(this.getAudioSourceBufferUpdating()))for(var i=this.pendingAudioRemoveRanges;i.length&&Io(this.getAudioSourceBufferUpdating());){var a=i.shift();try{this.audioSourceBuffer.remove(a.start,a.end)}catch(e){this.player.debug.warn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}},{key:"getDecodePlaybackRate",value:function(){var e=0,t=this.$videoElement;return t&&(e=t.playbackRate),e}},{key:"_getPlaybackRate",value:function(e){var t=this.$videoElement,r=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer,i=Math.max(r,1e3),a=i/2;return e*=1e3,1===t.playbackRate?e>i?1.2:1:e<=a?1:t.playbackRate}},{key:"_needCleanupSourceBuffer",value:function(){if(Io(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;var e=this.$videoElement,t=e.buffered,r=e.currentTime;return t.length>=1&&r-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}},{key:"getVideoCurrentTime",value:function(){var e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}},{key:"getVideoBufferLastTime",value:function(){var e=this.$videoElement,t=0;if(e){var r=e.buffered;r.length&&r.start(0),t=r.length?r.end(r.length-1):0}return t}},{key:"getVideoBufferStartTime",value:function(){var e=this.$videoElement,t=0;if(e){var r=e.buffered;t=r.length?r.start(0):0}return t}},{key:"getVideoBufferDelayTime",value:function(){var e=this.$videoElement,t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}},{key:"_clearAudioSourceBufferCheckTimeout",value:function(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}},{key:"_clearAudioNoDataCheckTimeout",value:function(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}},{key:"getMimeType",value:function(){return{video:this.videoMimeType,audio:this.audioMimeType}}},{key:"getMseBufferMaxDelayTime",value:function(){var e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}}])}(Ho),ud=function(){return"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&Io(On())},dd=function(){function t(e){var r=this;S(this,t),this.player=e,this.enabled=!1,ud()?(this.player.debug.log("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=function(){null!==r._wakeLock&&"visible"===document.visibilityState&&r.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debug.log("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsirXsYMPQkBNgI1MYXZmNTguNDUuMTAwV0GNTGF2ZjU4LjQ1LjEwMESJiECzmgAAAAAAFlSua0C5rgEAAAAAAABO14EBc8WI9UhIq9EDJPCcgQAitZyDdW5khoVWX1ZQOIOBASPjg4QF9eEA4AEAAAAAAAAbsIIBQLqB8FSwggElVLqB8FWwiFW3gQFVuIECrgEAAAAAAABZ14ECc8WIUEWPA9J/iJ6cgQAitZyDdW5khoZBX09QVVNWqoNjLqBWu4QExLQAg4EC4ZGfgQG1iEDncAAAAAAAYmSBIGOik09wdXNIZWFkAQE4AYC7AAAAAAASVMNnQcJzcwEAAAAAAACXY8CAZ8gBAAAAAAAAFUWji01BSk9SX0JSQU5ERIeEaXNvbWfIAQAAAAAAABZFo41NSU5PUl9WRVJTSU9ORIeDNTEyZ8gBAAAAAAAAJ0WjkUNPTVBBVElCTEVfQlJBTkRTRIeQaXNvbWlzbzJhdmMxbXA0MWfIAQAAAAAAABpFo4dFTkNPREVSRIeNTGF2ZjU4LjQ1LjEwMHNzAQAAAAAAAIZjwItjxYj1SEir0QMk8GfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xWaWRlb0hhbmRsZXJnyAEAAAAAAAAhRaOHRU5DT0RFUkSHlExhdmM1OC45MS4xMDAgbGlidnB4Z8iiRaOIRFVSQVRJT05Eh5QwMDowMDowNS4wMDcwMDAwMDAAAHNzAQAAAAAAAIdjwItjxYhQRY8D0n+InmfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xTb3VuZEhhbmRsZXJnyAEAAAAAAAAiRaOHRU5DT0RFUkSHlUxhdmM1OC45MS4xMDAgbGlib3B1c2fIokWjiERVUkFUSU9ORIeUMDA6MDA6MDUuMDE4MDAwMDAwAAAfQ7Z1T2TngQCjh4IAAID4//6jQKSBAAeAMBIAnQEqQAHwAABHCIWFiIWEiAICAAYWBPcGgWSfa9ubJzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh69AD+/6tQgKOHggAVgPj//qOHggApgPj//qOHggA9gPj//qOHggBRgPj//qOHggBlgPj//qOegQBrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAHmA+P/+o4eCAI2A+P/+o4eCAKGA+P/+o4eCALWA+P/+o4eCAMmA+P/+o56BAM8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IA3YD4//6jh4IA8YD4//6jh4IBBYD4//6jh4IBGYD4//6jh4IBLYD4//6jnoEBMwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggFBgPj//qOHggFVgPj//qOHggFpgPj//qOHggF9gPj//qOHggGRgPj//qOegQGXANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAaWA+P/+o4eCAbmA+P/+o4eCAc2A+P/+o4eCAeGA+P/+o4eCAfWA+P/+o56BAfsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ICCYD4//6jh4ICHYD4//6jh4ICMYD4//6jh4ICRYD4//6jh4ICWYD4//6jnoECXwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggJtgPj//qOHggKBgPj//qOHggKVgPj//qOHggKpgPj//qOHggK9gPj//qOegQLDANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCAtGA+P/+o4eCAuWA+P/+o4eCAvmA+P/+o4eCAw2A+P/+o4eCAyGA+P/+o56BAycA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IDNYD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDDCA+P/+o4eCDESA+P/+o4eCDFiA+P/+o4eCDGyA+P/+o4eCDICA+P/+o56BDIcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IMlID4//6jh4IMqID4//6jh4IMvID4//6jh4IM0ID4//6jnoEM6wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg0MgPj//qOHgg0ggPj//qOHgg00gPj//qOHgg1IgPj//qOegQ1PANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDVyA+P/+o4eCDXCA+P/+o4eCDYSA+P/+o4eCDZiA+P/+o4eCDayA+P/+o56BDbMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4INwID4//6jh4IN1ID4//6jh4IN6ID4//6jh4IN/ID4//6jh4IOEID4//6jnoEOFwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg4kgPj//qOHgg44gPj//qOHgg5MgPj//qOHgg5ggPj//qOHgg50gPj//qOegQ57ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDoiA+P/+o4eCDpyA+P/+o4eCDrCA+P/+o4eCDsSA+P/+o4eCDtiA+P/+o56BDt8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IO7ID4//6jh4IPAID4//6jh4IPFID4//6jh4IPKID4//6jh4IPPID4//6jnoEPQwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg9QgPj//qOHgg9kgPj//qOHgg94gPj//qOHgg+MgPj//qOHgg+ggPj//qOegQ+nANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCD7SA+P/+o4eCD8iA+P/+o4eCD9yA+P/+o4eCD/CA+P/+o4eCEASA+P/+o56BEAsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IQGID4//6jh4IQLID4//6jh4IQQID4//6jh4IQVID4//6jh4IQaID4//6jnoEQbwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbAD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbID/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm0A/wCWwARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwEYIAcAAAAHQZuAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0Gb4D/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmiA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmkA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZpgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmwA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtgP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbgD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm+A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcAAAAHQZogP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaQD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GaYD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GagD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmqA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwAAAAdBm4A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBm6A/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZvAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZvgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZoAO8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaIDfAJbABGCAHARggBwEYIAcBGCAHAAAMxm1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAABOgAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAPLdHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAABOIAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAElVVUA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAATiAAAAAAAAQAAAAADQ21kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAKAAAAMgAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAu5taW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAKuc3RibAAAAKpzdHNkAAAAAAAAAAEAAACaYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAADRhdmNDAULAC//hABxnQsAL2QFB+/8ACwAMEAAAAwAQAAADAUDxQqSAAQAFaMuDyyAAAAAQcGFzcAAAAAsAAAAMAAAAGHN0dHMAAAAAAAAAAQAAADIAAAQAAAAAFHN0c3MAAAAAAAAAAQAAAAEAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAA3HN0c3oAAAAAAAAAAAAAADIAAANoAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAANhzdGNvAAAAAAAAADIAAABFAAADwQAAA9wAAAP3AAAEFgAABDEAAARMAAAEawAABIYAAAShAAAEwAAABNcAAATuAAAFDQAABSgAAAVDAAAFYgAABX0AAAWYAAAFtwAABdIAAAXtAAAGBAAABh8AAAY6AAAGWQAABnQAAAaPAAAGrgAABskAAAbkAAAHAwAABx4AAAcxAAAHUAAAB2sAAAeGAAAHpQAAB8AAAAfbAAAH+gAACBUAAAgwAAAITwAACGIAAAh9AAAInAAACLcAAAjSAAAI8QAACCV0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAE6AAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAABOIAAAEAAABAAAAAAedbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAADYVRVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAAHSG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAHDHN0YmwAAABqc3RzZAAAAAAAAAABAAAAWm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAENiAAABVQFgICABRIIVuUABoCAgAECAAAAYHN0dHMAAAAAAAAACgAAAC8AAAQAAAAAAQAACtUAAAAsAAAEAAAAAAEAAArWAAAALAAABAAAAAABAAAK1QAAACwAAAQAAAAAAQAACtUAAAAaAAAEAAAAAAEAAAH/AAABzHN0c2MAAAAAAAAAJQAAAAEAAAABAAAAAQAAAAIAAAAFAAAAAQAAAAMAAAAEAAAAAQAAAAUAAAAFAAAAAQAAAAYAAAAEAAAAAQAAAAgAAAAFAAAAAQAAAAkAAAAEAAAAAQAAAAsAAAAFAAAAAQAAAAwAAAADAAAAAQAAAA4AAAAFAAAAAQAAAA8AAAAEAAAAAQAAABEAAAAFAAAAAQAAABIAAAAEAAAAAQAAABQAAAAFAAAAAQAAABUAAAAEAAAAAQAAABcAAAADAAAAAQAAABgAAAAEAAAAAQAAABoAAAAFAAAAAQAAABsAAAAEAAAAAQAAAB0AAAAFAAAAAQAAAB4AAAAEAAAAAQAAACAAAAAFAAAAAQAAACEAAAAEAAAAAQAAACIAAAACAAAAAQAAACMAAAAFAAAAAQAAACQAAAAEAAAAAQAAACYAAAAFAAAAAQAAACcAAAAEAAAAAQAAACkAAAAFAAAAAQAAACoAAAAEAAAAAQAAACwAAAAFAAAAAQAAAC0AAAACAAAAAQAAAC4AAAAEAAAAAQAAAC8AAAAFAAAAAQAAADAAAAAEAAAAAQAAADIAAAAFAAAAAQAAADMAAAAEAAAAAQAAA1xzdHN6AAAAAAAAAAAAAADSAAAAFQAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAA3HN0Y28AAAAAAAAAMwAAADAAAAOtAAADzAAAA+cAAAQCAAAEIQAABDwAAARXAAAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=function(){r.noSleepVideo&&r.noSleepVideo.currentTime>4&&(r.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}return w(t,[{key:"destroy",value:function(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debug.warn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}},{key:"_addSourceToVideo",value:function(e,t,r){var i=document.createElement("source");i.src=r,i.type="video/".concat(t),e.appendChild(i)}},{key:"isEnabled",get:function(){return this.enabled}},{key:"enable",value:function(){var e=this,t=this.player.debug;return ud()?navigator.wakeLock.request("screen").then((function(r){e._wakeLock=r,e.enabled=!0,t.log("wakeLock","Wake Lock active."),e._wakeLock.addEventListener("release",(function(){t.log("wakeLock","Wake Lock released.")}))})).catch((function(r){throw e.enabled=!1,t.warn("wakeLock","".concat(r.name,", ").concat(r.message)),r})):this.noSleepVideo.play().then((function(r){return t.log("wakeLock","noSleepVideo Wake Lock active."),e.enabled=!0,r})).catch((function(r){throw t.warn("wakeLock","noSleepVideo ".concat(r.name,", ").concat(r.message)),e.enabled=!1,r}))}},{key:"disable",value:function(){ud()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debug.log("wakeLock","Disabling wake lock.")}}])}();function hd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pd={exports:{}};!function(e,t){var r,i,a,n,o;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse base URL.");return a.path=o.normalizePath(a.path),o.buildURLFromParts(a)}var n=o.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=o.normalizePath(n.path),o.buildURLFromParts(n)):t;var s=o.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=i.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var c={scheme:s.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(c.netLoc=s.netLoc,"/"!==n.path[0]))if(n.path){var u=s.path,d=u.substring(0,u.lastIndexOf("/")+1)+n.path;c.path=o.normalizePath(d)}else c.path=s.path,n.params||(c.params=s.params,n.query||(c.query=s.query));return null===c.path&&(c.path=r.alwaysNormalize?o.normalizePath(n.path):n.path),o.buildURLFromParts(c)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}(pd);var fd=pd.exports;function md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function gd(e){for(var t=1;t1?t-1:0),i=1;i")):Td}(t)}))}var Dd=xd,Ld=/^(\d+)x(\d+)$/,Pd=/(.+?)=(".*?"|.*?)(?:,|$)/g,Bd=function(){function e(t){S(this,e),"string"==typeof t&&(t=e.parseAttrList(t)),Ad(this,t)}return w(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter((function(e){return"X-"===e.substring(0,2)}))}},{key:"decimalInteger",value:function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;iNumber.MAX_SAFE_INTEGER?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"optionalFloat",value:function(e,t){var r=this[e];return r?parseFloat(r):t}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"bool",value:function(e){return"YES"===this[e]}},{key:"decimalResolution",value:function(e){var t=Ld.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}}],[{key:"parseAttrList",value:function(e){var t,r={};for(Pd.lastIndex=0;null!==(t=Pd.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[t[1].trim()]=i}return r}}])}();function Id(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}var Md=function(){function e(t,r){if(S(this,e),this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,r){var i=r.attr;for(var a in i)if(Object.prototype.hasOwnProperty.call(t,a)&&t[a]!==i[a]){Dd.warn('DATERANGE tag attribute: "'.concat(a,'" does not match for tags with ID: "').concat(t.ID,'"')),this._badValueForSameId=a;break}t=Ad(new Bd({}),i,t)}if(this.attr=t,this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){var n=new Date(this.attr["END-DATE"]);bd(n.getTime())&&(this._endDate=n)}}return w(e,[{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(){if(this._endDate)return this._endDate;var e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(bd(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&&bd(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}])}(),Ud=w((function e(){S(this,e),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}})),Fd="audio",Od="video",Nd="audiovideo",jd=function(){function e(t){S(this,e),this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=p(p(p({},Fd,null),Od,null),Nd,null),this.baseurl=t}return w(e,[{key:"setByteRange",value:function(e,t){var r,i=e.split("@",2);r=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}},{key:"byteRange",get:function(){return this._byteRange?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=fd.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}])}(),zd=function(e){function t(e,r){var i;return S(this,t),i=_(this,t,[r]),i._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new Ud,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.urlId=0,i.type=e,i}return k(t,e),w(t,[{key:"decryptdata",get:function(){var e=this.levelkeys;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{var r=Object.keys(this.levelkeys);if(1===r.length)return this._decryptdata=this.levelkeys[r[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!bd(this.programDateTime))return null;var e=bd(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t=Object.keys(this.levelkeys),r=t.length;if(r>1||1===r&&this.levelkeys[t[0]].encrypted)return!0}return!1}},{key:"setKeyFormat",value:function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}},{key:"abortRequests",value:function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}},{key:"setElementaryStreamInfo",value:function(e,t,r,i,a){var n=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=this.elementaryStreams,s=o[e];s?(s.startPTS=Math.min(s.startPTS,t),s.endPTS=Math.max(s.endPTS,r),s.startDTS=Math.min(s.startDTS,i),s.endDTS=Math.max(s.endDTS,a)):o[e]={startPTS:t,endPTS:r,startDTS:i,endDTS:a,partial:n}}},{key:"clearElementaryStreamInfo",value:function(){var e=this.elementaryStreams;e[Fd]=null,e[Od]=null,e[Nd]=null}}])}(jd),Gd=function(e){function t(e,r,i,a,n){var o;S(this,t),o=_(this,t,[i]),o.fragOffset=0,o.duration=0,o.gap=!1,o.independent=!1,o.relurl=void 0,o.fragment=void 0,o.index=void 0,o.stats=new Ud,o.duration=e.decimalFloatingPoint("DURATION"),o.gap=e.bool("GAP"),o.independent=e.bool("INDEPENDENT"),o.relurl=e.enumeratedString("URI"),o.fragment=r,o.index=a;var s=e.enumeratedString("BYTERANGE");return s&&o.setByteRange(s,n),n&&(o.fragOffset=n.fragOffset+n.duration),o}return k(t,e),w(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}])}(jd),Hd=function(){function e(t){S(this,e),this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}return w(e,[{key:"reloaded",value:function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}},{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&bd(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])}();function Vd(e){return Uint8Array.from(atob(e),(function(e){return e.charCodeAt(0)}))}function Wd(e){var t=e.split(":"),r=null;if("data"===t[0]&&2===t.length){var i=t[1].split(";"),a=i[i.length-1].split(",");if(2===a.length){var n="base64"===a[0],o=a[1];n?(i.splice(-1,1),r=Vd(o)):r=function(e){var t=Jd(e).subarray(0,16),r=new Uint8Array(16);return r.set(t,16-t.length),r}(o)}}return r}function Jd(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(function(e){return e.charCodeAt(0)}))}var qd="undefined"!=typeof self?self:void 0,Kd={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Yd="org.w3.clearkey",Qd="com.apple.streamingkeydelivery",Xd="com.microsoft.playready",Zd="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function $d(e){switch(e){case Qd:return Kd.FAIRPLAY;case Xd:return Kd.PLAYREADY;case Zd:return Kd.WIDEVINE;case Yd:return Kd.CLEARKEY}}var eh="edef8ba979d64acea3c827dcd51d21ed";function th(e){switch(e){case Kd.FAIRPLAY:return Qd;case Kd.PLAYREADY:return Xd;case Kd.WIDEVINE:return Zd;case Kd.CLEARKEY:return Yd}}function rh(e){var t=e.drmSystems,r=e.widevineLicenseUrl,i=t?[Kd.FAIRPLAY,Kd.WIDEVINE,Kd.PLAYREADY,Kd.CLEARKEY].filter((function(e){return!!t[e]})):[];return!i[Kd.WIDEVINE]&&r&&i.push(Kd.WIDEVINE),i}var ih,ah=null!=qd&&null!=(ih=qd.navigator)&&ih.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function nh(e,t,r){return Uint8Array.prototype.slice?e.slice(t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))}var oh,sh=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},lh=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},ch=function(e,t){for(var r=t,i=0;sh(e,t);)i+=10,i+=uh(e,t+6),lh(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(r,r+i)},uh=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3],r},dh=function(e,t){return sh(e,t)&&uh(e,t+6)+10<=e.length-t},hh=function(e){for(var t=mh(e),r=0;r1&&void 0!==arguments[1]&&arguments[1],r=kh();if(r){var i=r.decode(e);if(t){var a=i.indexOf("\0");return-1!==a?i.substring(0,a):i}return i.replace(/\0/g,"")}for(var n,o,s,l=e.length,c="",u=0;u>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(n);break;case 12:case 13:o=e[u++],c+=String.fromCharCode((31&n)<<6|63&o);break;case 14:o=e[u++],s=e[u++],c+=String.fromCharCode((15&n)<<12|(63&o)<<6|(63&s)<<0)}}return c};function kh(){if(!navigator.userAgent.includes("PlayStation 4"))return oh||void 0===self.TextDecoder||(oh=new self.TextDecoder("utf-8")),oh}var wh=function(e){for(var t="",r=0;r>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function Bh(e,t){var r=[];if(!t.length)return r;for(var i=e.byteLength,a=0;a1?a+n:i;if(Ch(e.subarray(a+4,a+8))===t[0])if(1===t.length)r.push(e.subarray(a+8,o));else{var s=Bh(e.subarray(a+8,o),t.slice(1));s.length&&Eh.apply(r,s)}a=o}return r}function Ih(e){var t=[],r=e[0],i=8,a=Rh(e,i);i+=4;var n=0,o=0;0===r?(n=Rh(e,i),o=Rh(e,i+4),i+=8):(n=Dh(e,i),o=Dh(e,i+8),i+=16),i+=2;var s=e.length+o,l=xh(e,i);i+=2;for(var c=0;c>>31)return Dd.warn("SIDX has hierarchical references (not supported)"),null;var p=Rh(e,u);u+=4,t.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/a,start:s,end:s+h-1}}),s+=h,u+=4,i=u}return{earliestPresentationTime:n,timescale:a,version:r,referencesCount:l,references:t}}function Mh(e){for(var t=[],r=Bh(e,["moov","trak"]),i=0;i12){var u=4;if(3!==c[u++])break;u=Fh(c,u),u+=2;var d=c[u++];if(128&d&&(u+=2),64&d&&(u+=c[u++]),4!==c[u++])break;u=Fh(c,u);var h=c[u++];if(64!==h)break;if(a+="."+Oh(h),u+=12,5!==c[u++])break;u=Fh(c,u);var p=c[u++],f=(248&p)>>3;31===f&&(f+=1+((7&p)<<3)+((224&c[u])>>5)),a+="."+f}break;case"hvc1":case"hev1":var m=Bh(r,["hvcC"])[0],g=m[1],y=["","A","B","C"][g>>6],v=31&g,A=Rh(m,2),b=(32&g)>>5?"H":"L",_=m[12],k=m.subarray(6,12);a+="."+y+v,a+="."+A.toString(16).toUpperCase(),a+="."+b+_;for(var w="",S=k.length;S--;){var E=k[S];(E||w)&&(w="."+E.toString(16).toUpperCase()+w)}a+=w;break;case"dvh1":case"dvhe":var T=Bh(r,["dvcC"])[0],C=T[2]>>1&127,x=T[2]<<5&32|T[3]>>3&31;a+="."+Nh(C)+"."+Nh(x);break;case"vp09":var R=Bh(r,["vpcC"])[0],D=R[4],L=R[5],P=R[6]>>4&15;a+="."+Nh(D)+"."+Nh(L)+"."+Nh(P);break;case"av01":var B=Bh(r,["av1C"])[0],I=B[1]>>>5,M=31&B[1],U=B[2]>>>7?"H":"M",F=(64&B[2])>>6,O=(32&B[2])>>5,N=2===I&&F?O?12:10:F?10:8,j=(16&B[2])>>4,z=(8&B[2])>>3,G=(4&B[2])>>2,H=3&B[2],V=1,W=1,J=1,q=0;a+="."+I+"."+Nh(M)+U+"."+Nh(N)+"."+j+"."+z+G+H+"."+Nh(V)+"."+Nh(W)+"."+Nh(J)+"."+q;break}return{codec:a,encrypted:n}}function Fh(e,t){for(var r=t+5;128&e[t++]&&t>1&63;return 39===r||40===r}return 6===(31&t)}function Wh(e,t,r,i){var a=Jh(e),n=0;n+=t;for(var o=0,s=0,l=0;n=a.length)break;l=a[n++],o+=l}while(255===l);s=0;do{if(n>=a.length)break;l=a[n++],s+=l}while(255===l);var c=a.length-n,u=n;if(sc){Dd.error("Malformed SEI payload. ".concat(s," is too small, only ").concat(c," bytes left to parse."));break}if(4===o){if(181===a[u++]){var d=xh(a,u);if(u+=2,49===d){var h=Rh(a,u);if(u+=4,1195456820===h){var p=a[u++];if(3===p){var f=a[u++],m=31&f,g=64&f,y=g?2+3*m:0,v=new Uint8Array(y);if(g){v[0]=f;for(var A=1;A16){for(var b=[],_=0;_<16;_++){var k=a[u++].toString(16);b.push(1==k.length?"0"+k:k),3!==_&&5!==_&&7!==_&&9!==_||b.push("-")}for(var w=s-16,S=new Uint8Array(w),E=0;E0?(n=new Uint8Array(4),t.length>0&&new DataView(n.buffer).setUint32(0,t.length,!1)):n=new Uint8Array;var l=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(l.buffer).setUint32(0,r.byteLength,!1),function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=255&n,s.set(e,4),o=0,n=8;o3&&void 0!==arguments[3]?arguments[3]:[1],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;S(this,e),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=r,this.keyFormat=i,this.keyFormatVersions=a,this.iv=n,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&"AES-128"!==t}return w(e,[{key:"isSupported",value:function(){if(this.method){if("AES-128"===this.method||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Qd:case Zd:case Xd:case Yd:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}},{key:"getDecryptData",value:function(t){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof t&&("AES-128"!==this.method||this.iv||Dd.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue')),t=0);var r=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}(t);return new e(this.method,this.uri,"identity",this.keyFormatVersions,r)}var i=Wd(this.uri);if(i)switch(this.keyFormat){case Zd:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case Xd:var a=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=qh(a,null,i);var n=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),o=String.fromCharCode.apply(null,Array.from(n)),s=o.substring(o.indexOf("<"),o.length),l=(new DOMParser).parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(l){var c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){var u=Vd(c).subarray(0,16);!function(e){var t=function(e,t,r){var i=e[t];e[t]=e[r],e[r]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(u),this.keyId=u}}break;default:var d=i.subarray(0,16);if(16!==d.length){var h=new Uint8Array(16);h.set(d,16-d.length),d=h}this.keyId=d;break}if(!this.keyId||16!==this.keyId.byteLength){var p=Kh[this.uri];if(!p){var f=Object.keys(Kh).length%Number.MAX_SAFE_INTEGER;p=new Uint8Array(16),new DataView(p.buffer,12,4).setUint32(0,f),Kh[this.uri]=p}this.keyId=p}return this}}],[{key:"clearKeyUriToKeyIdMap",value:function(){Kh={}}}])}(),Qh=/\{\$([a-zA-Z0-9-_]+)\}/g;function Xh(e){return Qh.test(e)}function Zh(e,t,r){if(null!==e.variableList||e.hasVariableRefs)for(var i=r.length;i--;){var a=r[i],n=t[a];n&&(t[a]=$h(e,n))}}function $h(e,t){if(null!==e.variableList||e.hasVariableRefs){var r=e.variableList;return t.replace(Qh,(function(t){var i=t.substring(2,t.length-1),a=null==r?void 0:r[i];return void 0===a?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(i,'"'))),t):a}))}return t}function ep(e,t,r){var i,a,n=e.variableList;if(n||(e.variableList=n={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{var o=new self.URL(r).searchParams;if(!o.has(i))throw new Error('"'.concat(i,'" does not match any query parameter in URI: "').concat(r,'"'));a=o.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: ".concat(t.message)))}}else i=t.NAME,a=t.VALUE;i in n?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(i,'"'))):n[i]=a||""}function tp(e,t,r){var i=t.IMPORT;if(r&&i in r){var a=e.variableList;a||(e.variableList=a={}),a[i]=r[i]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(i,'"')))}function rp(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if("undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var ip={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function ap(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return!e.split(",").some((function(e){return!np(e,t,r)}))}function np(e,t){var r,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=rp(i);return null!=(r=null==a?void 0:a.isTypeSupported(op(e,t)))&&r}function op(e,t){return"".concat(t,'/mp4;codecs="').concat(e,'"')}function sp(e){if(e){var t=e.substring(0,4);return ip.video[t]}return 2}function lp(e){return e.split(",").reduce((function(e,t){var r=ip.video[t];return r?(2*r+e)/(e?3:2):(ip.audio[t]+e)/(e?2:1)}),0)}var cp={},up=/flac|opus/i;function dp(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.replace(up,(function(e){return function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(cp[e])return cp[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],i=0;i0&&n.length0&&j.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=j.optionalFloat("PART-HOLD-BACK",0),c.holdBack=j.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var z=new Bd(T);c.partTarget=z.decimalFloatingPoint("PART-TARGET");break;case"PART":var G=c.partList;G||(G=c.partList=[]);var H=p>0?G[G.length-1]:void 0,V=p++,W=new Bd(T);Zh(c,W,["BYTERANGE","URI"]);var J=new Gd(W,y,t,V,H);G.push(J),y.duration+=J.duration;break;case"PRELOAD-HINT":var q=new Bd(T);Zh(c,q,["URI"]),c.preloadHint=q;break;case"RENDITION-REPORT":var K=new Bd(T);Zh(c,K,["URI"]),c.renditionReports=c.renditionReports||[],c.renditionReports.push(K);break;default:Dd.warn("line parsed but not handled: ".concat(o))}}}g&&!g.relurl?(u.pop(),f-=g.duration,c.partList&&(c.fragmentHint=g)):c.partList&&(wp(y,g),y.cc=m,c.fragmentHint=y,l&&Ep(y,l,c));var Y=u.length,Q=u[0],X=u[Y-1];if(f+=c.skippedSegments*c.targetduration,f>0&&Y&&X){c.averagetargetduration=f/Y;var Z=X.sn;c.endSN="initSegment"!==Z?Z:0,c.live||(X.endList=!0),Q&&(c.startCC=Q.cc)}else c.endSN=0,c.startCC=0;return c.fragmentHint&&(f+=c.fragmentHint.duration),c.totalduration=f,c.endCC=m,v>0&&function(e,t){for(var r=e[t],i=t;i--;){var a=e[i];if(!a)return;a.programDateTime=r.programDateTime-1e3*a.duration,r=a}}(u,v),c}}])}();function Ap(e,t,r){var i,a,n=new Bd(e);Zh(r,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var o=null!=(i=n.METHOD)?i:"",s=n.URI,l=n.hexadecimalInteger("IV"),c=n.KEYFORMATVERSIONS,u=null!=(a=n.KEYFORMAT)?a:"identity";s&&n.IV&&!l&&Dd.error("Invalid IV: ".concat(n.IV));var d=s?vp.resolve(s,t):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Yh(o,d,u,h,l)}function bp(e){var t=new Bd(e).decimalFloatingPoint("TIME-OFFSET");return bd(t)?t:null}function _p(e,t){var r=(e||"").split(/[ ,]+/).filter((function(e){return e}));["video","audio","text"].forEach((function(e){var i=r.filter((function(t){return function(e,t){var r=ip[t];return!!r&&!!r[e.slice(0,4)]}(t,e)}));i.length&&(t["".concat(e,"Codec")]=i.join(","),r=r.filter((function(e){return-1===i.indexOf(e)})))})),t.unknownCodecs=r}function kp(e,t,r){var i=t[r];i&&(e[r]=i)}function wp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),bd(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function Sp(e,t,r,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=r,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Ep(e,t,r){e.levelkeys=t;var i=r.encryptedFragments;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some((function(e){return t[e].isCommonEncryption}))||i.push(e)}var Tp="manifest",Cp="level",xp="audioTrack",Rp="subtitleTrack",Dp="main",Lp="audio",Pp="subtitle";function Bp(e){var t=e.type;switch(t){case xp:return Lp;case Rp:return Pp;default:return Dp}}function Ip(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}var Mp=function(){function e(t){S(this,e),this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=t,this.registerListeners()}return w(e,[{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.destroyInternalLoaders()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.LEVEL_LOADING,this.onLevelLoading,this),e.on(wd.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(wd.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.LEVEL_LOADING,this.onLevelLoading,this),e.off(wd.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(wd.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}},{key:"createInternalLoader",value:function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,a=new(r||i)(t);return this.loaders[e.type]=a,a}},{key:"getInternalLoader",value:function(e){return this.loaders[e.type]}},{key:"resetInternalLoader",value:function(e){this.loaders[e]&&delete this.loaders[e]}},{key:"destroyInternalLoaders",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}},{key:"destroy",value:function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}},{key:"onManifestLoading",value:function(e,t){var r=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Tp,url:r,deliveryDirectives:null})}},{key:"onLevelLoading",value:function(e,t){var r=t.id,i=t.level,a=t.pathwayId,n=t.url,o=t.deliveryDirectives;this.load({id:r,level:i,pathwayId:a,responseType:"text",type:Cp,url:n,deliveryDirectives:o})}},{key:"onAudioTrackLoading",value:function(e,t){var r=t.id,i=t.groupId,a=t.url,n=t.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:xp,url:a,deliveryDirectives:n})}},{key:"onSubtitleTrackLoading",value:function(e,t){var r=t.id,i=t.groupId,a=t.url,n=t.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:Rp,url:a,deliveryDirectives:n})}},{key:"load",value:function(e){var t,r,i,a=this,n=this.hls.config,o=this.getInternalLoader(e);if(o){var s=o.context;if(s&&s.url===e.url&&s.level===e.level)return void Dd.trace("[playlist-loader]: playlist request ongoing");Dd.log("[playlist-loader]: aborting previous loader for type: ".concat(e.type)),o.abort()}if((r=e.type===Tp?n.manifestLoadPolicy.default:Ad({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(e),bd(null==(t=e.deliveryDirectives)?void 0:t.part))&&(e.type===Cp&&null!==e.level?i=this.hls.levels[e.level].details:e.type===xp&&null!==e.id?i=this.hls.audioTracks[e.id].details:e.type===Rp&&null!==e.id&&(i=this.hls.subtitleTracks[e.id].details),i)){var l=i.partTarget,c=i.targetduration;if(l&&c){var u=1e3*Math.max(3*l,.8*c);r=Ad({},r,{maxTimeToFirstByteMs:Math.min(u,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,r.maxTimeToFirstByteMs)})}}var d=r.errorRetry||r.timeoutRetry||{},h={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:d.maxNumRetry||0,retryDelay:d.retryDelayMs||0,maxRetryDelay:d.maxRetryDelayMs||0},p={onSuccess:function(e,t,r,i){var n=a.getInternalLoader(r);a.resetInternalLoader(r.type);var o=e.data;0===o.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),vp.isMediaPlaylist(o)?a.handleTrackOrLevelPlaylist(e,t,r,i||null,n):a.handleMasterPlaylist(e,t,r,i)):a.handleManifestParsingError(e,r,new Error("no EXTM3U delimiter"),i||null,t)},onError:function(e,t,r,i){a.handleNetworkError(t,r,!1,e,i)},onTimeout:function(e,t,r){a.handleNetworkError(t,r,!0,void 0,e)}};o.load(e,h,p)}},{key:"handleMasterPlaylist",value:function(e,t,r,i){var a=this.hls,n=e.data,o=Ip(e,r),s=vp.parseMasterPlaylist(n,o);if(s.playlistParsingError)this.handleManifestParsingError(e,r,s.playlistParsingError,i,t);else{var l=s.contentSteering,c=s.levels,u=s.sessionData,d=s.sessionKeys,h=s.startTimeOffset,p=s.variableList;this.variableList=p;var f=vp.parseMasterPlaylistMedia(n,o,s),m=f.AUDIO,g=void 0===m?[]:m,y=f.SUBTITLES,v=f["CLOSED-CAPTIONS"];g.length&&(g.some((function(e){return!e.url}))||!c[0].audioCodec||c[0].attrs.AUDIO||(Dd.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Bd({}),bitrate:0,url:""}))),a.trigger(wd.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:y,captions:v,contentSteering:l,url:o,stats:t,networkDetails:i,sessionData:u,sessionKeys:d,startTimeOffset:h,variableList:p})}}},{key:"handleTrackOrLevelPlaylist",value:function(e,t,r,i,a){var n=this.hls,o=r.id,s=r.level,l=r.type,c=Ip(e,r),u=bd(s)?s:bd(o)?o:0,d=Bp(r),h=vp.parseLevelPlaylist(e.data,c,u,d,0,this.variableList);if(l===Tp){var p={attrs:new Bd({}),bitrate:0,details:h,name:"",url:c};n.trigger(wd.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:c,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=h,this.handlePlaylistLoaded(h,e,t,r,i,a)}},{key:"handleManifestParsingError",value:function(e,t,r,i,a){this.hls.trigger(wd.ERROR,{type:Sd.NETWORK_ERROR,details:Ed.MANIFEST_PARSING_ERROR,fatal:t.type===Tp,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:i,stats:a})}},{key:"handleNetworkError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,n="A network ".concat(r?"timeout":"error"+(i?" (status "+i.code+")":"")," occurred while loading ").concat(e.type);e.type===Cp?n+=": ".concat(e.level," id: ").concat(e.id):e.type!==xp&&e.type!==Rp||(n+=" id: ".concat(e.id,' group-id: "').concat(e.groupId,'"'));var o=new Error(n);Dd.warn("[playlist-loader]: ".concat(n));var s=Ed.UNKNOWN,l=!1,c=this.getInternalLoader(e);switch(e.type){case Tp:s=r?Ed.MANIFEST_LOAD_TIMEOUT:Ed.MANIFEST_LOAD_ERROR,l=!0;break;case Cp:s=r?Ed.LEVEL_LOAD_TIMEOUT:Ed.LEVEL_LOAD_ERROR,l=!1;break;case xp:s=r?Ed.AUDIO_TRACK_LOAD_TIMEOUT:Ed.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Rp:s=r?Ed.SUBTITLE_TRACK_LOAD_TIMEOUT:Ed.SUBTITLE_LOAD_ERROR,l=!1}c&&this.resetInternalLoader(e.type);var u={type:Sd.NETWORK_ERROR,details:s,fatal:l,url:e.url,loader:c,context:e,error:o,networkDetails:t,stats:a};if(i){var d=(null==t?void 0:t.url)||e.url;u.response=gd({url:d,data:void 0},i)}this.hls.trigger(wd.ERROR,u)}},{key:"handlePlaylistLoaded",value:function(e,t,r,i,a,n){var o=this.hls,s=i.type,l=i.level,c=i.id,u=i.groupId,d=i.deliveryDirectives,h=Ip(t,i),p=Bp(i),f="number"==typeof i.level&&p===Dp?l:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var m=e.playlistParsingError;if(m)o.trigger(wd.ERROR,{type:Sd.NETWORK_ERROR,details:Ed.LEVEL_PARSING_ERROR,fatal:!1,url:h,error:m,reason:m.message,response:t,context:i,level:f,parent:p,networkDetails:a,stats:r});else switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),n.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),s){case Tp:case Cp:o.trigger(wd.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:r,networkDetails:a,deliveryDirectives:d});break;case xp:o.trigger(wd.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:r,networkDetails:a,deliveryDirectives:d});break;case Rp:o.trigger(wd.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:r,networkDetails:a,deliveryDirectives:d})}}else{var g=new Error("No Segments found in Playlist");o.trigger(wd.ERROR,{type:Sd.NETWORK_ERROR,details:Ed.LEVEL_EMPTY_ERROR,fatal:!1,url:h,error:g,reason:g.message,response:t,context:i,level:f,parent:p,networkDetails:a,stats:r})}}}])}();function Up(e,t){var r;try{r=new Event("addtrack")}catch(e){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)}function Fp(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: ".concat(t))}catch(r){Dd.debug("[texttrack-utils]: ".concat(r));try{var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){Dd.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(e))}}"disabled"===r&&(e.mode=r)}function Op(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var r=e.cues.length;r--;)e.removeCue(e.cues[r]);"disabled"===t&&(e.mode=t)}function Np(e,t,r,i){var a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var n=function(e,t,r){var i=[],a=function(e,t){if(te[r].endTime)return-1;for(var i=0,a=r;i<=a;){var n=Math.floor((a+i)/2);if(te[n].startTime&&i-1)for(var n=a,o=e.length;n=t&&s.endTime<=r)i.push(s);else if(s.startTime>r)return i}return i}(e.cues,t,r),o=0;oJp&&(d=Jp),d-u<=0&&(d=u+.25);for(var h=0;ht.startDate&&(!e||t.startDate.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,n)),c=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;e.playbackRate=Math.min(l,Math.max(1,c))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}}},{key:"estimateLiveEdge",value:function(){var e=this.levelDetails;return null===e?null:e.edge+e.age}},{key:"computeLatency",value:function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}])}(),Qp=["NONE","TYPE-0","TYPE-1",null],Xp=["SDR","PQ","HLG"],Zp="",$p="YES",ef="v2",tf=function(){function e(t,r,i){S(this,e),this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=r,this.skip=i}return w(e,[{key:"addDirectives",value:function(e){var t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}])}(),rf=function(){function e(t){S(this,e),this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(e){return!!e})).map((function(e){return e.substring(0,4)})).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}return w(e,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"hasAudioGroup",value:function(e){return af(this._audioGroups,e)}},{key:"hasSubtitleGroup",value:function(e){return af(this._subtitleGroups,e)}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"addGroupId",value:function(e,t){if(t)if("audio"===e){var r=this._audioGroups;r||(r=this._audioGroups=[]),-1===r.indexOf(t)&&r.push(t)}else if("text"===e){var i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),-1===i.indexOf(t)&&i.push(t)}}},{key:"urlId",get:function(){return 0},set:function(e){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var e;return null==(e=this.audioGroups)?void 0:e[0]}},{key:"textGroupId",get:function(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}},{key:"addFallback",value:function(){}}])}();function af(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function nf(e,t){var r=t.startPTS;if(bd(r)){var i,a=0;t.sn>e.sn?(a=r-e.start,i=e):(a=e.start-r,i=t),i.duration!==a&&(i.duration=a)}else 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 of(e,t,r,i,a,n){i-r<=0&&(Dd.warn("Fragment should have a positive duration",t),i=r+t.duration,n=a+t.duration);var o=r,s=i,l=t.startPTS,c=t.endPTS;if(bd(l)){var u=Math.abs(l-r);bd(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,o=Math.max(r,l),r=Math.min(r,l),a=Math.min(a,t.startDTS),s=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,t.endDTS)}var d=r-t.start;0!==t.start&&(t.start=r),t.duration=i-t.start,t.startPTS=r,t.maxStartPTS=o,t.startDTS=a,t.endPTS=i,t.minEndPTS=s,t.endDTS=n;var h,p=t.sn;if(!e||pe.endSN)return 0;var f=p-e.startSN,m=e.fragments;for(m[f]=t,h=f;h>0;h--)nf(m[h],m[h-1]);for(h=f;h=0;a--){var n=i[a].initSegment;if(n){r=n;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var o,s=0;if(function(e,t,r){for(var i=t.skippedSegments,a=Math.max(e.startSN,t.startSN)-t.startSN,n=(e.fragmentHint?1:0)+(i?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,s=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a;c<=n;c++){var u=l[o+c],d=s[c];i&&!d&&c=i.length||cf(t,i[r].start)}function cf(e,t){if(t){for(var r=e.fragments,i=e.skippedSegments;i499)}(a)||!!r);return e.shouldRetry?e.shouldRetry(e,t,r,i,n):n}var vf=function(e,t){for(var r=0,i=e.length-1,a=null,n=null;r<=i;){a=(r+i)/2|0,n=e[a];var o=t(n);if(o>0)r=a+1;else{if(!(o<0))return n;i=a-1}}return null};function Af(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=null;if(e){a=t[e.sn-t[0].sn+1]||null;var n=e.endDTS-r;n>0&&n<15e-7&&(r+=15e-7)}else 0===r&&0===t[0].start&&(a=t[0]);if(a&&(!e||e.level===a.level)&&0===bf(r,i,a))return a;var o=vf(t,bf.bind(null,r,i));return!o||o===e&&a?a:o}function bf(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;if(r.start<=e&&r.start+r.duration>e)return 0;var i=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=e?1:r.start-i>e&&r.start?-1:0}function _f(e,t,r){var i=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>e}var kf=0,wf=2,Sf=3,Ef=5,Tf=0,Cf=1,xf=2,Rf=function(){function e(t,r){S(this,e),this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=Dd.log.bind(Dd,"".concat(r,":")),this.warn=Dd.warn.bind(Dd,"".concat(r,":")),this.hls=t}return w(e,[{key:"destroy",value:function(){this.clearTimer(),this.hls=this.log=this.warn=null}},{key:"clearTimer",value:function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}},{key:"startLoad",value:function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}},{key:"stopLoad",value:function(){this.canLoad=!1,this.clearTimer()}},{key:"switchParams",value:function(e,t){var r=null==t?void 0:t.renditionReports;if(r){for(var i=-1,a=0;a=0&&u>t.partTarget&&(c+=1)}return new tf(l,c>=0?c:void 0,Zp)}}}},{key:"loadPlaylist",value:function(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}},{key:"shouldLoadPlaylist",value:function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}},{key:"shouldReloadPlaylist",value:function(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}},{key:"playlistLoaded",value:function(e,t,r){var i=this,a=t.details,n=t.stats,o=self.performance.now(),s=n.loading.first?Math.max(0,o-n.loading.first):0;if(a.advancedDateTime=Date.now()-s,a.live||null!=r&&r.live){if(a.reloaded(r),r&&this.log("live playlist ".concat(e," ").concat(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:a.updated?"UPDATED":"MISSED")),r&&a.fragments.length>0&&sf(r,a),!this.canLoad||!a.live)return;var l,c,u;if(a.canBlockReload&&a.endSN&&a.advanced){var d=this.hls.config.lowLatencyMode,h=a.lastPartSn,p=a.endSN,f=a.lastPartIndex,m=h===p,g=d?0:f;-1!==f?(c=m?p+1:h,u=m?g:f+1):c=p+1;var y=a.age,v=y+a.ageHeader,A=Math.min(v-a.partTarget,1.5*a.targetduration);if(A>0){if(r&&A>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: ".concat(r.tuneInGoal," to: ").concat(A," with playlist age: ").concat(a.age)),A=0;else{var b=Math.floor(A/a.targetduration);c+=b,void 0!==u&&(u+=Math.round(A%a.targetduration/a.partTarget)),this.log("CDN Tune-in age: ".concat(a.ageHeader,"s last advanced ").concat(y.toFixed(2),"s goal: ").concat(A," skip sn ").concat(b," to part ").concat(u))}a.tuneInGoal=A}if(l=this.getDeliveryDirectives(a,t.deliveryDirectives,c,u),d||!m)return void this.loadPlaylist(l)}else(a.canBlockReload||a.canSkipUntil)&&(l=this.getDeliveryDirectives(a,t.deliveryDirectives,c,u));var _=this.hls.mainForwardBufferInfo,k=_?_.end-_.len:0,w=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,r=1e3*e.targetduration;if(e.updated){var i=e.fragments,a=4;if(i.length&&r*a>t){var n=1e3*i[i.length-1].duration;nthis.requestScheduled+w&&(this.requestScheduled=n.loading.start),void 0!==c&&a.canBlockReload?this.requestScheduled=n.loading.first+w-(1e3*a.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+w=c.maxNumRetry)return!1;if(i&&null!=(d=e.context)&&d.deliveryDirectives)this.warn("Retrying playlist loading ".concat(l+1,"/").concat(c.maxNumRetry,' after "').concat(r,'" without delivery-directives')),this.loadPlaylist();else{var h=mf(c,l);this.timer=self.setTimeout((function(){return t.loadPlaylist()}),h),this.warn("Retrying playlist loading ".concat(l+1,"/").concat(c.maxNumRetry,' after "').concat(r,'" in ').concat(h,"ms"))}e.levelRetry=!0,a.resolved=!0}return u}}])}(),Df=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;S(this,e),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=r,this.totalWeight_=i}return w(e,[{key:"sample",value:function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}])}(),Lf=function(){function e(t,r,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;S(this,e),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Df(t),this.fast_=new Df(r),this.defaultTTFB_=a,this.ttfb_=new Df(t)}return w(e,[{key:"update",value:function(e,t){var r=this.slow_,i=this.fast_,a=this.ttfb_;r.halfLife!==e&&(this.slow_=new Df(e,r.getEstimate(),r.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Df(t,i.getEstimate(),i.getTotalWeight())),a.halfLife!==e&&(this.ttfb_=new Df(e,a.getEstimate(),a.getTotalWeight()))}},{key:"sample",value:function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}},{key:"sampleTTFB",value:function(e){var t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))}},{key:"canEstimate",value:function(){return this.fast_.getTotalWeight()>=this.minWeight_}},{key:"getEstimate",value:function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}},{key:"getEstimateTTFB",value:function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}},{key:"destroy",value:function(){}}])}(),Pf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Bf={};function If(e,t,r,i,a,n){var o=e.audioCodec?e.audioGroups:null,s=null==n?void 0:n.audioCodec,l=null==n?void 0:n.channels,c=l?parseInt(l):s?1/0:2,u=null;if(null!=o&&o.length)try{u=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((function(e,r){if(r){var i=t.groups[r];if(!i)throw new Error("Audio track group ".concat(r," not found"));Object.keys(i.channels).forEach((function(t){e[t]=(e[t]||0)+i.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(i,30)||"SDR"!==e.videoRange&&e.videoRange!==r||e.bitrate>Math.max(a,8e6))||!!u&&bd(c)&&Object.keys(u).some((function(e){return parseInt(e)>c}))}function Mf(e,t,r){var i=e.videoCodec,a=e.audioCodec;if(!i||!a||!r)return Promise.resolve(Pf);var n={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},o=e.videoRange;"SDR"!==o&&(n.transferFunction=o.toLowerCase());var s=i.split(",").map((function(e){return{type:"media-source",video:gd(gd({},n),{},{contentType:op(e,"video")})}}));return a&&e.audioGroups&&e.audioGroups.forEach((function(e){var r;e&&(null==(r=t.groups[e])||r.tracks.forEach((function(t){if(t.groupId===e){var r=t.channels||"",i=parseFloat(r);bd(i)&&i>2&&s.push.apply(s,a.split(",").map((function(e){return{type:"media-source",audio:{contentType:op(e,"audio"),channels:""+i}}})))}})))})),Promise.all(s.map((function(e){var t=function(e){var t=e.audio,r=e.video,i=r||t;if(i){var a=i.contentType.split('"')[1];if(r)return"r".concat(r.height,"x").concat(r.width,"f").concat(Math.ceil(r.framerate)).concat(r.transferFunction||"sd","_").concat(a,"_").concat(Math.ceil(r.bitrate/1e5));if(t)return"c".concat(t.channels).concat(t.spatialRendering?"s":"n","_").concat(a)}return""}(e);return Bf[t]||(Bf[t]=r.decodingInfo(e))}))).then((function(e){return{supported:!e.some((function(e){return!e.supported})),configurations:s,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:s,decodingInfoResults:[],error:e}}))}function Uf(e,t){var r=!1,i=[];return e&&(r="SDR"!==e,i=[e]),t&&(i=t.allowedVideoRanges||Xp.slice(0),r=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),i=r?i.filter((function(e){return"SDR"!==e})):["SDR"]),{preferHDR:r,allowedVideoRanges:i}}function Ff(e,t){Dd.log('[abr] start candidates with "'.concat(e,'" ignored because ').concat(t))}function Of(e,t,r){if("attrs"in e){var i=t.indexOf(e);if(-1!==i)return i}for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:"",r=e.split(","),i=t.split(",");return r.length===i.length&&!r.some((function(e){return-1===i.indexOf(e)}))}(s,t.characteristics))&&(void 0===r||r(e,t))}function jf(e,t){var r=e.audioCodec,i=e.channels;return!(void 0!==r&&(t.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==i&&i!==(t.channels||"2"))}function zf(e,t,r){for(var i=t;i;i--)if(r(e[i]))return i;for(var a=t+1;a1&&this.tickImmediate(),this._tickCallCount=0)}},{key:"tickImmediate",value:function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}},{key:"doTick",value:function(){}}])}(),Hf="NOT_LOADED",Vf="APPENDING",Wf="PARTIAL",Jf="OK",qf=function(){function e(t){S(this,e),this.activePartLists=Object.create(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=t,this._registerListeners()}return w(e,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(wd.BUFFER_APPENDED,this.onBufferAppended,this),e.on(wd.FRAG_BUFFERED,this.onFragBuffered,this),e.on(wd.FRAG_LOADED,this.onFragLoaded,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(wd.BUFFER_APPENDED,this.onBufferAppended,this),e.off(wd.FRAG_BUFFERED,this.onFragBuffered,this),e.off(wd.FRAG_LOADED,this.onFragLoaded,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}},{key:"getAppendedFrag",value:function(e,t){var r=this.activePartLists[t];if(r)for(var i=r.length;i--;){var a=r[i];if(!a)break;var n=a.end;if(a.start<=e&&null!==n&&e<=n)return a}return this.getBufferedFrag(e,t)}},{key:"getBufferedFrag",value:function(e,t){for(var r=this.fragments,i=Object.keys(r),a=i.length;a--;){var n=r[i[a]];if((null==n?void 0:n.body.type)===t&&n.buffered){var o=n.body;if(o.start<=e&&e<=o.end)return o}}return null}},{key:"detectEvictedFragments",value:function(e,t,r,i){var a=this;this.timeRanges&&(this.timeRanges[e]=t);var n=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((function(i){var o=a.fragments[i];if(o&&!(n>=o.body.sn))if(o.buffered||o.loaded){var s=o.range[e];s&&s.time.some((function(e){var r=!a.isTimeBuffered(e.startPTS,e.endPTS,t);return r&&a.removeFragment(o.body),r}))}else o.body.type===r&&a.removeFragment(o.body)}))}},{key:"detectPartialFragments",value:function(e){var t=this,r=this.timeRanges,i=e.frag,a=e.part;if(r&&"initSegment"!==i.sn){var n=Yf(i),o=this.fragments[n];if(!(!o||o.buffered&&i.gap)){var s=!i.relurl;Object.keys(r).forEach((function(e){var n=i.elementaryStreams[e];if(n){var l=r[e],c=s||!0===n.partial;o.range[e]=t.getBufferedTimes(i,a,c,l)}})),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Kf(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}}}},{key:"removeParts",value:function(e,t){var r=this.activePartLists[t];r&&(this.activePartLists[t]=r.filter((function(t){return t.fragment.sn>=e})))}},{key:"fragBuffered",value:function(e,t){var r=Yf(e),i=this.fragments[r];!i&&t&&(i=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}},{key:"getBufferedTimes",value:function(e,t,r,i){for(var a={time:[],partial:r},n=e.start,o=e.end,s=e.minEndPTS||o,l=e.maxStartPTS||n,c=0;c=u&&s<=d){a.time.push({startPTS:Math.max(n,i.start(c)),endPTS:Math.min(o,i.end(c))});break}if(nu){var h=Math.max(n,i.start(c)),p=Math.min(o,i.end(c));p>h&&(a.partial=!0,a.time.push({startPTS:h,endPTS:p}))}else if(o<=u)break}return a}},{key:"getPartialFragment",value:function(e){var t,r,i,a=null,n=0,o=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach((function(l){var c=s[l];c&&Kf(c)&&(r=c.body.start-o,i=c.body.end+o,e>=r&&e<=i&&(t=Math.min(e-r,i-e),n<=t&&(a=c.body,n=t)))})),a}},{key:"isEndListAppended",value:function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||Kf(t))}},{key:"getState",value:function(e){var t=Yf(e),r=this.fragments[t];return r?r.buffered?Kf(r)?Wf:Jf:Vf:Hf}},{key:"isTimeBuffered",value:function(e,t,r){for(var i,a,n=0;n=i&&t<=a)return!0;if(t<=i)return!1}return!1}},{key:"onFragLoaded",value:function(e,t){var r=t.frag,i=t.part;if("initSegment"!==r.sn&&!r.bitrateTest){var a=i?null:t,n=Yf(r);this.fragments[n]={body:r,appendedPTS:null,loaded:a,buffered:!1,range:Object.create(null)}}}},{key:"onBufferAppended",value:function(e,t){var r=this,i=t.frag,a=t.part,n=t.timeRanges;if("initSegment"!==i.sn){var o=i.type;if(a){var s=this.activePartLists[o];s||(this.activePartLists[o]=s=[]),s.push(a)}this.timeRanges=n,Object.keys(n).forEach((function(e){var t=n[e];r.detectEvictedFragments(e,t,o,a)}))}}},{key:"onFragBuffered",value:function(e,t){this.detectPartialFragments(t)}},{key:"hasFragment",value:function(e){var t=Yf(e);return!!this.fragments[t]}},{key:"hasParts",value:function(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}},{key:"removeFragmentsInRange",value:function(e,t,r,i,a){var n=this;i&&!this.hasGaps||Object.keys(this.fragments).forEach((function(o){var s=n.fragments[o];if(s){var l=s.body;l.type!==r||i&&!l.gap||l.starte&&(s.buffered||a)&&n.removeFragment(l)}}))}},{key:"removeFragment",value:function(e){var t=Yf(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var r=this.activePartLists[e.type];if(r){var i=e.sn;this.activePartLists[e.type]=r.filter((function(e){return e.fragment.sn!==i}))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}},{key:"removeAllFragments",value:function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}])}();function Kf(e){var t,r,i;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(r=e.range.audio)?void 0:r.partial)||(null==(i=e.range.audiovideo)?void 0:i.partial))}function Yf(e){return"".concat(e.type,"_").concat(e.level,"_").concat(e.sn)}var Qf={length:0,start:function(){return 0},end:function(){return 0}},Xf=function(){function e(){S(this,e)}return w(e,null,[{key:"isBuffered",value:function(t,r){try{if(t)for(var i=e.getBuffered(t),a=0;a=i.start(a)&&r<=i.end(a))return!0}catch(t){}return!1}},{key:"bufferInfo",value:function(t,r,i){try{if(t){var a,n=e.getBuffered(t),o=[];for(a=0;ao&&(i[n-1].end=e[a].end):i.push(e[a])}else i.push(e[a])}else i=e;for(var s,l=0,c=t,u=t,d=0;d=h&&t3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];S(this,e),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=t,this.sn=r,this.id=i,this.size=a,this.part=n,this.partial=o}));function $f(e,t){for(var r=0,i=e.length;rr.startCC||e&&e.cc1&&void 0!==arguments[1]?arguments[1]:null,r=t||e,i={frag:e,part:t,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},a=r.byteRangeStartOffset,n=r.byteRangeEndOffset;if(bd(a)&&bd(n)){var o,s=a,l=n;if("initSegment"===e.sn&&"AES-128"===(null==(o=e.decryptdata)?void 0:o.method)){var c=n-a;c%16&&(l=n+(16-c%16)),0!==a&&(i.resetIV=!0,s=a-16)}i.rangeStart=s,i.rangeEnd=l}return i}function sm(e,t){var r=new Error("GAP ".concat(e.gap?"tag":"attribute"," found")),i={type:Sd.MEDIA_ERROR,details:Ed.FRAG_GAP,fatal:!1,frag:e,error:r,networkDetails:null};return t&&(i.part=t),(t||e).stats.aborted=!0,new lm(i)}var lm=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e.error.message]),r.data=void 0,r.data=e,r}return k(t,e),w(t)}(y(Error)),cm=function(){function e(t,r){S(this,e),this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=r}return w(e,[{key:"decrypt",value:function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}])}(),um=function(){function e(t,r){S(this,e),this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=r}return w(e,[{key:"expandKey",value:function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}])}(),dm=function(){function e(){S(this,e),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}return w(e,[{key:"uint8ArrayToUint32Array_",value:function(e){for(var t=new DataView(e),r=new Uint32Array(4),i=0;i<4;i++)r[i]=t.getUint32(4*i);return r}},{key:"initTable",value:function(){var e=this.sBox,t=this.invSBox,r=this.subMix,i=r[0],a=r[1],n=r[2],o=r[3],s=this.invSubMix,l=s[0],c=s[1],u=s[2],d=s[3],h=new Uint32Array(256),p=0,f=0,m=0;for(m=0;m<256;m++)h[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){var g=f^f<<1^f<<2^f<<3^f<<4;g=g>>>8^255&g^99,e[p]=g,t[g]=p;var y=h[p],v=h[y],A=h[v],b=257*h[g]^16843008*g;i[p]=b<<24|b>>>8,a[p]=b<<16|b>>>16,n[p]=b<<8|b>>>24,o[p]=b,b=16843009*A^65537*v^257*y^16843008*p,l[g]=b<<24|b>>>8,c[g]=b<<16|b>>>16,u[g]=b<<8|b>>>24,d[g]=b,p?(p=y^h[h[h[A^y]]],f^=h[h[f]]):p=f=1}}},{key:"expandKey",value:function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,i=0;i>8|e>>>24}},{key:"decrypt",value:function(e,t,r){for(var i,a,n,o,s,l,c,u,d,h,p,f,m,g,y=this.keySize+6,v=this.invKeySchedule,A=this.invSBox,b=this.invSubMix,_=b[0],k=b[1],w=b[2],S=b[3],E=this.uint8ArrayToUint32Array_(r),T=E[0],C=E[1],x=E[2],R=E[3],D=new Int32Array(e),L=new Int32Array(D.length),P=this.networkToHostOrderSwap;t>>24]^k[l>>16&255]^w[c>>8&255]^S[255&u]^v[m],a=_[l>>>24]^k[c>>16&255]^w[u>>8&255]^S[255&s]^v[m+1],n=_[c>>>24]^k[u>>16&255]^w[s>>8&255]^S[255&l]^v[m+2],o=_[u>>>24]^k[s>>16&255]^w[l>>8&255]^S[255&c]^v[m+3],s=i,l=a,c=n,u=o,m+=4;i=A[s>>>24]<<24^A[l>>16&255]<<16^A[c>>8&255]<<8^A[255&u]^v[m],a=A[l>>>24]<<24^A[c>>16&255]<<16^A[u>>8&255]<<8^A[255&s]^v[m+1],n=A[c>>>24]<<24^A[u>>16&255]<<16^A[s>>8&255]<<8^A[255&l]^v[m+2],o=A[u>>>24]<<24^A[s>>16&255]<<16^A[l>>8&255]<<8^A[255&c]^v[m+3],L[t]=P(i^T),L[t+1]=P(o^C),L[t+2]=P(n^x),L[t+3]=P(a^R),T=d,C=h,x=p,R=f,t+=4}return L.buffer}}])}(),hm=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.removePKCS7Padding,a=void 0===i||i;if(S(this,e),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=t.enableSoftwareAES,this.removePKCS7Padding=a,a)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(t){}null===this.subtle&&(this.useSoftware=!0)}return w(e,[{key:"destroy",value:function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}},{key:"isSync",value:function(){return this.useSoftware}},{key:"flush",value:function(){var e=this.currentResult,t=this.remainderData;if(!e||t)return this.reset(),null;var r=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?function(e){var t=e.byteLength,r=t&&new DataView(e.buffer).getUint8(t-1);return r?nh(e,0,t-r):e}(r):r}},{key:"reset",value:function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}},{key:"decrypt",value:function(e,t,r){var i=this;return this.useSoftware?new Promise((function(a,n){i.softwareDecrypt(new Uint8Array(e),t,r);var o=i.flush();o?a(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(e),t,r)}},{key:"softwareDecrypt",value:function(e,t,r){var i=this.currentIV,a=this.currentResult,n=this.remainderData;this.logOnce("JS AES decrypt"),n&&(e=Gh(n,e),this.remainderData=null);var o=this.getValidChunk(e);if(!o.length)return null;i&&(r=i);var s=this.softwareDecrypter;s||(s=this.softwareDecrypter=new dm),s.expandKey(t);var l=a;return this.currentResult=s.decrypt(o.buffer,0,r),this.currentIV=nh(o,-16).buffer,l||null}},{key:"webCryptoDecrypt",value:function(e,t,r){var i=this,a=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new um(a,t)),this.fastAesKey.expandKey().then((function(t){return a?(i.logOnce("WebCrypto AES decrypt"),new cm(a,new Uint8Array(r)).decrypt(e.buffer,t)):Promise.reject(new Error("web crypto not initialized"))})).catch((function(a){return Dd.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(a.name,": ").concat(a.message)),i.onWebCryptoError(e,t,r)}))}},{key:"onWebCryptoError",value:function(e,t,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r);var i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}},{key:"getValidChunk",value:function(e){var t=e,r=e.length-e.length%16;return r!==e.length&&(t=nh(e,0,r),this.remainderData=nh(e,r)),t}},{key:"logOnce",value:function(e){this.logEnabled&&(Dd.log("[decrypter]: ".concat(e)),this.logEnabled=!1)}}])}(),pm=function(e){for(var t="",r=e.length,i=0;io.end){var u=n>c;(n2&&void 0!==arguments[2]?arguments[2]:null;if(e-t){var i={startOffset:e,endOffset:t,type:r};this.hls.trigger(wd.BUFFER_FLUSHING,i)}}},{key:"_loadInitSegment",value:function(e,t){var r=this;this._doFragLoad(e,t).then((function(t){if(!t||r.fragContextChanged(e)||!r.levels)throw new Error("init load aborted");return t})).then((function(t){var i=r.hls,a=t.payload,n=e.decryptdata;if(a&&a.byteLength>0&&null!=n&&n.key&&n.iv&&"AES-128"===n.method){var o=self.performance.now();return r.decrypter.decrypt(new Uint8Array(a),n.key.buffer,n.iv.buffer).catch((function(t){throw i.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((function(a){var n=self.performance.now();return i.trigger(wd.FRAG_DECRYPTED,{frag:e,payload:a,stats:{tstart:o,tdecrypt:n}}),t.payload=a,r.completeInitSegmentLoad(t)}))}return r.completeInitSegmentLoad(t)})).catch((function(t){r.state!==fm&&r.state!==wm&&(r.warn(t),r.resetFragmentLoading(e))}))}},{key:"completeInitSegmentLoad",value:function(e){var t=this.levels;if(!t)throw new Error("init load aborted, missing levels");var r=e.frag.stats;this.state=mm,e.frag.data=new Uint8Array(e.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}},{key:"fragContextChanged",value:function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level}},{key:"fragBufferedComplete",value:function(e,t){var r,i,a,n,o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered ".concat(e.type," sn: ").concat(e.sn).concat(t?" part: "+t.index:""," of ").concat(this.playlistType===Dp?"level":"track"," ").concat(e.level," (frag:[").concat((null!=(r=e.startPTS)?r:NaN).toFixed(3),"-").concat((null!=(i=e.endPTS)?i:NaN).toFixed(3),"] > buffer:").concat(o?pm(Xf.getBuffered(o)):"(detached)",")")),"initSegment"!==e.sn){var s;if(e.type!==Pp){var l=e.elementaryStreams;if(!Object.keys(l).some((function(e){return!!l[e]})))return void(this.state=mm)}var c=null==(s=this.levels)?void 0:s[e.level];null!=c&&c.fragmentError&&(this.log("Resetting level fragment error count of ".concat(c.fragmentError," on frag buffered")),c.fragmentError=0)}this.state=mm,o&&(!this.loadedmetadata&&e.type==Dp&&o.buffered.length&&(null==(a=this.fragCurrent)?void 0:a.sn)===(null==(n=this.fragPrevious)?void 0:n.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}},{key:"seekToStartPos",value:function(){}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this.transmuxer;if(t){var r=e.frag,i=e.part,a=e.partsLoaded,n=!a||0===a.length||a.some((function(e){return!e})),o=new Zf(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!n);t.flush(o)}}},{key:"_handleFragmentLoadProgress",value:function(e){}},{key:"_doFragLoad",value:function(e,t){var r,i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3?arguments[3]:void 0,o=null==t?void 0:t.details;if(!this.levels||!o)throw new Error("frag load aborted, missing level".concat(o?"":" detail","s"));var s=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments):(this.log("Loading key for ".concat(e.sn," of [").concat(o.startSN,"-").concat(o.endSN,"], ").concat("[stream-controller]"===this.logPrefix?"level":"track"," ").concat(e.level)),this.state=gm,this.fragCurrent=e,s=this.keyLoader.load(e).then((function(e){if(!i.fragContextChanged(e.frag))return i.hls.trigger(wd.KEY_LOADED,e),i.state===gm&&(i.state=mm),e})),this.hls.trigger(wd.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(s=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),a=Math.max(e.start,a||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){var l=o.partList;if(l&&n){a>e.end&&o.fragmentHint&&(e=o.fragmentHint);var c=this.getNextPart(l,e,a);if(c>-1){var u,d=l[c];return this.log("Loading part sn: ".concat(e.sn," p: ").concat(d.index," cc: ").concat(e.cc," of playlist [").concat(o.startSN,"-").concat(o.endSN,"] parts [0-").concat(c,"-").concat(l.length-1,"] ").concat("[stream-controller]"===this.logPrefix?"level":"track",": ").concat(e.level,", target: ").concat(parseFloat(a.toFixed(3)))),this.nextLoadPosition=d.start+d.duration,this.state=ym,u=s?s.then((function(r){return!r||i.fragContextChanged(r.frag)?null:i.doFragPartsLoad(e,d,t,n)})).catch((function(e){return i.handleFragLoadError(e)})):this.doFragPartsLoad(e,d,t,n).catch((function(e){return i.handleFragLoadError(e)})),this.hls.trigger(wd.FRAG_LOADING,{frag:e,part:d,targetBufferTime:a}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):u}if(!e.url||this.loadedEndOfParts(l,a))return Promise.resolve(null)}}this.log("Loading fragment ".concat(e.sn," cc: ").concat(e.cc," ").concat(o?"of ["+o.startSN+"-"+o.endSN+"] ":"").concat("[stream-controller]"===this.logPrefix?"level":"track",": ").concat(e.level,", target: ").concat(parseFloat(a.toFixed(3)))),bd(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ym;var p,f=this.config.progressive;return p=f&&s?s.then((function(t){return!t||i.fragContextChanged(null==t?void 0:t.frag)?null:i.fragmentLoader.load(e,n)})).catch((function(e){return i.handleFragLoadError(e)})):Promise.all([this.fragmentLoader.load(e,f?n:void 0),s]).then((function(e){var t=h(e,1),r=t[0];return!f&&r&&n&&n(r),r})).catch((function(e){return i.handleFragLoadError(e)})),this.hls.trigger(wd.FRAG_LOADING,{frag:e,targetBufferTime:a}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):p}},{key:"doFragPartsLoad",value:function(e,t,r,i){var a=this;return new Promise((function(n,o){var s,l=[],c=null==(s=r.details)?void 0:s.partList,u=function(t){a.fragmentLoader.loadPart(e,t,i).then((function(i){l[t.index]=i;var o=i.part;a.hls.trigger(wd.FRAG_LOADED,i);var s=uf(r,e.sn,t.index+1)||df(c,e.sn,t.index+1);if(!s)return n({frag:e,part:o,partsLoaded:l});u(s)})).catch(o)};u(t)}))}},{key:"handleFragLoadError",value:function(e){if("data"in e){var t=e.data;e.data&&t.details===Ed.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(wd.ERROR,t)}else this.hls.trigger(wd.ERROR,{type:Sd.OTHER_ERROR,details:Ed.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}},{key:"_handleTransmuxerFlush",value:function(e){var t=this.getCurrentContext(e);if(t&&this.state===bm){var r=t.frag,i=t.part,a=t.level,n=self.performance.now();r.stats.parsing.end=n,i&&(i.stats.parsing.end=n),this.updateLevelTiming(r,i,a,e.partial)}else this.fragCurrent||this.state===fm||this.state===wm||(this.state=mm)}},{key:"getCurrentContext",value:function(e){var t=this.levels,r=this.fragCurrent,i=e.level,a=e.sn,n=e.part;if(null==t||!t[i])return this.warn("Levels object was unset while buffering fragment ".concat(a," of level ").concat(i,". The current chunk will not be buffered.")),null;var o=t[i],s=n>-1?uf(o,a,n):null,l=s?s.fragment:function(e,t,r){if(null==e||!e.details)return null;var i=e.details,a=i.fragments[t-i.startSN];return a||(a=i.fragmentHint,a&&a.sn===t?a:tn&&this.flushMainBuffer(o,e.start)}else this.flushMainBuffer(0,e.start)}},{key:"getFwdBufferInfo",value:function(e,t){var r=this.getLoadPosition();return bd(r)?this.getFwdBufferInfoAtPos(e,r,t):null}},{key:"getFwdBufferInfoAtPos",value:function(e,t,r){var i=this.config.maxBufferHole,a=Xf.bufferInfo(e,t,i);if(0===a.len&&void 0!==a.nextStart){var n=this.fragmentTracker.getBufferedFrag(t,r);if(n&&a.nextStart=r&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to ".concat(t.maxMaxBufferLength,"s")),!0)}},{key:"getAppendedFrag",value:function(e){var t=this.fragmentTracker.getAppendedFrag(e,Dp);return t&&"fragment"in t?t.fragment:t}},{key:"getNextFragment",value:function(e,t){var r=t.fragments,i=r.length;if(!i)return null;var a,n=this.config,o=r[0].start;if(t.live){var s=n.initialLiveManifestSize;if(it}},{key:"getNextFragmentLoopLoading",value:function(e,t,r,i,a){var n=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(null===o)return o;if(e=o,n&&e&&!e.gap&&r.nextStart){var s=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i);if(null!==s&&r.len+s.len>=a)return this.log('buffer full after gaps in "'.concat(i,'" playlist starting at sn: ').concat(e.sn)),null}return e}},{key:"mapToInitFragWhenRequired",value:function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}},{key:"getNextPart",value:function(e,t,r){for(var i=-1,a=!1,n=!0,o=0,s=e.length;o-1&&rr.start&&r.loaded}},{key:"getInitialLiveFragment",value:function(e,t){var r=this.fragPrevious,i=null;if(r){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(r.programDateTime)),i=function(e,t,r){if(null===t||!Array.isArray(e)||!e.length||!bd(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;i=e.startSN&&a<=e.endSN){var n=t[a-e.startSN];r.cc===n.cc&&(i=n,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(i.sn)))}i||(i=function(e,t){return vf(e,(function(e){return e.cct?-1:0}))}(t,r.cc),i&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(i.sn)))}}else{var o=this.hls.liveSyncPosition;null!==o&&(i=this.getFragmentAtPosition(o,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}},{key:"getFragmentAtPosition",value:function(e,t,r){var i,a=this.config,n=this.fragPrevious,o=r.fragments,s=r.endSN,l=r.fragmentHint,c=a.maxFragLookUpTolerance,u=r.partList,d=!!(a.lowLatencyMode&&null!=u&&u.length&&l);if(d&&l&&!this.bitrateTest&&(o=o.concat(l),s=l.sn),i=et-c?0:c):o[o.length-1],i){var h=i.sn-r.startSN,p=this.fragmentTracker.getState(i);if((p===Jf||p===Wf&&i.gap)&&(n=i),n&&i.sn===n.sn&&(!d||u[0].fragment.sn>i.sn)&&n&&i.level===n.level){var f=o[h+1];i=i.sn=n-t.maxFragLookUpTolerance&&a<=o;if(null!==i&&r.duration>i&&(a").concat(e.startSN," prev-sn: ").concat(s?s.sn:"na"," fragments: ").concat(i)),l}return a}},{key:"waitForCdnTuneIn",value:function(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}},{key:"setStartPosition",value:function(e,t){var r=this.startPosition;if(r ").concat(null==(i=this.fragCurrent)?void 0:i.url));else{var n=t.details===Ed.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(a,!0);var o=t.errorAction,s=o||{},l=s.action,c=s.retryCount,u=void 0===c?0:c,d=s.retryConfig;if(o&&l===Ef&&d){this.resetStartWhenNotLoaded(this.levelLastLoaded);var h=mf(d,u);this.warn("Fragment ".concat(a.sn," of ").concat(e," ").concat(a.level," errored with ").concat(t.details,", retrying loading ").concat(u+1,"/").concat(d.maxNumRetry," in ").concat(h,"ms")),o.resolved=!0,this.retryDate=self.performance.now()+h,this.state=vm}else if(d&&o){if(this.resetFragmentErrors(e),!(u.5;i&&this.reduceMaxBufferLength(r.len);var a=!i;return a&&this.warn("Buffer full error while media.currentTime is not buffered, flush ".concat(t," buffer")),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),a}return!1}},{key:"resetFragmentErrors",value:function(e){e===Lp&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==fm&&(this.state=mm)}},{key:"afterBufferFlushed",value:function(e,t,r){if(e){var i=Xf.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,r),this.state===km&&this.resetLoadingState()}}},{key:"resetLoadingState",value:function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=mm}},{key:"resetStartWhenNotLoaded",value:function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}},{key:"resetWhenMissingContext",value:function(e){this.warn("The loading context changed while buffering fragment ".concat(e.sn," of level ").concat(e.level,". This chunk will not be buffered.")),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}},{key:"removeUnbufferedFrags",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}},{key:"updateLevelTiming",value:function(e,t,r,i){var a,n=this,o=r.details;if(o){if(!Object.keys(e.elementaryStreams).reduce((function(t,a){var s=e.elementaryStreams[a];if(s){var l=s.endPTS-s.startPTS;if(l<=0)return n.warn("Could not parse fragment ".concat(e.sn," ").concat(a," duration reliably (").concat(l,")")),t||!1;var c=i?0:of(o,e,s.startPTS,s.endPTS,s.startDTS,s.endDTS);return n.hls.trigger(wd.LEVEL_PTS_UPDATED,{details:o,level:r,drift:c,type:a,frag:e,start:s.startPTS,end:s.endPTS}),!0}return t}),!1)&&null===(null==(a=this.transmuxer)?void 0:a.error)){var s=new Error("Found no media in fragment ".concat(e.sn," of level ").concat(e.level," resetting transmuxer to fallback to playlist timing"));if(0===r.fragmentError&&(r.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(s.message),this.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_PARSING_ERROR,fatal:!1,error:s,frag:e,reason:"Found no media in msn ".concat(e.sn,' of level "').concat(r.url,'"')}),!this.hls)return;this.resetTransmuxer()}this.state=_m,this.hls.trigger(wd.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")}},{key:"resetTransmuxer",value:function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}},{key:"recoverWorkerError",value:function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}},{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log("".concat(t,"->").concat(e)))}}])}(Gf),Cm=function(){function e(){S(this,e),this.chunks=[],this.dataLength=0}return w(e,[{key:"push",value:function(e){this.chunks.push(e),this.dataLength+=e.length}},{key:"flush",value:function(){var e,t=this.chunks,r=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var r=new Uint8Array(t),i=0,a=0;a0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}var Rm=function(){function e(){S(this,e),this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}return w(e,[{key:"resetInitSegment",value:function(e,t,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}},{key:"resetTimeStamp",value:function(e){this.initPTS=e,this.resetContiguity()}},{key:"resetContiguity",value:function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}},{key:"canParse",value:function(e,t){return!1}},{key:"appendFrame",value:function(e,t,r){}},{key:"demux",value:function(e,t){this.cachedData&&(e=Gh(this.cachedData,e),this.cachedData=null);var r,i=ch(e,0),a=i?i.length:0,n=this._audioTrack,o=this._id3Track,s=i?hh(i):void 0,l=e.length;for((null===this.basePTS||0===this.frameIndex&&bd(s))&&(this.basePTS=Dm(s,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:zp,duration:Number.POSITIVE_INFINITY});a>>5}function Im(e,t){return t+1=e.length)return!1;var i=Bm(e,t);if(i<=r)return!1;var a=t+i;return a===e.length||Im(e,a)}return!1}function Um(e,t,r,i,a){if(!e.samplerate){var n=function(e,t,r,i){var a,n,o,s,l=navigator.userAgent.toLowerCase(),c=i,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];a=1+((192&t[r+2])>>>6);var d=(60&t[r+2])>>>2;if(!(d>u.length-1))return o=(1&t[r+2])<<2,o|=(192&t[r+3])>>>6,Dd.log("manifest codec:".concat(i,", ADTS type:").concat(a,", samplingIndex:").concat(d)),/firefox/i.test(l)?d>=6?(a=5,s=new Array(4),n=d-3):(a=2,s=new Array(2),n=d):-1!==l.indexOf("android")?(a=2,s=new Array(2),n=d):(a=5,s=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&d>=6?n=d-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(d>=6&&1===o||/vivaldi/i.test(l))||!i&&1===o)&&(a=2,s=new Array(2)),n=d)),s[0]=a<<3,s[0]|=(14&d)>>1,s[1]|=(1&d)<<7,s[1]|=o<<3,5===a&&(s[1]|=(14&n)>>1,s[2]=(1&n)<<7,s[2]|=8,s[3]=0),{config:s,samplerate:u[d],channelCount:o,codec:"mp4a.40."+a,manifestCodec:c};var h=new Error("invalid ADTS sampling index:".concat(d));e.emit(wd.ERROR,wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message})}(t,r,i,a);if(!n)return;e.config=n.config,e.samplerate=n.samplerate,e.channelCount=n.channelCount,e.codec=n.codec,e.manifestCodec=n.manifestCodec,Dd.log("parsed codec:".concat(e.codec,", rate:").concat(n.samplerate,", channels:").concat(n.channelCount))}}function Fm(e){return 9216e4/e}function Om(e,t,r,i,a){var n,o=i+a*Fm(e.samplerate),s=function(e,t){var r=Pm(e,t);if(t+r<=e.length){var i=Bm(e,t)-r;if(i>0)return{headerLength:r,frameLength:i}}}(t,r);if(s){var l=s.frameLength,c=s.headerLength,u=c+l,d=Math.max(0,r+u-t.length);d?(n=new Uint8Array(u-c),n.set(t.subarray(r+c,t.length),0)):n=t.subarray(r+c,r+u);var h={unit:n,pts:o};return d||e.samples.push(h),{sample:h,length:u,missing:d}}var p=t.length-r;return n=new Uint8Array(p),n.set(t.subarray(r,t.length),0),{sample:{unit:n,pts:o},length:p,missing:-1}}var Nm=null,jm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],zm=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Gm=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Hm=[0,1,1,4];function Vm(e,t,r,i,a){if(!(r+24>t.length)){var n=Wm(t,r);if(n&&r+n.frameLength<=t.length){var o=i+a*(9e4*n.samplesPerFrame/n.sampleRate),s={unit:t.subarray(r,r+n.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(s),{sample:s,length:n.frameLength,missing:0}}}}function Wm(e,t){var r=e[t+1]>>3&3,i=e[t+1]>>1&3,a=e[t+2]>>4&15,n=e[t+2]>>2&3;if(1!==r&&0!==a&&15!==a&&3!==n){var o=e[t+2]>>1&1,s=e[t+3]>>6,l=1e3*jm[14*(3===r?3-i:3===i?3:4)+a-1],c=zm[3*(3===r?0:2===r?1:2)+n],u=3===s?1:2,d=Gm[r][i],h=Hm[i],p=8*d*h,f=Math.floor(d*l/c+o)*h;if(null===Nm){var m=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Nm=m?parseInt(m[1]):0}return!!Nm&&Nm<=87&&2===i&&l>=224e3&&0===s&&(e[t+3]=128|e[t+3]),{sampleRate:c,channelCount:u,frameLength:f,samplesPerFrame:p}}}function Jm(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function qm(e,t){return t+10;){o[0]=e[t];var s=Math.min(i,8),l=8-s;n[0]=4278190080>>>24+l<>l,r=r?r<t.length)return-1;if(11!==t[r]||119!==t[r+1])return-1;var n=t[r+4]>>6;if(n>=3)return-1;var o=[48e3,44100,32e3][n],s=63&t[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*s+n];if(r+l>t.length)return-1;var c=t[r+6]>>5,u=0;2===c?u+=2:(1&c&&1!==c&&(u+=2),4&c&&(u+=2));var d=(t[r+6]<<8|t[r+7])>>12-u&1,h=[2,1,2,3,3,4,4,5][c]+d,p=t[r+5]>>3,f=7&t[r+5],m=new Uint8Array([n<<6|p<<1|f>>2,(3&f)<<6|c<<3|d<<2|s>>4,s<<4&224]),g=i+a*(1536/o*9e4),y=t.subarray(r,r+l);return e.config=m,e.channelCount=h,e.samplerate=o,e.samples.push({unit:y,pts:g}),l}var $m=function(){function e(){S(this,e),this.VideoSample=null}return w(e,[{key:"createVideoSample",value:function(e,t,r,i){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:i,length:0}}},{key:"getLastNalUnit",value:function(e){var t,r,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){var a=i.units;r=a[a.length-1]}return r}},{key:"pushAccessUnit",value:function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,i=r.length;if(!i)return void t.dropped++;var a=r[i-1];e.pts=a.pts,e.dts=a.dts}t.samples.push(e)}e.debug.length&&Dd.log(e.pts+"/"+e.dts+":"+e.debug)}}])}(),eg=function(){function e(t){S(this,e),this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}return w(e,[{key:"loadWord",value:function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");i.set(e.subarray(r,r+a)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*a,this.bytesAvailable-=a}},{key:"skipBits",value:function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;if(e>32&&Dd.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?r<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(e){for(var t,r=8,i=8,a=0;a4){var p=new eg(h).readSliceType();2!==p&&4!==p&&7!==p&&9!==p||(u=!0)}u&&null!=(d=l)&&d.frame&&!l.key&&(o.pushAccessUnit(l,e),l=o.VideoSample=null),l||(l=o.VideoSample=o.createVideoSample(!0,r.pts,r.dts,"")),l.frame=!0,l.key=u;break;case 5:n=!0,null!=(s=l)&&s.frame&&!l.key&&(o.pushAccessUnit(l,e),l=o.VideoSample=null),l||(l=o.VideoSample=o.createVideoSample(!0,r.pts,r.dts,"")),l.key=!0,l.frame=!0;break;case 6:n=!0,Wh(i.data,1,r.pts,t.samples);break;case 7:var f,m;n=!0,c=!0;var g=i.data,y=new eg(g).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||(null==(f=e.pixelRatio)?void 0:f[0])!==y.pixelRatio[0]||(null==(m=e.pixelRatio)?void 0:m[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[g],e.duration=a;for(var v=g.subarray(1,4),A="avc1.",b=0;b<3;b++){var _=v[b].toString(16);_.length<2&&(_="0"+_),A+=_}e.codec=A}break;case 8:n=!0,e.pps=[i.data];break;case 9:n=!0,e.audFound=!0,l&&o.pushAccessUnit(l,e),l=o.VideoSample=o.createVideoSample(!1,r.pts,r.dts,"");break;case 12:n=!0;break;default:n=!1,l&&(l.debug+="unknown NAL "+i.type+" ")}l&&n&&l.units.push(i)})),i&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)}},{key:"parseAVCNALu",value:function(e,t){var r,i,a,n=t.byteLength,o=e.naluState||0,s=o,l=[],c=0,u=-1,d=0;for(-1===o&&(u=0,d=31&t[0],o=0,c=1);c=0){var h={data:t.subarray(u,i),type:d};l.push(h)}else{var p=this.getLastNalUnit(e.samples);p&&(s&&c<=4-s&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-s)),i>0&&(p.data=Gh(p.data,t.subarray(0,i)),p.state=0))}c=0&&o>=0){var f={data:t.subarray(u,n),type:d,state:o};l.push(f)}if(0===l.length){var m=this.getLastNalUnit(e.samples);m&&(m.data=Gh(m.data,t))}return e.naluState=o,l}}])}($m),rg=function(){function e(t,r,i){S(this,e),this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new hm(r,{removePKCS7Padding:!1})}return w(e,[{key:"decryptBuffer",value:function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}},{key:"decryptAacSample",value:function(e,t,r){var i=this,a=e[t].unit;if(!(a.length<=16)){var n=a.subarray(16,a.length-a.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then((function(n){var o=new Uint8Array(n);a.set(o,16),i.decrypter.isSync()||i.decryptAacSamples(e,t+1,r)}))}}},{key:"decryptAacSamples",value:function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,r),!this.decrypter.isSync()))return}}},{key:"getAvcEncryptedData",value:function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),i=0,a=32;a=e.length)return void i();for(var a=e[t].units;!(r>=a.length);r++){var n=a[r];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(e,t,r,i,n),this.decrypter.isSync())))return}}}}])}(),ig=188,ag=function(){function e(t,r,i){S(this,e),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=r,this.typeSupported=i,this.videoParser=new tg}return w(e,[{key:"resetInitSegment",value:function(t,r,i,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",a),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=i,this._duration=a}},{key:"resetTimeStamp",value:function(){}},{key:"resetContiguity",value:function(){var e=this._audioTrack,t=this._videoTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}},{key:"demux",value:function(t,r){var i,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];a||(this.sampleAes=null);var o=this._videoTrack,s=this._audioTrack,l=this._id3Track,c=this._txtTrack,u=o.pid,d=o.pesData,h=s.pid,p=l.pid,f=s.pesData,m=l.pesData,g=null,y=this.pmtParsed,v=this._pmtId,A=t.length;if(this.remainderData&&(A=(t=Gh(this.remainderData,t)).length,this.remainderData=null),A>4>1){if(E=k+5+t[k+4],E===k+ig)continue}else E=k+4;switch(S){case u:w&&(d&&(i=cg(d))&&this.videoParser.parseAVCPES(o,c,i,!1,this._duration),d={data:[],size:0}),d&&(d.data.push(t.subarray(E,k+ig)),d.size+=k+ig-E);break;case h:if(w){if(f&&(i=cg(f)))switch(s.segmentCodec){case"aac":this.parseAACPES(s,i);break;case"mp3":this.parseMPEGPES(s,i);break;case"ac3":this.parseAC3PES(s,i)}f={data:[],size:0}}f&&(f.data.push(t.subarray(E,k+ig)),f.size+=k+ig-E);break;case p:w&&(m&&(i=cg(m))&&this.parseID3PES(l,i),m={data:[],size:0}),m&&(m.data.push(t.subarray(E,k+ig)),m.size+=k+ig-E);break;case 0:w&&(E+=t[E]+1),v=this._pmtId=og(t,E);break;case v:w&&(E+=t[E]+1);var T=sg(t,E,this.typeSupported,a);u=T.videoPid,u>0&&(o.pid=u,o.segmentCodec=T.segmentVideoCodec),h=T.audioPid,h>0&&(s.pid=h,s.segmentCodec=T.segmentAudioCodec),p=T.id3Pid,p>0&&(l.pid=p),null===g||y||(Dd.warn("MPEG-TS PMT found at ".concat(k," after unknown PID '").concat(g,"'. Backtracking to sync byte @").concat(b," to parse all TS packets.")),g=null,k=b-188),y=this.pmtParsed=!0;break;case 17:case 8191:break;default:g=S}}else _++;if(_>0){var C=new Error("Found ".concat(_," TS packet/s that do not start with 0x47"));this.observer.emit(wd.ERROR,wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_PARSING_ERROR,fatal:!1,error:C,reason:C.message})}o.pesData=d,s.pesData=f,l.pesData=m;var x={audioTrack:s,videoTrack:o,id3Track:l,textTrack:c};return n&&this.extractRemainingSamples(x),x}},{key:"flush",value:function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}},{key:"extractRemainingSamples",value:function(e){var t,r=e.audioTrack,i=e.videoTrack,a=e.id3Track,n=e.textTrack,o=i.pesData,s=r.pesData,l=a.pesData;if(o&&(t=cg(o))?(this.videoParser.parseAVCPES(i,n,t,!0,this._duration),i.pesData=null):i.pesData=o,s&&(t=cg(s))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,t);break;case"mp3":this.parseMPEGPES(r,t);break;case"ac3":this.parseAC3PES(r,t)}r.pesData=null}else null!=s&&s.size&&Dd.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=s;l&&(t=cg(l))?(this.parseID3PES(a,t),a.pesData=null):a.pesData=l}},{key:"demuxSampleAes",value:function(e,t,r){var i=this.demux(e,r,!0,!this.config.progressive),a=this.sampleAes=new rg(this.observer,this.config,t);return this.decrypt(i,a)}},{key:"decrypt",value:function(e,t){return new Promise((function(r){var i=e.audioTrack,a=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,(function(){a.samples?t.decryptAvcSamples(a.samples,0,0,(function(){r(e)})):r(e)})):a.samples&&t.decryptAvcSamples(a.samples,0,0,(function(){r(e)}))}))}},{key:"destroy",value:function(){this._duration=0}},{key:"parseAACPES",value:function(e,t){var r,i,a,n=0,o=this.aacOverFlow,s=t.data;if(o){this.aacOverFlow=null;var l=o.missing,c=o.sample.unit.byteLength;if(-1===l)s=Gh(o.sample.unit,s);else{var u=c-l;o.sample.unit.set(s.subarray(0,l),u),e.samples.push(o.sample),n=o.missing}}for(r=n,i=s.length;r0;)s+=a;else Dd.warn("[tsdemuxer]: AC3 PES unknown PTS")}},{key:"parseID3PES",value:function(e,t){if(void 0!==t.pts){var r=Ad({},t,{type:this._videoTrack?Hp:zp,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}else Dd.warn("[tsdemuxer]: ID3 PES unknown PTS")}}],[{key:"probe",value:function(t){var r=e.syncOffset(t);return r>0&&Dd.warn("MPEG2-TS detected but first sync word found @ offset ".concat(r)),-1!==r}},{key:"syncOffset",value:function(e){for(var t=e.length,r=Math.min(940,t-ig)+1,i=0;i1&&(0===n&&o>2||s+ig>r))return n}i++}return-1}},{key:"createTrack",value:function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Th[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}}])}();function ng(e,t){return((31&e[t+1])<<8)+e[t+2]}function og(e,t){return(31&e[t+10])<<8|e[t+11]}function sg(e,t,r,i){var a={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0)for(var l=t+5,c=s;c>2;){106===e[l]&&(!0!==r.ac3?Dd.log("AC-3 audio found, not supported in this browser for now"):(a.audioPid=o,a.segmentAudioCodec="ac3"));var u=e[l+1]+2;l+=u,c-=u}break;case 194:case 135:Dd.warn("Unsupported EC-3 in M2TS found");break;case 36:Dd.warn("Unsupported HEVC in M2TS found")}t+=s+5}return a}function lg(e){Dd.log("".concat(e," with AES-128-CBC encryption found in unencrypted stream"))}function cg(e){var t,r,i,a,n,o=0,s=e.data;if(!e||0===e.size)return null;for(;s[0].length<19&&s.length>1;)s[0]=Gh(s[0],s[1]),s.splice(1,1);if(t=s[0],1===(t[0]<<16)+(t[1]<<8)+t[2]){if(r=(t[4]<<8)+t[5],r&&r>e.size-6)return null;var l=t[7];192&l&&(a=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(n=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,a-n>54e5&&(Dd.warn("".concat(Math.round((a-n)/9e4),"s delta between PTS and DTS, align them")),a=n)):n=a),i=t[8];var c=i+9;if(e.size<=c)return null;e.size-=c;for(var u=new Uint8Array(e.size),d=0,h=s.length;dp){c-=p;continue}t=t.subarray(c),p-=c,c=0}u.set(t,o),o+=p}return r&&(r-=i+3),{data:u,pts:a,dts:n,len:r}}return null}var ug=function(){function e(){S(this,e)}return w(e,null,[{key:"getSilentFrame",value:function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}])}(),dg=Math.pow(2,32)-1,hg=function(){function e(){S(this,e)}return w(e,null,[{key:"init",value:function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:i};var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=n,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,l,o,s),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,a))}},{key:"box",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i>24&255,s[1]=a>>16&255,s[2]=a>>8&255,s[3]=255&a,s.set(e,4),n=0,a=8;n>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,r))}},{key:"moov",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,i=[];r--;)i[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(i))}},{key:"mvhd",value:function(t,r){r*=t;var i=Math.floor(r/(dg+1)),a=Math.floor(r%(dg+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,n)}},{key:"sdtp",value:function(t){var r,i,a=t.samples||[],n=new Uint8Array(4+a.length);for(r=0;r>>8&255),n.push(255&a),n=n.concat(Array.prototype.slice.call(i));for(r=0;r>>8&255),o.push(255&a),o=o.concat(Array.prototype.slice.call(i));var s=e.box(e.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(o))),l=t.width,c=t.height,u=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))}},{key:"esds",value: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]))}},{key:"audioStsd",value:function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}},{key:"mp4a",value:function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))}},{key:"mp3",value:function(t){return e.box(e.types[".mp3"],e.audioStsd(t))}},{key:"ac3",value:function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))}},{key:"stsd",value:function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,n=t.height,o=Math.floor(i/(dg+1)),s=Math.floor(i%(dg+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,n>>8&255,255&n,0,0]))}},{key:"traf",value:function(t,r){var i=e.sdtp(t),a=t.id,n=Math.floor(r/(dg+1)),o=Math.floor(r%(dg+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var i,a,n,o,s,l,c=t.samples||[],u=c.length,d=12+16*u,h=new Uint8Array(d);for(r+=8+d,h.set(["video"===t.type?1:0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t){e.types||e.init();var r=e.moov(t);return Gh(e.FTYP,r)}}])}();function pg(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=e*t*r;return i?Math.round(a):a}function fg(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return pg(e,1e3,1/9e4,t)}hg.types=void 0,hg.HDLR_TYPES=void 0,hg.STTS=void 0,hg.STSC=void 0,hg.STCO=void 0,hg.STSZ=void 0,hg.VMHD=void 0,hg.SMHD=void 0,hg.STSD=void 0,hg.FTYP=void 0,hg.DINF=void 0;var mg,gg=null,yg=null,vg=function(){function e(t,r,i){if(S(this,e),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=r,this.typeSupported=i,this.ISGenerated=!1,null===gg){var a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);gg=a?parseInt(a[1]):0}if(null===yg){var n=navigator.userAgent.match(/Safari\/(\d+)/i);yg=n?parseInt(n[1]):0}}return w(e,[{key:"destroy",value:function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}},{key:"resetTimeStamp",value:function(e){Dd.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}},{key:"resetNextTimestamp",value:function(){Dd.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}},{key:"resetInitSegment",value:function(){Dd.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}},{key:"getVideoStartPts",value:function(e){var t=!1,r=e.reduce((function(e,r){var i=r.pts-e;return i<-4294967296?(t=!0,Ag(e,r.pts)):i>0?e:r.pts}),e[0].pts);return t&&Dd.debug("PTS rollover detected"),r}},{key:"remux",value:function(e,t,r,i,a,n,o,s){var l,c,u,d,h,p,f=a,m=a,g=e.pid>-1,y=t.pid>-1,v=t.samples.length,A=e.samples.length>0,b=o&&v>0||v>1;if((!g||A)&&(!y||b)||this.ISGenerated||o){if(this.ISGenerated){var _,k,w,S,E=this.videoTrackConfig;!E||t.width===E.width&&t.height===E.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(k=E.pixelRatio)?void 0:k[0])&&(null==(w=t.pixelRatio)?void 0:w[1])===(null==(S=E.pixelRatio)?void 0:S[1])||this.resetInitSegment()}else u=this.generateIS(e,t,a,n);var T,C=this.isVideoContiguous,x=-1;if(b&&(x=function(e){for(var t=0;t0){Dd.warn("[mp4-remuxer]: Dropped ".concat(x," out of ").concat(v," video samples due to a missing keyframe"));var R=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(x),t.dropped+=x,m+=(t.samples[0].pts-R)/t.inputTimeScale,T=m}else-1===x&&(Dd.warn("[mp4-remuxer]: No keyframe found out of ".concat(v," video samples")),p=!1);if(this.ISGenerated){if(A&&b){var D=this.getVideoStartPts(t.samples),L=(Ag(e.samples[0].pts,D)-D)/t.inputTimeScale;f+=Math.max(0,L),m+=Math.max(0,-L)}if(A){if(e.samplerate||(Dd.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,a,n)),c=this.remuxAudio(e,f,this.isAudioContiguous,n,y||b||s===Lp?m:void 0),b){var P=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(Dd.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,a,n)),l=this.remuxVideo(t,m,C,P)}}else b&&(l=this.remuxVideo(t,m,C,0));l&&(l.firstKeyFrame=x,l.independent=-1!==x,l.firstKeyFramePTS=T)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(h=bg(r,a,this._initPTS,this._initDTS)),i.samples.length&&(d=_g(i,a,this._initPTS))),{audio:c,video:l,initSegment:u,independent:p,text:d,id3:h}}},{key:"generateIS",value:function(e,t,r,i){var a,n,o,s=e.samples,l=t.samples,c=this.typeSupported,u={},d=this._initPTS,h=!d||i,p="audio/mp4";if(h&&(a=n=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":c.mpeg?(p="audio/mpeg",e.codec=""):c.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}u.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&c.mpeg?new Uint8Array(0):hg.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(o=e.inputTimeScale,d&&o===d.timescale?h=!1:a=n=s[0].pts-Math.round(o*r))}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,u.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:hg.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(o=t.inputTimeScale,d&&o===d.timescale)h=!1;else{var f=this.getVideoStartPts(l),m=Math.round(o*r);n=Math.min(n,Ag(l[0].dts,f)-m),a=Math.min(a,f-m)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(u).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:a,timescale:o},this._initDTS={baseTime:n,timescale:o}):a=o=void 0,{tracks:u,initPTS:a,timescale:o}}},{key:"remuxVideo",value:function(e,t,r,i){var a,n,o=e.inputTimeScale,s=e.samples,l=[],c=s.length,u=this._initPTS,d=this.nextAvcDts,h=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!r||null===d){var y=t*o,v=s[0].pts-Ag(s[0].dts,s[0].pts);gg&&null!==d&&Math.abs(y-v-d)<15e3?r=!0:d=y-v}for(var A=u.baseTime*o/u.timescale,b=0;b0?b-1:b].dts&&(g=!0)}g&&s.sort((function(e,t){var r=e.dts-t.dts,i=e.pts-t.pts;return r||i})),a=s[0].dts,n=s[s.length-1].dts;var k=n-a,w=k?Math.round(k/(c-1)):p||e.inputTimeScale/30;if(r){var S=a-d,E=S>w,T=S<-1;if((E||T)&&(E?Dd.warn("AVC: ".concat(fg(S,!0)," ms (").concat(S,"dts) hole between fragments detected at ").concat(t.toFixed(3))):Dd.warn("AVC: ".concat(fg(-S,!0)," ms (").concat(S,"dts) overlapping between fragments detected at ").concat(t.toFixed(3))),!T||d>=s[0].pts||gg)){a=d;var C=s[0].pts-S;if(E)s[0].dts=a,s[0].pts=C;else for(var x=0;xC);x++)s[x].dts-=S,s[x].pts-=S;Dd.log("Video: Initial PTS/DTS adjusted: ".concat(fg(C,!0),"/").concat(fg(a,!0),", delta: ").concat(fg(S,!0)," ms"))}}a=Math.max(0,a);for(var R=0,D=0,L=a,P=0;P0?q.dts-s[J-1].dts:w;if(Y=J>0?q.pts-s[J-1].pts:w,re.stretchShortVideoTrack&&null!==this.nextAudioPts){var ae=Math.floor(re.maxBufferHole*o),ne=(i?f+i*o:this.nextAudioPts)-q.pts;ne>ae?(p=ne-ie,p<0?p=ie:z=!0,Dd.log("[mp4-remuxer]: It is approximately ".concat(ne/90," ms to the next segment; using duration ").concat(p/90," ms for the last video frame."))):p=ie}else p=ie}var oe=Math.round(q.pts-q.dts);G=Math.min(G,p),V=Math.max(V,p),H=Math.min(H,Y),W=Math.max(W,Y),l.push(new kg(q.key,p,Q,oe))}if(l.length)if(gg){if(gg<70){var se=l[0].flags;se.dependsOn=2,se.isNonSync=0}}else if(yg&&W-H0&&(i&&Math.abs(g-m)<9e3||Math.abs(Ag(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=Ag(e.pts-y,g)})),!r||m<0){if(p=p.filter((function(e){return e.pts>=0})),!p.length)return;m=0===a?0:i&&!h?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec)for(var v=this.config.maxAudioFramesDrift,A=0,b=m;A=v*l&&S<1e4&&h){var E=Math.round(w/l);b=k-E*l,b<0&&(E--,b+=l),0===A&&(this.nextAudioPts=m=b),Dd.warn("[mp4-remuxer]: Injecting ".concat(E," audio frame @ ").concat((b/n).toFixed(3),"s due to ").concat(Math.round(1e3*w/n)," ms gap."));for(var T=0;T0))return;P+=f;try{R=new Uint8Array(P)}catch(e){return void this.observer.emit(wd.ERROR,wd.ERROR,{type:Sd.MUX_ERROR,details:Ed.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:P,reason:"fail allocating audio mdat ".concat(P)})}u||(new DataView(R.buffer).setUint32(0,P),R.set(hg.types.mdat,4))}R.set(F,f);var N=F.byteLength;f+=N,d.push(new kg(!0,s,N,0)),L=O}var j=d.length;if(j){var z=d[d.length-1];this.nextAudioPts=m=L+o*z.duration;var G=u?new Uint8Array(0):hg.moof(e.sequenceNumber++,D/o,Ad({},e,{samples:d}));e.samples=[];var H=D/n,V=m/n,W={data1:G,data2:R,startPTS:H,endPTS:V,startDTS:H,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:j};return this.isAudioContiguous=!0,W}}},{key:"remuxEmptyAudio",value:function(e,t,r,i){var a=e.inputTimeScale,n=a/(e.samplerate?e.samplerate:a),o=this.nextAudioPts,s=this._initDTS,l=9e4*s.baseTime/s.timescale,c=(null!==o?o:i.startDTS*a)+l,u=i.endDTS*a+l,d=1024*n,h=Math.ceil((u-c)/d),p=ug.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(Dd.warn("[mp4-remuxer]: remux empty Audio"),p){for(var f=[],m=0;m4294967296;)e+=r;return e}function bg(e,t,r,i){var a=e.samples.length;if(a){for(var n=e.inputTimeScale,o=0;o4)return r;if(t===Fd){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r)return dp(r,!1);var i="mp4a.40.5";return Dd.info('Parsed audio codec "'.concat(r,'" or audio object type not handled. Using "').concat(i,'"')),i}return Dd.warn('Unhandled video codec "'.concat(r,'"')),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}try{mg=self.performance.now.bind(self.performance)}catch(e){Dd.debug("Unable to use Performance API on this environment"),mg=null==qd?void 0:qd.Date.now}var Sg=[{demux:function(){function e(t,r){S(this,e),this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=r}return w(e,[{key:"resetTimeStamp",value:function(){}},{key:"resetInitSegment",value:function(e,t,r,i){var a=this.videoTrack=xm("video",1),n=this.audioTrack=xm("audio",1),o=this.txtTrack=xm("text",1);if(this.id3Track=xm("id3",1),this.timeOffset=0,null!=e&&e.byteLength){var s=Mh(e);if(s.video){var l=s.video,c=l.id,u=l.timescale,d=l.codec;a.id=c,a.timescale=o.timescale=u,a.codec=d}if(s.audio){var h=s.audio,p=h.id,f=h.timescale,m=h.codec;n.id=p,n.timescale=f,n.codec=m}o.id=Th.text,a.sampleDuration=0,a.duration=n.duration=i}}},{key:"resetContiguity",value:function(){this.remainderData=null}},{key:"demux",value:function(e,t){this.timeOffset=t;var r=e,i=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Gh(this.remainderData,e));var n=function(e){var t={valid:null,remainder:null},r=Bh(e,["moof"]);if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=nh(e,0,i.byteOffset-8),t.remainder=nh(e,i.byteOffset-8),t}(r);this.remainderData=n.remainder,i.samples=n.valid||new Uint8Array}else i.samples=r;var o=this.extractID3Track(i,t);return a.samples=Hh(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}},{key:"flush",value:function(){var e=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;var i=this.extractID3Track(t,this.timeOffset);return r.samples=Hh(e,t),{videoTrack:t,audioTrack:xm(),id3Track:i,textTrack:xm()}}},{key:"extractID3Track",value:function(e,t){var r=this.id3Track;if(e.samples.length){var i=Bh(e.samples,["emsg"]);i&&i.forEach((function(e){var i=function(e){var t=e[0],r="",i="",a=0,n=0,o=0,s=0,l=0,c=0;if(0===t){for(;"\0"!==Ch(e.subarray(c,c+1));)r+=Ch(e.subarray(c,c+1)),c+=1;for(r+=Ch(e.subarray(c,c+1)),c+=1;"\0"!==Ch(e.subarray(c,c+1));)i+=Ch(e.subarray(c,c+1)),c+=1;i+=Ch(e.subarray(c,c+1)),c+=1,a=Rh(e,12),n=Rh(e,16),s=Rh(e,20),l=Rh(e,24),c=28}else if(1===t){c+=4,a=Rh(e,c),c+=4;var u=Rh(e,c);c+=4;var d=Rh(e,c);for(c+=4,o=Math.pow(2,32)*u+d,_d(o)||(o=Number.MAX_SAFE_INTEGER,Dd.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),s=Rh(e,c),c+=4,l=Rh(e,c),c+=4;"\0"!==Ch(e.subarray(c,c+1));)r+=Ch(e.subarray(c,c+1)),c+=1;for(r+=Ch(e.subarray(c,c+1)),c+=1;"\0"!==Ch(e.subarray(c,c+1));)i+=Ch(e.subarray(c,c+1)),c+=1;i+=Ch(e.subarray(c,c+1)),c+=1}return{schemeIdUri:r,value:i,timeScale:a,presentationTime:o,presentationTimeDelta:n,eventDuration:s,id:l,payload:e.subarray(c,e.byteLength)}}(e);if(Ym.test(i.schemeIdUri)){var a=bd(i.presentationTime)?i.presentationTime/i.timeScale:t+i.presentationTimeDelta/i.timeScale,n=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;n<=.001&&(n=Number.POSITIVE_INFINITY);var o=i.payload;r.samples.push({data:o,len:o.byteLength,dts:a,pts:a,type:Hp,duration:n})}}))}return r}},{key:"demuxSampleAes",value:function(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(e){return function(e){for(var t=e.byteLength,r=0;r8&&109===e[r+4]&&111===e[r+5]&&111===e[r+6]&&102===e[r+7])return!0;r=i>1?r+i:t}return!1}(e)}}])}(),remux:function(){function e(){S(this,e),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}return w(e,[{key:"destroy",value:function(){}},{key:"resetTimeStamp",value:function(e){this.initPTS=e,this.lastEndTime=null}},{key:"resetNextTimestamp",value:function(){this.lastEndTime=null}},{key:"resetInitSegment",value:function(e,t,r,i){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(function(e,t){if(!e||!t)return e;var r=t.keyId;return r&&t.isCommonEncryption&&Bh(e,["moov","trak"]).forEach((function(e){var t=Bh(e,["mdia","minf","stbl","stsd"])[0].subarray(8),i=Bh(t,["enca"]),a=i.length>0;a||(i=Bh(t,["encv"])),i.forEach((function(e){Bh(a?e.subarray(28):e.subarray(78),["sinf"]).forEach((function(e){var t=jh(e);if(t){var i=t.subarray(8,24);i.some((function(e){return 0!==e}))||(Dd.log("[eme] Patching keyId in 'enc".concat(a?"a":"v",">sinf>>tenc' box: ").concat(wh(i)," -> ").concat(wh(r))),t.set(r,8))}}))}))})),e}(e,i)),this.emitInitSegment=!0}},{key:"generateInitSegment",value:function(e){var t=this.audioCodec,r=this.videoCodec;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var i=this.initData=Mh(e);i.audio&&(t=wg(i.audio,Fd)),i.video&&(r=wg(i.video,Od));var a={};i.audio&&i.video?a.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:i.audio?a.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?a.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:Dd.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a}},{key:"remux",value:function(e,t,r,i,a,n){var o,s,l=this.initPTS,c=this.lastEndTime,u={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};bd(c)||(c=this.lastEndTime=a||0);var d=t.samples;if(null==d||!d.length)return u;var h={initPTS:void 0,timescale:1},p=this.initData;if(null!=(o=p)&&o.length||(this.generateInitSegment(d),p=this.initData),null==(s=p)||!s.length)return Dd.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1);var f=function(e,t){for(var r=0,i=0,a=0,n=Bh(e,["moof","traf"]),o=0;oa}(l,g,a,f)||h.timescale!==l.timescale&&n)&&(h.initPTS=g-a,l&&1===l.timescale&&Dd.warn("Adjusting initPTS by "+(h.initPTS-l.baseTime)),this.initPTS=l={baseTime:h.initPTS,timescale:1});var y=e?g-l.baseTime/l.timescale:c,v=y+f;!function(e,t,r){Bh(t,["moof","traf"]).forEach((function(t){Bh(t,["tfhd"]).forEach((function(i){var a=Rh(i,4),n=e[a];if(n){var o=n.timescale||9e4;Bh(t,["tfdt"]).forEach((function(e){var t=e[0],i=r*o;if(i){var a=Rh(e,4);if(0===t)a-=i,a=Math.max(a,0),Ph(e,4,a);else{a*=Math.pow(2,32),a+=Rh(e,8),a-=i,a=Math.max(a,0);var n=Math.floor(a/(Sh+1)),s=Math.floor(a%(Sh+1));Ph(e,4,n),Ph(e,8,s)}}}))}}))}))}(p,d,l.baseTime/l.timescale),f>0?this.lastEndTime=v:(Dd.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var A=!!p.audio,b=!!p.video,_="";A&&(_+="audio"),b&&(_+="video");var k={data1:d,startPTS:y,startDTS:y,endPTS:v,endDTS:v,type:_,hasAudio:A,hasVideo:b,nb:1,dropped:0};return u.audio="audio"===k.type?k:void 0,u.video="audio"!==k.type?k:void 0,u.initSegment=h,u.id3=bg(r,a,l,l),i.samples.length&&(u.text=_g(i,a,l)),u}}])}()},{demux:ag,remux:vg},{demux:function(e){function t(e,r){var i;return S(this,t),i=_(this,t),i.observer=void 0,i.config=void 0,i.observer=e,i.config=r,i}return k(t,e),w(t,[{key:"resetInitSegment",value:function(e,r,i,a){b(t,"resetInitSegment",this,3)([e,r,i,a]),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}}},{key:"canParse",value:function(e,t){return function(e,t){return function(e,t){return t+50&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(r=t),r}(o,t);if(_&&"AES-128"===_.method){var k=this.getDecrypter();if(!k.isSync())return this.decryptionPromise=k.webCryptoDecrypt(o,_.key.buffer,_.iv.buffer).then((function(e){var t=a.push(e,null,r);return a.decryptionPromise=null,t})),this.decryptionPromise;var w=k.softwareDecrypt(o,_.key.buffer,_.iv.buffer);if(r.part>-1&&(w=k.flush()),!w)return n.executeEnd=mg(),Tg(r);o=new Uint8Array(w)}var S=this.needsProbing(d,h);if(S){var E=this.configureTransmuxer(o);if(E)return Dd.warn("[transmuxer] ".concat(E.message)),this.observer.emit(wd.ERROR,wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_PARSING_ERROR,fatal:!1,error:E,reason:E.message}),n.executeEnd=mg(),Tg(r)}(d||h||m||S)&&this.resetInitSegment(b,g,y,A,t),(d||m||S)&&this.resetInitialTimestamp(v),u||this.resetContiguity();var T=this.transmux(o,_,f,p,r),C=this.currentTransmuxState;return C.contiguous=!0,C.discontinuity=!1,C.trackSwitch=!1,n.executeEnd=mg(),T}},{key:"flush",value:function(e){var t=this,r=e.transmuxing;r.executeStart=mg();var i=this.decrypter,a=this.currentTransmuxState,n=this.decryptionPromise;if(n)return n.then((function(){return t.flush(e)}));var o=[],s=a.timeOffset;if(i){var l=i.flush();l&&o.push(this.push(l,null,e))}var c=this.demuxer,u=this.remuxer;if(!c||!u)return r.executeEnd=mg(),[Tg(e)];var d=c.flush(s);return Cg(d)?d.then((function(r){return t.flushRemux(o,r,e),o})):(this.flushRemux(o,d,e),o)}},{key:"flushRemux",value:function(e,t,r){var i=t.audioTrack,a=t.videoTrack,n=t.id3Track,o=t.textTrack,s=this.currentTransmuxState,l=s.accurateTimeOffset,c=s.timeOffset;Dd.log("[transmuxer.ts]: Flushed fragment ".concat(r.sn).concat(r.part>-1?" p: "+r.part:""," of level ").concat(r.level));var u=this.remuxer.remux(i,a,n,o,c,l,!0,this.id);e.push({remuxResult:u,chunkMeta:r}),r.transmuxing.executeEnd=mg()}},{key:"resetInitialTimestamp",value:function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))}},{key:"resetContiguity",value:function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}},{key:"resetInitSegment",value:function(e,t,r,i,a){var n=this.demuxer,o=this.remuxer;n&&o&&(n.resetInitSegment(e,t,r,i),o.resetInitSegment(e,t,r,a))}},{key:"destroy",value:function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}},{key:"transmux",value:function(e,t,r,i,a){var n;return n=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,i,a):this.transmuxUnencrypted(e,r,i,a),n}},{key:"transmuxUnencrypted",value:function(e,t,r,i){var a=this.demuxer.demux(e,t,!1,!this.config.progressive),n=a.audioTrack,o=a.videoTrack,s=a.id3Track,l=a.textTrack;return{remuxResult:this.remuxer.remux(n,o,s,l,t,r,!1,this.id),chunkMeta:i}}},{key:"transmuxSampleAes",value:function(e,t,r,i,a){var n=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:n.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,r,i,!1,n.id),chunkMeta:a}}))}},{key:"configureTransmuxer",value:function(e){for(var t,r=this.config,i=this.observer,a=this.typeSupported,n=this.vendor,o=0,s=Sg.length;o1&&l.id===(null==g?void 0:g.stats.chunkCount),k=!v&&(1===A||0===A&&(1===b||_&&b<=0)),w=self.performance.now();(v||A||0===a.stats.parsing.start)&&(a.stats.parsing.start=w),!n||!b&&k||(n.stats.parsing.start=w);var S=!(g&&(null==(u=a.initSegment)?void 0:u.url)===(null==(d=g.initSegment)?void 0:d.url)),E=new Rg(y,k,s,v,f,S);if(!k||y||S){Dd.log("[transmuxer-interface, ".concat(a.type,"]: Starting new transmux session for sn: ").concat(l.sn," p: ").concat(l.part," level: ").concat(l.level," id: ").concat(l.id,"\n discontinuity: ").concat(y,"\n trackSwitch: ").concat(v,"\n contiguous: ").concat(k,"\n accurateTimeOffset: ").concat(s,"\n timeOffset: ").concat(f,"\n initSegmentChange: ").concat(S));var T=new xg(r,i,t,o,c);this.configureTransmuxer(T)}if(this.frag=a,this.part=n,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:l,state:E},e instanceof ArrayBuffer?[e]:[]);else if(p){var C=p.push(e,m,l,E);Cg(C)?(p.async=!0,C.then((function(e){h.handleTransmuxComplete(e)})).catch((function(e){h.transmuxerError(e,l,"transmuxer-interface push error")}))):(p.async=!1,this.handleTransmuxComplete(C))}}},{key:"flush",value:function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(r){var i=r.flush(e);Cg(i)||r.async?(Cg(i)||(i=Promise.resolve(i)),i.then((function(r){t.handleFlushResult(r,e)})).catch((function(r){t.transmuxerError(r,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}},{key:"transmuxerError",value:function(e,t,r){this.hls&&(this.error=e,this.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:r}))}},{key:"handleFlushResult",value:function(e,t){var r=this;e.forEach((function(e){r.handleTransmuxComplete(e)})),this.onFlush(t)}},{key:"onWorkerMessage",value:function(e){var t=e.data,r=this.hls;switch(t.event){case"init":var i,a=null==(i=this.workerContext)?void 0:i.objectURL;a&&self.URL.revokeObjectURL(a);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":Dd[t.data.logType]&&Dd[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}}},{key:"configureTransmuxer",value:function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}},{key:"handleTransmuxComplete",value:function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}])}();function Bg(e,t){if(e.length!==t.length)return!1;for(var r=0;r>>=0)>i-1)throw new DOMException("Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (").concat(r,") is greater than the maximum bound (").concat(i,")"));return t[r][e]};this.buffered={get length(){return t.length},end:function(e){return r("end",e,t.length)},start:function(e){return r("start",e,t.length)}}})),Fg=function(){function e(t){S(this,e),this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}return w(e,[{key:"append",value:function(e,t,r){var i=this.queues[t];i.push(e),1!==i.length||r||this.executeNext(t)}},{key:"insertAbort",value:function(e,t){this.queues[t].unshift(e),this.executeNext(t)}},{key:"appendBlocker",value:function(e){var t,r=new Promise((function(e){t=e})),i={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(i,e),r}},{key:"executeNext",value:function(e){var t=this.queues[e];if(t.length){var r=t[0];try{r.execute()}catch(t){Dd.warn('[buffer-operation-queue]: Exception executing "'.concat(e,'" SourceBuffer operation: ').concat(t)),r.onError(t);var i=this.buffers[e];null!=i&&i.updating||this.shiftAndExecuteNext(e)}}}},{key:"shiftAndExecuteNext",value:function(e){this.queues[e].shift(),this.executeNext(e)}},{key:"current",value:function(e){return this.queues[e][0]}}])}(),Og=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function Ng(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach((function(t){e.removeChild(t)}))}var jg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},zg=function(e){var t=e;return jg.hasOwnProperty(e)&&(t=jg[e]),String.fromCharCode(t)},Gg=15,Hg=100,Vg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Wg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Jg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},qg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Kg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],Yg=function(){function e(){S(this,e),this.time=null,this.verboseLevel=0}return w(e,[{key:"log",value:function(e,t){if(this.verboseLevel>=e){var r="function"==typeof t?t():t;Dd.log("".concat(this.time," [").concat(e,"] ").concat(r))}}}])}(),Qg=function(e){for(var t=[],r=0;rHg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Hg)}},{key:"moveCursor",value:function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r=144&&this.backSpace();var r=zg(e);this.pos>=Hg?this.logger.log(0,(function(){return"Cannot insert "+e.toString(16)+" ("+r+") at position "+t.pos+". Skipping it!"})):(this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1))}},{key:"clearFromPos",value:function(e){var t;for(t=e;t0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}])}(),ty=function(){function e(t,r,i){S(this,e),this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new ey(i),this.nonDisplayedMemory=new ey(i),this.lastOutputScreen=new ey(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}return w(e,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(e){this.outputFilter=e}},{key:"setPAC",value:function(e){this.writeScreen.setPAC(e)}},{key:"setBkgData",value:function(e){this.writeScreen.setBkgData(e)}},{key:"setMode",value:function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(function(){return"MODE="+e})),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}},{key:"insertChars",value:function(e){for(var t=this,r=0;r=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[r]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}},{key:"outputDataUpdate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}},{key:"cueSplitAtTime",value:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}])}(),ry=function(){function e(t,r,i){S(this,e),this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;var a=this.logger=new Yg;this.channels=[null,new ty(t,r,a),new ty(t+1,i,a)]}return w(e,[{key:"getHandler",value:function(e){return this.channels[e].getHandler()}},{key:"setHandler",value:function(e,t){this.channels[e].setHandler(t)}},{key:"addData",value:function(e,t){var r,i,a,n=!1;this.logger.time=e;for(var o=0;o ("+Qg([i,a])+")"),r=this.parseCmd(i,a),r||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(n=this.parseChars(i,a),n)){var s=this.currentChannel;s&&s>0?this.channels[s].insertChars(n):this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||n||this.logger.log(2,"Couldn't parse cleaned data "+Qg([i,a])+" orig: "+Qg([t[o],t[o+1]]))}}},{key:"parseCmd",value:function(e,t){var r=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;if(ay(e,t,r))return iy(null,null,r),this.logger.log(3,"Repeated command ("+Qg([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,a=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?a.ccRCL():33===t?a.ccBS():34===t?a.ccAOF():35===t?a.ccAON():36===t?a.ccDER():37===t?a.ccRU(2):38===t?a.ccRU(3):39===t?a.ccRU(4):40===t?a.ccFON():41===t?a.ccRDC():42===t?a.ccTR():43===t?a.ccRTD():44===t?a.ccEDM():45===t?a.ccCR():46===t?a.ccENM():47===t&&a.ccEOC():a.ccTO(t-32),iy(e,t,r),this.currentChannel=i,!0}},{key:"parseMidrow",value:function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if(r=17===e?1:2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Qg([e,t])+")"),!0)}return!1}},{key:"parsePAC",value:function(e,t){var r,i=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;if(ay(e,t,i))return iy(null,null,i),!0;var a=e<=23?1:2;r=t>=64&&t<=95?1===a?Vg[e]:Jg[e]:1===a?Wg[e]:qg[e];var n=this.channels[a];return!!n&&(n.setPAC(this.interpretPAC(r,t)),iy(e,t,i),this.currentChannel=a,!0)}},{key:"interpretPAC",value:function(e,t){var r,i={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i}},{key:"parseChars",value:function(e,t){var r,i,a=null,n=null;(e>=25?(r=2,n=e-8):(r=1,n=e),n>=17&&n<=19)?(i=17===n?t+80:18===n?t+112:t+144,this.logger.log(2,"Special char '"+zg(i)+"' in channel "+r),a=[i]):e>=32&&e<=127&&(a=0===t?[e]:[e,t]);if(a){var o=Qg(a);this.logger.log(3,"Char codes = "+o.join(",")),iy(e,t,this.cmdHistory)}return a}},{key:"parseBackgroundAttributes",value:function(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;var r,i={};16===e||24===e?(r=Math.floor((t-32)/2),i.background=Kg[r],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var a=e<=23?1:2;return this.channels[a].setBkgData(i),iy(e,t,this.cmdHistory),!0}},{key:"reset",value:function(){for(var e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}},{key:"reset",value:function(){this.cueRanges=[],this.startTime=null}}])}(),oy=function(){if(null!=qd&&qd.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var r=t.toLowerCase();return!!~e.indexOf(r)&&r}function i(e){return r(t,e)}function a(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i100)throw new Error("Position must be between 0 and 100.");A=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",a({},l,{get:function(){return b},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",a({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",a({},l,{get:function(){return k},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");k=t,this.hasBeenReset=!0}})),s.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}(),sy=function(){function e(){S(this,e)}return w(e,[{key:"decode",value:function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}])}();function ly(e){function t(e,t,r,i){return 3600*(0|e)+60*(0|t)+(0|r)+parseFloat(i||0)}var r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}var cy=function(){function e(){S(this,e),this.values=Object.create(null)}return w(e,[{key:"set",value:function(e,t){this.get(e)||""===t||(this.values[e]=t)}},{key:"get",value:function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t}},{key:"has",value:function(e){return e in this.values}},{key:"alt",value:function(e,t,r){for(var i=0;i=0&&r<=100)return this.set(e,r),!0}return!1}}])}();function uy(e,t,r,i){var a=i?e.split(i):[e];for(var n in a)if("string"==typeof a[n]){var o=a[n].split(r);2===o.length&&t(o[0],o[1])}}var dy=new oy(0,0,""),hy="middle"===dy.align?"middle":"center";function py(e,t,r){var i=e;function a(){var t=ly(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function n(){e=e.replace(/^\s+/,"")}if(n(),t.startTime=a(),n(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),n(),t.endTime=a(),n(),function(e,t){var i=new cy;uy(e,(function(e,t){var a;switch(e){case"region":for(var n=r.length-1;n>=0;n--)if(r[n].id===t){i.set(e,r[n].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":a=t.split(","),i.integer(e,a[0]),i.percent(e,a[0])&&i.set("snapToLines",!1),i.alt(e,a[0],["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start",hy,"end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start",hy,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",hy,"end","left","right"])}}),/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var a=i.get("line","auto");"auto"===a&&-1===dy.line&&(a=-1),t.line=a,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",hy);var n=i.get("position","auto");"auto"===n&&50===dy.position&&(n="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=n}(e,t)}function fy(e){return e.replace(//gi,"\n")}var my=function(){function e(){S(this,e),this.state="INITIAL",this.buffer="",this.decoder=new sy,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}return w(e,[{key:"parse",value:function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=fy(e);r2&&void 0!==arguments[2]?arguments[2]:0;return e.slice(r,r+t.length)===t},vy=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()};function Ay(e,t,r){return vy(e.toString())+vy(t.toString())+vy(r)}function by(e,t,r,i,a,n,o){var s,l=new my,c=_h(new Uint8Array(e)).trim().replace(gy,"\n").split("\n"),u=[],d=t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return pg(e,9e4,1/t)}(t.baseTime,t.timescale):0,h="00:00.000",p=0,f=0,m=!0;l.oncue=function(e){var n=r[i],o=r.ccOffset,l=(p-d)/9e4;if(null!=n&&n.new&&(void 0!==f?o=r.ccOffset=n.start:function(e,t,r){var i=e[t],a=e[i.prevCC];if(!a||!a.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(n=a)&&n.new;){var n;e.ccOffset+=i.start-a.start,i.new=!1,i=a,a=e[i.prevCC]}e.presentationOffset=r}(r,i,l)),l){if(!t)return void(s=new Error("Missing initPTS for VTT MPEGTS"));o=l-r.presentationOffset}var c=e.endTime-e.startTime,h=Ag(9e4*(e.startTime+o-f),9e4*a)/9e4;e.startTime=Math.max(h,0),e.endTime=Math.max(h+c,0);var m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=Ay(e.startTime,e.endTime,m)),e.endTime>0&&u.push(e)},l.onparsingerror=function(e){s=e},l.onflush=function(){s?o(s):n(u)},c.forEach((function(e){if(m){if(yy(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((function(e){yy(e,"LOCAL:")?h=e.slice(6):yy(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){var t=parseInt(e.slice(-3)),r=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),a=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(bd(t)&&bd(r)&&bd(i)&&bd(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e));return t+=1e3*r,t+=6e4*i,t+=36e5*a,t}(h)/1e3}catch(e){s=e}return}""===e&&(m=!1)}l.parse(e+"\n")})),l.flush()}var _y="stpp.ttml.im1t",ky=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,wy=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Sy={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ey(e,t,r,i){var a=Bh(new Uint8Array(e),["mdat"]);if(0!==a.length){var n=a.map((function(e){return _h(e)})),o=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return pg(e,t,1/r,i)}(t.baseTime,1,t.timescale);try{n.forEach((function(e){return r(function(e,t){var r=new DOMParser,i=r.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},n=Object.keys(a).reduce((function(e,t){return e[t]=i.getAttribute("ttp:".concat(t))||a[t],e}),{}),o="preserve"!==i.getAttribute("xml:space"),s=Cy(Ty(i,"styling","style")),l=Cy(Ty(i,"layout","region")),c=Ty(i,"body","[begin]");return[].map.call(c,(function(e){var r=xy(e,o);if(!r||!e.hasAttribute("begin"))return null;var i=Ly(e.getAttribute("begin"),n),a=Ly(e.getAttribute("dur"),n),c=Ly(e.getAttribute("end"),n);if(null===i)throw Dy(e);if(null===c){if(null===a)throw Dy(e);c=i+a}var u=new oy(i-t,c-t,r);u.id=Ay(u.startTime,u.endTime,u.text);var d=function(e,t,r){var i="http://www.w3.org/ns/ttml#styling",a=null,n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return o&&r.hasOwnProperty(o)&&(a=r[o]),n.reduce((function(r,n){var o=Ry(t,i,n)||Ry(e,i,n)||Ry(a,i,n);return o&&(r[n]=o),r}),{})}(l[e.getAttribute("region")],s[e.getAttribute("style")],s),h=d.textAlign;if(h){var p=Sy[h];p&&(u.lineAlign=p),u.align=h}return Ad(u,d),u})).filter((function(e){return null!==e}))}(e,o))}))}catch(e){i(e)}}else i(new Error("Could not parse IMSC1 mdat"))}function Ty(e,t,r){var i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(r)):[]}function Cy(e){return e.reduce((function(e,t){var r=t.getAttribute("xml:id");return r&&(e[r]=t),e}),{})}function xy(e,t){return[].slice.call(e.childNodes).reduce((function(e,r,i){var a;return"br"===r.nodeName&&i?e+"\n":null!=(a=r.childNodes)&&a.length?xy(r,t):t?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent}),"")}function Ry(e,t,r){return e&&e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null}function Dy(e){return new Error("Could not parse ttml timestamp ".concat(e))}function Ly(e,t){if(!e)return null;var r=ly(e);return null===r&&(ky.test(e)?r=function(e,t){var r=ky.exec(e),i=(0|r[4])+(0|r[5])/t.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+i/t.frameRate}(e,t):wy.test(e)&&(r=function(e,t){var r=wy.exec(e),i=Number(r[1]);switch(r[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}(e,t))),r}function Py(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function By(e,t){return!!e&&e.kind===Py(t)&&Mg(t,e)}var Iy=function(){function e(t){S(this,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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}return w(e,[{key:"setStreamController",value:function(e){this.streamController=e}},{key:"destroy",value:function(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}},{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(wd.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wd.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(wd.BUFFER_CODECS,this.onBufferCodecs,this),e.on(wd.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"unregisterListener",value:function(){var e=this.hls;e.off(wd.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(wd.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wd.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(wd.BUFFER_CODECS,this.onBufferCodecs,this),e.off(wd.MEDIA_DETACHING,this.onMediaDetaching,this)}},{key:"onFpsDropLevelCapping",value:function(e,t){var r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}},{key:"onMediaAttaching",value:function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}},{key:"onManifestParsed",value:function(e,t){var r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()}},{key:"onLevelsUpdated",value:function(e,t){this.timer&&bd(this.autoLevelCapping)&&this.detectPlayerSize()}},{key:"onBufferCodecs",value:function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}},{key:"onMediaDetaching",value:function(){this.stopCapping()}},{key:"detectPlayerSize",value:function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);var e=this.hls.levels;if(e.length){var t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&Dd.log("Setting autoLevelCapping to ".concat(r,": ").concat(e[r].height,"p@").concat(e[r].bitrate," for media ").concat(this.mediaWidth,"x").concat(this.mediaHeight)),t.autoLevelCapping=r,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}},{key:"getMaxLevel",value:function(t){var r=this,i=this.hls.levels;if(!i.length)return-1;var a=i.filter((function(e,i){return r.isLevelAllowed(e)&&i<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(a,this.mediaWidth,this.mediaHeight)}},{key:"startCapping",value:function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"stopCapping",value:function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}},{key:"getDimensions",value:function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t}},{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}},{key:"isLevelAllowed",value:function(e){return!this.restrictedLevels.some((function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height}))}}],[{key:"getMaxLevelByMediaSize",value:function(e,t,r){if(null==e||!e.length)return-1;for(var i,a,n=e.length-1,o=Math.max(t,r),s=0;s=o||l.height>=o)&&(i=l,!(a=e[s+1])||i.width!==a.width||i.height!==a.height)){n=s;break}}return n}}])}(),My="[eme]",Uy=function(){function e(t){S(this,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=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=Dd.debug.bind(Dd,My),this.log=Dd.log.bind(Dd,My),this.warn=Dd.warn.bind(Dd,My),this.error=Dd.error.bind(Dd,My),this.hls=t,this.config=t.config,this.registerListeners()}return w(e,[{key:"destroy",value: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}},{key:"registerListeners",value:function(){this.hls.on(wd.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(wd.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(wd.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"unregisterListeners",value:function(){this.hls.off(wd.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(wd.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(wd.MANIFEST_LOADED,this.onManifestLoaded,this)}},{key:"getLicenseServerUrl",value:function(e){var t=this.config,r=t.drmSystems,i=t.widevineLicenseUrl,a=r[e];if(a)return a.licenseUrl;if(e===Kd.WIDEVINE&&i)return i;throw new Error('no license server URL configured for key-system "'.concat(e,'"'))}},{key:"getServerCertificateUrl",value:function(e){var t=this.config.drmSystems,r=t[e];if(r)return r.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'.concat(e,'"]'))}},{key:"attemptKeySystemAccess",value:function(e){var t=this,r=this.hls.levels,i=function(e){function t(t,r,i){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t,r){return!!e&&r.indexOf(e)===t})),a=r.map((function(e){return e.audioCodec})).filter(i),n=r.map((function(e){return e.videoCodec})).filter(i);return a.length+n.length===0&&n.push("avc1.42e01e"),new Promise((function(r,i){var o=function(e){var s=e.shift();t.getMediaKeysPromise(s,a,n).then((function(e){return r({keySystem:s,mediaKeys:e})})).catch((function(t){e.length?o(e):i(t instanceof jy?t:new jy({type:Sd.KEY_SYSTEM_ERROR,details:Ed.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};o(e)}))}},{key:"requestMediaKeySystemAccess",value:function(e,t){var r=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof r){var i="Configured requestMediaKeySystemAccess is not a function ".concat(r);return null===ah&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),Promise.reject(new Error(i))}return r(e,t)}},{key:"getMediaKeysPromise",value:function(e,t,r){var i=this,a=function(e,t,r,i){var a;switch(e){case Kd.FAIRPLAY:a=["cenc","sinf"];break;case Kd.WIDEVINE:case Kd.PLAYREADY:a=["cenc"];break;case Kd.CLEARKEY:a=["cenc","keyids"];break;default:throw new Error("Unknown key-system: ".concat(e))}return function(e,t,r,i){return[{initDataTypes:e,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map((function(e){return{contentType:'audio/mp4; codecs="'.concat(e,'"'),robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}})),videoCapabilities:r.map((function(e){return{contentType:'video/mp4; codecs="'.concat(e,'"'),robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}}))}]}(a,t,r,i)}(e,t,r,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e],o=null==n?void 0:n.keySystemAccess;if(!o){this.log('Requesting encrypted media "'.concat(e,'" key-system access with config: ').concat(JSON.stringify(a))),o=this.requestMediaKeySystemAccess(e,a);var s=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch((function(t){i.log('Failed to obtain access to key-system "'.concat(e,'": ').concat(t))})),o.then((function(t){i.log('Access for key-system "'.concat(t.keySystem,'" obtained'));var r=i.fetchServerCertificate(e);return i.log('Create media-keys for "'.concat(e,'"')),s.mediaKeys=t.createMediaKeys().then((function(t){return i.log('Media-keys created for "'.concat(e,'"')),r.then((function(r){return r?i.setMediaKeysServerCertificate(t,e,r):t}))})),s.mediaKeys.catch((function(t){i.error('Failed to create media-keys for "'.concat(e,'"}: ').concat(t))})),s.mediaKeys}))}return o.then((function(){return n.mediaKeys}))}},{key:"createMediaKeySessionContext",value:function(e){var t=e.decryptdata,r=e.keySystem,i=e.mediaKeys;this.log('Creating key-system session "'.concat(r,'" keyId: ').concat(wh(t.keyId||[])));var a=i.createSession(),n={decryptdata:t,keySystem:r,mediaKeys:i,mediaKeysSession:a,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}},{key:"renewKeySession",value:function(e){var t=e.decryptdata;if(t.pssh){var r=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),a="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(r,a,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}},{key:"getKeyIdString",value: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 wh(e.keyId)}},{key:"updateKeySession",value:function(e,t){var r,i=e.mediaKeysSession;return this.log('Updating key-session "'.concat(i.sessionId,'" for keyID ').concat(wh((null==(r=e.decryptdata)?void 0:r.keyId)||[]),"\n } (data length: ").concat(t?t.byteLength:t,")")),i.update(t)}},{key:"selectKeySystemFormat",value:function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: ".concat(e.sn," ").concat(e.type,": ").concat(e.level,") key formats ").concat(t.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}},{key:"getKeyFormatPromise",value:function(e){var t=this;return new Promise((function(r,i){var a=rh(t.config),n=e.map($d).filter((function(e){return!!e&&-1!==a.indexOf(e)}));return t.getKeySystemSelectionPromise(n).then((function(e){var t=e.keySystem,a=th(t);a?r(a):i(new Error('Unable to find format for key-system "'.concat(t,'"')))})).catch(i)}))}},{key:"loadKey",value:function(e){var t=this,r=e.keyInfo.decryptdata,i=this.getKeyIdString(r),a="(keyId: ".concat(i,' format: "').concat(r.keyFormat,'" method: ').concat(r.method," uri: ").concat(r.uri,")");this.log("Starting session for key ".concat(a));var n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(r).then((function(i){var n=i.keySystem,o=i.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: ".concat(e.frag.sn," ").concat(e.frag.type,": ").concat(e.frag.level," using key ").concat(a)),t.attemptSetMediaKeys(n,o).then((function(){t.throwIfDestroyed();var e=t.createMediaKeySessionContext({keySystem:n,mediaKeys:o,decryptdata:r});return t.generateRequestWithPreferredKeySession(e,"cenc",r.pssh,"playlist-key")}))})),n.catch((function(e){return t.handleError(e)}))),n}},{key:"throwIfDestroyed",value:function(){if(!this.hls)throw new Error("invalid state")}},{key:"handleError",value:function(e){this.hls&&(this.error(e.message),e instanceof jy?this.hls.trigger(wd.ERROR,e.data):this.hls.trigger(wd.ERROR,{type:Sd.KEY_SYSTEM_ERROR,details:Ed.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}},{key:"getKeySystemForKeyPromise",value:function(e){var t=this.getKeyIdString(e),r=this.keyIdToKeySessionPromise[t];if(!r){var i=$d(e.keyFormat),a=i?[i]:rh(this.config);return this.attemptKeySystemAccess(a)}return r}},{key:"getKeySystemSelectionPromise",value:function(e){if(e.length||(e=rh(this.config)),0===e.length)throw new jy({type:Sd.KEY_SYSTEM_ERROR,details:Ed.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(JSON.stringify({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}},{key:"_onMediaEncrypted",value:function(e){var t=this,r=e.initDataType,i=e.initData;if(this.debug('"'.concat(e.type,'" event: init data type: "').concat(r,'"')),null!==i){var a,n;if("sinf"===r&&this.config.drmSystems[Kd.FAIRPLAY]){var o=Ch(new Uint8Array(i));try{var s=Vd(JSON.parse(o).sinf),l=jh(new Uint8Array(s));if(!l)return;a=l.subarray(8,24),n=Kd.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var c=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;var t={version:0,systemId:"",kids:null,data:null},r=new DataView(e),i=r.getUint32(0);if(e.byteLength!==i&&i>44)return null;if(1886614376!==r.getUint32(4))return null;if(t.version=r.getUint32(8)>>>24,t.version>1)return null;t.systemId=wh(new Uint8Array(e,12,16));var a=r.getUint32(28);if(0===t.version){if(i-320)for(var n,o=0,s=a.length;o in key message");return Jd(atob(p))}},{key:"setupLicenseXHR",value:function(e,t,r,i){var a=this,n=this.config.licenseXhrSetup;return n?Promise.resolve().then((function(){if(!r.decryptdata)throw new Error("Key removed");return n.call(a.hls,e,t,r,i)})).catch((function(o){if(!r.decryptdata)throw o;return e.open("POST",t,!0),n.call(a.hls,e,t,r,i)})).then((function(r){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||i}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}},{key:"requestLicense",value:function(e,t){var r=this,i=this.config.keyLoadPolicy.default;return new Promise((function(a,n){var o=r.getLicenseServerUrl(e.keySystem);r.log("Sending license request to URL: ".concat(o));var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=function(){if(!r.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(4===s.readyState)if(200===s.status){r._requestLicenseFailureCount=0;var l=s.response;r.log("License received ".concat(l instanceof ArrayBuffer?l.byteLength:l));var c=r.config.licenseResponseCallback;if(c)try{l=c.call(r.hls,s,o,e)}catch(e){r.error(e)}a(l)}else{var u=i.errorRetry,d=u?u.maxNumRetry:0;if(r._requestLicenseFailureCount++,r._requestLicenseFailureCount>d||s.status>=400&&s.status<500)n(new jy({type:Sd.KEY_SYSTEM_ERROR,details:Ed.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:{url:o,data:void 0,code:s.status,text:s.statusText}},"License Request XHR failed (".concat(o,"). Status: ").concat(s.status," (").concat(s.statusText,")")));else{var h=d-r._requestLicenseFailureCount+1;r.warn("Retrying license request, ".concat(h," attempts left")),r.requestLicense(e,t).then(a,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=s,r.setupLicenseXHR(s,o,e,t).then((function(t){var i=t.xhr,a=t.licenseChallenge;e.keySystem==Kd.PLAYREADY&&(a=r.unpackPlayReadyKeyMessage(i,a)),i.send(a)}))}))}},{key:"onMediaAttached",value:function(e,t){if(this.config.emeEnabled){var r=t.media;this.media=r,r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}}},{key:"onMediaDetached",value:function(){var t=this,r=this.media,i=this.mediaKeySessions;r&&(r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Yh.clearKeyUriToKeyIdMap();var a=i.length;e.CDMCleanupPromise=Promise.all(i.map((function(e){return t.removeSession(e)})).concat(null==r?void 0:r.setMediaKeys(null).catch((function(e){t.log("Could not clear media keys: ".concat(e))})))).then((function(){a&&(t.log("finished closing key sessions and clearing media keys"),i.length=0)})).catch((function(e){t.log("Could not close sessions and clear media keys: ".concat(e))}))}},{key:"onManifestLoading",value:function(){this.keyFormatPromise=null}},{key:"onManifestLoaded",value:function(e,t){var r=t.sessionKeys;if(r&&this.config.emeEnabled&&!this.keyFormatPromise){var i=r.reduce((function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e}),[]);this.log("Selecting key-system from session-keys ".concat(i.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(i)}}},{key:"removeSession",value:function(e){var t=this,r=e.mediaKeysSession,i=e.licenseXhr;if(r){this.log("Remove licenses and keys and close session ".concat(r.sessionId)),e._onmessage&&(r.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(r.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var a=this.mediaKeySessions.indexOf(e);return a>-1&&this.mediaKeySessions.splice(a,1),r.remove().catch((function(e){t.log("Could not remove session: ".concat(e))})).then((function(){return r.close()})).catch((function(e){t.log("Could not close session: ".concat(e))}))}}}])}();Uy.CDMCleanupPromise=void 0;var Fy,Oy,Ny,jy=function(e){function t(e,r){var i;return S(this,t),i=_(this,t,[r]),i.data=void 0,e.error||(e.error=new Error(r)),i.data=e,e.err=e.error,i}return k(t,e),w(t)}(y(Error));!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(Fy||(Fy={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(Oy||(Oy={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(Ny||(Ny={}));var zy=p(p(p(p({},Ny.OBJECT,["br","d","ot","tb"]),Ny.REQUEST,["bl","dl","mtp","nor","nrr","su"]),Ny.SESSION,["cid","pr","sf","sid","st","v"]),Ny.STATUS,["bs","rtp"]),Gy=w((function e(t,r){S(this,e),this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map((function(t){return t instanceof e?t:new e(t)}))),this.value=t,this.params=r})),Hy=w((function e(t){S(this,e),this.description=void 0,this.description=t}));function Vy(e,t,r,i){return new Error("failed to ".concat(e,' "').concat((a=t,Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":"object"==T(a)?JSON.stringify(a):String(a)),'" as ').concat(r),{cause:i});var a}var Wy="Bare Item",Jy=/[\x00-\x1f\x7f]+/;function qy(e,t,r){return Vy("serialize",e,t,r)}function Ky(e){if(!1===ArrayBuffer.isView(e))throw qy(e,"Byte Sequence");return":".concat((t=e,btoa(String.fromCharCode.apply(String,g(t)))),":");var t}function Yy(e){if(function(e){return e<-999999999999999||99999999999999912)throw qy(e,"Decimal");var r=t.toString();return r.includes(".")?r:"".concat(r,".0")}function Zy(e){var t,r=(t=e).description||t.toString().slice(7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(r))throw qy(r,"Token");return r}function $y(e){switch(T(e)){case"number":if(!bd(e))throw qy(e,Wy);return Number.isInteger(e)?Yy(e):Xy(e);case"string":return function(e){if(Jy.test(e))throw qy(e,"String");return'"'.concat(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"')}(e);case"symbol":return Zy(e);case"boolean":return function(e){if("boolean"!=typeof e)throw qy(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return"@".concat(Yy(e.getTime()/1e3))}(e);if(e instanceof Uint8Array)return Ky(e);if(e instanceof Hy)return Zy(e);default:throw qy(e,Wy)}}function ev(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw qy(e,"Key");return e}function tv(e){return null==e?"":Object.entries(e).map((function(e){var t=h(e,2),r=t[0],i=t[1];return!0===i?";".concat(ev(r)):";".concat(ev(r),"=").concat($y(i))})).join("")}function rv(e){return e instanceof Gy?"".concat($y(e.value)).concat(tv(e.params)):$y(e)}function iv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{whitespace:!0};if("object"!=T(e))throw qy(e,"Dict");var r=e instanceof Map?e.entries():Object.entries(e),i=null!=t&&t.whitespace?" ":"";return Array.from(r).map((function(e){var t=h(e,2),r=t[0],i=t[1];i instanceof Gy==0&&(i=new Gy(i));var a,n=ev(r);return!0===i.value?n+=tv(i.params):(n+="=",Array.isArray(i.value)?n+="(".concat((a=i).value.map(rv).join(" "),")").concat(tv(a.params)):n+=rv(i)),n})).join(",".concat(i))}var av=function(e){return Math.round(e)},nv=function(e){return 100*av(e/100)},ov={br:av,d:av,bl:nv,dl:nv,mtp:nv,nor:function(e,t){return null!=t&&t.baseUrl&&(e=function(e,t){var r=new URL(e),i=new URL(t);if(r.origin!==i.origin)return e;for(var a=r.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);a[0]===n[0];)a.shift(),n.shift();for(;n.length;)n.shift(),a.unshift("..");return a.join("/")}(e,t.baseUrl)),encodeURIComponent(e)},rtp:nv,tb:av};function sv(e,t){var r={};if(null==e||"object"!=T(e))return r;var i=Object.keys(e).sort(),a=Ad({},ov,null==t?void 0:t.formatters),n=null==t?void 0:t.filter;return i.forEach((function(i){if(null==n||!n(i)){var o=e[i],s=a[i];s&&(o=s(o,t)),"v"===i&&1===o||"pr"==i&&1===o||function(e){return"number"==typeof e?bd(e):null!=e&&""!==e&&!1!==e}(o)&&(function(e){return"ot"===e||"sf"===e||"st"===e}(i)&&"string"==typeof o&&(o=new Hy(o)),r[i]=o)}})),r}function lv(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?function(e,t){return iv(e,t)}(sv(e,t),Ad({whitespace:!1},t)):""}function cv(e,t,r){return Ad(e,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return{};var r=Object.entries(e),i=Object.entries(zy).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),a=r.reduce((function(e,t){var r,a=h(t,2),n=a[0],o=a[1],s=(null==(r=i.find((function(e){return e[1].includes(n)})))?void 0:r[0])||Ny.REQUEST;return null!=e[s]||(e[s]={}),e[s][n]=o,e}),{});return Object.entries(a).reduce((function(e,r){var i=h(r,2),a=i[0],n=i[1];return e[a]=lv(n,t),e}),{})}(t,r))}var uv=/CMCD=[^&#]+/;function dv(e,t,r){var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return"";var r=lv(e,t);return"CMCD=".concat(encodeURIComponent(r))}(t,r);if(!i)return e;if(uv.test(e))return e.replace(uv,i);var a=e.includes("?")?"&":"?";return"".concat(e).concat(a).concat(i)}function hv(e,t,r,i){e&&Object.keys(t).forEach((function(a){var n=e.filter((function(e){return e.groupId===a})).map((function(e){var n=Ad({},e);return n.details=void 0,n.attrs=new Bd(n.attrs),n.url=n.attrs.URI=pv(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),n.groupId=n.attrs["GROUP-ID"]=t[a],n.attrs["PATHWAY-ID"]=i,n}));e.push.apply(e,g(n))}))}function pv(e,t,r,i){var a,n=i.HOST,o=i.PARAMS,s=i[r];t&&(a=null==s?void 0:s[t],a&&(e=a));var l=new self.URL(e);return n&&!a&&(l.host=n),o&&Object.keys(o).sort().forEach((function(e){e&&l.searchParams.set(e,o[e])})),l.href}var fv=/^age:\s*[\d.]+\s*$/im,mv=function(){function e(t){S(this,e),this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new Ud,this.retryDelay=0}return w(e,[{key:"destroy",value:function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}},{key:"abortInternal",value:function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}},{key:"abort",value:function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}},{key:"load",value:function(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()}},{key:"loadInternal",value:function(){var e=this,t=this.config,r=this.context;if(t&&r){var i=this.loader=new self.XMLHttpRequest,a=this.stats;a.loading.first=0,a.loaded=0,a.aborted=!1;var n=this.xhrSetup;n?Promise.resolve().then((function(){if(!e.stats.aborted)return n(i,r.url)})).catch((function(e){return i.open("GET",r.url,!0),n(i,r.url)})).then((function(){e.stats.aborted||e.openAndSendXhr(i,r,t)})).catch((function(t){e.callbacks.onError({code:i.status,text:t.message},r,i,a)})):this.openAndSendXhr(i,r,t)}}},{key:"openAndSendXhr",value:function(e,t,r){e.readyState||e.open("GET",t.url,!0);var i=t.headers,a=r.loadPolicy,n=a.maxTimeToFirstByteMs,o=a.maxLoadTimeMs;if(i)for(var s in i)e.setRequestHeader(s,i[s]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=n&&bd(n)?n:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}},{key:"readystatechange",value:function(){var e=this.context,t=this.loader,r=this.stats;if(e&&t){var i=t.readyState,a=this.config;if(!r.aborted&&i>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),a.timeout!==a.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),a.timeout=a.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var n=t.status,o="text"!==t.responseType;if(n>=200&&n<300&&(o&&t.response||null!==t.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);var s=o?t.response:t.responseText,l="arraybuffer"===t.responseType?s.byteLength:s.length;if(r.loaded=r.total=l,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first),!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(r,e,s,t),!this.callbacks)return;var u={url:t.responseURL,data:s,code:n};this.callbacks.onSuccess(u,r,e,t)}else{var d=a.loadPolicy.errorRetry;yf(d,r.retry,!1,{url:e.url,data:void 0,code:n})?this.retry(d):(Dd.error("".concat(n," while loading ").concat(e.url)),this.callbacks.onError({code:n,text:t.statusText},e,t,r))}}}}},{key:"loadtimeout",value:function(){var e,t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(yf(t,this.stats.retry,!0))this.retry(t);else{var r;Dd.warn("timeout while loading ".concat(null==(r=this.context)?void 0:r.url));var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}},{key:"retry",value:function(e){var t=this.context,r=this.stats;this.retryDelay=mf(e,r.retry),r.retry++,Dd.warn("".concat(status?"HTTP Status "+status:"Timeout"," while loading ").concat(null==t?void 0:t.url,", retrying ").concat(r.retry,"/").concat(e.maxNumRetry," in ").concat(this.retryDelay,"ms")),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}},{key:"loadprogress",value:function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}},{key:"getCacheAge",value:function(){var e=null;if(this.loader&&fv.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}},{key:"getResponseHeader",value:function(e){return this.loader&&new RegExp("^".concat(e,":\\s*[\\d.]+\\s*$"),"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}])}(),gv=/(\d+)-(\d+)\/(\d+)/,yv=function(){function e(t){S(this,e),this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||vv,this.controller=new self.AbortController,this.stats=new Ud}return w(e,[{key:"destroy",value:function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}},{key:"abortInternal",value:function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}},{key:"abort",value:function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}},{key:"load",value:function(e,t,r){var i=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var n=function(e,t){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(Ad({},e.headers))};return e.rangeEnd&&r.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),r}(e,this.controller.signal),o=r.onProgress,s="arraybuffer"===e.responseType,l=s?"byteLength":"length",c=t.loadPolicy,u=c.maxTimeToFirstByteMs,d=c.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=u&&bd(u)?u:d,this.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(a,e,i.response)}),t.timeout),self.fetch(this.request).then((function(n){i.response=i.loader=n;var l=Math.max(self.performance.now(),a.loading.start);if(self.clearTimeout(i.requestTimeout),t.timeout=d,i.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(a,e,i.response)}),d-(l-a.loading.start)),!n.ok){var c=n.status,u=n.statusText;throw new bv(u||"fetch, bad network response",c,n)}return a.loading.first=l,a.total=function(e){var t=e.get("Content-Range");if(t){var r=function(e){var t=gv.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(bd(r))return r}var i=e.get("Content-Length");if(i)return parseInt(i)}(n.headers)||a.total,o&&bd(t.highWaterMark)?i.loadProgressively(n,a,e,t.highWaterMark,o):s?n.arrayBuffer():"json"===e.responseType?n.json():n.text()})).then((function(n){var s=i.response;if(!s)throw new Error("loader destroyed");self.clearTimeout(i.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first);var c=n[l];c&&(a.loaded=a.total=c);var u={url:s.url,data:n,code:s.status};o&&!bd(t.highWaterMark)&&o(a,e,n,s),r.onSuccess(u,a,e,s)})).catch((function(t){if(self.clearTimeout(i.requestTimeout),!a.aborted){var n=t&&t.code||0,o=t?t.message:null;r.onError({code:n,text:o},e,t?t.details:null,a)}}))}},{key:"getCacheAge",value:function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}},{key:"getResponseHeader",value:function(e){return this.response?this.response.headers.get(e):null}},{key:"loadProgressively",value:function(e,t,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,n=new Cm,o=e.body.getReader(),s=function(){return o.read().then((function(o){if(o.done)return n.dataLength&&a(t,r,n.flush(),e),Promise.resolve(new ArrayBuffer(0));var l=o.value,c=l.length;return t.loaded+=c,c=i&&a(t,r,n.flush(),e)):a(t,r,l,e),s()})).catch((function(){return Promise.reject()}))};return s()}}])}();function vv(e,t){return new self.Request(e.url,t)}var Av,bv=function(e){function t(e,r,i){var a;return S(this,t),a=_(this,t,[e]),a.code=void 0,a.details=void 0,a.code=r,a.details=i,a}return k(t,e),w(t)}(y(Error)),_v=/\s/,kv={newCue:function(e,t,r,i){for(var a,n,o,s,l,c=[],u=self.VTTCue||self.TextTrackCue,d=0;d=16?s--:s++;var f=fy(l.trim()),m=Ay(t,r,f);null!=e&&null!=(h=e.cues)&&h.getCueById(m)||(n=new u(t,r,f),n.id=m,n.line=d+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*s/32)),c.push(n))}return e&&c.length&&(c.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),c.forEach((function(t){return Fp(e,t)}))),c}},wv=gd(gd({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:mv,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:function(){function e(t){var r=this;S(this,e),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=function(){var e=r.fragCurrent,t=r.partCurrent,i=r.hls,a=i.autoLevelEnabled,n=i.media;if(e&&n){var o=performance.now(),s=t?t.stats:e.stats,l=t?t.duration:e.duration,c=o-s.loading.start,u=i.minAutoLevel;if(s.aborted||s.loaded&&s.loaded===s.total||e.level<=u)return r.clearTimer(),void(r._nextAutoLevel=-1);if(a&&!n.paused&&n.playbackRate&&n.readyState){var d=i.mainForwardBufferInfo;if(null!==d){var h=r.bwEstimator.getEstimateTTFB(),p=Math.abs(n.playbackRate);if(!(c<=Math.max(h,l/(2*p)*1e3))){var f=d.len/p,m=s.loading.first?s.loading.first-s.loading.start:-1,g=s.loaded&&m>-1,y=r.getBwEstimate(),v=i.levels,A=v[e.level],b=s.total||Math.max(s.loaded,Math.round(l*A.averageBitrate/8)),_=g?c-m:c;_<1&&g&&(_=Math.min(c,8*s.loaded/y));var k=g?1e3*s.loaded/_:0,w=k?(b-s.loaded)/k:8*b/y+h/1e3;if(!(w<=f)){var S,E=k?8*k:y,T=Number.POSITIVE_INFINITY;for(S=e.level-1;S>u;S--){var C=v[S].maxBitrate;if(T=r.getTimeToLoadFrag(h/1e3,E,l*C,!v[S].details),T=w)&&!(T>10*l)){i.nextLoadLevel=i.nextAutoLevel=S,g?r.bwEstimator.sample(c-Math.min(h,m),s.loaded):r.bwEstimator.sampleTTFB(c);var x=v[S].maxBitrate;r.getBwEstimate()*r.hls.config.abrBandWidthUpFactor>x&&r.resetEstimator(x),r.clearTimer(),Dd.warn("[abr] Fragment ".concat(e.sn).concat(t?" part "+t.index:""," of level ").concat(e.level," is loading too slowly;\n Time to underbuffer: ").concat(f.toFixed(3)," s\n Estimated load time for current fragment: ").concat(w.toFixed(3)," s\n Estimated load time for down switch fragment: ").concat(T.toFixed(3)," s\n TTFB estimate: ").concat(0|m," ms\n Current BW estimate: ").concat(bd(y)?0|y:"Unknown"," bps\n New BW estimate: ").concat(0|r.getBwEstimate()," bps\n Switching to level ").concat(S," @ ").concat(0|x," bps")),i.trigger(wd.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:s})}}}}}}},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}return w(e,[{key:"resetEstimator",value:function(e){e&&(Dd.log("setting initial bwe to ".concat(e)),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}},{key:"initEstimator",value:function(){var e=this.hls.config;return new Lf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}},{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.FRAG_LOADING,this.onFragLoading,this),e.on(wd.FRAG_LOADED,this.onFragLoaded,this),e.on(wd.FRAG_BUFFERED,this.onFragBuffered,this),e.on(wd.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(wd.LEVEL_LOADED,this.onLevelLoaded,this),e.on(wd.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(wd.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(wd.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.FRAG_LOADING,this.onFragLoading,this),e.off(wd.FRAG_LOADED,this.onFragLoaded,this),e.off(wd.FRAG_BUFFERED,this.onFragBuffered,this),e.off(wd.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(wd.LEVEL_LOADED,this.onLevelLoaded,this),e.off(wd.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(wd.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(wd.ERROR,this.onError,this))}},{key:"destroy",value:function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}},{key:"onManifestLoading",value:function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}},{key:"onLevelsUpdated",value:function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}},{key:"onMaxAutoLevelUpdated",value:function(){this.firstSelection=-1,this.nextAutoLevelKey=""}},{key:"onFragLoading",value:function(e,t){var r,i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))}},{key:"onLevelSwitching",value:function(e,t){this.clearTimer()}},{key:"onError",value:function(e,t){if(!t.fatal)switch(t.details){case Ed.BUFFER_ADD_CODEC_ERROR:case Ed.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Ed.FRAG_LOAD_TIMEOUT:var r=t.frag,i=this.fragCurrent,a=this.partCurrent;if(r&&i&&r.sn===i.sn&&r.level===i.level){var n=performance.now(),o=a?a.stats:r.stats,s=n-o.loading.start,l=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&l>-1){var c=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(s-Math.min(c,l),o.loaded)}else this.bwEstimator.sampleTTFB(s)}break}}},{key:"getTimeToLoadFrag",value:function(e,t,r,i){return e+r/t+(i?this.lastLevelLoadSec:0)}},{key:"onLevelLoaded",value:function(e,t){var r=this.hls.config,i=t.stats.loading,a=i.end-i.start;bd(a)&&(this.lastLevelLoadSec=a/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}},{key:"onFragLoaded",value:function(e,t){var r=t.frag,i=t.part,a=i?i.stats:r.stats;if(r.type===Dp&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var n=i?i.duration:r.duration,o=this.hls.levels[r.level],s=(o.loaded?o.loaded.bytes:0)+a.loaded,l=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:s,duration:l},o.realBitrate=Math.round(8*s/l)}if(r.bitrateTest){var c={stats:a,frag:r,part:i,id:r.type};this.onFragBuffered(wd.FRAG_BUFFERED,c),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,i=t.part,a=null!=i&&i.stats.loaded?i.stats:r.stats;if(!a.aborted&&!this.ignoreFragment(r)){var n=a.parsing.end-a.loading.start-Math.min(a.loading.first-a.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,a.loaded),a.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=n/1e3:this.bitrateTestDelay=0}}},{key:"ignoreFragment",value:function(e){return e.type!==Dp||"initSegment"===e.sn}},{key:"clearTimer",value:function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}},{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,r=e.minAutoLevel,i=this.getBwEstimate(),a=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,r,t,0,a,1,1);if(n>-1)return n;var o=this.hls.firstLevel,s=Math.min(Math.max(o,r),t);return Dd.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist ".concat(o," clamped to ").concat(s)),s}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var i=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var a=this.hls.levels;if(a.length>Math.max(e,i)&&a[e].loadError<=a[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i},set:function(e){var t=this.hls,r=t.maxAutoLevel,i=t.minAutoLevel,a=Math.min(Math.max(e,i),r);this._nextAutoLevel!==a&&(this.nextAutoLevelKey="",this._nextAutoLevel=a)}},{key:"getAutoLevelKey",value:function(){return"".concat(this.getBwEstimate(),"_").concat(this.getStarvationDelay().toFixed(2))}},{key:"getNextABRAutoLevel",value:function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,i=r.maxAutoLevel,a=r.config,n=r.minAutoLevel,o=t?t.duration:e?e.duration:0,s=this.getBwEstimate(),l=this.getStarvationDelay(),c=a.abrBandWidthFactor,u=a.abrBandWidthUpFactor;if(l){var d=this.findBestLevel(s,n,i,l,0,c,u);if(d>=0)return d}var h=o?Math.min(o,a.maxStarvationDelay):a.maxStarvationDelay;if(!l){var p=this.bitrateTestDelay;p&&(h=(o?Math.min(o,a.maxLoadingDelay):a.maxLoadingDelay)-p,Dd.info("[abr] bitrate test took ".concat(Math.round(1e3*p),"ms, set first fragment max fetchDuration to ").concat(Math.round(1e3*h)," ms")),c=u=1)}var f=this.findBestLevel(s,n,i,l,h,c,u);if(Dd.info("[abr] ".concat(l?"rebuffering expected":"buffer is empty",", optimal quality level ").concat(f)),f>-1)return f;var m=r.levels[n],g=r.levels[r.loadLevel];return(null==m?void 0:m.bitrate)<(null==g?void 0:g.bitrate)?n:r.loadLevel}},{key:"getStarvationDelay",value:function(){var e=this.hls,t=e.media;if(!t)return 1/0;var r=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/r}},{key:"getBwEstimate",value:function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}},{key:"findBestLevel",value:function(e,t,r,i,a,n,o){var s,l=this,c=i+a,u=this.lastLoadedFragLevel,d=-1===u?this.hls.firstLevel:u,h=this.fragCurrent,p=this.partCurrent,f=this.hls,m=f.levels,g=f.allAudioTracks,y=f.loadLevel,v=f.config;if(1===m.length)return 0;var A,b=m[d],_=!(null==b||null==(s=b.details)||!s.live),k=-1===y||-1===u,w="SDR",S=(null==b?void 0:b.frameRate)||0,E=v.audioPreference,T=v.videoPreference,C=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce((function(e,t){var r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);var i=t.channels||"2";return r.channels[i]=(r.channels[i]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(g));if(k){if(-1!==this.firstSelection)return this.firstSelection;var x=this.codecTiers||(this.codecTiers=function(e,t,r,i){return e.slice(r,i+1).reduce((function(e,r){if(!r.codecSet)return e;var i=r.audioGroups,a=e[r.codecSet];a||(e[r.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,r.bitrate);var n=Math.min(r.height,r.width);return a.minHeight=Math.min(a.minHeight,n),a.minFramerate=Math.min(a.minFramerate,r.frameRate),a.maxScore=Math.max(a.maxScore,r.score),a.fragmentError+=r.fragmentError,a.videoRanges[r.videoRange]=(a.videoRanges[r.videoRange]||0)+1,i&&i.forEach((function(e){if(e){var r=t.groups[e];a.hasDefaultAudio=a.hasDefaultAudio||t.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(r.channels).forEach((function(e){a.channels[e]=(a.channels[e]||0)+r.channels[e]}))}})),e}),{})}(m,C,t,r)),R=function(e,t,r,i,a){for(var n=Object.keys(e),o=null==i?void 0:i.channels,s=null==i?void 0:i.audioCodec,l=o&&2===parseInt(o),c=!0,u=!1,d=1/0,h=1/0,p=1/0,f=0,m=[],g=Uf(t,a),y=g.preferHDR,v=g.allowedVideoRanges,A=function(){var t=e[n[b]];c=t.channels[2]>0,d=Math.min(d,t.minHeight),h=Math.min(h,t.minFramerate),p=Math.min(p,t.minBitrate);var r=v.filter((function(e){return t.videoRanges[e]>0}));r.length>0&&(u=!0,m=r)},b=n.length;b--;)A();d=bd(d)?d:0,h=bd(h)?h:0;var _=Math.max(1080,d),k=Math.max(30,h);p=bd(p)?p:r,r=Math.max(p,r),u||(t=void 0,m=[]);var w=n.reduce((function(t,i){var a=e[i];if(i===t)return t;if(a.minBitrate>r)return Ff(i,"min bitrate of ".concat(a.minBitrate," > current estimate of ").concat(r)),t;if(!a.hasDefaultAudio)return Ff(i,"no renditions with default or auto-select sound found"),t;if(s&&i.indexOf(s.substring(0,4))%5!=0)return Ff(i,'audio codec preference "'.concat(s,'" not found')),t;if(o&&!l){if(!a.channels[o])return Ff(i,"no renditions with ".concat(o," channel sound found (channels options: ").concat(Object.keys(a.channels),")")),t}else if((!s||l)&&c&&0===a.channels[2])return Ff(i,"no renditions with stereo sound found"),t;return a.minHeight>_?(Ff(i,"min resolution of ".concat(a.minHeight," > maximum of ").concat(_)),t):a.minFramerate>k?(Ff(i,"min framerate of ".concat(a.minFramerate," > maximum of ").concat(k)),t):m.some((function(e){return a.videoRanges[e]>0}))?a.maxScore=lp(t)||a.fragmentError>e[t].fragmentError)?t:(f=a.maxScore,i):(Ff(i,"no variants with VIDEO-RANGE of ".concat(JSON.stringify(m)," found")),t)}),void 0);return{codecSet:w,videoRanges:m,preferHDR:y,minFramerate:h,minBitrate:p}}(x,w,e,E,T),D=R.codecSet,L=R.videoRanges,P=R.minFramerate,B=R.minBitrate,I=R.preferHDR;A=D,w=I?L[L.length-1]:L[0],S=P,e=Math.max(e,B),Dd.log("[abr] picked start tier ".concat(JSON.stringify(R)))}else A=null==b?void 0:b.codecSet,w=null==b?void 0:b.videoRange;for(var M,U,F=p?p.duration:h?h.duration:0,O=this.bwEstimator.getEstimateTTFB()/1e3,N=[],j=function(){var t=m[z],s=z>d;if(!t)return 0;if(v.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){var h=navigator.mediaCapabilities;"function"==typeof(null==h?void 0:h.decodingInfo)&&If(t,C,w,S,e,E)?(t.supportedPromise=Mf(t,C,h),t.supportedPromise.then((function(e){if(l.hls){t.supportedResult=e;var r=l.hls.levels,i=r.indexOf(t);e.error?Dd.warn('[abr] MediaCapabilities decodingInfo error: "'.concat(e.error,'" for level ').concat(i," ").concat(JSON.stringify(e))):e.supported||(Dd.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level ".concat(i," ").concat(JSON.stringify(e))),i>-1&&r.length>1&&(Dd.log("[abr] Removing unsupported level ".concat(i)),l.hls.removeLevel(i)))}}))):t.supportedResult=Pf}if(A&&t.codecSet!==A||w&&t.videoRange!==w||s&&S>t.frameRate||!s&&S>0&&S=2*F&&0===a?m[z].averageBitrate:m[z].maxBitrate,R=l.getTimeToLoadFrag(O,f,x*T,void 0===g);if(f>=x&&(z===u||0===t.loadError&&0===t.fragmentError)&&(R<=O||!bd(R)||_&&!l.bitrateTestDelay||R").concat(z," adjustedbw(").concat(Math.round(f),")-bitrate=").concat(Math.round(f-x)," ttfb:").concat(O.toFixed(1)," avgDuration:").concat(T.toFixed(1)," maxFetchDuration:").concat(c.toFixed(1)," fetchDuration:").concat(R.toFixed(1)," firstSelection:").concat(k," codecSet:").concat(A," videoRange:").concat(w," hls.loadLevel:").concat(y))),k&&(l.firstSelection=z),z)}}},z=r;z>=t;z--)if(U=j(),0!==U&&U)return U.v;return-1}}])}(),bufferController:function(){function e(t){var r=this;S(this,e),this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=function(e){r.hls&&r.hls.pauseBuffering()},this._onStartStreaming=function(e){r.hls&&r.hls.resumeBuffering()},this._onMediaSourceOpen=function(){var e=r.media,t=r.mediaSource;r.log("Media source opened"),e&&(e.removeEventListener("emptied",r._onMediaEmptied),r.updateMediaElementDuration(),r.hls.trigger(wd.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){r.log("Media source closed")},this._onMediaSourceEnded=function(){r.log("Media source ended")},this._onMediaEmptied=function(){var e=r.mediaSrc,t=r._objectUrl;e!==t&&Dd.error("Media element src was set while attaching MediaSource (".concat(t," > ").concat(e,")"))},this.hls=t;var i="[buffer-controller]";this.appendSource=t.config.preferManagedMediaSource&&"undefined"!=typeof self&&self.ManagedMediaSource,this.log=Dd.log.bind(Dd,i),this.warn=Dd.warn.bind(Dd,i),this.error=Dd.error.bind(Dd,i),this._initSourceBuffer(),this.registerListeners()}return w(e,[{key:"hasSourceTypes",value:function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}},{key:"destroy",value:function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}},{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wd.BUFFER_RESET,this.onBufferReset,this),e.on(wd.BUFFER_APPENDING,this.onBufferAppending,this),e.on(wd.BUFFER_CODECS,this.onBufferCodecs,this),e.on(wd.BUFFER_EOS,this.onBufferEos,this),e.on(wd.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(wd.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(wd.FRAG_PARSED,this.onFragParsed,this),e.on(wd.FRAG_CHANGED,this.onFragChanged,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(wd.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wd.BUFFER_RESET,this.onBufferReset,this),e.off(wd.BUFFER_APPENDING,this.onBufferAppending,this),e.off(wd.BUFFER_CODECS,this.onBufferCodecs,this),e.off(wd.BUFFER_EOS,this.onBufferEos,this),e.off(wd.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(wd.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(wd.FRAG_PARSED,this.onFragParsed,this),e.off(wd.FRAG_CHANGED,this.onFragChanged,this)}},{key:"_initSourceBuffer",value:function(){this.sourceBuffer={},this.operationQueue=new Fg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}},{key:"onManifestLoading",value:function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}},{key:"onManifestParsed",value:function(e,t){var r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log("".concat(this.bufferCodecEventsExpected," bufferCodec event(s) expected"))}},{key:"onMediaAttaching",value:function(e,t){var r=this.media=t.media,i=rp(this.appendSource);if(r&&i){var a,n=this.mediaSource=new i;this.log("created media source: ".concat(null==(a=n.constructor)?void 0:a.name)),n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(n.addEventListener("startstreaming",this._onStartStreaming),n.addEventListener("endstreaming",this._onEndStreaming));var o=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{r.removeAttribute("src");var s=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||s&&n instanceof s,Ng(r),function(e,t){var r=self.document.createElement("source");r.type="video/mp4",r.src=t,e.appendChild(r)}(r,o),r.load()}catch(e){r.src=o}else r.src=o;r.addEventListener("emptied",this._onMediaEmptied)}}},{key:"onMediaDetaching",value:function(){var e=this.media,t=this.mediaSource,r=this._objectUrl;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn("onMediaDetaching: ".concat(e.message," while calling endOfStream"))}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(e.removeAttribute("src"),this.appendSource&&Ng(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(wd.MEDIA_DETACHED,void 0)}},{key:"onBufferReset",value:function(){var e=this;this.getSourceBufferTypes().forEach((function(t){e.resetBuffer(t)})),this._initSourceBuffer()}},{key:"resetBuffer",value:function(e){var t=this.sourceBuffer[e];try{var r;t&&(this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t))}catch(t){this.warn("onBufferReset ".concat(e),t)}}},{key:"onBufferCodecs",value:function(e,t){var r=this,i=this.getSourceBufferTypes().length,a=Object.keys(t);if(a.forEach((function(e){if(i){var a=r.tracks[e];if(a&&"function"==typeof a.buffer.changeType){var n,o=t[e],s=o.id,l=o.codec,c=o.levelCodec,u=o.container,d=o.metadata,h=hp(a.codec,a.levelCodec),p=null==h?void 0:h.replace(Og,"$1"),f=hp(l,c),m=null==(n=f)?void 0:n.replace(Og,"$1");if(f&&p!==m){"audio"===e.slice(0,5)&&(f=dp(f,r.appendSource));var g="".concat(u,";codecs=").concat(f);r.appendChangeType(e,g),r.log("switching codec ".concat(h," to ").concat(f)),r.tracks[e]={buffer:a.buffer,codec:l,container:u,levelCodec:c,metadata:d,id:s}}}}else r.pendingTracks[e]=t[e]})),!i){var n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log("".concat(n," bufferCodec event(s) expected ").concat(a.join(","))),this.bufferCodecEventsExpected=n),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}}},{key:"appendChangeType",value:function(e,t){var r=this,i=this.operationQueue,a={execute:function(){var a=r.sourceBuffer[e];a&&(r.log("changing ".concat(e," sourceBuffer type to ").concat(t)),a.changeType(t)),i.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){r.warn("Failed to change ".concat(e," SourceBuffer type"),t)}};i.append(a,e,!!this.pendingTracks[e])}},{key:"onBufferAppending",value:function(e,t){var r=this,i=this.hls,a=this.operationQueue,n=this.tracks,o=t.data,s=t.type,l=t.frag,c=t.part,u=t.chunkMeta,d=u.buffering[s],h=self.performance.now();d.start=h;var p=l.stats.buffering,f=c?c.stats.buffering:null;0===p.start&&(p.start=h),f&&0===f.start&&(f.start=h);var m=n.audio,g=!1;"audio"===s&&"audio/mpeg"===(null==m?void 0:m.container)&&(g=!this.lastMpegAudioChunk||1===u.id||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);var y=l.start,v={execute:function(){if(d.executeStart=self.performance.now(),g){var e=r.sourceBuffer[s];if(e){var t=y-e.timestampOffset;Math.abs(t)>=.1&&(r.log("Updating audio SourceBuffer timestampOffset to ".concat(y," (delta: ").concat(t,") sn: ").concat(l.sn,")")),e.timestampOffset=y)}}r.appendExecutor(o,s)},onStart:function(){},onComplete:function(){var e=self.performance.now();d.executeEnd=d.end=e,0===p.first&&(p.first=e),f&&0===f.first&&(f.first=e);var t=r.sourceBuffer,i={};for(var a in t)i[a]=Xf.getBuffered(t[a]);r.appendErrors[s]=0,"audio"===s||"video"===s?r.appendErrors.audiovideo=0:(r.appendErrors.audio=0,r.appendErrors.video=0),r.hls.trigger(wd.BUFFER_APPENDED,{type:s,frag:l,part:c,chunkMeta:u,parent:l.type,timeRanges:i})},onError:function(e){var t={type:Sd.MEDIA_ERROR,parent:l.type,details:Ed.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:l,part:c,chunkMeta:u,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=Ed.BUFFER_FULL_ERROR;else{var a=++r.appendErrors[s];t.details=Ed.BUFFER_APPEND_ERROR,r.warn("Failed ".concat(a,"/").concat(i.config.appendErrorMaxRetry,' times to append segment in "').concat(s,'" sourceBuffer')),a>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(wd.ERROR,t)}};a.append(v,s,!!this.pendingTracks[s])}},{key:"onBufferFlushing",value:function(e,t){var r=this,i=this.operationQueue,a=function(e){return{execute:r.removeExecutor.bind(r,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(wd.BUFFER_FLUSHED,{type:e})},onError:function(t){r.warn("Failed to remove from ".concat(e," SourceBuffer"),t)}}};t.type?i.append(a(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){i.append(a(e),e)}))}},{key:"onFragParsed",value:function(e,t){var r=this,i=t.frag,a=t.part,n=[],o=a?a.elementaryStreams:i.elementaryStreams;o[Nd]?n.push("audiovideo"):(o[Fd]&&n.push("audio"),o[Od]&&n.push("video")),0===n.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: ".concat(i.type," level: ").concat(i.level," sn: ").concat(i.sn)),this.blockBuffers((function(){var e=self.performance.now();i.stats.buffering.end=e,a&&(a.stats.buffering.end=e);var t=a?a.stats:i.stats;r.hls.trigger(wd.FRAG_BUFFERED,{frag:i,part:a,stats:t,id:i.type})}),n)}},{key:"onFragChanged",value:function(e,t){this.trimBuffers()}},{key:"onBufferEos",value:function(e,t){var r=this;this.getSourceBufferTypes().reduce((function(e,i){var a=r.sourceBuffer[i];return!a||t.type&&t.type!==i||(a.ending=!0,a.ended||(a.ended=!0,r.log("".concat(i," sourceBuffer now EOS")))),e&&!(a&&!a.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((function(){r.getSourceBufferTypes().forEach((function(e){var t=r.sourceBuffer[e];t&&(t.ending=!1)}));var e=r.mediaSource;e&&"open"===e.readyState?(r.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&r.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(e.readyState))})))}},{key:"onLevelUpdated",value:function(e,t){var r=t.details;r.fragments.length&&(this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}},{key:"trimBuffers",value:function(){var e=this.hls,t=this.details,r=this.media;if(r&&null!==t&&this.getSourceBufferTypes().length){var i=e.config,a=r.currentTime,n=t.levelTargetDuration,o=t.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(bd(o)&&o>0){var s=Math.max(o,n),l=Math.floor(a/n)*n-s;this.flushBackBuffer(a,n,l)}if(bd(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){var c=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),u=Math.max(c,n),d=Math.floor(a/n)*n+u;this.flushFrontBuffer(a,n,d)}}}},{key:"flushBackBuffer",value:function(e,t,r){var i=this,a=this.details,n=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(o){var s=n[o];if(s){var l=Xf.getBuffered(s);if(l.length>0&&r>l.start(0)){if(i.hls.trigger(wd.BACK_BUFFER_REACHED,{bufferEnd:r}),null!=a&&a.live)i.hls.trigger(wd.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(s.ended&&l.end(l.length-1)-e<2*t)return void i.log("Cannot flush ".concat(o," back buffer while SourceBuffer is in ended state"));i.hls.trigger(wd.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:o})}}}))}},{key:"flushFrontBuffer",value:function(e,t,r){var i=this,a=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(n){var o=a[n];if(o){var s=Xf.getBuffered(o),l=s.length;if(l<2)return;var c=s.start(l-1),u=s.end(l-1);if(r>c||e>=c&&e<=u)return;if(o.ended&&e-u<2*t)return void i.log("Cannot flush ".concat(n," front buffer while SourceBuffer is in ended state"));i.hls.trigger(wd.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}}))}},{key:"updateMediaElementDuration",value:function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,r=this.media,i=this.mediaSource,a=e.fragments[0].start+e.totalduration,n=r.duration,o=bd(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(a>o&&a>n||!bd(n))&&(this.log("Updating Media Source duration to ".concat(a.toFixed(3))),i.duration=a)}}},{key:"updateSeekableRange",value:function(e){var t=this.mediaSource,r=e.fragments;if(r.length&&e.live&&null!=t&&t.setLiveSeekableRange){var i=Math.max(0,r[0].start),a=Math.max(i,i+e.totalduration);this.log("Media Source duration is set to ".concat(t.duration,". Setting seekable range to ").concat(i,"-").concat(a,".")),t.setLiveSeekableRange(i,a)}}},{key:"checkPendingTracks",value:function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,r=this.pendingTracks,i=Object.keys(r).length;if(i&&(!e||2===i||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};var a=this.getSourceBufferTypes();if(a.length)this.hls.trigger(wd.BUFFER_CREATED,{tracks:this.tracks}),a.forEach((function(e){t.executeNext(e)}));else{var n=new Error("could not create source buffer for media codec(s)");this.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:n,reason:n.message})}}}},{key:"createSourceBuffers",value:function(e){var t=this,r=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var a=function(a){if(!r[a]){var n=e[a];if(!n)throw Error("source buffer exists for track ".concat(a,", however track does not"));var o=n.levelCodec||n.codec;o&&"audio"===a.slice(0,5)&&(o=dp(o,t.appendSource));var s="".concat(n.container,";codecs=").concat(o);t.log("creating sourceBuffer(".concat(s,")"));try{var l=r[a]=i.addSourceBuffer(s),c=a;t.addBufferListener(c,"updatestart",t._onSBUpdateStart),t.addBufferListener(c,"updateend",t._onSBUpdateEnd),t.addBufferListener(c,"error",t._onSBUpdateError),t.appendSource&&t.addBufferListener(c,"bufferedchange",(function(e,r){var i=r.removedRanges;null!=i&&i.length&&t.hls.trigger(wd.BUFFER_FLUSHED,{type:a})})),t.tracks[a]={buffer:l,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(e){t.error("error while trying to add sourceBuffer: ".concat(e.message)),t.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:a,mimeType:s})}}};for(var n in e)a(n)}},{key:"mediaSrc",get:function(){var e,t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}},{key:"_onSBUpdateStart",value:function(e){var t=this.operationQueue;t.current(e).onStart()}},{key:"_onSBUpdateEnd",value:function(e){var t;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var r=this.operationQueue;r.current(e).onComplete(),r.shiftAndExecuteNext(e)}else this.resetBuffer(e)}},{key:"_onSBUpdateError",value:function(e,t){var r,i=new Error("".concat(e," SourceBuffer error. MediaSource readyState: ").concat(null==(r=this.mediaSource)?void 0:r.readyState));this.error("".concat(i),t),this.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});var a=this.operationQueue.current(e);a&&a.onError(i)}},{key:"removeExecutor",value:function(e,t,r){var i=this.media,a=this.mediaSource,n=this.operationQueue,o=this.sourceBuffer,s=o[e];if(!i||!a||!s)return this.warn("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist")),void n.shiftAndExecuteNext(e);var l=bd(i.duration)?i.duration:1/0,c=bd(a.duration)?a.duration:1/0,u=Math.max(0,t),d=Math.min(r,l,c);d>u&&(!s.ending||s.ended)?(s.ended=!1,this.log("Removing [".concat(u,",").concat(d,"] from the ").concat(e," SourceBuffer")),s.remove(u,d)):n.shiftAndExecuteNext(e)}},{key:"appendExecutor",value:function(e,t){var r=this.sourceBuffer[t];if(r)r.ended=!1,r.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error("Attempting to append to the ".concat(t," SourceBuffer, but it does not exist"))}},{key:"blockBuffers",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getSourceBufferTypes();if(!r.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var i=this.operationQueue,a=r.map((function(e){return i.appendBlocker(e)}));Promise.all(a).then((function(){e(),r.forEach((function(e){var r=t.sourceBuffer[e];null!=r&&r.updating||i.shiftAndExecuteNext(e)}))}))}},{key:"getSourceBufferTypes",value:function(){return Object.keys(this.sourceBuffer)}},{key:"addBufferListener",value:function(e,t,r){var i=this.sourceBuffer[e];if(i){var a=r.bind(this,e);this.listeners[e].push({event:t,listener:a}),i.addEventListener(t,a)}}},{key:"removeBufferListeners",value:function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))}}])}(),capLevelController:Iy,errorController:function(){function e(t){S(this,e),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=t,this.log=Dd.log.bind(Dd,"[info]:"),this.warn=Dd.warn.bind(Dd,"[warning]:"),this.error=Dd.error.bind(Dd,"[error]:"),this.registerListeners()}return w(e,[{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.ERROR,this.onError,this),e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.LEVEL_UPDATED,this.onLevelUpdated,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(wd.ERROR,this.onError,this),e.off(wd.ERROR,this.onErrorOut,this),e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.LEVEL_UPDATED,this.onLevelUpdated,this))}},{key:"destroy",value:function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}},{key:"startLoad",value:function(e){}},{key:"stopLoad",value:function(){this.playlistError=0}},{key:"getVariantLevelIndex",value:function(e){return(null==e?void 0:e.type)===Dp?e.level:this.hls.loadLevel}},{key:"onManifestLoading",value:function(){this.playlistError=0,this.penalizedRenditions={}}},{key:"onLevelUpdated",value:function(){this.playlistError=0}},{key:"onError",value:function(e,t){var r,i;if(!t.fatal){var a=this.hls,n=t.context;switch(t.details){case Ed.FRAG_LOAD_ERROR:case Ed.FRAG_LOAD_TIMEOUT:case Ed.KEY_LOAD_ERROR:case Ed.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Ed.FRAG_PARSING_ERROR:if(null!=(r=t.frag)&&r.gap)return void(t.errorAction={action:kf,flags:Tf});case Ed.FRAG_GAP:case Ed.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=wf);case Ed.LEVEL_EMPTY_ERROR:case Ed.LEVEL_PARSING_ERROR:var o,s,l=t.parent===Dp?t.level:a.loadLevel;return void(t.details===Ed.LEVEL_EMPTY_ERROR&&null!=(o=t.context)&&null!=(s=o.levelDetails)&&s.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l)));case Ed.LEVEL_LOAD_ERROR:case Ed.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case Ed.AUDIO_TRACK_LOAD_ERROR:case Ed.AUDIO_TRACK_LOAD_TIMEOUT:case Ed.SUBTITLE_LOAD_ERROR:case Ed.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var c=a.levels[a.loadLevel];if(c&&(n.type===xp&&c.hasAudioGroup(n.groupId)||n.type===Rp&&c.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.loadLevel),t.errorAction.action=wf,void(t.errorAction.flags=Cf)}return;case Ed.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var u=a.levels[a.loadLevel],d=null==u?void 0:u.attrs["HDCP-LEVEL"];return void(d?t.errorAction={action:wf,flags:xf,hdcpLevel:d}:this.keySystemError(t));case Ed.BUFFER_ADD_CODEC_ERROR:case Ed.REMUX_ALLOC_ERROR:case Ed.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(i=t.level)?i:a.loadLevel));case Ed.INTERNAL_EXCEPTION:case Ed.BUFFER_APPENDING_ERROR:case Ed.BUFFER_FULL_ERROR:case Ed.LEVEL_SWITCH_ERROR:case Ed.BUFFER_STALLED_ERROR:case Ed.BUFFER_SEEK_OVER_HOLE:case Ed.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:kf,flags:Tf})}t.type===Sd.KEY_SYSTEM_ERROR&&this.keySystemError(t)}}},{key:"keySystemError",value:function(e){var t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}},{key:"getPlaylistRetryOrSwitchAction",value:function(e,t){var r=ff(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(yf(r,i,pf(e),e.response))return{action:Ef,flags:Tf,retryConfig:r,retryCount:i};var a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=i),a}},{key:"getFragRetryOrSwitchAction",value:function(e){var t=this.hls,r=this.getVariantLevelIndex(e.frag),i=t.levels[r],a=t.config,n=a.fragLoadPolicy,o=a.keyLoadPolicy,s=ff(e.details.startsWith("key")?o:n,e),l=t.levels.reduce((function(e,t){return e+t.fragmentError}),0);if(i&&(e.details!==Ed.FRAG_GAP&&i.fragmentError++,yf(s,l,pf(e),e.response)))return{action:Ef,flags:Tf,retryConfig:s,retryCount:l};var c=this.getLevelSwitchAction(e,r);return s&&(c.retryConfig=s,c.retryCount=l),c}},{key:"getLevelSwitchAction",value:function(e,t){var r=this.hls;null==t&&(t=r.loadLevel);var i=this.hls.levels[t];if(i){var a,n,o=e.details;i.loadError++,o===Ed.BUFFER_APPEND_ERROR&&i.fragmentError++;var s=-1,l=r.levels,c=r.loadLevel,u=r.minAutoLevel,d=r.maxAutoLevel;r.autoLevelEnabled||(r.loadLevel=-1);for(var h,p,f,m=null==(a=e.frag)?void 0:a.type,g=(m===Lp&&o===Ed.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(o===Ed.BUFFER_ADD_CODEC_ERROR||o===Ed.BUFFER_APPEND_ERROR))&&l.some((function(e){var t=e.audioCodec;return i.audioCodec!==t})),y="video"===e.sourceBufferName&&(o===Ed.BUFFER_ADD_CODEC_ERROR||o===Ed.BUFFER_APPEND_ERROR)&&l.some((function(e){var t=e.codecSet,r=e.audioCodec;return i.codecSet!==t&&i.audioCodec===r})),v=null!=(n=e.context)?n:{},A=v.type,b=v.groupId,_=function(){var t=(k+c)%l.length;if(t!==c&&t>=u&&t<=d&&0===l[t].loadError){var r=l[t];if(o===Ed.FRAG_GAP&&e.frag){var a=l[t].details;if(a){var n=Af(e.frag,a.fragments,e.frag.start);if(null!=n&&n.gap)return 0}}else{if(A===xp&&r.hasAudioGroup(b)||A===Rp&&r.hasSubtitleGroup(b))return 0;if(m===Lp&&null!=(h=i.audioGroups)&&h.some((function(e){return r.hasAudioGroup(e)}))||m===Pp&&null!=(p=i.subtitleGroups)&&p.some((function(e){return r.hasSubtitleGroup(e)}))||g&&i.audioCodec===r.audioCodec||!g&&i.audioCodec!==r.audioCodec||y&&i.codecSet===r.codecSet)return 0}return s=t,1}},k=l.length;k--;)if(f=_(),0!==f&&1===f)break;if(s>-1&&r.loadLevel!==s)return e.levelRetry=!0,this.playlistError=0,{action:wf,flags:Tf,nextAutoLevel:s}}return{action:wf,flags:Cf}}},{key:"onErrorOut",value:function(e,t){var r;switch(null==(r=t.errorAction)?void 0:r.action){case kf:break;case wf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Ed.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'.concat(t.sourceBufferName,'" sourceBuffer append error. Attempting to recover from media error.')),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}},{key:"sendAlternateToPenaltyBox",value:function(e){var t=this.hls,r=e.errorAction;if(r){var i=r.flags,a=r.hdcpLevel,n=r.nextAutoLevel;switch(i){case Tf:this.switchLevel(e,n);break;case xf:a&&(t.maxHdcpLevel=Qp[Qp.indexOf(a)-1],r.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'.concat(t.maxHdcpLevel,'" or lower'))}r.resolved||this.switchLevel(e,n)}}},{key:"switchLevel",value:function(e,t){void 0!==t&&e.errorAction&&(this.warn("switching to level ".concat(t," after ").concat(e.details)),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}])}(),fpsController:function(){function e(t){S(this,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=t,this.registerListeners()}return w(e,[{key:"setStreamController",value:function(e){this.streamController=e}},{key:"registerListeners",value:function(){this.hls.on(wd.MEDIA_ATTACHING,this.onMediaAttaching,this)}},{key:"unregisterListeners",value:function(){this.hls.off(wd.MEDIA_ATTACHING,this.onMediaAttaching,this)}},{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}},{key:"onMediaAttaching",value:function(e,t){var r=this.hls.config;if(r.capLevelOnFPSDrop){var i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}},{key:"checkFPS",value:function(e,t,r){var i=performance.now();if(t){if(this.lastTime){var a=i-this.lastTime,n=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,s=1e3*n/a,l=this.hls;if(l.trigger(wd.FPS_DROP,{currentDropped:n,currentDecoded:o,totalDroppedFrames:r}),s>0&&n>l.config.fpsDroppedMonitoringThreshold*o){var c=l.currentLevel;Dd.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=c)&&(c-=1,l.trigger(wd.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}},{key:"checkFPSInterval",value:function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}])}(),stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ah,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!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:kv,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:function(e){function t(e,r,i){var a;return S(this,t),a=_(this,t,[e,r,i,"[subtitle-stream-controller]",Pp]),a.currentTrackId=-1,a.tracksBuffered=[],a.mainDetails=null,a._registerListeners(),a}return k(t,e),w(t,[{key:"onHandlerDestroying",value:function(){this._unregisterListeners(),b(t,"onHandlerDestroying",this,3)([]),this.mainDetails=null}},{key:"_registerListeners",value:function(){var e=this.hls;e.on(wd.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.LEVEL_LOADED,this.onLevelLoaded,this),e.on(wd.ERROR,this.onError,this),e.on(wd.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(wd.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(wd.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(wd.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(wd.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(wd.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(wd.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.LEVEL_LOADED,this.onLevelLoaded,this),e.off(wd.ERROR,this.onError,this),e.off(wd.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(wd.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(wd.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(wd.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(wd.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(wd.FRAG_BUFFERED,this.onFragBuffered,this)}},{key:"startLoad",value:function(e){this.stopLoad(),this.state=mm,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"onManifestLoading",value:function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}},{key:"onMediaDetaching",value:function(){this.tracksBuffered=[],b(t,"onMediaDetaching",this,3)([])}},{key:"onLevelLoaded",value:function(e,t){this.mainDetails=t.details}},{key:"onSubtitleFragProcessed",value:function(e,t){var r=t.frag,i=t.success;if(this.fragPrevious=r,this.state=mm,i){var a=this.tracksBuffered[this.currentTrackId];if(a){for(var n,o=r.start,s=0;s=a[s].start&&o<=a[s].end){n=a[s];break}var l=r.start+r.duration;n?n.end=l:(n={start:o,end:l},a.push(n)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}}}},{key:"onBufferFlushing",value:function(e,t){var r=t.startOffset,i=t.endOffset;if(0===r&&i!==Number.POSITIVE_INFINITY){var a=i-1;if(a<=0)return;t.endOffsetSubtitles=Math.max(0,a),this.tracksBuffered.forEach((function(e){for(var t=0;t=a.length||o!==i)&&s){this.log("Subtitle track ".concat(o," loaded [").concat(n.startSN,",").concat(n.endSN,"]").concat(n.lastPartSn?"[part-".concat(n.lastPartSn,"-").concat(n.lastPartIndex,"]"):"",",duration:").concat(n.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges;var l=0;if(n.live||null!=(r=s.details)&&r.live){var c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;var u,d=c.fragments[0];s.details?(l=this.alignPlaylists(n,s.details,null==(u=this.levelLastLoaded)?void 0:u.details),0===l&&d&&(l=d.start,cf(n,l))):n.hasProgramDateTime&&c.hasProgramDateTime?(im(n,c),l=n.fragments[0].start):d&&(l=d.start,cf(n,l))}s.details=n,this.levelLastLoaded=s,this.startFragRequested||!this.mainDetails&&n.live||this.setStartPosition(this.mainDetails||n,l),this.tick(),n.live&&!this.fragCurrent&&this.media&&this.state===mm&&(Af(null,n.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),s.details=void 0))}}else this.warn("Subtitle tracks were reset while loading level ".concat(o))}},{key:"_handleFragmentLoadComplete",value:function(e){var t=this,r=e.frag,i=e.payload,a=r.decryptdata,n=this.hls;if(!this.fragContextChanged(r)&&i&&i.byteLength>0&&null!=a&&a.key&&a.iv&&"AES-128"===a.method){var o=performance.now();this.decrypter.decrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).catch((function(e){throw n.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:r}),e})).then((function(e){var t=performance.now();n.trigger(wd.FRAG_DECRYPTED,{frag:r,payload:e,stats:{tstart:o,tdecrypt:t}})})).catch((function(e){t.warn("".concat(e.name,": ").concat(e.message)),t.state=mm}))}}},{key:"doTick",value:function(){if(this.media){if(this.state===mm){var e=this.currentTrackId,t=this.levels,r=null==t?void 0:t[e];if(!r||!t.length||!r.details)return;var i=this.config,a=this.getLoadPosition(),n=Xf.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],a,i.maxBufferHole),o=n.end,s=n.len,l=this.getFwdBufferInfo(this.media,Dp),c=r.details;if(s>this.getMaxBufferLength(null==l?void 0:l.len)+c.levelTargetDuration)return;var u=c.fragments,d=u.length,h=c.edge,p=null,f=this.fragPrevious;if(oh-m?0:m;p=Af(f,u,Math.max(u[0].start,o),g),!p&&f&&f.start-1&&this.toggleTrackModes()}},{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wd.LEVEL_LOADING,this.onLevelLoading,this),e.on(wd.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(wd.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(wd.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(wd.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wd.LEVEL_LOADING,this.onLevelLoading,this),e.off(wd.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(wd.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(wd.ERROR,this.onError,this)}},{key:"onMediaAttached",value:function(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}},{key:"pollTrackChange",value:function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}},{key:"onMediaDetaching",value:function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),jp(this.media.textTracks).forEach((function(e){Op(e)})),this.subtitleTrack=-1,this.media=null)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}},{key:"onManifestParsed",value:function(e,t){this.tracks=t.subtitleTracks}},{key:"onSubtitleTrackLoaded",value:function(e,t){var r=t.id,i=t.groupId,a=t.details,n=this.tracksInGroup[r];if(n&&n.groupId===i){var o=n.details;n.details=t.details,this.log("Subtitle track ".concat(r,' "').concat(n.name,'" lang:').concat(n.lang," group:").concat(i," loaded [").concat(a.startSN,"-").concat(a.endSN,"]")),r===this.trackId&&this.playlistLoaded(r,t,o)}else this.warn("Subtitle track with id:".concat(r," and group:").concat(i," not found in active group ").concat(null==n?void 0:n.groupId))}},{key:"onLevelLoading",value:function(e,t){this.switchLevel(t.level)}},{key:"onLevelSwitching",value:function(e,t){this.switchLevel(t.level)}},{key:"switchLevel",value:function(e){var t=this.hls.levels[e];if(t){var r=t.subtitleGroups||null,i=this.groupIds,a=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some((function(e){return-1===(null==i?void 0:i.indexOf(e))}))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;var n=this.tracks.filter((function(e){return!r||-1!==r.indexOf(e.groupId)}));if(n.length)this.selectDefaultTrack&&!n.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),n.forEach((function(e,t){e.id=t}));else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=n;var o=this.hls.config.subtitlePreference;if(!a&&o){this.selectDefaultTrack=!1;var s=Of(o,n);if(s>-1)a=n[s];else{var l=Of(o,this.tracks);a=this.tracks[l]}}var c=this.findTrackId(a);-1===c&&a&&(c=this.findTrackId(null));var u={subtitleTracks:n};this.log("Updating subtitle tracks, ".concat(n.length,' track(s) found in "').concat(null==r?void 0:r.join(","),'" group-id')),this.hls.trigger(wd.SUBTITLE_TRACKS_UPDATED,u),-1!==c&&-1===this.trackId&&this.setSubtitleTrack(c)}else this.shouldReloadPlaylist(a)&&this.setSubtitleTrack(this.trackId)}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,r=this.selectDefaultTrack,i=0;i-1){var a=this.tracksInGroup[i];return this.setSubtitleTrack(i),a}if(r)return null;var n=Of(e,t);if(n>-1)return t[n]}}return null}},{key:"loadPlaylist",value:function(e){b(t,"loadPlaylist",this,3)([]);var r=this.currentTrack;if(this.shouldLoadPlaylist(r)&&r){var i=r.id,a=r.groupId,n=r.url;if(e)try{n=e.addDirectives(n)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(e))}this.log("Loading subtitle playlist for id ".concat(i)),this.hls.trigger(wd.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:a,deliveryDirectives:e||null})}}},{key:"toggleTrackModes",value:function(){var e=this.media;if(e){var t,r=jp(e.textTracks),i=this.currentTrack;if(i&&(t=r.filter((function(e){return Mg(i,e)}))[0],t||this.warn('Unable to find subtitle TextTrack with name "'.concat(i.name,'" and language "').concat(i.lang,'"'))),[].slice.call(r).forEach((function(e){"disabled"!==e.mode&&e!==t&&(e.mode="disabled")})),t){var a=this.subtitleDisplay?"showing":"hidden";t.mode!==a&&(t.mode=a)}}}},{key:"setSubtitleTrack",value:function(e){var t=this.tracksInGroup;if(this.media)if(e<-1||e>=t.length||!bd(e))this.warn("Invalid subtitle track id: ".concat(e));else{this.clearTimer(),this.selectDefaultTrack=!1;var r=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),i){var a=!!i.details&&!i.details.live;if(e!==this.trackId||i!==r||!a){this.log("Switching to subtitle-track ".concat(e)+(i?' "'.concat(i.name,'" lang:').concat(i.lang," group:").concat(i.groupId):""));var n=i.id,o=i.groupId,s=void 0===o?"":o,l=i.name,c=i.type,u=i.url;this.hls.trigger(wd.SUBTITLE_TRACK_SWITCH,{id:n,groupId:s,name:l,type:c,url:u});var d=this.switchParams(i.url,null==r?void 0:r.details);this.loadPlaylist(d)}}else this.hls.trigger(wd.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e}}])}(Rf),timelineController:function(){function e(t){S(this,e),this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},t.on(wd.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(wd.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),t.on(wd.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(wd.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(wd.FRAG_LOADING,this.onFragLoading,this),t.on(wd.FRAG_LOADED,this.onFragLoaded,this),t.on(wd.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(wd.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(wd.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(wd.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(wd.BUFFER_FLUSHING,this.onBufferFlushing,this)}return w(e,[{key:"destroy",value:function(){var e=this.hls;e.off(wd.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(wd.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(wd.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(wd.FRAG_LOADING,this.onFragLoading,this),e.off(wd.FRAG_LOADED,this.onFragLoaded,this),e.off(wd.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(wd.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(wd.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(wd.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(wd.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}},{key:"initCea608Parsers",value:function(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){var e=new ny(this,"textTrack1"),t=new ny(this,"textTrack2"),r=new ny(this,"textTrack3"),i=new ny(this,"textTrack4");this.cea608Parser1=new ry(1,e,t),this.cea608Parser2=new ry(3,r,i)}}},{key:"addCues",value:function(e,t,r,i,a){for(var n,o,s,l,c=!1,u=a.length;u--;){var d=a[u],h=(n=d[0],o=d[1],s=t,l=r,Math.min(o,l)-Math.max(n,s));if(h>=0&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],r),c=!0,h/(r-t)>.5))return}if(c||a.push([t,r]),this.config.renderTextTracksNatively){var p=this.captionsTracks[e];this.Cues.newCue(p,t,r,i)}else{var f=this.Cues.newCue(null,t,r,i);this.hls.trigger(wd.CUES_PARSED,{type:"captions",cues:f,track:e})}}},{key:"onInitPtsFound",value:function(e,t){var r=this,i=t.frag,a=t.id,n=t.initPTS,o=t.timescale,s=this.unparsedVttFrags;"main"===a&&(this.initPTS[i.cc]={baseTime:n,timescale:o}),s.length&&(this.unparsedVttFrags=[],s.forEach((function(e){r.onFragLoaded(wd.FRAG_LOADED,e)})))}},{key:"getExistingTrack",value:function(e,t){var r=this.media;if(r)for(var i=0;ii.cc||l.trigger(wd.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}else o.push(e)}},{key:"_fallbackToIMSC1",value:function(e,t){var r=this,i=this.tracks[e.level];i.textCodec||Ey(t,this.initPTS[e.cc],(function(){i.textCodec=_y,r._parseIMSC1(e,t)}),(function(){i.textCodec="wvtt"}))}},{key:"_appendCues",value:function(e,t){var r=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((function(e){return Fp(i,e)}))}else{var a=this.tracks[t];if(!a)return;var n=a.default?"default":"subtitles"+t;r.trigger(wd.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}},{key:"onFragDecrypted",value:function(e,t){var r=t.frag;r.type===Pp&&this.onFragLoaded(wd.FRAG_LOADED,t)}},{key:"onSubtitleTracksCleared",value:function(){this.tracks=[],this.captionsTracks={}}},{key:"onFragParsingUserdata",value:function(e,t){this.initCea608Parsers();var r=this.cea608Parser1,i=this.cea608Parser2;if(this.enabled&&r&&i){var a=t.frag,n=t.samples;if(a.type!==Dp||"NONE"!==this.closedCaptionsForLevel(a))for(var o=0;o0&&-1===e?(this.log("Override startPosition with lastCurrentTime @".concat(t.toFixed(3))),e=t,this.state=mm):(this.loadedmetadata=!1,this.state=Am),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}},{key:"doTick",value:function(){switch(this.state){case mm:this.doTickIdle();break;case Am:var e,r=this.levels,i=this.trackId,a=null==r||null==(e=r[i])?void 0:e.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=Sm}break;case vm:var n,o=performance.now(),s=this.retryDate;if(!s||o>=s||null!=(n=this.media)&&n.seeking){var l=this.levels,c=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==l?void 0:l[c])||null),this.state=mm}break;case Sm:var u=this.waitingData;if(u){var d=u.frag,h=u.part,p=u.cache,f=u.complete;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=ym;var m={frag:d,part:h,payload:p.flush(),networkDetails:null};this._handleFragmentLoadProgress(m),f&&b(t,"_handleFragmentLoadComplete",this,3)([m])}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc (".concat(d.cc,") cancelled because video is at cc ").concat(this.videoTrackCC)),this.clearWaitingFragment();else{var g=this.getLoadPosition(),y=Xf.bufferInfo(this.mediaBuffer,g,this.config.maxBufferHole);bf(y.end,this.config.maxFragLookUpTolerance,d)<0&&(this.log("Waiting fragment cc (".concat(d.cc,") @ ").concat(d.start," cancelled because another fragment at ").concat(y.end," is needed")),this.clearWaitingFragment())}}else this.state=mm}this.onTickEnd()}},{key:"clearWaitingFragment",value:function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=mm)}},{key:"resetLoadingState",value:function(){this.clearWaitingFragment(),b(t,"resetLoadingState",this,3)([])}},{key:"onTickEnd",value:function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}},{key:"doTickIdle",value:function(){var e=this.hls,t=this.levels,r=this.media,i=this.trackId,a=e.config;if((r||!this.startFragRequested&&a.startFragPrefetch)&&null!=t&&t[i]){var n=t[i],o=n.details;if(!o||o.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(o))this.state=Am;else{var s=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&s&&(this.bufferFlushed=!1,this.afterBufferFlushed(s,Fd,Lp));var l=this.getFwdBufferInfo(s,Lp);if(null!==l){var c=this.bufferedTrack,u=this.switchingTrack;if(!u&&this._streamEnded(l,o))return e.trigger(wd.BUFFER_EOS,{type:"audio"}),void(this.state=km);var d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Dp),h=l.len,p=this.getMaxBufferLength(null==d?void 0:d.len),f=o.fragments,m=f[0].start,g=this.flushing?this.getLoadPosition():l.end;if(u&&r){var y=this.getLoadPosition();c&&!Ig(u.attrs,c.attrs)&&(g=y),o.PTSKnown&&ym||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=m+.05)}if(!(h>=p&&!u&&gd.end+o.targetduration;if(b||(null==d||!d.len)&&l.len){var _=this.getAppendedFrag(v.start,Dp);if(null===_)return;if(A||(A=!!_.gap||!!b&&0===d.len),b&&!A||A&&l.nextStart&&l.nextStart<_.end)return}this.loadFragment(v,n,g)}else this.bufferFlushed=!0}}}}}},{key:"getMaxBufferLength",value:function(e){var r=b(t,"getMaxBufferLength",this,3)([]);return e?Math.min(Math.max(r,e),this.config.maxMaxBufferLength):r}},{key:"onMediaDetaching",value:function(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,b(t,"onMediaDetaching",this,3)([])}},{key:"onAudioTracksUpdated",value:function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(e){return new rf(e)}))}},{key:"onAudioTrackSwitching",value:function(e,t){var r=!!t.url;this.trackId=t.id;var i=this.fragCurrent;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=t,this.state=mm,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=fm),this.tick()}},{key:"onManifestLoading",value:function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}},{key:"onLevelLoaded",value:function(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(wd.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}},{key:"onAudioTrackLoaded",value:function(e,t){var r;if(null!=this.mainDetails){var i=this.levels,a=t.details,n=t.id;if(i){this.log("Audio track ".concat(n," loaded [").concat(a.startSN,",").concat(a.endSN,"]").concat(a.lastPartSn?"[part-".concat(a.lastPartSn,"-").concat(a.lastPartIndex,"]"):"",",duration:").concat(a.totalduration));var o=i[n],s=0;if(a.live||null!=(r=o.details)&&r.live){this.checkLiveUpdate(a);var l,c=this.mainDetails;if(a.deltaUpdateFailed||!c)return;!o.details&&a.hasProgramDateTime&&c.hasProgramDateTime?(im(a,c),s=a.fragments[0].start):s=this.alignPlaylists(a,o.details,null==(l=this.levelLastLoaded)?void 0:l.details)}o.details=a,this.levelLastLoaded=o,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(this.mainDetails||a,s),this.state!==Am||this.waitForCdnTuneIn(a)||(this.state=mm),this.tick()}else this.warn("Audio tracks were reset while loading level ".concat(n))}else this.cachedTrackLoadedData=t}},{key:"_handleFragmentLoadProgress",value:function(e){var t,r=e.frag,i=e.part,a=e.payload,n=this.config,o=this.trackId,s=this.levels;if(s){var l=s[o];if(l){var c=l.details;if(!c)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);var u=n.defaultAudioCodec||l.audioCodec||"mp4a.40.2",d=this.transmuxer;d||(d=this.transmuxer=new Pg(this.hls,Lp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var h=this.initPTS[r.cc],p=null==(t=r.initSegment)?void 0:t.data;if(void 0!==h){var f=!1,m=i?i.index:-1,g=-1!==m,y=new Zf(r.level,r.sn,r.stats.chunkCount,a.byteLength,m,g);d.push(a,p,u,"",r,i,c.totalduration,f,y,h)}else{this.log("Unknown video PTS for cc ".concat(r.cc,", waiting for video PTS before demuxing audio frag ").concat(r.sn," of [").concat(c.startSN," ,").concat(c.endSN,"],track ").concat(o));var v=this.waitingData=this.waitingData||{frag:r,part:i,cache:new Cm,complete:!1},A=v.cache;A.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=Sm}}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment ".concat(r.sn," of level ").concat(r.level," will not be buffered"))}},{key:"_handleFragmentLoadComplete",value:function(e){this.waitingData?this.waitingData.complete=!0:b(t,"_handleFragmentLoadComplete",this,3)([e])}},{key:"onBufferReset",value:function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}},{key:"onBufferCreated",value:function(e,t){var r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,i=t.part;if(r.type===Lp)if(this.fragContextChanged(r))this.warn("Fragment ".concat(r.sn).concat(i?" p: "+i.index:""," of level ").concat(r.level," finished buffering, but was aborted. state: ").concat(this.state,", audioSwitch: ").concat(this.switchingTrack?this.switchingTrack.name:"false"));else{if("initSegment"!==r.sn){this.fragPrevious=r;var a=this.switchingTrack;a&&(this.bufferedTrack=a,this.switchingTrack=null,this.hls.trigger(wd.AUDIO_TRACK_SWITCHED,gd({},a)))}this.fragBufferedComplete(r,i)}else if(!this.loadedmetadata&&r.type===Dp){var n=this.videoBuffer||this.media;n&&Xf.getBuffered(n).length&&(this.loadedmetadata=!0)}}},{key:"onError",value:function(e,r){var i;if(r.fatal)this.state=wm;else switch(r.details){case Ed.FRAG_GAP:case Ed.FRAG_PARSING_ERROR:case Ed.FRAG_DECRYPT_ERROR:case Ed.FRAG_LOAD_ERROR:case Ed.FRAG_LOAD_TIMEOUT:case Ed.KEY_LOAD_ERROR:case Ed.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Lp,r);break;case Ed.AUDIO_TRACK_LOAD_ERROR:case Ed.AUDIO_TRACK_LOAD_TIMEOUT:case Ed.LEVEL_PARSING_ERROR:r.levelRetry||this.state!==Am||(null==(i=r.context)?void 0:i.type)!==xp||(this.state=mm);break;case Ed.BUFFER_APPEND_ERROR:case Ed.BUFFER_FULL_ERROR:if(!r.parent||"audio"!==r.parent)return;if(r.details===Ed.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(r)&&(this.bufferedTrack=null,b(t,"flushMainBuffer",this,3)([0,Number.POSITIVE_INFINITY,"audio"]));break;case Ed.INTERNAL_EXCEPTION:this.recoverWorkerError(r)}}},{key:"onBufferFlushing",value:function(e,t){var r=t.type;r!==Od&&(this.flushing=!0)}},{key:"onBufferFlushed",value:function(e,t){var r=t.type;if(r!==Od){this.flushing=!1,this.bufferFlushed=!0,this.state===km&&(this.state=mm);var i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,r,Lp),this.tick())}}},{key:"_handleTransmuxComplete",value:function(e){var t,r="audio",i=this.hls,a=e.remuxResult,n=e.chunkMeta,o=this.getCurrentContext(n);if(o){var s=o.frag,l=o.part,c=o.level,u=c.details,d=a.audio,h=a.text,p=a.id3,f=a.initSegment;if(!this.fragContextChanged(s)&&u){if(this.state=bm,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){var m=s.initSegment||s;this._bufferInitSegment(c,f.tracks,m,n),i.trigger(wd.FRAG_PARSING_INIT_SEGMENT,{frag:m,id:r,tracks:f.tracks})}if(d){var g=d.startPTS,y=d.endPTS,v=d.startDTS,A=d.endDTS;l&&(l.elementaryStreams[Fd]={startPTS:g,endPTS:y,startDTS:v,endDTS:A}),s.setElementaryStreamInfo(Fd,g,y,v,A),this.bufferFragmentData(d,s,l,n)}if(null!=p&&null!=(t=p.samples)&&t.length){var b=Ad({id:r,frag:s,details:u},p);i.trigger(wd.FRAG_PARSING_METADATA,b)}if(h){var _=Ad({id:r,frag:s,details:u},h);i.trigger(wd.FRAG_PARSING_USERDATA,_)}}else this.fragmentTracker.removeFragment(s)}else this.resetWhenMissingContext(n)}},{key:"_bufferInitSegment",value:function(e,t,r,i){if(this.state===bm){t.video&&delete t.video;var a=t.audio;if(a){a.id="audio";var n=e.audioCodec;this.log("Init audio buffer, container:".concat(a.container,", codecs[level/parsed]=[").concat(n,"/").concat(a.codec,"]")),n&&1===n.split(",").length&&(a.levelCodec=n),this.hls.trigger(wd.BUFFER_CODECS,t);var o=a.initSegment;if(null!=o&&o.byteLength){var s={type:"audio",frag:r,part:null,chunkMeta:i,parent:r.type,data:o};this.hls.trigger(wd.BUFFER_APPENDING,s)}this.tickImmediate()}}}},{key:"loadFragment",value:function(e,r,i){var a,n=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||n===Hf||n===Wf)if("initSegment"===e.sn)this._loadInitSegment(e,r);else if(null!=(a=r.details)&&a.live&&!this.initPTS[e.cc]){this.log("Waiting for video PTS in continuity counter ".concat(e.cc," of live stream before loading audio fragment ").concat(e.sn," of level ").concat(this.trackId)),this.state=Sm;var o=this.mainDetails;o&&o.fragments[0].start!==r.details.fragments[0].start&&im(r.details,o)}else this.startFragRequested=!0,b(t,"loadFragment",this,3)([e,r,i]);else this.clearTrackerIfNeeded(e)}},{key:"flushAudioIfNeeded",value:function(e){var r=this.media,i=this.bufferedTrack,a=null==i?void 0:i.attrs,n=e.attrs;r&&a&&(a.CHANNELS!==n.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),b(t,"flushMainBuffer",this,3)([0,Number.POSITIVE_INFINITY,"audio"]),this.bufferedTrack=null)}},{key:"completeAudioSwitch",value:function(e){var t=this.hls;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(wd.AUDIO_TRACK_SWITCHED,gd({},e))}}])}(Tm),audioTrackController:function(e){function t(e){var r;return S(this,t),r=_(this,t,[e,"[audio-track-controller]"]),r.tracks=[],r.groupIds=null,r.tracksInGroup=[],r.trackId=-1,r.currentTrack=null,r.selectDefaultTrack=!0,r.registerListeners(),r}return k(t,e),w(t,[{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wd.LEVEL_LOADING,this.onLevelLoading,this),e.on(wd.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(wd.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(wd.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wd.LEVEL_LOADING,this.onLevelLoading,this),e.off(wd.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(wd.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(wd.ERROR,this.onError,this)}},{key:"destroy",value:function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,b(t,"destroy",this,3)([])}},{key:"onManifestLoading",value:function(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}},{key:"onManifestParsed",value:function(e,t){this.tracks=t.audioTracks||[]}},{key:"onAudioTrackLoaded",value:function(e,t){var r=t.id,i=t.groupId,a=t.details,n=this.tracksInGroup[r];if(n&&n.groupId===i){var o=n.details;n.details=t.details,this.log("Audio track ".concat(r,' "').concat(n.name,'" lang:').concat(n.lang," group:").concat(i," loaded [").concat(a.startSN,"-").concat(a.endSN,"]")),r===this.trackId&&this.playlistLoaded(r,t,o)}else this.warn("Audio track with id:".concat(r," and group:").concat(i," not found in active group ").concat(null==n?void 0:n.groupId))}},{key:"onLevelLoading",value:function(e,t){this.switchLevel(t.level)}},{key:"onLevelSwitching",value:function(e,t){this.switchLevel(t.level)}},{key:"switchLevel",value:function(e){var t=this.hls.levels[e];if(t){var r=t.audioGroups||null,i=this.groupIds,a=this.currentTrack;if(!r||(null==i?void 0:i.length)!==(null==r?void 0:r.length)||null!=r&&r.some((function(e){return-1===(null==i?void 0:i.indexOf(e))}))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;var n=this.tracks.filter((function(e){return!r||-1!==r.indexOf(e.groupId)}));if(n.length)this.selectDefaultTrack&&!n.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),n.forEach((function(e,t){e.id=t}));else if(!a&&!this.tracksInGroup.length)return;this.tracksInGroup=n;var o=this.hls.config.audioPreference;if(!a&&o){var s=Of(o,n,jf);if(s>-1)a=n[s];else{var l=Of(o,this.tracks);a=this.tracks[l]}}var c=this.findTrackId(a);-1===c&&a&&(c=this.findTrackId(null));var u={audioTracks:n};this.log("Updating audio tracks, ".concat(n.length," track(s) found in group(s): ").concat(null==r?void 0:r.join(","))),this.hls.trigger(wd.AUDIO_TRACKS_UPDATED,u);var d=this.trackId;if(-1!==c&&-1===d)this.setAudioTrack(c);else if(n.length&&-1===d){var h,p=new Error("No audio track selected for current audio group-ID(s): ".concat(null==(h=this.groupIds)?void 0:h.join(",")," track count: ").concat(n.length));this.warn(p.message),this.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:p})}}else this.shouldReloadPlaylist(a)&&this.setAudioTrack(this.trackId)}}},{key:"onError",value:function(e,t){!t.fatal&&t.context&&(t.context.type!==xp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}},{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}},{key:"setAudioOption",value:function(e){var t=this.hls;if(t.config.audioPreference=e,e){var r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){var i=this.currentTrack;if(i&&Nf(e,i,jf))return i;var a=Of(e,this.tracksInGroup,jf);if(a>-1){var n=this.tracksInGroup[a];return this.setAudioTrack(a),n}if(i){var o=t.loadLevel;-1===o&&(o=t.firstAutoLevel);var s=function(e,t,r,i,a){var n=t[i],o=t.reduce((function(e,t,r){var i=t.uri;return(e[i]||(e[i]=[])).push(r),e}),{})[n.uri];o.length>1&&(i=Math.max.apply(Math,o));var s=n.videoRange,l=n.frameRate,c=n.codecSet.substring(0,4),u=zf(t,i,(function(t){if(t.videoRange!==s||t.frameRate!==l||t.codecSet.substring(0,4)!==c)return!1;var i=t.audioGroups,n=r.filter((function(e){return!i||-1!==i.indexOf(e.groupId)}));return Of(e,n,a)>-1}));return u>-1?u:zf(t,i,(function(t){var i=t.audioGroups,n=r.filter((function(e){return!i||-1!==i.indexOf(e.groupId)}));return Of(e,n,a)>-1}))}(e,t.levels,r,o,jf);if(-1===s)return null;t.nextLoadLevel=s}if(e.channels||e.audioCodec){var l=Of(e,r);if(l>-1)return r[l]}}}return null}},{key:"setAudioTrack",value:function(e){var t=this.tracksInGroup;if(e<0||e>=t.length)this.warn("Invalid audio track id: ".concat(e));else{this.clearTimer(),this.selectDefaultTrack=!1;var r=this.currentTrack,i=t[e],a=i.details&&!i.details.live;if((e!==this.trackId||i!==r||!a)&&(this.log("Switching to audio-track ".concat(e,' "').concat(i.name,'" lang:').concat(i.lang," group:").concat(i.groupId," channels:").concat(i.channels)),this.trackId=e,this.currentTrack=i,this.hls.trigger(wd.AUDIO_TRACK_SWITCHING,gd({},i)),!a)){var n=this.switchParams(i.url,null==r?void 0:r.details);this.loadPlaylist(n)}}}},{key:"findTrackId",value:function(e){for(var t=this.tracksInGroup,r=0;r1&&void 0!==arguments[1]?arguments[1]:{};Ad(t,this.createData());var r=t.ot===Fy.INIT||t.ot===Fy.VIDEO||t.ot===Fy.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);var i=this.includeKeys;i&&(t=Object.keys(t).reduce((function(e,r){return i.includes(r)&&(e[r]=t[r]),e}),{})),this.useHeaders?(e.headers||(e.headers={}),cv(e.headers,t)):e.url=dv(e.url,t)}},{key:"getObjectType",value:function(e){var t=e.type;return"subtitle"===t?Fy.TIMED_TEXT:"initSegment"===e.sn?Fy.INIT:"audio"===t?Fy.AUDIO:"main"===t?this.hls.audioTracks.length?Fy.VIDEO:Fy.MUXED:void 0}},{key:"getTopBandwidth",value:function(e){var t,r=0,i=this.hls;if(e===Fy.AUDIO)t=i.audioTracks;else{var a=i.maxAutoLevel,n=a>-1?a+1:i.levels.length;t=i.levels.slice(0,n)}var o,s=f(t);try{for(s.s();!(o=s.n()).done;){var l=o.value;l.bitrate>r&&(r=l.bitrate)}}catch(c){s.e(c)}finally{s.f()}return r>0?r:NaN}},{key:"getBufferLength",value:function(e){var t=this.hls.media,r=e===Fy.AUDIO?this.audioBuffer:this.videoBuffer;return r&&t?1e3*Xf.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len:NaN}},{key:"createPlaylistLoader",value:function(){var e=this.config.pLoader,t=this.applyPlaylistData,r=e||this.config.loader;return function(){function e(t){S(this,e),this.loader=void 0,this.loader=new r(t)}return w(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}},{key:"destroy",value:function(){this.loader.destroy()}},{key:"abort",value:function(){this.loader.abort()}},{key:"load",value:function(e,r,i){t(e),this.loader.load(e,r,i)}}])}()}},{key:"createFragmentLoader",value:function(){var e=this.config.fLoader,t=this.applyFragmentData,r=e||this.config.loader;return function(){function e(t){S(this,e),this.loader=void 0,this.loader=new r(t)}return w(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}},{key:"destroy",value:function(){this.loader.destroy()}},{key:"abort",value:function(){this.loader.abort()}},{key:"load",value:function(e,r,i){t(e),this.loader.load(e,r,i)}}])}()}}])}(),contentSteeringController:function(){function e(t){S(this,e),this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=t,this.log=Dd.log.bind(Dd,"[content-steering]:"),this.registerListeners()}return w(e,[{key:"registerListeners",value:function(){var e=this.hls;e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.on(wd.ERROR,this.onError,this)}},{key:"unregisterListeners",value:function(){var e=this.hls;e&&(e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(wd.MANIFEST_PARSED,this.onManifestParsed,this),e.off(wd.ERROR,this.onError,this))}},{key:"startLoad",value:function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}},{key:"stopLoad",value:function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}},{key:"clearTimeout",value:function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}},{key:"destroy",value:function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}},{key:"removeLevel",value:function(e){var t=this.levels;t&&(this.levels=t.filter((function(t){return t!==e})))}},{key:"onManifestLoading",value:function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}},{key:"onManifestLoaded",value:function(e,t){var r=t.contentSteering;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}},{key:"onManifestParsed",value:function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}},{key:"onError",value:function(e,t){var r=t.errorAction;if((null==r?void 0:r.action)===wf&&r.flags===Cf){var i=this.levels,a=this.pathwayPriority,n=this.pathwayId;if(t.context){var o=t.context,s=o.groupId,l=o.pathwayId,c=o.type;s&&i?n=this.getPathwayForGroupId(s,c,n):l&&(n=l)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!a&&i&&(a=i.reduce((function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e}),[])),a&&a.length>1&&(this.updatePathwayPriority(a),r.resolved=this.pathwayId!==n),r.resolved||Dd.warn("Could not resolve ".concat(t.details,' ("').concat(t.error.message,'") with content-steering for Pathway: ').concat(n," levels: ").concat(i?i.length:i," priorities: ").concat(JSON.stringify(a)," penalized: ").concat(JSON.stringify(this.penalizedPathways)))}}},{key:"filterParsedLevels",value:function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){var r=e[0].pathwayId;this.log("No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "').concat(r,'"')),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length?(this.log("Found ".concat(t.length,"/").concat(e.length,' levels in Pathway "').concat(this.pathwayId,'"')),t):e}},{key:"getLevelsForPathway",value:function(e){return null===this.levels?[]:this.levels.filter((function(t){return e===t.pathwayId}))}},{key:"updatePathwayPriority",value:function(e){var t;this.pathwayPriority=e;var r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach((function(e){i-r[e]>3e5&&delete r[e]}));for(var a=0;a0){this.log('Setting Pathway to "'.concat(n,'"')),this.pathwayId=n,hf(t),this.hls.trigger(wd.LEVELS_UPDATED,{levels:t});var l=this.hls.levels[o];s&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==s.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==s.bitrate&&this.log("Unstable Pathways change from bitrate ".concat(s.bitrate," to ").concat(l.bitrate)),this.hls.nextLoadLevel=o);break}}}}},{key:"getPathwayForGroupId",value:function(e,t,r){for(var i=this.getLevelsForPathway(r).concat(this.levels||[]),a=0;a1&&void 0!==arguments[1]?arguments[1]:1e3*this.timeToLoad;this.clearTimeout(),this.reloadTimer=self.setTimeout((function(){var r,i=null==(r=t.hls)?void 0:r.media;!i||i.ended?t.scheduleRefresh(e,1e3*t.timeToLoad):t.loadSteeringManifest(e)}),r)}}])}()});function Sv(e){return e&&"object"==T(e)?Array.isArray(e)?e.map(Sv):Object.keys(e).reduce((function(t,r){return t[r]=Sv(e[r]),t}),{}):e}function Ev(e){var t=e.loader;t!==yv&&t!==mv?(Dd.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({}),!0}catch(e){}return!1}()&&(e.loader=yv,e.progressive=!0,e.enableSoftwareAES=!0,Dd.log("[config]: Progressive streaming enabled, using FetchLoader"))}var Tv=function(e){function t(e,r){var i;return S(this,t),i=_(this,t,[e,"[level-controller]"]),i._levels=[],i._firstLevel=-1,i._maxAutoLevel=-1,i._startLevel=void 0,i.currentLevel=null,i.currentLevelIndex=-1,i.manualLevelIndex=-1,i.steering=void 0,i.onParsedComplete=void 0,i.steering=r,i._registerListeners(),i}return k(t,e),w(t,[{key:"_registerListeners",value:function(){var e=this.hls;e.on(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.on(wd.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(wd.LEVEL_LOADED,this.onLevelLoaded,this),e.on(wd.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(wd.FRAG_BUFFERED,this.onFragBuffered,this),e.on(wd.ERROR,this.onError,this)}},{key:"_unregisterListeners",value:function(){var e=this.hls;e.off(wd.MANIFEST_LOADING,this.onManifestLoading,this),e.off(wd.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(wd.LEVEL_LOADED,this.onLevelLoaded,this),e.off(wd.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(wd.FRAG_BUFFERED,this.onFragBuffered,this),e.off(wd.ERROR,this.onError,this)}},{key:"destroy",value:function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),b(t,"destroy",this,3)([])}},{key:"stopLoad",value:function(){this._levels.forEach((function(e){e.loadError=0,e.fragmentError=0})),b(t,"stopLoad",this,3)([])}},{key:"resetLevels",value:function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}},{key:"onManifestLoading",value:function(e,t){this.resetLevels()}},{key:"onManifestLoaded",value:function(e,t){var r=this.hls.config.preferManagedMediaSource,i=[],a={},n={},o=!1,s=!1,l=!1;t.levels.forEach((function(e){var t,c,u=e.attrs,d=e.audioCodec,h=e.videoCodec;-1!==(null==(t=d)?void 0:t.indexOf("mp4a.40.34"))&&(Av||(Av=/chrome|firefox/i.test(navigator.userAgent)),Av&&(e.audioCodec=d=void 0)),d&&(e.audioCodec=d=dp(d,r)),0===(null==(c=h)?void 0:c.indexOf("avc1"))&&(h=e.videoCodec=function(e){var t=e.split(".");if(t.length>2){var r=t.shift()+".";return r+=parseInt(t.shift()).toString(16),r+=("000"+parseInt(t.shift()).toString(16)).slice(-4),r}return e}(h));var p=e.width,f=e.height,m=e.unknownCodecs;if(o||(o=!(!p||!f)),s||(s=!!h),l||(l=!!d),!(null!=m&&m.length||d&&!ap(d,"audio",r)||h&&!ap(h,"video",r))){var g=u.CODECS,y=u["FRAME-RATE"],v=u["HDCP-LEVEL"],A=u["PATHWAY-ID"],b=u.RESOLUTION,_=u["VIDEO-RANGE"],k="".concat("".concat(A||".","-"),e.bitrate,"-").concat(b,"-").concat(y,"-").concat(g,"-").concat(_,"-").concat(v);if(a[k])if(a[k].uri===e.url||e.attrs["PATHWAY-ID"])a[k].addGroupId("audio",u.AUDIO),a[k].addGroupId("text",u.SUBTITLES);else{var w=n[k]+=1;e.attrs["PATHWAY-ID"]=new Array(w+1).join(".");var S=new rf(e);a[k]=S,i.push(S)}else{var E=new rf(e);a[k]=E,n[k]=1,i.push(E)}}})),this.filterAndSortMediaOptions(i,t,o,s,l)}},{key:"filterAndSortMediaOptions",value:function(e,t,r,i,a){var n=this,o=[],s=[],l=e;if((r||i)&&a&&(l=l.filter((function(e){var t,r=e.videoCodec,i=e.videoRange,a=e.width,n=e.height;return(!!r||!(!a||!n))&&!!(t=i)&&Xp.indexOf(t)>-1}))),0!==l.length){if(t.audioTracks){var c=this.hls.config.preferManagedMediaSource;o=t.audioTracks.filter((function(e){return!e.audioCodec||ap(e.audioCodec,"audio",c)})),Cv(o)}t.subtitles&&(s=t.subtitles,Cv(s));var u=l.slice(0);l.sort((function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Xp.indexOf(e.videoRange)-Xp.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){var i=sp(e.videoCodec),a=sp(t.videoCodec);if(i!==a)return a-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var n=lp(e.codecSet),o=lp(t.codecSet);if(n!==o)return o-n}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));var d=u[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==u.length))for(var h=0;hg&&g===wv.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}var v=a&&!i,A={levels:l,audioTracks:o,subtitleTracks:s,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:a,video:i,altAudio:!v&&o.some((function(e){return!!e.url}))};this.hls.trigger(wd.MANIFEST_PARSED,A),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then((function(){if(n.hls){t.levels.length&&n.warn("One or more CODECS in variant not supported: ".concat(JSON.stringify(t.levels[0].attrs)));var e=new Error("no level with compatible codecs found in manifest");n.hls.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}))}},{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(0!==t.length){if(e<0||e>=t.length){var r=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(wd.ERROR,{type:Sd.OTHER_ERROR,details:Ed.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:r,reason:r.message}),i)return;e=Math.min(e,t.length-1)}var a=this.currentLevelIndex,n=this.currentLevel,o=n?n.attrs["PATHWAY-ID"]:void 0,s=t[e],l=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,a!==e||!s.details||!n||o!==l){this.log("Switching to level ".concat(e," (").concat(s.height?s.height+"p ":"").concat(s.videoRange?s.videoRange+" ":"").concat(s.codecSet?s.codecSet+" ":"","@").concat(s.bitrate,")").concat(l?" with Pathway "+l:""," from level ").concat(a).concat(o?" with Pathway "+o:""));var c={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(wd.LEVEL_SWITCHING,c);var u=s.details;if(!u||u.live){var d=this.switchParams(s.uri,null==n?void 0:n.details);this.loadPlaylist(d)}}}}},{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(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"onError",value:function(e,t){!t.fatal&&t.context&&t.context.type===Cp&&t.context.level===this.level&&this.checkRetry(t)}},{key:"onFragBuffered",value:function(e,t){var r=t.frag;if(void 0!==r&&r.type===Dp){var i=r.elementaryStreams;if(!Object.keys(i).some((function(e){return!!i[e]})))return;var a=this._levels[r.level];null!=a&&a.loadError&&(this.log("Resetting level error count of ".concat(a.loadError," on frag buffered")),a.loadError=0)}}},{key:"onLevelLoaded",value:function(e,t){var r,i,a=t.level,n=t.details,o=this._levels[a];if(!o)return this.warn("Invalid level index ".concat(a)),void(null!=(i=t.deliveryDirectives)&&i.skip&&(n.deltaUpdateFailed=!0));a===this.currentLevelIndex?(0===o.fragmentError&&(o.loadError=0),this.playlistLoaded(a,t,o.details)):null!=(r=t.deliveryDirectives)&&r.skip&&(n.deltaUpdateFailed=!0)}},{key:"loadPlaylist",value:function(e){b(t,"loadPlaylist",this,3)([]);var r=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){var a=i.uri;if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(e))}var n=i.attrs["PATHWAY-ID"];this.log("Loading level index ".concat(r).concat(void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""," with").concat(n?" Pathway "+n:""," ").concat(a)),this.clearTimer(),this.hls.trigger(wd.LEVEL_LOADING,{url:a,level:r,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}},{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)}},{key:"removeLevel",value:function(e){var t,r=this,i=this._levels.filter((function(t,i){return i!==e||(r.steering&&r.steering.removeLevel(t),t===r.currentLevel&&(r.currentLevel=null,r.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((function(e){return e.level=-1}))),!1)}));hf(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(wd.LEVELS_UPDATED,{levels:i})}},{key:"onLevelsUpdated",value:function(e,t){var r=t.levels;this._levels=r}},{key:"checkMaxAutoUpdated",value:function(){var e=this.hls,t=e.autoLevelCapping,r=e.maxAutoLevel,i=e.maxHdcpLevel;this._maxAutoLevel!==r&&(this._maxAutoLevel=r,this.hls.trigger(wd.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}])}(Rf);function Cv(e){var t={};e.forEach((function(e){var r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++}))}var xv=function(){function e(t){S(this,e),this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}return w(e,[{key:"abort",value:function(e){for(var t in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[t].loader;if(r){var i;if(e&&e!==(null==(i=r.context)?void 0:i.frag.type))return;r.abort()}}}},{key:"detach",value:function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}},{key:"destroy",value:function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}},{key:"createKeyLoadError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ed.KEY_LOAD_ERROR,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return new lm({type:Sd.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:a,error:r,networkDetails:i})}},{key:"loadClear",value:function(e,t){var r=this;if(this.emeController&&this.config.emeEnabled)for(var i=e.sn,a=e.cc,n=function(){var e=t[o];if(a<=e.cc&&("initSegment"===i||"initSegment"===e.sn||i2,h=!u||t&&t.start<=n||u-n>2&&!this.fragmentTracker.getPartialFragment(n);if(d||h)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var p;if(!(c.len>0)&&!u)return;var f=Math.max(u,c.start||0)-n,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,g=(null==m||null==(p=m.details)?void 0:p.live)?2*m.details.targetduration:2,y=this.fragmentTracker.getPartialFragment(n);if(f>0&&(f<=g||y))return void(i.paused||this._trySkipBufferHole(y))}var v=self.performance.now();if(null!==a){var A=v-a;if(o||!(A>=250)||(this._reportStall(c),this.media)){var b=Xf.bufferInfo(i,n,r.maxBufferHole);this._tryFixBufferStall(b,A)}}else this.stalled=v}else if(this.moved=!0,o||(this.nudgeRetry=0),null!==a){if(this.stallReported){var _=self.performance.now()-a;Dd.warn("playback not stuck anymore @".concat(n,", after ").concat(Math.round(_),"ms")),this.stallReported=!1}this.stalled=null}}}},{key:"_tryFixBufferStall",value:function(e,t){var r=this.config,i=this.fragmentTracker,a=this.media;if(null!==a){var n=a.currentTime,o=i.getPartialFragment(n);(!o||!this._trySkipBufferHole(o)&&this.media)&&(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-n1e3*r.highBufferWatchdogPeriod&&(Dd.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}}},{key:"_reportStall",value:function(e){var t=this.hls,r=this.media,i=this.stallReported;if(!i&&r){this.stallReported=!0;var a=new Error("Playback stalling at @".concat(r.currentTime," due to low buffer (").concat(JSON.stringify(e),")"));Dd.warn(a.message),t.trigger(wd.ERROR,{type:Sd.MEDIA_ERROR,details:Ed.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len})}}},{key:"_trySkipBufferHole",value:function(e){var t=this.config,r=this.hls,i=this.media;if(null===i)return 0;var a=i.currentTime,n=Xf.bufferInfo(i,a,0),o=a0&&n.len<1&&i.readyState<3,c=o-a;if(c>0&&(s||l)){if(c>t.maxBufferHole){var u=this.fragmentTracker,d=!1;if(0===a){var h=u.getAppendedFrag(0,Dp);h&&o1?(i=0,this.bitrateTest=!0):i=r.firstAutoLevel),r.nextLoadLevel=i,this.level=r.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @".concat(t.toFixed(3))),e=t),this.state=mm,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=fm}},{key:"stopLoad",value:function(){this._forceStartLoad=!1,b(t,"stopLoad",this,3)([])}},{key:"doTick",value:function(){switch(this.state){case Em:var e=this.levels,t=this.level,r=null==e?void 0:e[t],i=null==r?void 0:r.details;if(i&&(!i.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(i))break;this.state=mm;break}if(this.hls.nextLoadLevel!==this.level){this.state=mm;break}break;case vm:var a,n=self.performance.now(),o=this.retryDate;if(!o||n>=o||null!=(a=this.media)&&a.seeking){var s=this.levels,l=this.level,c=null==s?void 0:s[l];this.resetStartWhenNotLoaded(c||null),this.state=mm}}this.state===mm&&this.doTickIdle(),this.onTickEnd()}},{key:"onTickEnd",value:function(){b(t,"onTickEnd",this,3)([]),this.checkBuffer(),this.checkFragmentChanged()}},{key:"doTickIdle",value:function(){var e=this.hls,t=this.levelLastLoaded,r=this.levels,i=this.media;if(null!==t&&(i||!this.startFragRequested&&e.config.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)){var a=e.nextLoadLevel;if(null!=r&&r[a]){var n=r[a],o=this.getMainFwdBufferInfo();if(null!==o){var s=this.getLevelDetails();if(s&&this._streamEnded(o,s)){var l={};return this.altAudio&&(l.type="video"),this.hls.trigger(wd.BUFFER_EOS,l),void(this.state=km)}e.loadLevel!==a&&-1===e.manualLevel&&this.log("Adapting to level ".concat(a," from level ").concat(this.level)),this.level=e.nextLoadLevel=a;var c=n.details;if(!c||this.state===Em||c.live&&this.levelLastLoaded!==n)return this.level=a,void(this.state=Em);var u=o.len,d=this.getMaxBufferLength(n.maxBitrate);if(!(u>=d)){this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);var h=this.backtrackFragment?this.backtrackFragment.start:o.end,p=this.getNextFragment(h,c);if(this.couldBacktrack&&!this.fragPrevious&&p&&"initSegment"!==p.sn&&this.fragmentTracker.getState(p)!==Jf){var f,m=(null!=(f=this.backtrackFragment)?f:p).sn-c.startSN,g=c.fragments[m-1];g&&p.cc===g.cc&&(p=g,this.fragmentTracker.removeFragment(g))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(p&&this.isLoopLoading(p,h)){if(!p.gap){var y=this.audioOnly&&!this.altAudio?Fd:Od,v=(y===Od?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,y,Dp)}p=this.getNextFragmentLoopLoading(p,c,o,Dp,d)}p&&(!p.initSegment||p.initSegment.data||this.bitrateTest||(p=p.initSegment),this.loadFragment(p,n,h))}}}}}},{key:"loadFragment",value:function(e,r,i){var a=this.fragmentTracker.getState(e);this.fragCurrent=e,a===Hf||a===Wf?"initSegment"===e.sn?this._loadInitSegment(e,r):this.bitrateTest?(this.log("Fragment ".concat(e.sn," of level ").concat(e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,r)):(this.startFragRequested=!0,b(t,"loadFragment",this,3)([e,r,i])):this.clearTrackerIfNeeded(e)}},{key:"getBufferedFrag",value:function(e){return this.fragmentTracker.getBufferedFrag(e,Dp)}},{key:"followingBufferedFrag",value:function(e){return e?this.getBufferedFrag(e.end+.5):null}},{key:"immediateLevelSwitch",value:function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}},{key:"nextLevelSwitch",value:function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var r,i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);var a=this.getLevelDetails();if(null!=a&&a.live){var n=this.getMainFwdBufferInfo();if(!n||n.len<2*a.targetduration)return}if(!t.paused&&e){var o=e[this.hls.nextLoadLevel],s=this.fragLastKbps;r=s&&this.fragCurrent?this.fragCurrent.duration*o.maxBitrate/(1e3*s)+1:0}else r=0;var l=this.getBufferedFrag(t.currentTime+r);if(l){var c=this.followingBufferedFrag(l);if(c){this.abortCurrentFrag();var u=c.maxStartPTS?c.maxStartPTS:c.start,d=c.duration,h=Math.max(l.end,u+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}},{key:"abortCurrentFrag",value:function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case gm:case ym:case vm:case bm:case _m:this.state=mm}this.nextLoadPosition=this.getLoadPosition()}},{key:"flushMainBuffer",value:function(e,r){b(t,"flushMainBuffer",this,3)([e,r,this.altAudio?"video":null])}},{key:"onMediaAttached",value:function(e,r){b(t,"onMediaAttached",this,3)([e,r]);var i=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new Lv(this.config,i,this.fragmentTracker,this.hls)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),b(t,"onMediaDetaching",this,3)([])}},{key:"onMediaPlaying",value:function(){this.tick()}},{key:"onMediaSeeked",value:function(){var e=this.media,t=e?e.currentTime:null;bd(t)&&this.log("Media seeked to ".concat(t.toFixed(3)));var r=this.getMainFwdBufferInfo();null!==r&&0!==r.len?this.tick():this.warn('Main forward buffer length on "seeked" event '.concat(r?r.len:"empty",")"))}},{key:"onManifestLoading",value:function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(wd.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}},{key:"onManifestParsed",value:function(e,t){var r=!1,i=!1;t.levels.forEach((function(e){var t=e.audioCodec;t&&(r=r||-1!==t.indexOf("mp4a.40.2"),i=i||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=r&&i&&!function(){var e,t=Rv();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}},{key:"onLevelLoading",value:function(e,t){var r=this.levels;if(r&&this.state===mm){var i=r[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=Em)}}},{key:"onLevelLoaded",value:function(e,t){var r,i=this.levels,a=t.level,n=t.details,o=n.totalduration;if(i){this.log("Level ".concat(a," loaded [").concat(n.startSN,",").concat(n.endSN,"]").concat(n.lastPartSn?"[part-".concat(n.lastPartSn,"-").concat(n.lastPartIndex,"]"):"",", cc [").concat(n.startCC,", ").concat(n.endCC,"] duration:").concat(o));var s=i[a],l=this.fragCurrent;!l||this.state!==ym&&this.state!==vm||l.level!==t.level&&l.loader&&this.abortCurrentFrag();var c=0;if(n.live||null!=(r=s.details)&&r.live){var u;if(this.checkLiveUpdate(n),n.deltaUpdateFailed)return;c=this.alignPlaylists(n,s.details,null==(u=this.levelLastLoaded)?void 0:u.details)}if(s.details=n,this.levelLastLoaded=s,this.hls.trigger(wd.LEVEL_UPDATED,{details:n,level:a}),this.state===Em){if(this.waitForCdnTuneIn(n))return;this.state=mm}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,c),this.tick()}else this.warn("Levels were reset while loading level ".concat(a))}},{key:"_handleFragmentLoadProgress",value:function(e){var t,r=e.frag,i=e.part,a=e.payload,n=this.levels;if(n){var o=n[r.level],s=o.details;if(!s)return this.warn("Dropping fragment ".concat(r.sn," of level ").concat(r.level," after level details were reset")),void this.fragmentTracker.removeFragment(r);var l=o.videoCodec,c=s.PTSKnown||!s.live,u=null==(t=r.initSegment)?void 0:t.data,d=this._getAudioCodec(o),h=this.transmuxer=this.transmuxer||new Pg(this.hls,Dp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=i?i.index:-1,f=-1!==p,m=new Zf(r.level,r.sn,r.stats.chunkCount,a.byteLength,p,f),g=this.initPTS[r.cc];h.push(a,u,d,l,r,i,s.totalduration,c,m,g)}else this.warn("Levels were reset while fragment load was in progress. Fragment ".concat(r.sn," of level ").concat(r.level," will not be buffered"))}},{key:"onAudioTrackSwitching",value:function(e,t){var r=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i&&(this.log("Switching to main audio track, cancel main fragment load"),i.abortRequests(),this.fragmentTracker.removeFragment(i)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var a=this.hls;r&&(a.trigger(wd.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),a.trigger(wd.AUDIO_TRACK_SWITCHED,t)}}},{key:"onAudioTrackSwitched",value:function(e,t){var r=t.id,i=!!this.hls.audioTracks[r].url;if(i){var a=this.videoBuffer;a&&this.mediaBuffer!==a&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=a)}this.altAudio=i,this.tick()}},{key:"onBufferCreated",value:function(e,t){var r,i,a=t.tracks,n=!1;for(var o in a){var s=a[o];if("main"===s.id){if(i=o,r=s,"video"===o){var l=a[o];l&&(this.videoBuffer=l.buffer)}}else n=!0}n&&r?(this.log("Alternate track found, use ".concat(i,".buffered to schedule main fragment loading")),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}},{key:"onFragBuffered",value:function(e,t){var r=t.frag,i=t.part;if(!r||r.type===Dp){if(this.fragContextChanged(r))return this.warn("Fragment ".concat(r.sn).concat(i?" p: "+i.index:""," of level ").concat(r.level," finished buffering, but was aborted. state: ").concat(this.state)),void(this.state===_m&&(this.state=mm));var a=i?i.stats:r.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,i)}}},{key:"onError",value:function(e,t){var r;if(t.fatal)this.state=wm;else switch(t.details){case Ed.FRAG_GAP:case Ed.FRAG_PARSING_ERROR:case Ed.FRAG_DECRYPT_ERROR:case Ed.FRAG_LOAD_ERROR:case Ed.FRAG_LOAD_TIMEOUT:case Ed.KEY_LOAD_ERROR:case Ed.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Dp,t);break;case Ed.LEVEL_LOAD_ERROR:case Ed.LEVEL_LOAD_TIMEOUT:case Ed.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Em||(null==(r=t.context)?void 0:r.type)!==Cp||(this.state=mm);break;case Ed.BUFFER_APPEND_ERROR:case Ed.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===Ed.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Ed.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}},{key:"checkBuffer",value:function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){if(this.loadedmetadata||!Xf.getBuffered(e).length){var r=this.state!==mm?this.fragCurrent:null;t.poll(this.lastCurrentTime,r)}this.lastCurrentTime=e.currentTime}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=mm,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}},{key:"onBufferFlushed",value:function(e,t){var r=t.type;if(r!==Fd||this.audioOnly&&!this.altAudio){var i=(r===Od?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,r,Dp),this.tick()}}},{key:"onLevelsUpdated",value:function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"seekToStartPos",value:function(){var e=this.media;if(e){var t=e.currentTime,r=this.startPosition;if(r>=0&&t0&&(aA.cc;if(!1!==a.independent){var k=u.startPTS,w=u.endPTS,S=u.startDTS,E=u.endDTS;if(l)l.elementaryStreams[u.type]={startPTS:k,endPTS:w,startDTS:S,endDTS:E};else if(u.firstKeyFrame&&u.independent&&1===n.id&&!_&&(this.couldBacktrack=!0),u.dropped&&u.independent){var T=this.getMainFwdBufferInfo(),C=(T?T.end:this.getLoadPosition())+this.config.maxBufferHole,x=u.firstKeyFramePTS?u.firstKeyFramePTS:k;if(!b&&C2&&(s.gap=!0);s.setElementaryStreamInfo(u.type,k,w,S,E),this.backtrackFragment&&(this.backtrackFragment=s),this.bufferFragmentData(u,s,l,n,b||_)}else{if(!b&&!_)return void this.backtrack(s);s.gap=!0}}if(m){var R=m.startPTS,D=m.endPTS,L=m.startDTS,P=m.endDTS;l&&(l.elementaryStreams[Fd]={startPTS:R,endPTS:D,startDTS:L,endDTS:P}),s.setElementaryStreamInfo(Fd,R,D,L,P),this.bufferFragmentData(m,s,l,n)}if(f&&null!=h&&null!=(t=h.samples)&&t.length){var B={id:r,frag:s,details:f,samples:h.samples};i.trigger(wd.FRAG_PARSING_METADATA,B)}if(f&&d){var I={id:r,frag:s,details:f,samples:d.samples};i.trigger(wd.FRAG_PARSING_USERDATA,I)}}}else this.resetWhenMissingContext(n)}},{key:"_bufferInitSegment",value:function(e,t,r,i){var a=this;if(this.state===bm){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var n=t.audio,o=t.video,s=t.audiovideo;if(n){var l=e.audioCodec,c=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(l&&(l=-1!==l.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==n.metadata.channelCount&&-1===c.indexOf("firefox")&&(l="mp4a.40.5")),l&&-1!==l.indexOf("mp4a.40.5")&&-1!==c.indexOf("android")&&"audio/mpeg"!==n.container&&(l="mp4a.40.2",this.log("Android: force audio codec to ".concat(l))),e.audioCodec&&e.audioCodec!==l&&this.log('Swapping manifest audio codec "'.concat(e.audioCodec,'" for "').concat(l,'"')),n.levelCodec=l,n.id="main",this.log("Init audio buffer, container:".concat(n.container,", codecs[selected/level/parsed]=[").concat(l||"","/").concat(e.audioCodec||"","/").concat(n.codec,"]"))}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log("Init video buffer, container:".concat(o.container,", codecs[level/parsed]=[").concat(e.videoCodec||"","/").concat(o.codec,"]"))),s&&this.log("Init audiovideo buffer, container:".concat(s.container,", codecs[level/parsed]=[").concat(e.codecs,"/").concat(s.codec,"]")),this.hls.trigger(wd.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var n=t[e].initSegment;null!=n&&n.byteLength&&a.hls.trigger(wd.BUFFER_APPENDING,{type:e,data:n,frag:r,part:null,chunkMeta:i,parent:r.type})})),this.tickImmediate()}}},{key:"getMainFwdBufferInfo",value:function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Dp)}},{key:"backtrack",value:function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=mm}},{key:"checkFragmentChanged",value:function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var r=e.currentTime;if(Xf.isBuffered(e,r)?t=this.getAppendedFrag(r):Xf.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;var i=this.fragPlaying,a=t.level;i&&t.sn===i.sn&&i.level===a||(this.fragPlaying=t,this.hls.trigger(wd.FRAG_CHANGED,{frag:t}),i&&i.level===a||this.hls.trigger(wd.LEVEL_SWITCHED,{level:a}))}}}},{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}},{key:"currentProgramDateTime",get:function(){var e=this.media;if(e){var t=e.currentTime,r=this.currentFrag;if(r&&bd(t)&&bd(r.programDateTime)){var i=r.programDateTime+1e3*(t-r.start);return new Date(i)}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])}(Tm),Bv=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};S(this,e),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Lg,this._autoLevelCapping=-1,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,this.triggeringException=void 0,function(e,t){if("object"==("undefined"===typeof console?"undefined":T(console))&&!0===e||"object"==T(e)){Rd(e,"debug","log","info","warn","error");try{xd.log('Debug logs enabled for "'.concat(t,'" in hls.js version 1.5.7'))}catch(e){xd=Cd}}else xd=Cd}(t.debug||!1,"Hls instance");var r=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var r=Sv(e),i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((function(e){var a="".concat("level"===e?"playlist":e,"LoadPolicy"),n=void 0===t[a],o=[];i.forEach((function(i){var s="".concat(e,"Loading").concat(i),l=t[s];if(void 0!==l&&n){o.push(s);var c=r[a].default;switch(t[a]={default:c},i){case"TimeOut":c.maxLoadTimeMs=l,c.maxTimeToFirstByteMs=l;break;case"MaxRetry":c.errorRetry.maxNumRetry=l,c.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":c.errorRetry.retryDelayMs=l,c.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":c.errorRetry.maxRetryDelayMs=l,c.timeoutRetry.maxRetryDelayMs=l}}})),o.length&&Dd.warn('hls.js config: "'.concat(o.join('", "'),'" setting(s) are deprecated, use "').concat(a,'": ').concat(JSON.stringify(t[a])))})),gd(gd({},r),t)}(e.DefaultConfig,t);this.userConfig=t,r.progressive&&Ev(r);var i=r.abrController,a=r.bufferController,n=r.capLevelController,o=r.errorController,s=r.fpsController,l=new o(this),c=this.abrController=new i(this),u=this.bufferController=new a(this),d=this.capLevelController=new n(this),h=new s(this),p=new Mp(this),f=new Kp(this),m=r.contentSteeringController,g=m?new m(this):null,y=this.levelController=new Tv(this,g),v=new qf(this),A=new xv(this.config),b=this.streamController=new Pv(this,v,A);d.setStreamController(b),h.setStreamController(b);var _=[p,y,b];g&&_.splice(1,0,g),this.networkControllers=_;var k=[c,u,d,h,f,v];this.audioTrackController=this.createController(r.audioTrackController,_);var w=r.audioStreamController;w&&_.push(new w(this,v,A)),this.subtitleTrackController=this.createController(r.subtitleTrackController,_);var E=r.subtitleStreamController;E&&_.push(new E(this,v,A)),this.createController(r.timelineController,k),A.emeController=this.emeController=this.createController(r.emeController,k),this.cmcdController=this.createController(r.cmcdController,k),this.latencyController=this.createController(Yp,k),this.coreComponents=k,_.push(l);var C=l.onErrorOut;"function"==typeof C&&this.on(wd.ERROR,C,l)}return w(e,[{key:"createController",value:function(e,t){if(e){var r=new e(this);return t&&t.push(r),r}return null}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.on(e,t,r)}},{key:"once",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.once(e,t,r)}},{key:"removeAllListeners",value:function(e){this._emitter.removeAllListeners(e)}},{key:"off",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,i=arguments.length>3?arguments[3]:void 0;this._emitter.off(e,t,r,i)}},{key:"listeners",value:function(e){return this._emitter.listeners(e)}},{key:"emit",value:function(e,t,r){return this._emitter.emit(e,t,r)}},{key:"trigger",value:function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(Dd.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;var r=e===wd.ERROR;this.trigger(wd.ERROR,{type:Sd.OTHER_ERROR,details:Ed.INTERNAL_EXCEPTION,fatal:r,event:e,error:t}),this.triggeringException=!1}}return!1}},{key:"listenerCount",value:function(e){return this._emitter.listenerCount(e)}},{key:"destroy",value:function(){Dd.log("destroy"),this.trigger(wd.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(e){return e.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(e){return e.destroy()})),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}},{key:"attachMedia",value:function(e){Dd.log("attachMedia"),this._media=e,this.trigger(wd.MEDIA_ATTACHING,{media:e})}},{key:"detachMedia",value:function(){Dd.log("detachMedia"),this.trigger(wd.MEDIA_DETACHING,void 0),this._media=null}},{key:"loadSource",value:function(e){this.stopLoad();var t=this.media,r=this.url,i=this.url=fd.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,Dd.log("loadSource:".concat(i)),t&&r&&(r!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(wd.MANIFEST_LOADING,{url:e})}},{key:"startLoad",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;Dd.log("startLoad(".concat(e,")")),this.started=!0,this.networkControllers.forEach((function(t){t.startLoad(e)}))}},{key:"stopLoad",value:function(){Dd.log("stopLoad"),this.started=!1,this.networkControllers.forEach((function(e){e.stopLoad()}))}},{key:"resumeBuffering",value:function(){this.started&&this.networkControllers.forEach((function(e){"fragmentLoader"in e&&e.startLoad(-1)}))}},{key:"pauseBuffering",value:function(){this.networkControllers.forEach((function(e){"fragmentLoader"in e&&e.stopLoad()}))}},{key:"swapAudioCodec",value:function(){Dd.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){Dd.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)}},{key:"removeLevel",value:function(e){this.levelController.removeLevel(e)}},{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){Dd.log("set currentLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){Dd.log("set nextLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){Dd.log("set loadLevel:".concat(e)),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){Dd.log("set firstLevel:".concat(e)),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e},set:function(e){Dd.log("set startLevel:".concat(e)),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(Dd.log("set autoLevelCapping:".concat(e)),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){(function(e){return Qp.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var r=e.length,i=0;i=t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,r=this.autoLevelCapping,i=this.maxHdcpLevel;if(e=-1===r&&null!=t&&t.length?t.length-1:r,i)for(var a=e;a--;){var n=t[a].attrs["HDCP-LEVEL"];if(n&&n<=i)return a}return e}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"setAudioOption",value:function(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}},{key:"setSubtitleOption",value:function(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{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:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{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.5.7"}},{key:"isMSESupported",value:function(){return Dv()}},{key:"isSupported",value:function(){return function(){if(!Dv())return!1;var e=rp();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((function(t){return e.isTypeSupported(op(t,"video"))}))||["mp4a.40.2","fLaC"].some((function(t){return e.isTypeSupported(op(t,"audio"))})))}()}},{key:"getMediaSource",value:function(){return rp()}},{key:"Events",get:function(){return wd}},{key:"ErrorTypes",get:function(){return Sd}},{key:"ErrorDetails",get:function(){return Ed}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:wv},set:function(t){e.defaultConfig=t}}])}();Bv.defaultConfig=void 0;var Iv=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.TAG_NAME="HlsDecoder",e._opt,r.canVideoPlay=!1,r.$videoElement=null,r.canvasRenderInterval=null,r.bandwidthEstimateInterval=null,r.fpsInterval=null,r.hlsFps=0,r.hlsPrevFrams=0,r.isInitInfo=!1,r.eventsDestroy=[],r.supportVideoFrameCallbackHandle=null,r.player.isHlsCanVideoPlay()?(r.$videoElement=r.player.video.$videoElement,r.canVideoPlay=!0):Bv.isSupported()?(r.$videoElement=r.player.video.$videoElement,r.hls=new Bv({}),r._initHls(),r._bindEvents()):r.player.debug.error(r.TAG_NAME,"init hls error ,not support "),r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,r){e.supportVideoFrameCallbackHandle&&e.$videoElement&&(e.$videoElement.cancelVideoFrameCallback(e.supportVideoFrameCallbackHandle),e.supportVideoFrameCallbackHandle=null),e.hls&&(e.hls.destroy(),e.hls=null),e.eventsDestroy.length&&(e.eventsDestroy.forEach((function(e){return e()})),e.eventsDestroy=[]),e.isInitInfo=!1,e._stopCanvasRender(),e._stopBandwidthEstimateInterval(),e._stopFpsInterval(),e.$videoElement=null,e.hlsFps=0,e.player.debug.log(e.TAG_NAME,"destroy"),setTimeout((function(){t()}),0)}))}},{key:"checkHlsBufferedDelay",value:function(){var e=this.$videoElement,t=0,r=e.buffered,i=r.length?r.end(r.length-1):0;return t=i-e.currentTime,t<0&&(this.player.debug.warn(this.TAG_NAME,"checkHlsBufferedDelay ".concat(t," < 0, and buffered is ").concat(i," ,currentTime is ").concat(e.currentTime," , try to seek ").concat(e.currentTime," to ").concat(i)),e.currentTime=i,t=0),t}},{key:"getFps",value:function(){return this.hlsFps}},{key:"_startCanvasRender",value:function(){var e=this;jo()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((function(){e.player.video.render({$video:e.$videoElement,ts:parseInt(1e3*e.$videoElement.currentTime,10)||0})}),40))}},{key:"_stopCanvasRender",value:function(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}},{key:"videoFrameCallback",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed");else{var r=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:r}),this.player.handleRender(),this.player.updateStats({dts:r}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}}},{key:"_startBandwidthEstimateInterval",value:function(){var e=this;this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((function(){var t=0;e.hls.bandwidthEstimate&&(t=e.hls.bandwidthEstimate),e.player.emit(Ct.kBps,(t/1024/8/10).toFixed(2))}),1e3)}},{key:"_stopBandwidthEstimateInterval",value:function(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}},{key:"_startFpsInterval",value:function(){var e=this;this._stopCanvasRender(),this.fpsInterval=setInterval((function(){if(e.$videoElement)if(vo(e.$videoElement.getVideoPlaybackQuality)){var t=e.$videoElement.getVideoPlaybackQuality();e.hlsFps=t.totalVideoFrames-e.hlsPrevFrams,e.hlsPrevFrams=t.totalVideoFrames}else{var r=e.$videoElement.webkitDecodedFrameCount||0;e.hlsFps=r-e.hlsPrevFrams,e.hlsPrevFrams=r}}),1e3)}},{key:"_stopFpsInterval",value:function(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}},{key:"_initHls",value:function(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,Nn()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}},{key:"_bindEvents",value:function(){var e=this,t=this.player,r=this.player.events.proxy;this.hls;var i=this.$videoElement,a=jo(),n=r(i,ki,(function(r){if(e.hls){var i=parseInt(r.timeStamp,10);e.player._opt.useCanvasRender&&Io(a)&&t.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(n),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(Bv.Events.ERROR,(function(t,r){if(r.fatal)switch(r.type){case Bv.ErrorTypes.NETWORK_ERROR:e.player.debug.warn(e.TAG_NAME,"fatal network error encountered, try to recover"),e.hls.startLoad();break;case Bv.ErrorTypes.MEDIA_ERROR:e.player.debug.warn(e.TAG_NAME,"fatal media error encountered, try to recover"),e.hls.recoverMediaError()}})),this.hls.on(Bv.Events.MEDIA_ATTACHING,(function(){})),this.hls.on(Bv.Events.MEDIA_ATTACHED,(function(){})),this.hls.on(Bv.Events.MEDIA_DETACHING,(function(){})),this.hls.on(Bv.Events.MEDIA_DETACHED,(function(){})),this.hls.on(Bv.Events.BUFFER_RESET,(function(){})),this.hls.on(Bv.Events.BUFFER_CODECS,(function(){})),this.hls.on(Bv.Events.BUFFER_CREATED,(function(){})),this.hls.on(Bv.Events.BUFFER_APPENDING,(function(t,r){e.player.debug.log(e.TAG_NAME,"BUFFER_APPENDING",r.type)})),this.hls.on(Bv.Events.BUFFER_APPENDED,(function(){})),this.hls.on(Bv.Events.BUFFER_EOS,(function(){})),this.hls.on(Bv.Events.BUFFER_FLUSHING,(function(){})),this.hls.on(Bv.Events.BUFFER_FLUSHED,(function(){})),this.hls.on(Bv.Events.MANIFEST_LOADING,(function(){e.player.debug.log(e.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(Bv.Events.MANIFEST_LOADED,(function(t,r){e.player.debug.log(e.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",r.url)})),this.hls.on(Bv.Events.MANIFEST_PARSED,(function(){e.player.debug.log(e.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),t._times.demuxStart||(t._times.demuxStart=Tn())})),this.hls.on(Bv.Events.LEVEL_LOADING,(function(){})),this.hls.on(Bv.Events.LEVEL_LOADED,(function(e,t){})),this.hls.on(Bv.Events.FRAG_LOADING,(function(){})),this.hls.on(Bv.Events.FRAG_LOADED,(function(e,r){t._times.decodeStart||(t._times.decodeStart=Tn())})),this.hls.on(Bv.Events.BUFFER_APPENDING,(function(){t._times.videoStart||(t._times.videoStart=Tn(),t.handlePlayToRenderTimes())})),this.hls.on(Bv.Events.FRAG_DECRYPTED,(function(){})),this.hls.on(Bv.Events.KEY_LOADING,(function(){})),this.hls.on(Bv.Events.KEY_LOADING,(function(){})),this.hls.on(Bv.Events.FPS_DROP,(function(e){})),this.hls.on(Bv.Events.FPS_DROP_LEVEL_CAPPING,(function(e){})),this.hls.on(Bv.Events.FRAG_PARSING_INIT_SEGMENT,(function(t,r){e.player.debug.log(e.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",r);var i=!!(r&&r.tracks&&r.tracks.audio),a=!!(r&&r.tracks&&r.tracks.video);if(i&&r.tracks.audio){var n=r.tracks.audio,o=n.metadata&&n.metadata.channelCount?n.metadata.channelCount:0,s=n.codec;e.player.audio&&e.player.audio.updateAudioInfo({encType:s,channels:o,sampleRate:44100})}if(a&&r.tracks.video){var l=r.tracks.video,c={encTypeCode:-1!==l.codec.indexOf("avc")?jt:zt};l.metadata&&(c.width=l.metadata.width,c.height=l.metadata.height),e.player.video&&e.player.video.updateVideoInfo(c)}}))}},{key:"initVideoPlay",value:function(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}},{key:"_initRenderSize",value:function(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}},{key:"initVideoEvents",value:function(){var e=this,t=this.player.events.proxy,r=t(this.$videoElement,bi,(function(){e.player.debug.log(e.TAG_NAME,"video canplay"),e.$videoElement.play().then((function(){e.player.debug.log(e.TAG_NAME,"video play"),e._startCanvasRender(),e._initRenderSize()})).catch((function(t){e.player.debug.warn(e.TAG_NAME,"video play error ",t)}))})),i=t(this.$videoElement,_i,(function(){e.player.debug.log(e.TAG_NAME,"video waiting")})),a=t(this.$videoElement,ki,(function(t){var r=parseInt(t.timeStamp,10);e.player.handleRender(),e.player.updateStats({ts:r}),e.$videoElement.paused&&(e.player.debug.warn(e.TAG_NAME,"video is paused and next try to replay"),e.$videoElement.play().then((function(){e.player.debug.log(e.TAG_NAME,"video is paused and replay success")})).catch((function(t){e.player.debug.warn(e.TAG_NAME,"video is paused and replay error ",t)})))})),n=t(this.$videoElement,wi,(function(){e.player.debug.log(e.TAG_NAME,"video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate)}));this.eventsDestroy.push(r,i,a,n)}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(r,i){t.canVideoPlay?(t.initVideoPlay(e),r()):t.hls.on(Bv.Events.MEDIA_ATTACHED,(function(){t.hls.loadSource(e),r()}))}))}}])}(Ho),Mv=2097152,Uv="fetch",Fv="xhr",Ov="arraybuffer",Nv="text",jv="json",zv="real_time_speed",Gv=Object.prototype.toString;function Hv(e){if("[object Object]"!==Gv.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Vv(e){if(e&&null!==e[0]&&void 0!==e[0]&&(0!==e[0]||null!==e[1]&&void 0!==e[1])){var t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}}function Wv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Jv(e,t){if(e){if(!t)return e;var r,i=Object.keys(t).map((function(e){if(r=t[e],null!=r)return Array.isArray(r)?e+="[]":r=[r],r.map((function(t){var r;return r=t,"[object Date]"===Gv.call(r)?t=t.toISOString():function(e){return null!==e&&"object"==T(e)}(t)&&(t=JSON.stringify(t)),"".concat(Wv(e),"=").concat(Wv(t))})).join("&")})).filter(Boolean).join("&");if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}}function qv(e,t,r,i,a,n,o,s,l,c,u){return a=null!=a?parseFloat(a):null,i=parseInt(i||"0",10),Number.isNaN(i)&&(i=0),{data:e,done:t,option:{range:l,vid:c,index:s,contentLength:i,age:a,startTime:n,firstByteTime:o,endTime:Date.now(),priOptions:u},response:r}}function Kv(e,t){return Math.round(8*e*1e3/t/1024)}var Yv=function(e){function t(e,r,i,a){var n;return S(this,t),n=_(this,t,[a]),su(m(n),"retryCount",0),su(m(n),"isTimeout",!1),su(m(n),"loaderType",Uv),su(m(n),"startTime",0),su(m(n),"endTime",0),su(m(n),"options",{}),n.url=e,n.request=r,n.response=i,n}return k(t,e),w(t)}(y(Error)),Qv=function(t){function r(e){var t;return S(this,r),t=_(this,r),su(m(t),"_abortController",null),su(m(t),"_timeoutTimer",null),su(m(t),"_reader",null),su(m(t),"_response",null),su(m(t),"_aborted",!1),su(m(t),"_index",-1),su(m(t),"_range",null),su(m(t),"_receivedLength",0),su(m(t),"_running",!1),su(m(t),"_logger",null),su(m(t),"_vid",""),su(m(t),"_onProcessMinLen",0),su(m(t),"_onCancel",null),su(m(t),"_priOptions",null),su(m(t),"TAG_NAME","FetchLoader"),t.player=e,t}return k(r,t),w(r,[{key:"load",value:function(e){var t,r=this,i=e.url,a=e.vid,n=e.timeout,o=e.responseType,s=e.onProgress,l=e.index,c=e.onTimeout,u=e.onCancel,d=e.range,h=e.transformResponse,p=e.request,f=e.params,m=(e.logger,e.method),g=e.headers,y=e.body,b=e.mode,_=e.credentials,k=e.cache,w=e.redirect,S=e.referrer,E=e.referrerPolicy,T=e.onProcessMinLen,C=e.priOptions;this._aborted=!1,this._onProcessMinLen=T,this._onCancel=u,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=l,this._range=d||[0,0],this._vid=a||i,this._priOptions=C||{};var x={method:m,headers:g,body:y,mode:b,credentials:_,cache:k,redirect:w,referrer:S,referrerPolicy:E,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal},R=!1;clearTimeout(this._timeoutTimer),i=Jv(i,f);var D=Vv(d);D&&(g=p?p.headers:x.headers=x.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",D):g.Range=D),n&&(this._timeoutTimer=setTimeout((function(){if(R=!0,r.cancel(),c){var e=new Yv(i,x,null,"timeout");e.isTimeout=!0,c(e,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})}}),n));var L=Date.now();return(eo(l)||eo(d))&&this.player.debug.log(this.TAG_NAME,"[fetch load start], index,",l,",range,",d),new Promise((function(e,t){fetch(p||i,p?void 0:x).then(function(){var a=A(v().mark((function a(n){var c,u,p,f;return v().wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(clearTimeout(r._timeoutTimer),r._response=n,!r._aborted&&r._running){a.next=2;break}return a.abrupt("return");case 2:if(h&&(n=h(n,i)||n),n.ok){a.next=4;break}throw new Yv(i,x,n,"bad network response");case 4:if(c=Date.now(),o!==Nv){a.next=12;break}return a.next=8,n.text();case 8:u=a.sent,r._running=!1,a.next=28;break;case 12:if(o!==jv){a.next=19;break}return a.next=15,n.json();case 15:u=a.sent,r._running=!1,a.next=28;break;case 19:if(!s){a.next=21;break}return a.abrupt("return",(r.resolve=e,r.reject=t,void r._loadChunk(n,s,L,c)));case 21:return a.next=23,n.arrayBuffer();case 23:u=a.sent,u=new Uint8Array(u),r._running=!1,p=Date.now()-L,f=Kv(u.byteLength,p),r.emit(zv,{speed:f,len:u.byteLength,time:p,vid:r._vid,index:r._index,range:r._range,priOptions:r._priOptions});case 28:(eo(l)||eo(d))&&r.player.debug.log(r.TAG_NAME,"[fetch load end], index,",l,",range,",d),e(qv(u,!0,n,n.headers.get("Content-Length"),n.headers.get("age"),L,c,l,d,r._vid,r._priOptions));case 29:case"end":return a.stop()}}),a)})));return function(e){return a.apply(this,arguments)}}()).catch((function(e){var a;clearTimeout(r._timeoutTimer),r._running=!1,r._aborted&&!R||((e=e instanceof Yv?e:new Yv(i,x,null,null===(a=e)||void 0===a?void 0:a.message)).startTime=L,e.endTime=Date.now(),e.isTimeout=R,e.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},t(e))}))}))}},{key:"cancel",value:function(){var t=A(v().mark((function t(){return v().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(this._aborted){t.next=14;break}if(this._aborted=!0,this._running=!1,!this._response){t.next=12;break}if(t.prev=2,t.t0=this._reader,!t.t0){t.next=7;break}return t.next=7,this._reader.cancel();case 7:t.next=11;break;case 9:t.prev=9,t.t1=t["catch"](2);case 11:this._response=this._reader=null;case 12:if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions});case 14:case"end":return t.stop()}}),t,this,[[2,9]])})));function r(){return t.apply(this,arguments)}return r}()},{key:"_loadChunk",value:function(e,t,r,i){var a=this;if(!e.body||!e.body.getReader){this._running=!1;var n=new Yv(e.url,"",e,"onProgress of bad response.body.getReader");return n.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(n)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(Mv),this._writeIdx=0);var o,s,l,c=this._reader=e.body.getReader(),u=function(){var n=A(v().mark((function n(){var d,h,p,f,m,g,y,A;return v().wrap((function(n){while(1)switch(n.prev=n.next){case 0:return s=Date.now(),n.prev=1,n.next=4,c.read();case 4:o=n.sent,l=Date.now(),n.next=11;break;case 8:return n.prev=8,n.t0=n["catch"](1),n.abrupt("return",(l=Date.now(),void(a._aborted||(a._running=!1,n.t0.options={index:a._index,range:a._range,vid:a._vid,priOptions:a._priOptions},a.reject(n.t0)))));case 11:if(h=(null===(d=a._range)||void 0===d?void 0:d.length)>0?a._range[0]:0,p=h+a._receivedLength,!a._aborted){n.next=14;break}return n.abrupt("return",(a._running=!1,void t(void 0,!1,{range:[p,p],vid:a._vid,index:a._index,startTime:s,endTime:l,st:r,firstByteTime:i,priOptions:a._priOptions},e)));case 14:f=o.value?o.value.byteLength:0,a._receivedLength+=f,a.player.debug.log(a.TAG_NAME,"【fetchLoader,onProgress call】,task,",a._range,", start,",p,", end,",h+a._receivedLength,", done,",o.done),a._onProcessMinLen>0?a._writeIdx+f>=a._onProcessMinLen||o.done?(m=new Uint8Array(a._writeIdx+f),m.set(a._cache.slice(0,a._writeIdx),0),f>0&&m.set(o.value,a._writeIdx),a._writeIdx=0,a.player.debug.log(a.TAG_NAME,"【fetchLoader,onProgress enough】,done,",o.done,",len,",m.byteLength,", writeIdx,",a._writeIdx)):f>0&&a._writeIdx+f0&&(g=new Uint8Array(a._writeIdx+f+2048),a.player.debug.log(a.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",a._writeIdx+f+2048,", datalen,",f,", writeIdx,",a._writeIdx),g.set(a._cache.slice(0,a._writeIdx),0),f>0&&g.set(o.value,a._writeIdx),a._writeIdx+=f,delete a._cache,a._cache=g,a.player.debug.log(a.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",f,", writeIdx,",a._writeIdx)):m=o.value,(m&&m.byteLength>0||o.done)&&t(m,o.done,{range:[a._range[0]+a._receivedLength-(m?m.byteLength:0),a._range[0]+a._receivedLength],vid:a._vid,index:a._index,startTime:s,endTime:l,st:r,firstByteTime:i,priOptions:a._priOptions},e),o.done?(y=Date.now()-r,A=Kv(a._receivedLength,y),a.emit(zv,{speed:A,len:a._receivedLength,time:y,vid:a._vid,index:a._index,range:a._range,priOptions:a._priOptions}),a._running=!1,a.player.debug.log(a.TAG_NAME,"[fetchLoader onProgress end],task,",a._range,",done,",o.done),a.resolve(qv(o,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),r,i,a._index,a._range,a._vid,a._priOptions))):u();case 17:case"end":return n.stop()}}),n,null,[[1,8]])})));return function(){return n.apply(this,arguments)}}();u()}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}}],[{key:"isSupported",value:function(){return!("undefined"==typeof fetch)}}])}(Ho),Xv=function(){function e(t,r,i){S(this,e),su(this,"TAG_NAME","Task"),this.promise=function(){var e,t,r=new Promise((function(r,i){e=r,t=i}));return r.used=!1,r.resolve=function(){return r.used=!0,e.apply(void 0,arguments)},r.reject=function(){return r.used=!0,t.apply(void 0,arguments)},r}(),this.alive=!!r.onProgress,this._loaderType=t,this.player=i,this._loader=t===Uv&&window.fetch?new Qv(i):new Zv(i),this._config=r,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=r.retryCheckFunc}return w(e,[{key:"exec",value:function(){var e=this,t=this._config,r=t.retry,i=t.retryDelay,a=t.onRetryError,n=t.transformError,o=d(t,C),s=function(){var t=A(v().mark((function t(){var l,c,u;return v().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._loader.load(o);case 3:l=t.sent,e.promise.resolve(l),t.next=18;break;case 7:if(t.prev=7,t.t0=t["catch"](0),e._loader.running=!1,e.player.debug.log(e.TAG_NAME,"[task request catch err]",t.t0),!e._canceled){t.next=11;break}return t.abrupt("return");case 11:if(t.t0.loaderType=e._loaderType,t.t0.retryCount=e._retryCount,c=t.t0,n&&(c=n(c)||c),a&&e._retryCount>0&&a(c,e._retryCount,{index:o.index,vid:o.vid,range:o.range,priOptions:o.priOptions}),e._retryCount++,u=!0,e._retryCheckFunc&&(u=e._retryCheckFunc(t.t0)),!(u&&e._retryCount<=r)){t.next=17;break}return t.abrupt("return",(clearTimeout(e._retryTimer),e.player.debug.log(e.TAG_NAME,"[task request setTimeout],retry",e._retryCount,",retry range,",o.range),void(e._retryTimer=setTimeout(s,i))));case 17:e.promise.reject(c);case 18:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();return s(),this.promise}},{key:"cancel",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.abrupt("return",(clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"running",get:function(){return this._loader&&this._loader.running}},{key:"loader",get:function(){return this._loader}}])}(),Zv=function(e){function r(e){var t;return S(this,r),t=_(this,r),su(m(t),"_xhr",null),su(m(t),"_aborted",!1),su(m(t),"_timeoutTimer",null),su(m(t),"_range",null),su(m(t),"_receivedLength",0),su(m(t),"_url",null),su(m(t),"_onProgress",null),su(m(t),"_index",-1),su(m(t),"_headers",null),su(m(t),"_currentChunkSizeKB",384),su(m(t),"_timeout",null),su(m(t),"_xhr",null),su(m(t),"_withCredentials",null),su(m(t),"_startTime",-1),su(m(t),"_loadCompleteResolve",null),su(m(t),"_loadCompleteReject",null),su(m(t),"_runing",!1),su(m(t),"_logger",!1),su(m(t),"_vid",""),su(m(t),"_responseType",void 0),su(m(t),"_credentials",void 0),su(m(t),"_method",void 0),su(m(t),"_transformResponse",void 0),su(m(t),"_firstRtt",void 0),su(m(t),"_onCancel",null),su(m(t),"_priOptions",null),su(m(t),"TAG_NAME","XhrLoader"),t.player=e,t}return k(r,e),w(r,[{key:"load",value:function(e){var t=this;clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debug.log(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=Jv(e.url,e.params);var r=Date.now();return new Promise((function(e,r){t._loadCompleteResolve=e,t._loadCompleteReject=r,t._startLoad()})).catch((function(e){if(clearTimeout(t._timeoutTimer),t._runing=!1,!t._aborted)throw(e=e instanceof Yv?e:new Yv(t._url,t._request)).startTime=r,e.endTime=Date.now(),e.options={index:t._index,vid:t._vid,priOptions:t._priOptions},e}))}},{key:"_startLoad",value:function(){var e=null;if(this._responseType===Ov&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;var t=1024*this._currentChunkSizeKB,r=this._range[0]+this._receivedLength,i=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debug.log(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}},{key:"_internalOpen",value:function(e){var r=this;try{this._startTime=Date.now();var i=this._xhr=new XMLHttpRequest;i.open(this._method||"GET",this._url,!0),i.responseType=this._responseType,this._timeout&&(i.timeout=this._timeout),i.withCredentials=this._withCredentials,i.onload=this._onLoad.bind(this),i.onreadystatechange=this._onReadyStatechange.bind(this),i.onerror=function(e){var t,i,a;r._running=!1;var n=new Yv(r._url,r._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(a=e.currentTarget)||void 0===a?void 0:a.statusText));n.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},r._loadCompleteReject(n)},i.ontimeout=function(e){r.cancel();var t=new Yv(r._url,r._request,{status:408},"timeout");r._onTimeout&&(t.isTimeout=!0,r._onTimeout(t,{index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions})),t.options={index:r._index,range:r._range,vid:r._vid,priOptions:r._priOptions},r._loadCompleteReject(t)};var a=this._headers||{},n=Vv(e);n&&(a.Range=n),a&&Object.keys(a).forEach((function(e){i.setRequestHeader(e,a[e])})),this.player.debug.log(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),i.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}},{key:"_onReadyStatechange",value:function(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}},{key:"_onLoad",value:function(e){var t,r=e.target.status;if(r<200||r>299){var i=new Yv(this._url,null,E(E({},e.target.response),{},{status:r}),"bad response,status:"+r);return i.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(i)}var a,n=null,o=!1,s=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===Ov){var l,c=new Uint8Array(e.target.response);if(a=s+this._receivedLength,c&&c.byteLength>0){this._receivedLength+=c.byteLength;var u=Date.now()-this._startTime,d=Kv(this._receivedLength,u);this.emit(zv,{speed:d,len:this._receivedLength,time:u,vid:this._vid,index:this._index,range:[a,s+this._receivedLength],priOptions:this._priOptions})}n=c,o=!((null===(l=this._range)||void 0===l?void 0:l.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",a,"end ",s+this._receivedLength,",dataLen,",c?c.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",o)}else o=!0,n=e.target.response;var h={ok:r>=200&&r<300,status:r,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(h=this._transformResponse(h,this._url)||h),this._onProgress&&this._onProgress(n,o,{index:this._index,vid:this._vid,range:[a,s+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},h),o?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(qv(this._onProgress?null:n,o,h,h.headers["content-length"],h.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}},{key:"cancel",value:function(){if(!this._aborted)return this._aborted=!0,this._runing=!1,b(r,"removeAllListeners",this,3)([]),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}},{key:"receiveLen",get:function(){return this._receivedLength}},{key:"running",get:function(){return this._running},set:function(e){this._running=e}},{key:"_getHeaders",value:function(e){var t,r=e.getAllResponseHeaders().trim().split("\r\n"),i={},a=f(r);try{for(a.s();!(t=a.n()).done;){var n=t.value,o=n.split(": ");i[o[0].toLowerCase()]=o.slice(1).join(": ")}}catch(s){a.e(s)}finally{a.f()}return i}}],[{key:"isSupported",value:function(){return"undefined"!=typeof XMLHttpRequest}}])}(Ho),$v=function(e){function t(e,r){var i;return S(this,t),i=_(this,t),su(m(i),"type",Uv),su(m(i),"_queue",[]),su(m(i),"_alive",[]),su(m(i),"_currentTask",null),su(m(i),"_config",void 0),i.player=r,i._config=function(e){return E({loaderType:Uv,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:Nv,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0},e)}(e),i._config.loaderType!==Fv&&Qv.isSupported()||(i.type=Fv),i}return k(t,e),w(t,[{key:"destroy",value:function(){this._queue=[],this._alive=[],this._currentTask=null}},{key:"isFetch",value:function(){return this.type===Uv}},{key:"load",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?r=e:r.url=e||r.url||this._config.url,r=Object.assign({},this._config,r),r.params&&(r.params=Object.assign({},r.params)),r.headers&&Hv(r.headers)&&(r.headers=Object.assign({},r.headers)),r.body&&Hv(r.body)&&(r.body=Object.assign({},r.body)),r.transformRequest&&(r=r.transformRequest(r)||r);var i=new Xv(this.type,r,this.player);return i.loader.on(zv,(function(e){t.emit(zv,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}},{key:"cancel",value:function(){var e=A(v().mark((function e(){var t;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=this._queue.map((function(e){return e.cancel()})).concat(this._alive.map((function(e){return e.cancel()}))),this._currentTask&&t.push(this._currentTask.cancel()),this._queue=[],this._alive=[],e.next=6,Promise.all(t);case 6:return e.next=8,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}();case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_processTask",value:function(){var e=this;if(this._currentTask=this._queue.shift(),this._currentTask){this._currentTask.alive&&this._alive.push(this._currentTask);var t=this._currentTask.exec().catch((function(e){}));t&&"function"==typeof t.finally&&t.finally((function(){var t,r;null!==(t=e._currentTask)&&void 0!==t&&t.alive&&(null===(r=e._alive)||void 0===r?void 0:r.length)>0&&(e._alive=e._alive.filter((function(t){return t&&t!==e._currentTask}))),e._processTask()}))}}}],[{key:"isFetchSupport",value:function(){return Qv.isSupported()}}])}(Ho),eA="network",tA="network_timeout",rA="other",iA="manifest",aA="hls",nA="demux",oA=function(e){function t(e,r,i,a,n){var o;return S(this,t),o=_(this,t,[n||(null==i?void 0:i.message)]),o.errorType=e===tA?eA:e,o.originError=i,o.ext=a,o.errorMessage=o.message,o}return k(t,e),w(t,null,[{key:"create",value:function(e,r,i,a,n){return e instanceof t?e:(e instanceof Error&&(i=e,e=""),e||(e=rA),new t(e,r,i,a,n))}},{key:"network",value:function(e){var r;return new t(null!=e&&e.isTimeout?tA:eA,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(r=e.response)||void 0===r?void 0:r.status})}}])}(y(Error)),sA=/^#(EXT[^:]*)(?::(.*))?$/,lA=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,cA=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,uA=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function dA(e){var t=e.match(sA);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function hA(e){for(var t={},r=lA.exec(e);r;)t[r[1]]=r[2]||r[3],r=lA.exec(e);return t}function pA(e,t){if(!t||!e||cA.test(e))return e;var r=uA.exec(t);return r?"/"===e[0]?r[1]+e:r[1]+r[2]+e:e}var fA={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function mA(e,t){var r=fA[e];if(r&&t&&t.length)for(var i=0;i>8*(15-t)&255}}}])}(),TA=function(){function e(){S(this,e)}return w(e,null,[{key:"parse",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if(!t.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");var i=function(e){return e.split(/[\r\n]/).map((function(e){return e.trim()})).filter(Boolean)}(t);return e.isMediaPlaylist(t)?function(e,t){var r=new wA;r.url=t;for(var i,a=new SA,n=null,o=null,s=0,l=0,c=0,u=0,d=!1;(i=e[u++])&&!d;)if("#"===i[0]){var p=dA(i);if(p){var f=h(p,2),m=f[0],g=f[1];switch(m){case"VERSION":r.version=parseInt(g);break;case"PLAYLIST-TYPE":r.type=null==g?void 0:g.toUpperCase();break;case"TARGETDURATION":r.targetDuration=parseFloat(g);break;case"ENDLIST":var y=r.segments[r.segments.length-1];y&&(y.isLast=!0),r.live=!1,d=!0;break;case"MEDIA-SEQUENCE":l=r.startSN=parseInt(g);break;case"DISCONTINUITY-SEQUENCE":c=r.startCC=parseInt(g);break;case"DISCONTINUITY":c++;break;case"BYTERANGE":a.setByteRange(g,r.segments[r.segments.length-1]);break;case"EXTINF":var v=g.split(","),A=h(v,2),b=A[0],_=A[1];a.start=s,a.duration=parseFloat(b),s+=a.duration,a.title=_;break;case"KEY":var k=hA(g);if("NONE"===k.METHOD){o=null;break}if("AES-128"!==k.METHOD)throw new Error("encrypt ".concat(k.METHOD,"/").concat(k.KEYFORMAT," is not supported"));if(o=new EA,o.method=k.METHOD,o.url=/^blob:/.test(k.URI)?k.URI:pA(k.URI,t),o.keyFormat=k.KEYFORMAT||"identity",o.keyFormatVersions=k.KEYFORMATVERSIONS,k.IV){var w=k.IV.slice(2);w=(1&w.length?"0":"")+w,o.iv=new Uint8Array(w.length/2);for(var S=0,E=w.length/2;S3&&void 0!==arguments[3]?arguments[3]:r,a=[];return e&&(a[0]=this.loadVideoSegment(e,r)),t&&(a[1]=this.loadAudioSegment(t,i)),Promise.all(a)}},{key:"loadVideoSegment",value:function(e,t){return this._loadSegment(this._segmentLoader,e,t)}},{key:"loadAudioSegment",value:function(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}},{key:"_loadSegment",value:function(){var e=A(v().mark((function e(t,r,i){var a,n,o,s,l,c,u,d,p,f,m,g,y,A,b,_=this;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return u=[],this.hls.emit(ma,{url:r.url}),u[0]=t.load(r.url),i&&r.initSegment&&(p=r.initSegment.url,n=this._mapCache[p],n||(this.hls.emit(ma,{url:p}),u[1]=t.load(p).then((function(e){e&&(Object.keys(_._mapCache)>30&&(_._mapCache={}),n=_._mapCache[p]=e.data,_._emitOnLoaded(e,p))}))),f=null===(d=r.initSegment.key)||void 0===d?void 0:d.url,f&&(c=r.initSegment.key.iv,l=this._keyCache[f],l||(this.hls.emit(ma,{url:f}),u[2]=this._keyLoader.load(f).then((function(e){e&&(l=_._keyCache[f]=e.data,_._emitOnLoaded(e,f))}))))),m=null===(a=r.key)||void 0===a?void 0:a.url,m&&(s=r.key.iv,o=this._keyCache[m],o||(this.hls.emit(ma,{url:m}),u[3]=this._keyLoader.load(m).then((function(e){e&&(o=_._keyCache[m]=e.data,_._emitOnLoaded(e,m))})))),e.next=6,Promise.all(u);case 6:if(g=e.sent,y=h(g,1),A=y[0],A){e.next=11;break}return e.abrupt("return");case 11:return b=A.data,e.abrupt("return",(this._emitOnLoaded(A,r.url),{data:b,map:n,key:o,mapKey:l,keyIv:s,mapKeyIv:c}));case 13:case"end":return e.stop()}}),e,this)})));function t(t,r,i){return e.apply(this,arguments)}return t}()},{key:"reset",value:function(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}},{key:"cancel",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()]);case 2:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}])}(),DA=function(){function e(t,r,i){S(this,e),this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(t,r,i)}return w(e,[{key:"lastSegment",get:function(){return this.segments.length?this.segments[this.segments.length-1]:null}},{key:"segmentDuration",get:function(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}},{key:"liveEdge",get:function(){return this.endTime}},{key:"endTime",get:function(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}},{key:"currentSubtitleEndSn",get:function(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}},{key:"clearOldSegment",value:function(e,t){return this._clearSegments(e,t)}},{key:"getAudioSegment",value:function(e){if(e&&this.currentAudioStream){var t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((function(e){return e.sn===t}))}}},{key:"update",value:function(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((function(e){return e.default}))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((function(e){return e.default}))||this.subtitleStreams[0]))}},{key:"updateSubtitle",value:function(e){var t=this;if(e&&this.currentSubtitleStream&&Array.isArray(e.segments)){var r=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),r?r.map((function(e){return{sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:t.currentSubtitleStream.lang}})):void 0}}},{key:"switchSubtitle",value:function(e){var t=this.subtitleStreams.find((function(t){return t.lang===e})),r=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,r.segments=[])}},{key:"_clearSegments",value:function(e,t){for(var r=0,i=this.segments,a=0,n=i.length;a=e){r=a;break}return r>t&&(r=t),r&&(this.segments=this.segments.slice(r),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(r))),t-r}},{key:"_updateSegments",value:function(e,t){var r=t.segments;if(this.live){var i=r[r.length-1],a=(null==i?void 0:i.sn)||-1;if(ao[0].cc&&o.forEach((function(e){return e.cc+=l}))}return t.endSN=e.endSN,t.segments=r.concat(o),o}}else t.segments=e.segments}}])}(),LA=function(){function e(t){S(this,e),this.hls=t,this.player=t.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}return w(e,[{key:"destroy",value:function(){this.reset()}},{key:"lastSegment",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}},{key:"currentSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}},{key:"nextSegment",get:function(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}},{key:"currentSegments",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}},{key:"currentSubtitleEndSn",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}},{key:"liveEdge",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}},{key:"totalDuration",get:function(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}},{key:"seekRange",get:function(){var e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}},{key:"isEmpty",get:function(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}},{key:"isLive",get:function(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}},{key:"hasSubtitle",get:function(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}},{key:"getAudioSegment",value:function(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}},{key:"moveSegmentPointer",value:function(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=Cn(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debug.log(this.TAG_NAME,"moveSegmentPointer() and param pos is ".concat(e," and clamp result is ").concat(this._segmentPointer))}},{key:"reset",value:function(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}},{key:"getSegmentByIndex",value:function(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}},{key:"setNextSegmentByIndex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debug.log(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}},{key:"findSegmentIndexByTime",value:function(e){var t=this.currentSegments;if(t){for(var r,i=0,a=t.length;i=r.start&&e0&&void 0!==arguments[0]?arguments[0]:50,t=this.currentStream;if(this.dvrWindow&&t){var r=t.endTime-this.dvrWindow;if(r<=0)this.player.debug.log(this.TAG_NAME,"clearOldSegment() stream.endTime:".concat(t.endTime,", this.dvrWindow:").concat(this.dvrWindow," startTime <= 0"));else{var i=t.segments;if(i.length<=e)this.player.debug.log(this.TAG_NAME,"clearOldSegment() segments.length:".concat(i.length," <= maxPlaylistSize:").concat(e));else{var a=this._segmentPointer;this._segmentPointer=t.clearOldSegment(r,a),this.player.debug.log(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",a,this._segmentPointer),this.player.debug.log(this.TAG_NAME,"currentSegments",this.currentSegments)}}}}},{key:"checkSegmentTrackChange",value:function(e,t){var r=this.findSegmentIndexByTime(e),i=this.getSegmentByIndex(r);if(i&&(i.hasAudio||i.hasVideo)){if(2!==t&&i.hasAudio&&i.hasVideo)return i;if(!(i.end-e>.3)){var a=this.getSegmentByIndex(r+1);return!a||!a.hasAudio&&!a.hasVideo||a.hasAudio===i.hasAudio&&a.hasVideo===i.hasVideo?void 0:a}}}}])}(),PA=function(){function e(t,r){S(this,e),this.hls=t,this.player=r;var i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}return w(e,[{key:"decrypt",value:function(e,t){if(e||t){var r=[];return e&&(r[0]=this._decryptSegment(e)),t&&(r[1]=this._decryptSegment(t)),Promise.all(r)}}},{key:"_decryptSegment",value:function(){var e=A(v().mark((function e(t){var r;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r=t.data,e.t0=t.key,!e.t0){e.next=6;break}return e.next=5,this._decryptData(t.data,t.key,t.keyIv);case 5:r=e.sent;case 6:return e.abrupt("return",t.map?gu(t.map,r):r);case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_decryptData",value:function(){var e=A(v().mark((function e(t,r,i){var a,n;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!this.externalDecryptor){e.next=4;break}return e.next=3,this.externalDecryptor.decrypt(t,r,i);case 3:return e.abrupt("return",e.sent);case 4:if(!this.subtle){e.next=12;break}return e.next=7,this.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt","decrypt"]);case 7:return a=e.sent,e.next=10,this.subtle.decrypt({name:"AES-CBC",iv:i},a,t);case 10:return n=e.sent,e.abrupt("return",new Uint8Array(n));case 12:return t=Pc(t),r=Pc(r),i=Pc(i),e.abrupt("return",function(e){for(var t=e.words,r=e.sigBytes,i=new Uint8Array(r),a=0;a>>2]>>>24-a%4*8&255;return i}(Dc.AES.decrypt({ciphertext:t},r,{iv:i,mode:Dc.mode.CBC})));case 14:case"end":return e.stop()}}),e,this)})));function t(t,r,i){return e.apply(this,arguments)}return t}()}])}(),BA=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.player=e,r._pmtId=-1,r._remainingPacketData=null,r._videoPesData=[],r._audioPesData=[],r._gopId=0,r._videoPid=-1,r._audioPid=-1,r._codecType=jt,r._audioCodecType=Vt,r._vps=null,r._sps=null,r._pps=null,r.TAG_NAME="HlsTsLoader",r._isForHls=!0,r.videoTrack=t.initVideoTrack(),r.audioTrack=t.initAudioTrack(),r._baseDts=-1,r._baseDtsInited=!1,r._basefps=25,r._baseFpsInterval=null,r._tempSampleTsList=[],r._hasAudio=!1,r._hasVideo=!1,r._audioNextPts=void 0,r._videoNextDts=void 0,r._audioTimestampBreak=!1,r._videoTimestampBreak=!1,r._lastAudioExceptionGapDot=0,r._lastAudioExceptionOverlapDot=0,r._lastAudioExceptionLargeGapDot=0,r._isSendAACSeqHeader=!1,r.workerClearTimeout=null,r.workerUrl=null,r.loopWorker=null,r.tempSampleListInfo={},r._isUseWorker()&&r._initLoopWorker(),r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._stopDecodeLoopInterval(),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isForHls=!0,this._isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_parsePES",value:function(e){var t=e[8];if(!(null==t||e.lengthe.length-6)){var a,n,o=e[7];return 192&o&&(a=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&o?(n=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,a-n>54e5&&(a=n)):n=a),{data:e.subarray(9+t),pts:a,dts:n,originalPts:a,originalDts:n}}}}},{key:"_demux",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];r&&(this._pmtId=-1,this.videoTrack=t.initVideoTrack(),this.audioTrack=t.initAudioTrack()),!i||r?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=gu(this._remainingPacketData,e),this._remainingPacketData=null));var a=e.length,n=a%188;n&&(this._remainingPacketData=e.subarray(a-n),a-=n);for(var o=0;o>4>1){if(c=o+5+e[o+4],c===o+188)continue}else c=o+4;switch(l){case 0:s&&(c+=e[c]+1),this._pmtId=(31&e[c+10])<<8|e[c+11];break;case this._pmtId:s&&(c+=e[c]+1);var u=c+3+((15&e[c+1])<<8|e[c+2])-4;for(c+=12+((15&e[c+10])<<8|e[c+11]);c=t)return[];for(var a=[];i>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!a&&5!==t||a&&5===t)break;n.isIFrame=!0,i._gopId++;break;case 6:case 39:case 40:if(!a&&6!==t||a&&6===t)break;return void function(e,t){for(var r=e.length,i=t?2:1,a=0;255===e[i];)a+=255,i++;for(a+=e[i++];255===e[i];)255,i++;if(e[i++],5===a&&r>i+16)for(var n=0;n<16;n++)e[i].toString(16),i++;e.subarray(i)}(function(e){for(var t=e.byteLength,r=[],i=1;i=r)){var a=i,n=[],o=(60&e[i+2])>>>2,s=an[o];if(!s)throw new Error("Invalid sampling index: ".concat(o));for(var l,c,u=1+((192&e[i+2])>>>6),d=(1&e[i+2])<<2|(192&e[i+3])>>>6,h=0,p=dn(s);i+7>5,r-i=r?void 0:e.subarray(i),frames:n,samplingFrequencyIndex:o,sampleRate:s,objectType:u,channelCount:d,originCodec:"mp4a.40.".concat(u)}}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){var r=sn({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debug.log(this.TAG_NAME,"aac seq header","profile: ".concat(t.objectType,", sampleRate:").concat(t.sampleRate,",sampleRateIndex: ").concat(t.samplingFrequencyIndex,", channel: ").concat(t.channelCount)),this._doDecodeByHls(r,nt,0,!1,0)}if(this._isSendAACSeqHeader){var i=[];t.frames.forEach((function(e){var t=e.pts,r=new Uint8Array(e.data.length+2);r.set([175,1],0),r.set(e.data,2);var a={type:nt,pts:t,dts:t,payload:r};i.push(a)})),this.audioTrack.samples=this.audioTrack.samples.concat(i)}else this.player.debug.warn(this.TAG_NAME,"aac seq header not send")}else this.player.debug.warn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}}},{key:"_fix",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t=Math.round(9e4*t);var a=this.videoTrack,n=this.audioTrack,o=a.samples,s=n.samples;if(o.length||s.length){var l=o[0],c=s[0],u=0;if(o.length&&s.length&&(u=l.dts-c.pts),this._baseDtsInited||this._calculateBaseDts(),r&&(this._calculateBaseDts(),this._baseDts-=t),!i){this._videoNextDts=u>0?t+u:t,this._audioNextPts=u>0?t:t-u;var d=l?l.dts-this._baseDts-this._videoNextDts:0,h=c?c.pts-this._baseDts-this._audioNextPts:0;Math.abs(d||h)>Ka&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=t)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(n),this._fixVideo(a);var p=a.samples.concat(n.samples);p=p.map((function(e){return e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e})).sort((function(e,t){return e.dts-t.dts})),p.forEach((function(t){var r=new Uint8Array(t.payload);delete t.payload,e._isUseWorker()?e.loopWorker.postMessage(E(E({},t),{},{payload:r,cmd:"sample"}),[r.buffer]):t.type===ot?e._doDecodeVideo(E(E({},t),{},{payload:r})):t.type===nt&&e._doDecodeAudio(E(E({},t),{},{payload:r}))})),Io(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=!0,this._calcDecodeFps(p))}}},{key:"_isUseWorker",value:function(){return!this.player.isUseMSE()&&this.isForHls()}},{key:"_calculateBaseDts",value:function(){var e=this.audioTrack,t=this.videoTrack,r=e.samples,i=t.samples;if(!r.length&&!i.length)return!1;var a=1/0,n=1/0;r.length&&(e.baseDts=a=r[0].pts),i.length&&(t.baseDts=n=i[0].dts),this._baseDts=Math.min(a,n);var o=n-a;return Number.isFinite(o)&&Math.abs(o)>45e3&&this.player.debug.warn(this.TAG_NAME,"large av first frame gap,\n video pts: ".concat(n,",\n audio pts: ").concat(a,",\n base dts: ").concat(this._baseDts,",\n detect is: ").concat(o)),this._baseDtsInited=!0,!0}},{key:"_resetBaseDtsWhenStreamBreaked",value:function(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}},{key:"_fixAudio",value:function(e){var t=this,r=e.samples;r.length&&(r.forEach((function(e){e.pts-=t._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,r,9e4))}},{key:"_fixVideo",value:function(e){var t=this,r=e.samples;if(r.length){if(r.forEach((function(e){e.dts-=t._baseDts,e.pts-=t._baseDts})),void 0===this._videoNextDts){var i=r[0];this._videoNextDts=i.dts}var a,n=r.length,o=0,s=r[0],l=r[1],c=this._videoNextDts-s.dts;Math.abs(c)>45e3&&(s.dts+=c,s.pts+=c,this.player.debug.warn(this.TAG_NAME,"large video gap between chunk,\n next dts is ".concat(this._videoNextDts,",\n first dts is ").concat(s.dts,",\n next dts is ").concat(l.dts,",\n duration is ").concat(c)),l&&Math.abs(l.dts-s.dts)>Ka&&(this._videoTimestampBreak=!0,r.forEach((function(e,t){0!==t&&(e.dts+=c,e.pts+=c)}))));var u=e.samples[0],d=e.samples[n-1];a=1===n?9e3:Math.floor((d.dts-u.dts)/(n-1));for(var h=0;hKa||o<0){this._videoTimestampBreak=!0,o=this._audioTimestampBreak?a:Math.max(o,2700);var m=this._audioNextPts||0;f&&f.dts>m&&(o=a),this.player.debug.warn(this.TAG_NAME,"large video gap between frames,\n time is ".concat(p/e.timescale,",\n dts is ").concat(p,",\n origin dts is ").concat(r[h].originalDts,",\n next dts is ").concat(this._videoNextDts,",\n sample Duration is ").concat(o," ,\n ref Sample DurationInt is ").concat(a))}r[h].duration=o,this._videoNextDts+=o}}}},{key:"_doFixAudioInternal",value:function(e,t,r){e.sampleDuration||(e.sampleDuration=dn(e.timescale,r));var i=e.sampleDuration;if(void 0===this._audioNextPts){var a=t[0];this._audioNextPts=a.pts}for(var n=0;n=3*i&&l<=Ja&&!Nn()){un(e.codec,e.channelCount)||t[0].data.subarray();var c=Math.floor(l/i);Math.abs(s.pts-this._lastAudioExceptionGapDot)>qa&&(this._lastAudioExceptionGapDot=s.pts),this.player.debug.warn(this.TAG_NAME,"audio gap detected,\n pts is ".concat(t.pts,",\n originPts is ").concat(t.originalPts,",\n count is ").concat(c,",\n nextPts is ").concat(o,",\n ref sample duration is ").concat(i));for(var u=0;u=-9e4?(Math.abs(s.pts-this._lastAudioExceptionOverlapDot)>qa&&(this._lastAudioExceptionOverlapDot=s.pts,this.player.debug.warn(this.TAG_NAME,"audio overlap detected,\n pts is ".concat(s.pts,",\n originPts is ").concat(s.originalPts,",\n nextPts is ").concat(o,",\n ref sample duration is ").concat(i))),t.splice(n,1),n--):(Math.abs(l)>=Ja&&(this._audioTimestampBreak=!0,Math.abs(s.pts-this._lastAudioExceptionLargeGapDot)>qa&&(this._lastAudioExceptionLargeGapDot=s.pts,this.player.debug.warn(this.TAG_NAME,"large audio gap detected,\n time is ".concat(s.pts/1e3,"\n pts is ").concat(s.pts,",\n originPts is ").concat(s.originalPts,",\n nextPts is ").concat(o,",\n sample duration is ").concat(l,"\n ref sample duration is ").concat(i)))),s.dts=s.pts=o,this._audioNextPts+=i)}}},{key:"_calcDecodeFps",value:function(e){var t=To(e.map((function(e){return{ts:e.dts||e.pts,type:e.type}})),ot);t&&(this.player.debug.log(this.TAG_NAME,"_calcDecodeFps() video fps is ".concat(t,", update base fps is ").concat(this._basefps)),this._basefps=t),this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps})}},{key:"_initLoopWorker",value:function(){var e=this;this.player.debug.log(this.TAG_NAME,"_initLoopWorker()");var t=No(function(){var e=1,t=2,r=new(function(){function r(){S(this,r),this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}return w(r,[{key:"destroy",value:function(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}},{key:"updateBaseFps",value:function(e){this.baseFps=e,this._clearInterval(),this._startInterval()}},{key:"pushSample",value:function(e){delete e.cmd,this.allSampleList.push(e)}},{key:"_startInterval",value:function(){var e=this,t=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((function(){var r=(new Date).getTime();e.preLoopTimestamp||(e.preLoopTimestamp=r),e.startBpsTime||(e.startBpsTime=r);var i=r-e.preLoopTimestamp;i>2*t&&console.warn("JbPro:[TsLoader LoopWorker] loop interval is ".concat(i,"ms, more than ").concat(t," * 2ms")),e._loop(),e.preLoopTimestamp=(new Date).getTime(),e.startBpsTime&&r-e.startBpsTime>=1e3&&(e._calcSampleList(),e.startBpsTime=r)}),t)}},{key:"_clearInterval",value:function(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}},{key:"_calcSampleList",value:function(){var r={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((function(i){i.type===t?(r.videoListLength++,i.duration&&(r.buferredDuration+=Math.round(i.duration/90))):i.type===e&&r.audioListLength++})),postMessage(E({cmd:"sampleListInfo"},r))}},{key:"_loop",value:function(){var r=null;if(this.allSampleList.length)if(r=this.allSampleList.shift(),r.type===t){postMessage(E({cmd:"decodeVideo"},r),[r.payload.buffer]);for(var i=this.allSampleList[0];i&&i.type===e;)r=this.allSampleList.shift(),postMessage(E({cmd:"decodeAudio"},r),[r.payload.buffer]),i=this.allSampleList[0]}else r.type===e&&(postMessage(E({cmd:"decodeAudio"},r),[r.payload.buffer]),this.allSampleList.length&&this.allSampleList[0].type===t&&(r=this.allSampleList.shift(),postMessage(E({cmd:"decodeVideo"},r),[r.payload.buffer])))}}])}());self.onmessage=function(e){var t=e.data;switch(t.cmd){case"updateBaseFps":r.updateBaseFps(t.baseFps);break;case"sample":r.pushSample(t);break;case"destroy":r.destroy(),r=null}}}.toString()),r=new Blob([t],{type:"text/javascript"}),i=URL.createObjectURL(r),a=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((function(){window.URL.revokeObjectURL(e.workerUrl),e.workerUrl=null,e.workerClearTimeout=null}),_e),a.onmessage=function(t){var r=t.data;switch(r.cmd){case"decodeVideo":e._doDecodeVideo(r);break;case"decodeAudio":e._doDecodeAudio(r);break;case"sampleListInfo":e.tempSampleListInfo=r}},this.loopWorker=a}},{key:"_postMessageToLoopWorker",value:function(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage(E({cmd:e},t)):this.player.debug.warn(this.TAG_NAME,"loop worker is not init, can not post message"))}},{key:"_doDecodeAudio",value:function(e){var t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});var r=t;Bo(this.player._opt.m7sCryptoAudio)&&(r=this.cryptoPayloadAudio(t)),this.isForHls()?this._doDecodeByHls(r,nt,e.dts,!1,0):this._doDecodeByTs(r,nt,e.dts,!1,0)}},{key:"_doDecodeVideo",value:function(e){var t=new Uint8Array(e.payload),r=null;r=e.isHevc?ol(t,e.isIFrame):Js(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:r.byteLength});var i=e.pts-e.dts,a=this.cryptoPayload(r,e.isIFrame);this.isForHls()?this._doDecodeByHls(a,ot,e.dts,e.isIFrame,i):this._doDecodeByTs(a,ot,e.dts,e.isIFrame,i)}},{key:"_stopDecodeLoopInterval",value:function(){this._baseFpsInterval&&(clearInterval(this._baseFpsInterval),this._baseFpsInterval=null)}},{key:"getBuferredDuration",value:function(){return this.tempSampleListInfo.buferredDuration||0}},{key:"getSampleListLength",value:function(){return this.tempSampleListInfo.allListLength||0}},{key:"getSampleAudioListLength",value:function(){return this.tempSampleListInfo.audioListLength||0}},{key:"getSampleVideoListLength",value:function(){return this.tempSampleListInfo.videoListLength||0}},{key:"isForHls",value:function(){return this._isForHls}},{key:"getInputByteLength",value:function(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}],[{key:"initVideoTrack",value:function(){return{samples:[]}}},{key:"initAudioTrack",value:function(){return{samples:[]}}},{key:"probe",value:function(e){return!!e.length&&71===e[0]&&71===e[188]&&71===e[376]}}])}(Qc);function IA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function MA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function UA(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=Math.pow(2,32);return MA(e,t)*r+MA(e,t+4)}var FA="aac",OA="g7110a",NA="g7110m",jA="avc",zA="hevc",GA=function(){function e(){S(this,e)}return w(e,null,[{key:"getFrameDuration",value:function(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}},{key:"getRateIndexByRate",value:function(t){return e.FREQ.indexOf(t)}}])}();function HA(e,t,r,i,a,n){var o,s,l,c=[],u=null==a?void 0:a.entries,d=t.entries,h=i.entries,p=r.entrySizes,f=null==n?void 0:n.entries;f&&(o={},f.forEach((function(e){o[e-1]=!0}))),u&&(s=[],u.forEach((function(e){for(var t=e.count,r=e.offset,i=0;i=k&&(A++,k=d[A+1]?d[A+1].firstChunk-1:1/0),_+=d[A].samplesPerChunk)})),c}function VA(e,t){return e.dataReferenceIndex=IA(t,6),e.width=IA(t,24),e.height=IA(t,26),e.horizresolution=MA(t,28),e.vertresolution=MA(t,32),e.frameCount=IA(t,40),e.depth=IA(t,74),78}function WA(e,t){return e.dataReferenceIndex=IA(t,6),e.channelCount=IA(t,16),e.sampleSize=IA(t,18),e.sampleRate=MA(t,24)/65536,28}function JA(e,t,r){if(e){if(e.size!==e.data.length)throw new Error("box ".concat(e.type," size !== data.length"));var i={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(i.version=e.data[e.headerSize],i.flags=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),i.headerSize+=4),r(i,e.data.subarray(i.headerSize),i.start+i.headerSize),i}}su(GA,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);var qA=function(e,t,r){for(var i=String(r),a=t>>0,n=Math.ceil(a/i.length),o=[],s=String(e);n--;)o.push(i);return o.join("").substring(0,a-s.length)+s},KA=function(){for(var e=[],t=arguments.length,r=new Array(t),i=0;i2&&void 0!==arguments[2]?arguments[2]:0,a=[];if(!t)return a;for(var n=0,o="",s=0;t.length>7;){if(n=MA(t),o=String.fromCharCode.apply(null,t.subarray(4,8)),s=8,1===n?(n=UA(t,8),s+=8):n||(n=t.length),!r[0]||o===r[0]){var l=t.subarray(0,n);if(!(r.length<2))return e.findBox(l.subarray(s),r.slice(1),i+s);a.push({start:i,size:n,headerSize:s,type:o,data:l})}i+=n,t=t.subarray(n)}return a}},{key:"tfhd",value:function(e){return JA(e,!0,(function(e,t){e.trackId=MA(t);var r=4,i=1&e.flags,a=2&e.flags,n=8&e.flags,o=16&e.flags,s=32&e.flags;i&&(r+=4,e.baseDataOffset=MA(t,r),r+=4),a&&(e.sampleDescriptionIndex=MA(t,r),r+=4),n&&(e.defaultSampleDuration=MA(t,r),r+=4),o&&(e.defaultSampleSize=MA(t,r),r+=4),s&&(e.defaultSampleFlags=MA(t,r))}))}},{key:"sidx",value:function(e){return JA(e,!0,(function(e,t){var r=0;e.reference_ID=MA(t,r),r+=4,e.timescale=MA(t,r),r+=4,0===e.version?(e.earliest_presentation_time=MA(t,r),r+=4,e.first_offset=MA(t,r),r+=4):(e.earliest_presentation_time=UA(t,r),r+=8,e.first_offset=UA(t,r),r+=8),r+=2,e.references=[];var i=IA(t,r);r+=2;for(var a=0;a>31&1,n.referenced_size=2147483647&o,n.subsegment_duration=MA(t,r),r+=4,o=MA(t,r),r+=4,n.starts_with_SAP=o>>31&1,n.SAP_type=o>>28&7,n.SAP_delta_time=268435455&o}}))}},{key:"moov",value:function(t){return JA(t,!1,(function(t,r,i){t.mvhd=e.mvhd(e.findBox(r,["mvhd"],i)[0]),t.trak=e.findBox(r,["trak"],i).map((function(t){return e.trak(t)})),t.pssh=e.pssh(e.findBox(r,["pssh"],i)[0])}))}},{key:"mvhd",value:function(e){return JA(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=MA(t,16),e.duration=UA(t,20),r+=28):(e.timescale=MA(t,8),e.duration=MA(t,12),r+=16),e.nextTrackId=MA(t,r+76)}))}},{key:"trak",value:function(t){return JA(t,!1,(function(t,r,i){t.tkhd=e.tkhd(e.findBox(r,["tkhd"],i)[0]),t.mdia=e.mdia(e.findBox(r,["mdia"],i)[0])}))}},{key:"tkhd",value:function(e){return JA(e,!0,(function(e,t){var r=0;1===e.version?(e.trackId=MA(t,16),e.duration=UA(t,24),r+=32):(e.trackId=MA(t,8),e.duration=MA(t,16),r+=20),e.width=MA(t,r+52),e.height=MA(t,r+56)}))}},{key:"mdia",value:function(t){return JA(t,!1,(function(t,r,i){t.mdhd=e.mdhd(e.findBox(r,["mdhd"],i)[0]),t.hdlr=e.hdlr(e.findBox(r,["hdlr"],i)[0]),t.minf=e.minf(e.findBox(r,["minf"],i)[0])}))}},{key:"mdhd",value:function(e){return JA(e,!0,(function(e,t){var r=0;1===e.version?(e.timescale=MA(t,16),e.duration=UA(t,20),r+=28):(e.timescale=MA(t,8),e.duration=MA(t,12),r+=16);var i=IA(t,r);e.language=String.fromCharCode(96+(i>>10&31),96+(i>>5&31),96+(31&i))}))}},{key:"hdlr",value:function(e){return JA(e,!0,(function(e,t){0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}},{key:"minf",value:function(t){return JA(t,!1,(function(t,r,i){t.vmhd=e.vmhd(e.findBox(r,["vmhd"],i)[0]),t.smhd=e.smhd(e.findBox(r,["smhd"],i)[0]),t.stbl=e.stbl(e.findBox(r,["stbl"],i)[0])}))}},{key:"vmhd",value:function(e){return JA(e,!0,(function(e,t){e.graphicsmode=IA(t),e.opcolor=[IA(t,2),IA(t,4),IA(t,6)]}))}},{key:"smhd",value:function(e){return JA(e,!0,(function(e,t){e.balance=IA(t)}))}},{key:"stbl",value:function(t){return JA(t,!1,(function(t,r,i){var a,n,o;t.stsd=e.stsd(e.findBox(r,["stsd"],i)[0]),t.stts=e.stts(e.findBox(r,["stts"],i)[0]),t.ctts=e.ctts(e.findBox(r,["ctts"],i)[0]),t.stsc=e.stsc(e.findBox(r,["stsc"],i)[0]),t.stsz=e.stsz(e.findBox(r,["stsz"],i)[0]),t.stco=e.stco(e.findBox(r,["stco"],i)[0]),t.stco||(t.co64=e.co64(e.findBox(r,["co64"],i)[0]),t.stco=t.co64);var s=null===(a=t.stsd.entries[0])||void 0===a||null===(n=a.sinf)||void 0===n||null===(o=n.schi)||void 0===o?void 0:o.tenc.default_IV_size;t.stss=e.stss(e.findBox(r,["stss"],i)[0]),t.senc=e.senc(e.findBox(r,["senc"],i)[0],s)}))}},{key:"senc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return JA(e,!0,(function(e,r){var i=0,a=MA(r,i);i+=4,e.samples=[];for(var n=0;n0){var o=MA(t,a);a+=4;for(var s=0;s<(""+o).length;s++)for(var l=0;l<16;l++){var c=t[a];a+=1,r.push(KA(c))}}var u=MA(t,a);e.data_size=u,a+=4,e.kid=r,e.system_id=i,e.buffer=t}))}},{key:"stsd",value:function(t){return JA(t,!0,(function(t,r,i){t.entryCount=MA(r),t.entries=e.findBox(r.subarray(4),[],i+4).map((function(t){switch(t.type){case"avc1":case"avc2":case"avc3":case"avc4":return e.avc1(t);case"hvc1":case"hev1":return e.hvc1(t);case"mp4a":return e.mp4a(t);case"alaw":case"ulaw":return e.alaw(t);case"enca":return JA(t,!1,(function(t,r,i){t.channelCount=IA(r,16),t.samplesize=IA(r,18),t.sampleRate=MA(r,24)/65536,r=r.subarray(28),t.sinf=e.sinf(e.findBox(r,["sinf"],i)[0]),t.esds=e.esds(e.findBox(r,["esds"],i)[0])}));case"encv":return JA(t,!1,(function(t,r,i){t.width=IA(r,24),t.height=IA(r,26),t.horizresolution=MA(r,28),t.vertresolution=MA(r,32),r=r.subarray(78),t.sinf=e.sinf(e.findBox(r,["sinf"],i)[0]),t.avcC=e.avcC(e.findBox(r,["avcC"],i)[0]),t.hvcC=e.hvcC(e.findBox(r,["hvcC"],i)[0]),t.pasp=e.pasp(e.findBox(r,["pasp"],i)[0])}))}})).filter(Boolean)}))}},{key:"tenc",value:function(e){return JA(e,!1,(function(e,t){var r=6;e.default_IsEncrypted=t[r],r+=1,e.default_IV_size=t[r],r+=1,e.default_KID=[];for(var i=0;i<16;i++)e.default_KID.push(KA(t[r])),r+=1}))}},{key:"schi",value:function(t){return JA(t,!1,(function(t,r,i){t.tenc=e.tenc(e.findBox(r,["tenc"],i)[0])}))}},{key:"sinf",value:function(t){return JA(t,!1,(function(t,r,i){t.schi=e.schi(e.findBox(r,["schi"],i)[0]),t.frma=e.frma(e.findBox(r,["frma"],i)[0])}))}},{key:"frma",value:function(e){return JA(e,!1,(function(e,t){e.data_format="";for(var r=0;r<4;r++)e.data_format+=String.fromCharCode(t[r])}))}},{key:"avc1",value:function(t){return JA(t,!1,(function(t,r,i){var a=VA(t,r),n=r.subarray(a);i+=a,t.avcC=e.avcC(e.findBox(n,["avcC"],i)[0]),t.pasp=e.pasp(e.findBox(n,["pasp"],i)[0])}))}},{key:"avcC",value:function(e){return JA(e,!1,(function(e,t){e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){for(var t,r="avc1.",i=0;i<3;i++)t=e[i].toString(16),t.length<2&&(t="0".concat(t)),r+=t;return r}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];for(var r=6,i=0;i>6,t.generalTierFlag=(32&i)>>5,t.generalProfileIdc=31&i,t.generalProfileCompatibility=MA(r,2),t.generalConstraintIndicatorFlags=r.subarray(6,12),t.generalLevelIdc=r[12],t.avgFrameRate=IA(r,19),t.numOfArrays=r[22],t.vps=[],t.sps=[],t.pps=[];for(var a=23,n=0,o=0,s=0,l=0;l>3;return 31===s&&o.length>=2&&(s=32+((7&o[0])<<3)+((224&o[1])>>5)),e.objectType=s,e.codec+=s.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[r].toString(16)+".").padStart(3,"0"),t=t.subarray(r+13)}}}))}},{key:"alaw",value:function(e){return JA(e,!1,(function(e,t){WA(e,t)}))}},{key:"stts",value:function(e){return JA(e,!0,(function(e,t){for(var r=MA(t),i=[],a=4,n=0;no&&1&i&&(e.dataOffset=-(1+~MA(t,o)),o+=4),a>o&&4&i&&(e.firstSampleFlags=MA(t,o),o+=4),e.samples=[],a>o)for(var s,l=0;l>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}},{key:"moovToTrack",value:function(e,t,r){var i,a,n=e.trak;if(n&&n.length){var o=n.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),s=n.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(o&&t){var l,c,u,d,h,p,f,m=t,g=null===(l=o.tkhd)||void 0===l?void 0:l.trackId;null!=g&&(m.id=o.tkhd.trackId),m.tkhdDuration=o.tkhd.duration,m.mvhdDurtion=e.mvhd.duration,m.mvhdTimecale=e.mvhd.timescale,m.timescale=m.formatTimescale=o.mdia.mdhd.timescale,m.duration=o.mdia.mdhd.duration||m.mvhdDurtion/m.mvhdTimecale*m.timescale;var y,v,A,b,_,k,w,S,E=o.mdia.minf.stbl.stsd.entries[0];if(m.width=E.width,m.height=E.height,E.pasp&&(m.sarRatio=[E.pasp.hSpacing,E.pasp.vSpacing]),E.hvcC)m.codecType=zA,m.codec=E.hvcC.codec,m.vps=E.hvcC.vps,m.sps=E.hvcC.sps,m.pps=E.hvcC.pps,m.hvcC=E.hvcC.data;else{if(!E.avcC)throw new Error("unknown video stsd entry");m.codecType=jA,m.codec=E.avcC.codec,m.sps=E.avcC.sps,m.pps=E.avcC.pps}m.present=!0,m.ext={},m.ext.stss=null===(c=o.mdia)||void 0===c||null===(u=c.minf)||void 0===u||null===(d=u.stbl)||void 0===d?void 0:d.stss,m.ext.ctts=null===(h=o.mdia)||void 0===h||null===(p=h.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,E&&"encv"===E.type&&(m.isVideoEncryption=!0,E.default_KID=null===(y=E.sinf)||void 0===y||null===(v=y.schi)||void 0===v?void 0:v.tenc.default_KID,E.default_IsEncrypted=null===(A=E.sinf)||void 0===A||null===(b=A.schi)||void 0===b?void 0:b.tenc.default_IsEncrypted,E.default_IV_size=null===(_=E.sinf)||void 0===_||null===(k=_.schi)||void 0===k?void 0:k.tenc.default_IV_size,m.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,E.data_format=null===(w=E.sinf)||void 0===w||null===(S=w.frma)||void 0===S?void 0:S.data_format,m.useEME=e.useEME,m.kidValue=e.kidValue,m.pssh=e.pssh,m.encv=E)}if(s&&r){var T,C,x,R,D,L,P,B,I,M=r,U=null===(T=s.tkhd)||void 0===T?void 0:T.trackId;null!=U&&(M.id=s.tkhd.trackId),M.tkhdDuration=s.tkhd.duration,M.mvhdDurtion=e.mvhd.duration,M.mvhdTimecale=e.mvhd.timescale,M.timescale=M.formatTimescale=s.mdia.mdhd.timescale,M.duration=s.mdia.mdhd.duration||M.mvhdDurtion/M.mvhdTimecale*M.timescale;var F,O,N,j,z,G,H,V,W=s.mdia.minf.stbl.stsd.entries[0];switch(M.sampleSize=W.sampleSize,M.sampleRate=W.sampleRate,M.channelCount=W.channelCount,M.present=!0,W.type){case"alaw":M.codecType=M.codec=OA,M.sampleRate=8e3;break;case"ulaw":M.codecType=M.codec=NA,M.sampleRate=8e3;break;default:M.codecType=FA,M.sampleDuration=GA.getFrameDuration(M.sampleRate,M.timescale),M.sampleRateIndex=GA.getRateIndexByRate(M.sampleRate),M.objectType=(null===(i=W.esds)||void 0===i?void 0:i.objectType)||2,W.esds&&(M.config=Array.from(W.esds.config)),M.codec=(null===(a=W.esds)||void 0===a?void 0:a.codec)||"mp4a.40.2"}M.sampleDuration=GA.getFrameDuration(M.sampleRate,M.timescale),M.objectType=(null===(C=W.esds)||void 0===C?void 0:C.objectType)||2,W.esds&&(W.esds.config?M.config=Array.from(W.esds.config):console.warn("esds config is null")),M.codec=(null===(x=W.esds)||void 0===x?void 0:x.codec)||"mp4a.40.2",M.sampleRateIndex=GA.getRateIndexByRate(M.sampleRate),M.ext={},M.ext.stss=null===(R=s.mdia)||void 0===R||null===(D=R.minf)||void 0===D||null===(L=D.stbl)||void 0===L?void 0:L.stss,M.ext.ctts=null===(P=s.mdia)||void 0===P||null===(B=P.minf)||void 0===B||null===(I=B.stbl)||void 0===I?void 0:I.ctts,M.present=!0,W&&"enca"===W.type&&(M.isAudioEncryption=!0,W.data_format=null===(F=W.sinf)||void 0===F||null===(O=F.frma)||void 0===O?void 0:O.data_format,W.default_KID=null===(N=W.sinf)||void 0===N||null===(j=N.schi)||void 0===j?void 0:j.tenc.default_KID,W.default_IsEncrypted=null===(z=W.sinf)||void 0===z||null===(G=z.schi)||void 0===G?void 0:G.tenc.default_IsEncrypted,W.default_IV_size=null===(H=W.sinf)||void 0===H||null===(V=H.schi)||void 0===V?void 0:V.tenc.default_IV_size,M.audioSenc=s.mdia.minf.stbl.senc&&s.mdia.minf.stbl.senc.samples,M.useEME=e.useEME,M.kidValue=e.kidValue,M.enca=W)}if(r&&(r.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!r&&r.isAudioEncryption),null!=t&&t.encv||null!=r&&r.enca){var J,q,K=null==t||null===(J=t.encv)||void 0===J?void 0:J.default_KID,Y=null==r||null===(q=r.enca)||void 0===q?void 0:q.default_KID,Q=K||Y?(K||Y).join(""):null;t&&(t.kid=Q),r&&(r.kid=Q)}return t&&(t.flags=3841),r&&(r.flags=1793),{videoTrack:t,audioTrack:r}}}},{key:"evaluateDefaultDuration",value:function(e,t,r){var i,a=null==t||null===(i=t.samples)||void 0===i?void 0:i.length;return a?1024*a/t.timescale*e.timescale/r:1024}},{key:"moofToSamples",value:function(t,r,i){var a={};return t.mfhd&&(r&&(r.sequenceNumber=t.mfhd.sequenceNumber),i&&(i.sequenceNumber=t.mfhd.sequenceNumber)),t.traf.forEach((function(t){var n=t.tfhd,o=t.tfdt,s=t.trun;if(n&&s){o&&(r&&r.id===n.trackId&&(r.baseMediaDecodeTime=o.baseMediaDecodeTime),i&&i.id===n.trackId&&(i.baseMediaDecodeTime=o.baseMediaDecodeTime));var l=n.defaultSampleSize||0,c=n.defaultSampleDuration||e.evaluateDefaultDuration(r,i,s.samples.length||s.sampleCount),u=s.dataOffset||0,d=0,h=-1;if(!s.samples.length&&s.sampleCount){a[n.trackId]=[];for(var p=0;p>>0!=65536}).keyframe&&(h++,e.gopId=h),d+=e.duration,u+=e.size,e}))}})),a}},{key:"moovToSamples",value:function(e){var t=e.trak;if(t&&t.length){var r=t.find((function(e){var t,r;return"vide"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)})),i=t.find((function(e){var t,r;return"soun"===(null===(t=e.mdia)||void 0===t||null===(r=t.hdlr)||void 0===r?void 0:r.handlerType)}));if(r||i){var a,n;if(r){var o,s,l=null===(o=r.mdia)||void 0===o||null===(s=o.minf)||void 0===s?void 0:s.stbl;if(!l)return;var c=l.stts,u=l.stsc,d=l.stsz,h=l.stco,p=l.stss,f=l.ctts;if(!(c&&u&&d&&h&&p))return;a=HA(c,u,d,h,f,p)}if(i){var m,g,y,v=null===(m=i.mdia)||void 0===m||null===(g=m.minf)||void 0===g?void 0:g.stbl;if(!v)return;var A=null===(y=i.mdia.mdhd)||void 0===y?void 0:y.timescale,b=v.stts,_=v.stsc,k=v.stsz,w=v.stco;if(!(A&&b&&_&&k&&w))return;n=HA(b,_,k,w)}return{videoSamples:a,audioSamples:n}}}}}])}(),QA=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.player=e,r.TAG_NAME="HlsFmp4Loader",r.tempSampleListInfo={},r.isInitVideo=!1,r.isInitAudio=!1,r.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},r.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},r.workerClearTimeout=null,r.workerUrl=null,r.loopWorker=null,r._hasCalcFps=!1,r._basefps=25,r.player.isUseMSE()||r._initLoopWorker(),e.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"demux",value:function(e,t){var r=this,i=this.audioTrack,a=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],a.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),Io(this.isInitAudio)){var n=YA.findBox(t,["moov"])[0];if(!n)return void this.player.debug.error(this.TAG_NAME,"cannot found moov box");YA.moovToTrack(YA.moov(n),null,i),this.checkInitAudio()&&(this.player.debug.log(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}var o=YA.findBox(t,["moof"])[0];if(o){var s=YA.moofToSamples(YA.moof(o),null,i)[i.id],l=i.baseMediaDecodeTime;if(s){var c=o.start;s.map((function(e){e.offset+=c;var r=t.subarray(e.offset,e.offset+e.size),a=e.dts+l,n=new Uint8Array(r.length+2);n.set([175,1],0),n.set(r,2),i.samples.push({type:nt,pts:a,dts:a,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),Io(this.isInitVideo)&&Io(this.isInitAudio)){var u=YA.findBox(e,["moov"])[0];if(!u)throw new Error("cannot found moov box");if(YA.moovToTrack(YA.moov(u),a,i),Io(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debug.log(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debug.log(this.TAG_NAME,"video init success");var d=null;a.codecType===Ei?a.sps.length&&a.vps.length&&a.pps.length&&(d=nl({sps:a.sps[0],pps:a.pps[0],vps:a.vps[0]})):a.sps.length&&a.pps.length&&(d=Ws({sps:a.sps[0],pps:a.pps[0]})),d&&(this.player.debug.log(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(d,ot,0,!0,0))}}var h=YA.findBox(e,["moof"])[0];if(h){var p=YA.moofToSamples(YA.moof(h),a,i),f=a.baseMediaDecodeTime,m=i.baseMediaDecodeTime,g=h.start;Object.keys(p).forEach((function(t){a.id==t?p[t].map((function(t){t.offset+=g;var r={type:ot,pts:(t.pts||t.dts)+f,dts:t.dts+f,units:[],payload:null,isIFrame:!1};r.duration=t.duration,r.gopId=t.gopId,t.keyframe&&(r.isIFrame=!0);var i=e.subarray(t.offset,t.offset+t.size);r.payload=i,a.samples.push(r)})):i.id==t&&p[t].map((function(t){t.offset+=g;var r=e.subarray(t.offset,t.offset+t.size),a=t.dts+m,n=new Uint8Array(r.length+2);n.set([175,1],0),n.set(r,2),i.samples.push({type:nt,pts:a,dts:a,payload:n,duration:t.duration,size:n.byteLength})}))}))}}var y=a.samples.concat(i.samples);y.sort((function(e,t){return e.dts-t.dts})),y.forEach((function(e){var t=new Uint8Array(e.payload);delete e.payload,r.player.isUseMSE()?e.type===ot?r._doDecodeVideo(E(E({},e),{},{payload:t})):e.type===nt&&r._doDecodeAudio(E(E({},e),{},{payload:t})):r.loopWorker.postMessage(E(E({},e),{},{payload:t,cmd:"sample"}),[t.buffer])})),Io(this._hasCalcFps)&&(this._hasCalcFps=!0,this._calcDecodeFps(y))}},{key:"checkInitAudio",value:function(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}},{key:"checkInitVideo",value:function(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}},{key:"_sendAccADTSHeader",value:function(e){var t=sn({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,nt,0,!0,0)}},{key:"_calcDecodeFps",value:function(e){var t=To(e.map((function(e){return{ts:e.dts||e.pts,type:e.type}})),ot);t&&(this.player.debug.log(this.TAG_NAME,"_calcDecodeFps() video fps is ".concat(t,", update base fps is ").concat(this._basefps)),this._basefps=t),this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps})}},{key:"_initLoopWorker",value:function(){var e=this;this.player.debug.log(this.TAG_NAME,"_initLoopWorker()");var t=No(function(){var e=1,t=2,r=new(function(){function r(){S(this,r),this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}return w(r,[{key:"destroy",value:function(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}},{key:"updateBaseFps",value:function(e){this.baseFps=e,this._clearInterval(),this._startInterval()}},{key:"pushSample",value:function(e){delete e.cmd,this.allSampleList.push(e)}},{key:"_startInterval",value:function(){var e=this,t=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((function(){var r=(new Date).getTime();e.preLoopTimestamp||(e.preLoopTimestamp=r),e.startBpsTime||(e.startBpsTime=r);var i=r-e.preLoopTimestamp;i>2*t&&console.warn("JbPro:[HlsFmp4Loader LoopWorker] loop interval is ".concat(i,"ms, more than ").concat(t," * 2ms")),e._loop(),e.preLoopTimestamp=(new Date).getTime(),e.startBpsTime&&r-e.startBpsTime>=1e3&&(e._calcSampleList(),e.startBpsTime=r)}),t)}},{key:"_clearInterval",value:function(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}},{key:"_calcSampleList",value:function(){var r={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((function(i){i.type===t?(r.videoListLength++,i.duration&&(r.buferredDuration+=i.duration)):i.type===e&&r.audioListLength++})),postMessage(E({cmd:"sampleListInfo"},r))}},{key:"_loop",value:function(){var r=null;if(this.allSampleList.length)if(r=this.allSampleList.shift(),r.type===t){postMessage(E({cmd:"decodeVideo"},r),[r.payload.buffer]);for(var i=this.allSampleList[0];i&&i.type===e;)r=this.allSampleList.shift(),postMessage(E({cmd:"decodeAudio"},r),[r.payload.buffer]),i=this.allSampleList[0]}else r.type===e&&(postMessage(E({cmd:"decodeAudio"},r),[r.payload.buffer]),this.allSampleList.length&&this.allSampleList[0].type===t&&(r=this.allSampleList.shift(),postMessage(E({cmd:"decodeVideo"},r),[r.payload.buffer])))}}])}());self.onmessage=function(e){var t=e.data;switch(t.cmd){case"updateBaseFps":r.updateBaseFps(t.baseFps);break;case"sample":r.pushSample(t);break;case"destroy":r.destroy(),r=null}}}.toString()),r=new Blob([t],{type:"text/javascript"}),i=URL.createObjectURL(r),a=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((function(){window.URL.revokeObjectURL(e.workerUrl),e.workerUrl=null,e.workerClearTimeout=null}),_e),a.onmessage=function(t){var r=t.data;switch(r.cmd){case"decodeVideo":e._doDecodeVideo(r);break;case"decodeAudio":e._doDecodeAudio(r);break;case"sampleListInfo":e.tempSampleListInfo=r}},this.loopWorker=a}},{key:"_postMessageToLoopWorker",value:function(e,t){this.player.isUseMSE()||(this.loopWorker?this.loopWorker.postMessage(E({cmd:e},t)):this.player.debug.warn(this.TAG_NAME,"loop worker is not init, can not post message"))}},{key:"_doDecodeAudio",value:function(e){var t=new Uint8Array(e.payload);this._doDecodeByHls(t,nt,e.dts,!1,0)}},{key:"_doDecodeVideo",value:function(e){var t=new Uint8Array(e.payload),r=null;r=e.isHevc?ol(t,e.isIFrame):Js(t,e.isIFrame),this.player.updateStats({dts:e.dts});var i=e.pts-e.dts;this._doDecodeByHls(r,ot,e.dts,e.isIFrame,i)}},{key:"getBuferredDuration",value:function(){return this.tempSampleListInfo.buferredDuration||0}},{key:"getSampleListLength",value:function(){return this.tempSampleListInfo.allListLength||0}},{key:"getSampleAudioListLength",value:function(){return this.tempSampleListInfo.audioListLength||0}},{key:"getSampleVideoListLength",value:function(){return this.tempSampleListInfo.videoListLength||0}}])}(Qc),XA=function(){function e(t,r){S(this,e),this.hls=t,this.player=this.hls.player,this.isMP4=r,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=r?new QA(this.hls.player):new BA(this.hls.player),this.player.debug.log(this.TAG_NAME,"init and isMP4 is ".concat(r))}return w(e,[{key:"destroy",value:function(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}},{key:"transmux",value:function(e,t,r,i,a,n){this.player.debug.log(this.TAG_NAME,"transmux videoChunk:".concat(e&&e.byteLength,", audioChunk:").concat(t&&t.byteLength,", discontinuity:").concat(r,", contiguous:").concat(i,", startTime:").concat(a,", needInit:").concat(n));var o=this._demuxer;try{this.isMP4?o.demux(e,t):o.demuxAndFix(gu(e,t),r,i,a)}catch(e){throw new oA(nA,aA,e)}}}])}(),ZA=function(){function e(t){S(this,e),this.hls=t,this.player=t.player,this._decryptor=new PA(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}return w(e,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null);case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"baseDts",get:function(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}},{key:"nbSb",get:function(){return 0}},{key:"updateDuration",value:function(){var e=A(v().mark((function e(t){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.player.debug.log(this.TAG_NAME,"updateDuration()",t);case 1:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getBuferredDuration",value:function(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}},{key:"getBufferedSegments",value:function(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}},{key:"getBufferedAudioSegments",value:function(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}},{key:"getBufferedVideoSegments",value:function(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}},{key:"createSource",value:function(e,t,r,i){if(!this._sourceCreated){var a=e||t;a&&(BA.probe(a)?this._transmuxer||(this._transmuxer=new XA(this.hls,!1)):YA.probe(a)?this._transmuxer||(this._transmuxer=new XA(this.hls,!0)):this.player.debug.error(this.TAG_NAME,"createSource error: chunk is not ts"))}}},{key:"appendBuffer",value:function(){var e=A(v().mark((function e(t,r,i,a,n,o,s){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!(null!=i&&i.length||null!=a&&a.length)){e.next=2;break}return e.abrupt("return",(this._needInitSegment,this._transmuxer.transmux(i,a,n,o,s,this._needInitSegment||n),!0));case 2:case"end":return e.stop()}}),e,this)})));function t(t,r,i,a,n,o,s){return e.apply(this,arguments)}return t}()},{key:"clearAllBuffer",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.player.debug.log(this.TAG_NAME,"clearAllBuffer");case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"decryptBuffer",value:function(e,t){return this._decryptor.decrypt(e,t)}},{key:"reset",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1;case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"endOfStream",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:this._softVideo&&this._softVideo.endOfStream();case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"setLiveSeekableRange",value:function(){var e=A(v().mark((function e(t,r){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"seamlessSwitch",value:function(){this._needInitSegment=!0}}])}(),$A=function(){function e(t){var r=this;S(this,e),this.emitter=t,this._seiSet=new Set,t.on(Aa,(function(e){e&&r._seiSet.add(e)}))}return w(e,[{key:"throw",value:function(e){var t=this;if(null!=e&&this._seiSet.size){var r=e-.2,i=e+.2,a=[];this._seiSet.forEach((function(e){e.time>=r&&e.time<=i&&a.push(e)})),a.forEach((function(e){t._seiSet.delete(e),t.emitter.emit(ba,e)}))}}},{key:"reset",value:function(){this._seiSet.clear()}}])}(),eb=function(){function e(t){S(this,e),this._timescale=t,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}return w(e,[{key:"getStats",value:function(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}},{key:"setEncodeType",value:function(e){this.encodeType=e}},{key:"setFpsFromScriptData",value:function(e){var t,r=e.data,i=null==r||null===(t=r.onMetaData)||void 0===t?void 0:t.framerate;i&&i>0&&i<100&&(this.fps=i)}},{key:"setVideoMeta",value:function(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){var t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}},{key:"setAudioMeta",value:function(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}},{key:"setDomain",value:function(e){this.domain=e.split("/").slice(2,3)[0]}},{key:"updateBitrate",value:function(e){var t=this;if((!this.fps||this.fps>=100)&&e.length){var r=e.reduce((function(e,t){return e+t.duration}),0)/e.length;this.fps=Math.round(this._timescale/r)}e.forEach((function(e){1===e.gopId&&t.gop++,t._bitsAccumulateDuration+=e.duration/(t._timescale/1e3),t._bitsAccumulateSize+=e.units.reduce((function(e,t){return e+t.length}),0),t._bitsAccumulateDuration>=1e3&&(t.bitrate=8*t._bitsAccumulateSize,t._bitsAccumulateDuration=0,t._bitsAccumulateSize=0)}))}}])}(),tb=function(){function e(t){S(this,e);var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;su(this,"_core",null),su(this,"_samples",[]),this._core=t,this._timescale=r,this._stats=new eb(r),this._bindEvents()}return w(e,[{key:"getStats",value:function(){var e,t,r,i,a,n,o,s=(null===(e=this._core)||void 0===e?void 0:e.media)||{},l=s.currentTime,c=void 0===l?0:l,u=s.decodeFps,d=void 0===u?0:u;return E(E({},this._stats.getStats()),{},{downloadSpeed:(null===(t=this._core)||void 0===t||null===(r=t.speedInfo)||void 0===r?void 0:r.call(t).speed)||0,avgSpeed:(null===(i=this._core)||void 0===i||null===(a=i.speedInfo)||void 0===a?void 0:a.call(i).avgSpeed)||0,currentTime:c,bufferEnd:(null===(n=this._core)||void 0===n||null===(o=n.bufferInfo())||void 0===o?void 0:o.remaining)||0,decodeFps:d})}},{key:"_bindEvents",value:function(){var e=this;this._core.on(ua,(function(t){return e._stats.updateBitrate(t.samples)})),this._core.on(da,(function(t){e._stats.setFpsFromScriptData(t)})),this._core.on(ha,(function(t){"video"===t.type?e._stats.setVideoMeta(t.track):e._stats.setAudioMeta(t.track)})),this._core.on(pa,(function(t){e._stats.setDomain(t.responseUrl)}))}},{key:"reset",value:function(){this._samples=[],this._stats=new eb(this._timescale)}}])}(),rb=function(e){function t(e){var r;S(this,t);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r=_(this,t),su(m(r),"_loadSegment",A(v().mark((function e(){var t,i;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!r._segmentProcessing){e.next=2;break}return e.abrupt("return",void r.player.debug.warn("_loadSegment()","_segmentProcessing is ture and return"));case 2:if(r._playlist){e.next=4;break}return e.abrupt("return",void r.player.debug.warn("_loadSegment()","this._playlist is null and return"));case 4:if(t=r._playlist.currentSegment,i=r._playlist.nextSegment,r.player.debug.log(r.TAG_NAME,"_loadSegment()","curSeg",t&&t.url,"nextSeg",i&&i.url),!i){e.next=7;break}return e.abrupt("return",r._loadSegmentDirect());case 7:r.player.debug.log(r.TAG_NAME,"nextSeg is null and return");case 8:case"end":return e.stop()}}),e)})))),r.player=e,r.config=null,r._manifestLoader=null,r._segmentLoader=null,r._playlist=null,r._bufferService=null,r._seiService=null,r._stats=null,r._prevSegSn=null,r._prevSegCc=null,r._tickTimer=null,r._tickInterval=500,r._segmentProcessing=!1,r._reloadOnPlay=!1,r._switchUrlOpts=null,r._disconnectTimer=null,r.TAG_NAME="Hls256",r.canVideoPlay=!1,r.$videoElement=null,r.config=i=function(e){return E({isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0},e)}(i),r._manifestLoader=new CA(m(r)),r._segmentLoader=new RA(m(r)),r._playlist=new LA(m(r)),r._bufferService=new ZA(m(r)),r._seiService=new $A(m(r)),r._stats=new tb(m(r),9e4),r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.player.debug.log(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),e.next=6,Promise.all([this._clear(),this._bufferService.destroy()]);case 6:if(e.t0=this._manifestLoader,!e.t0){e.next=11;break}return e.next=10,this._manifestLoader.destroy();case 10:this._manifestLoader=null;case 11:this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debug.log(this.TAG_NAME,"destroy end");case 14:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_startTick",value:function(){var e=this;this._stopTick(),this._tickTimer=setTimeout((function(){e._tick()}),this._tickInterval)}},{key:"_stopTick",value:function(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}},{key:"_tick",value:function(){this.player.isDestroyedOrClosed()?this.player.debug.log(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}},{key:"isLive",get:function(){return this._playlist.isLive}},{key:"streams",get:function(){return this._playlist.streams}},{key:"currentStream",get:function(){return this._playlist.currentStream}},{key:"hasSubtitle",get:function(){return this._playlist.hasSubtitle}},{key:"baseDts",get:function(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}},{key:"speedInfo",value:function(){return this._segmentLoader.speedInfo()}},{key:"resetBandwidth",value:function(){this._segmentLoader.resetBandwidth()}},{key:"getStats",value:function(){return this._stats.getStats()}},{key:"loadSource",value:function(){var e=A(v().mark((function e(t){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this._reset();case 2:return e.next=4,this._loadData(t);case 4:return this._startTick(),e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_loadData",value:function(){var e=A(v().mark((function e(t){var r,i,a,n,o,s,l,c;return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:try{t&&(t=t.trim())}catch(t){}if(t){e.next=3;break}throw this._emitError(new oA(rA,rA,null,null,"m3u8 url is missing"));case 3:return e.next=5,this._loadM3U8(t);case 5:if(r=e.sent,i=this._playlist.currentStream,this._urlSwitching&&(0===i.bitrate&&null!==(a=this._switchUrlOpts)&&void 0!==a&&a.bitrate&&(i.bitrate=null===(n=this._switchUrlOpts)||void 0===n?void 0:n.bitrate),o=this._getSeamlessSwitchPoint(),this.config.startTime=o,s=this._playlist.findSegmentIndexByTime(o),l=this._playlist.getSegmentByIndex(s+1),l&&(c=l.start,this.player.debug.warn(this.TAG_NAME,"clear buffer from ".concat(c)))),e.t0=r,!e.t0){e.next=17;break}if(!this.isLive){e.next=14;break}this.player.debug.log(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency0&&void 0!==r[0]&&r[0],this.player.debug.log(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),e.next=12,this._clear();case 12:return e.abrupt("return",this._bufferService.reset(t));case 13:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_end",value:function(){this.player.debug.log(this.TAG_NAME,"_end()"),this._clear()}},{key:"_emitError",value:function(e){var t,r,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(r=this.media)||void 0===r?void 0:r.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(_a,e)),i&&this._end(),this._seiService.reset(),this.emit(Ea,e)),e}},{key:"_getSeamlessSwitchPoint",value:function(){var e=this.media,t=e.currentTime;if(!e.paused){var r,i=this._playlist.findSegmentIndexByTime(e.currentTime),a=this._playlist.getSegmentByIndex(i),n=null===(r=this._stats)||void 0===r?void 0:r.getStats().downloadSpeed;t+=n&&a?a.duration*this._playlist.currentStream.bitrate/n+1:5}return t}},{key:"getDemuxBuferredDuration",value:function(){return this._bufferService.getBuferredDuration()||0}},{key:"getDemuxBufferedListLength",value:function(){return this._bufferService.getBufferedSegments()||0}},{key:"getDemuxAudioBufferedListLength",value:function(){return this._bufferService.getBufferedAudioSegments()||0}},{key:"getDemuxVideoBufferedListLength",value:function(){return this._bufferService.getBufferedVideoSegments()||0}}])}(Ho),ib=function(e){function t(e){var r;return S(this,t),r=_(this,t),su(m(r),"TAG_NAME","Hls256Decoder"),r.player=e,r.$videoElement=r.player.video.$videoElement,r.hls=null,r.eventsDestroy=[],r.bandwidthEstimateInterval=null,r.hls=new rb(e),r._bindEvents(),r}return k(t,e),w(t,[{key:"destroy",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._stopBandwidthEstimateInterval(),e.t0=this.hls,!e.t0){e.next=6;break}return e.next=5,this.hls.destroy();case 5:this.hls=null;case 6:return this.eventsDestroy.length&&(this.eventsDestroy.forEach((function(e){return e()})),this.eventsDestroy=[]),this.$videoElement=null,this.player.debug.log(this.TAG_NAME,"destroy"),e.abrupt("return",!0);case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"_bindEvents",value:function(){var e=this;this.hls.on(Ea,(function(t){e.player.emitError(Lt.hlsError,t)})),this._startBandwidthEstimateInterval()}},{key:"_startBandwidthEstimateInterval",value:function(){var e=this;this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((function(){var t=e.hls.speedInfo();e.player.emit(Ct.kBps,(t.avgSpeed/1024/8).toFixed(2)),e.hls.resetBandwidth()}),1e3)}},{key:"_stopBandwidthEstimateInterval",value:function(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}},{key:"loadSource",value:function(){var e=A(v().mark((function e(t){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.url=t,e.next=3,this.hls.loadSource(t);case 3:return e.abrupt("return",!0);case 4:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"checkHlsBufferedDelay",value:function(){var e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}},{key:"getDemuxBufferedListLength",value:function(){var e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}},{key:"getDemuxAudioBufferedListLength",value:function(){var e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}},{key:"getDemuxVideoBufferedListLength",value:function(){var e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}])}(Ho),ab=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.TAG_NAME="CommonWebrtc",r.rtcPeerConnection=null,r.videoStream=null,r.isDisconnected=!1,r.isH264=r.player.isWebrtcH264(),r.eventsDestroy=[],r.supportVideoFrameCallbackHandle=null,r.isInitInfo=!1,r.$videoElement=r.player.video.$videoElement,r.bandwidthEstimateInterval=null,r.rtcPeerTrackVideoReceiver=null,r.rtcPeerTrackAudioReceiver=null,r.prevWebrtcVideoStats={},r.prevWebrtcAudioStats={},r.currentWebrtcStats={},r.player._opt.webrtcUseCanvasRender&&r.isH264&&(r.$videoElement=document.createElement("video"),Nn()&&(r.$videoElement.style.position="absolute"),r._initVideoEvents()),r.$videoElement.muted=!0,r._initRtcPeerConnection(),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((function(e){return e()})),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((function(e){return e.stop()})),this.videoStream=null),this.$videoElement.srcObject=null),this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=kn,this.rtcPeerConnection.ontrack=kn,this.rtcPeerConnection.onconnectionstatechange=kn,this.rtcPeerConnection.ondatachannel=kn,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}},{key:"_initVideoEvents",value:function(){var e=this,t=this.player.events.proxy,r=t(this.$videoElement,bi,(function(){e.player.debug.log(e.TAG_NAME,"video canplay"),e.$videoElement.play().then((function(){e.player.debug.log(e.TAG_NAME,"video play"),e._startCanvasRender(),e._initRenderSize()})).catch((function(t){e.player.debug.warn(e.TAG_NAME,"video play error ",t)}))})),i=t(this.$videoElement,_i,(function(){e.player.debug.log("HlsDecoder","video waiting")})),a=t(this.$videoElement,ki,(function(t){var r=parseInt(t.timeStamp,10);e.player.handleRender(),e.player.updateStats({ts:r}),e.$videoElement.paused&&(e.player.debug.warn("HlsDecoder","video is paused and next try to replay"),e.$videoElement.play().then((function(){e.player.debug.log("HlsDecoder","video is paused and replay success")})).catch((function(t){e.player.debug.warn("HlsDecoder","video is paused and replay error ",t)})))})),n=t(this.$videoElement,wi,(function(){e.player.debug.log("HlsDecoder","video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate)}));this.eventsDestroy.push(r,i,a,n)}},{key:"_initRtcPeerConnection",value:function(){var e=this,t=new RTCPeerConnection,r=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=function(t){e.player.debug.log(e.TAG_NAME,"onsignalingstatechange",t)},t.oniceconnectionstatechange=function(i){e.player.debug.log(e.TAG_NAME,"oniceconnectionstatechange",t.iceConnectionState);var a=t.iceConnectionState;switch(e.player.emit(Ct.webrtcOnIceConnectionStateChange,a),e.isDisconnected="disconnected"===a,t.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":r.emit(Ct.webrtcFailed);break;case"disconnected":r.emit(Ct.webrtcDisconnect);break;case"closed":r.emit(Ct.webrtcClosed)}},t.onicecandidate=function(t){e.player.debug.log(e.TAG_NAME,"onicecandidate",t),t.candidate&&e.player.debug.log(e.TAG_NAME,"Remote ICE candidate: ",t.candidate.candidate)},t.ontrack=function(r){if(e.player.debug.log(e.TAG_NAME,"ontrack",r),"video"===r.track.kind){e.player.debug.log(e.TAG_NAME,"ontrack video"),e.rtcPeerTrackVideoReceiver=t.getReceivers().find((function(e){return e.track===r.track})),e.rtcPeerTrackVideoReceiver&&e._startBandwidthEstimateInterval();var i=r.streams[0];e.$videoElement.autoplay=!0,e.$videoElement.srcObject=i,e.videoStream=i}else"audio"===r.track.kind&&(e.player.debug.log(e.TAG_NAME,"ontrack audio"),e.rtcPeerTrackAudioReceiver=t.getReceivers().find((function(e){return e.track===r.track})),e.rtcPeerTrackAudioReceiver&&e._startBandwidthEstimateInterval())},t.onicecandidateerror=function(t){e.player.debug.log(e.TAG_NAME,"onicecandidateerror",t),e.player.emitError(Lt.webrtcIceCandidateError,t)},t.onconnectionstatechange=function(i){switch(e.player.debug.log(e.TAG_NAME,"onconnectionstatechange",i),e.player.emit(Ct.webrtcOnConnectionStateChange,t.connectionState),t.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":e.isDisconnected&&r.emit(Ct.webrtcFailed)}},this.rtcPeerConnection=t}},{key:"_startBandwidthEstimateInterval",value:function(){var e=this;this.player.debug.log(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((function(){e.rtcPeerTrackVideoReceiver&&e.rtcPeerTrackVideoReceiver.getStats().then((function(t){var r={},i=0;t.forEach((function(t){if(t)switch(t.type){case za:("succeeded"===t.state||t.bytesReceived)&&(e.currentWebrtcStats.timestamp=t.timestamp,e.currentWebrtcStats.rtt=t.currentRoundTripTime||-1,e.currentWebrtcStats.bytesReceived=t.bytesReceived||0,e.currentWebrtcStats.bytesSent=t.bytesSent||0);break;case Va:e.currentWebrtcStats.remoteCandidate=t||{};break;case Ha:e.currentWebrtcStats.localCandidate=t||{};break;case Ga:e.currentWebrtcStats.lastTimeStamp=t.timestamp;var a=((t.timestamp||0)-(e.prevWebrtcVideoStats.timestamp||0))/1e3,n=Number(t.bytesReceived||0)-Number(e.prevWebrtcVideoStats.bytesReceived||0),o=Math.floor(n/a);i+=o,r.vbps=o,e.prevWebrtcVideoStats=t;break;case Wa:t.frameWidth&&t.frameHeight&&(e.currentWebrtcStats.frameWidth=t.frameWidth||0,e.currentWebrtcStats.frameHeight=t.frameHeight||0)}})),e.rtcPeerTrackAudioReceiver?e.rtcPeerTrackAudioReceiver.getStats().then((function(t){t.forEach((function(t){if(t&&t.type===Ga){e.currentWebrtcStats.lastTimeStamp=t.timestamp;var a=((t.timestamp||0)-(e.prevWebrtcAudioStats.timestamp||0))/1e3,n=Number(t.bytesReceived||0)-Number(e.prevWebrtcAudioStats.bytesReceived||0),o=Math.floor(n/a);i+=o,r.abps=o,e.prevWebrtcAudioStats=t}})),e.player.updateStats(r),e.player.emit(Ct.kBps,(i/1024).toFixed(2))})):(e.player.updateStats(r),e.player.emit(Ct.kBps,(i/1024).toFixed(2)))}))}),1e3)}},{key:"_stopBandwidthEstimateInterval",value:function(){this.player.debug.log(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}},{key:"_startCanvasRender",value:function(){var e=this;jo()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((function(){e.player.video.render({$video:e.$videoElement,ts:0})}),40))}},{key:"_stopCanvasRender",value:function(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}},{key:"videoFrameCallback",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}},{key:"_initRenderSize",value:function(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}},{key:"getVideoCurrentTime",value:function(){var e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}}])}(Ho),nb=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.rtcPeerConnectionDataChannel=null,r.player.isWebrtcH265()&&(r.streamRate=Ln((function(t){e.emit(Ct.kBps,(t/1024).toFixed(2))}))),r.TAG_NAME="WebrtcForM7SDecoder",r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=kn,this.rtcPeerConnectionDataChannel.onclose=kn,this.rtcPeerConnectionDataChannel.onmessage=kn,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_initRtcPeerConnection",value:function(){var e=this,t=new RTCPeerConnection,r=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=function(t){e.player.debug.log(e.TAG_NAME,"onsignalingstatechange",t)},t.oniceconnectionstatechange=function(i){e.player.debug.log(e.TAG_NAME,"oniceconnectionstatechange",t.iceConnectionState);var a=t.iceConnectionState;switch(e.player.emit(Ct.webrtcOnIceConnectionStateChange,a),e.isDisconnected="disconnected"===a,t.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":r.emit(Ct.webrtcFailed);break;case"disconnected":r.emit(Ct.webrtcDisconnect);break;case"closed":r.emit(Ct.webrtcClosed)}},t.onicecandidate=function(t){e.player.debug.log(e.TAG_NAME,"onicecandidate",t),t.candidate&&e.player.debug.log(e.TAG_NAME,"Remote ICE candidate: ",t.candidate.candidate)},t.ontrack=function(i){e.player.debug.log(e.TAG_NAME,"ontrack",i);var a=r.video.$videoElement;if(r.isWebrtcH264())if("video"===i.track.kind){e.player.debug.log(e.TAG_NAME,"ontrack video"),e.rtcPeerTrackVideoReceiver=t.getReceivers().find((function(e){return e.track===i.track})),e.rtcPeerTrackVideoReceiver&&e._startBandwidthEstimateInterval();var n=i.streams[0];a.autoplay=!0,a.srcObject=n,e.videoStream=n}else"audio"===i.track.kind&&(e.player.debug.log(e.TAG_NAME,"ontrack audio"),e.rtcPeerTrackAudioReceiver=t.getReceivers().find((function(e){return e.track===i.track})),e.rtcPeerTrackAudioReceiver&&e._startBandwidthEstimateInterval())},t.onicecandidateerror=function(t){e.player.debug.log(e.TAG_NAME,"onicecandidateerror",t),e.player.emitError(Lt.webrtcIceCandidateError,t)},t.onconnectionstatechange=function(i){switch(r.debug.log(e.TAG_NAME,"sdp connect status ".concat(t.connectionState)),t.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":e.isDisconnected&&r.emit(Ct.webrtcFailed)}},t.ondatachannel=function(t){var r=t.channel;e.player.debug.log(e.TAG_NAME,"ondatachannel"),r.onopen=function(){e.player.debug.log(e.TAG_NAME,"ondatachannel and onopen")},r.onmessage=function(t){var r=t.data;if(e.player.isWebrtcH264())return e.player.debug.warn(e.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void e.player.emit(Ct.webrtcStreamH265);e.player.isDestroyedOrClosed()?e.player.debug.warn(e.TAG_NAME,"ondatachannel and player is destroyed"):(e.streamRate&&e.streamRate(r.byteLength),e.player.demux&&e.player.demux.dispatch(r))},r.onclose=function(){e.player.debug.warn(e.TAG_NAME,"ondatachannel and onclose")},e.rtcPeerConnectionDataChannel=r},t.createDataChannel("signal").onmessage=function(t){e.player.debug.log(e.TAG_NAME,"signalChannel,onmessage",t),JSON.parse(t.data).type},this.rtcPeerConnection=t}},{key:"startStreamRateInterval",value:function(){var e=this;this.stopStreamRateInterval(),this.streamRateInterval=setInterval((function(){e.streamRate&&e.streamRate(0)}),1e3)}},{key:"stopStreamRateInterval",value:function(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}},{key:"loadSource",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,a){var n=t.rtcPeerConnection;n.createOffer().then((function(o){n.setLocalDescription(o),t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,r){var i={"Content-Type":"application/sdp"};return r.username&&r.password&&(i.Authorization="Basic "+btoa(r.username+":"+r.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:i,body:t})}(e,o.sdp,r).then((function(e){e.text().then((function(e){t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp response"),e?n.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((function(){t.player.isWebrtcH265()&&t.startStreamRateInterval(),i()})).catch((function(e){a(e)})):a("sdp is null")})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource response.text() error",e),a(e)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),a(e)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),a(e)}))}))}}])}(ab),ob=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="WebrtcForZLMDecoder",r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(r,i){var a=t.rtcPeerConnection;a.createOffer().then((function(n){a.setLocalDescription(n),t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return Nl({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,n.sdp).then((function(e){t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp response and code is ".concat(e.code));var n=e;if(n&&0!==n.code)return i(n.msg);n&&n.sdp?a.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:n.sdp})).then((function(){r()})).catch((function(e){i(e)})):i("sdp is null")})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}])}(ab),sb=function(e){function t(e,r){var i;if(S(this,t),i=_(this,t),i.player=e,i.player.$container.classList.add("jb-pro-container-playback"),i._showPrecision=null,i._startTime=null,i._playStartTime=null,i._playingTimestamp=null,i._fps=parseInt(r.fps,10)||e._opt.playbackFps,i._isUseFpsRender=!!Bo(r.isUseFpsRender),i._rate=1,i._audioTimestamp=0,i._videoTimestamp=0,i.controlType=r.controlType||ye.normal,r.controlType&&-1===[ye.normal,ye.simple].indexOf(r.controlType)&&(i.player.debug.warn("Playback","constructor()","controlType is not in [normal,simple]",r.controlType),i.controlType=ye.normal),i._currentLocalTimestamp=0,i._localOneFrameTimestamp=r.localOneFrameTimestamp||40,i._localCalculateTimeInterval=null,i._isUseLocalCalculateTime=!!Bo(r.isUseLocalCalculateTime),i._isPlaybackPauseClearCache=!Io(r.isPlaybackPauseClearCache),i._isCacheBeforeDecodeForFpsRender=!!Bo(r.isCacheBeforeDecodeForFpsRender),i._startfpsTime=null,i._startFpsTimestamp=null,i._checkStatsInterval=null,i._playbackTs=0,i._renderFps=0,i._isUseLocalCalculateTime?i._startLocalCalculateTime():i._listen(),i.playbackList=[],i._playbackListStartTimestamp=null,i._totalDuration=0,r.controlType===ye.normal)i.initPlaybackList(r.playList,r.showPrecision,r.startTime);else if(r.controlType===ye.simple){r.duration&&(i._totalDuration=1e3*r.duration);var a=r.startTime||0;a>i.totalDuration&&(a=i.totalDuration),i.setStartTime(a)}i.player.on(Ct.playbackPause,(function(e){e?i.pause():i.resume()}));var n={fps:i._fps,isUseFpsRender:i._isUseFpsRender,localOneFrameTimestamp:i._localOneFrameTimestamp,isUseLocalCalculateTime:i._isUseLocalCalculateTime,uiUsePlaybackPause:r.uiUsePlaybackPause,showControl:r.showControl};return e.debug.log("Playback","init",JSON.stringify(n)),i}return k(t,e),w(t,[{key:"destroy",value:function(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debug.log("Playback","destroy")}},{key:"_listen",value:function(){var e=this;this.player.on(Ct.stats,(function(t){var r=t.ts;e._playStartTime||(e._playStartTime=r-1e3);var i=r-e._playStartTime;e.setPlayingTimestamp(i)}))}},{key:"pause",value:function(){this.clearStatsInterval()}},{key:"resume",value:function(){this.startCheckStatsInterval()}},{key:"updateStats",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=Tn()),eo(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);var t=Tn(),r=t-this._startFpsTimestamp;if(!(r<1e3)){var i=null;this._startfpsTime&&(i=this._playbackTs-this._startfpsTime),this.player.emit(Ct.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:r,dataTimestamp:i,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}}},{key:"updateLocalOneFrameTimestamp",value:function(e){this._localOneFrameTimestamp=e}},{key:"_startLocalCalculateTime",value:function(){var e=this;this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((function(){var t=e._currentLocalTimestamp;e._playStartTime||(e._playStartTime=t-1e3);var r=t-e._playStartTime;e.setPlayingTimestamp(r)}),1e3)}},{key:"startCheckStatsInterval",value:function(){var e=this;this.clearStatsInterval(),this._checkStatsInterval=setInterval((function(){e.updateStats()}),1e3)}},{key:"_stopLocalCalculateTime",value:function(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}},{key:"clearStatsInterval",value:function(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}},{key:"increaseLocalTimestamp",value:function(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}},{key:"initPlaybackList",value:function(e,t,r){this.playbackList=e||[];var i=0;if(this.playbackList.forEach((function(e,t){10===co(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=jn(e.startTimestamp)),10===co(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=jn(e.endTimestamp)),e.duration=e.end-e.start,i+=e.duration})),this._totalDuration=i,this.player.debug.log("Playback",this.playbackList),this.playbackList.length>0){var a=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=a;var n=a;r&&(10===co(r)&&(r*=1e3),this._isTimeInPlaybackList(r)&&(n=r)),this.setStartTime(n)}var o=t||Gr;this.setShowPrecision(o)}},{key:"totalDuration",get:function(){return(this._totalDuration||0)/1e3}},{key:"startTime",get:function(){return this._startTime||0}},{key:"setStartTime",value:function(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}},{key:"setRate",value:function(e){this._rate=e,this.player.emit(Ct.playbackRateChange,e)}},{key:"fps",get:function(){return this._fps}},{key:"rate",get:function(){return this._rate}},{key:"isUseFpsRender",get:function(){return this._isUseFpsRender}},{key:"isUseLocalCalculateTime",get:function(){return this._isUseLocalCalculateTime}},{key:"showPrecision",get:function(){return this._showPrecision}},{key:"is60Min",get:function(){return this.showPrecision===Gr}},{key:"is30Min",get:function(){return this.showPrecision===Hr}},{key:"is10Min",get:function(){return this.showPrecision===Vr}},{key:"is5Min",get:function(){return this.showPrecision===Wr}},{key:"is1Min",get:function(){return this.showPrecision===Wr}},{key:"isPlaybackPauseClearCache",get:function(){return this._isPlaybackPauseClearCache}},{key:"isCacheBeforeDecodeForFpsRender",get:function(){return this._isCacheBeforeDecodeForFpsRender}},{key:"setShowPrecision",value:function(e){qr.includes(e)||(this.player.debug.warn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Gr),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(Ct.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(Ct.playbackShowPrecisionChange,this._showPrecision))}},{key:"setPlayingTimestamp",value:function(e){var t;if(this.controlType===ye.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(Ct.playbackTime,t);var r=new Date(t);this.player.emit(Ct.playbackTimestamp,{ts:t,hour:r.getHours(),min:r.getMinutes(),second:r.getSeconds()})}else this.controlType===ye.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debug.log("Playback","setPlayingTimestamp()","timestamp ".concat(t," > this.totalDuration ").concat(this.totalDuration)),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(Ct.playbackTime,t),this.player.emit(Ct.playbackTimestamp,{ts:t}))}},{key:"playingTimestamp",get:function(){return this._playingTimestamp}},{key:"narrowPrecision",value:function(){var e=qr.indexOf(this.showPrecision)-1;if(e>=0){var t=qr[e];this.setShowPrecision(t)}}},{key:"expandPrecision",value:function(){var e=qr.indexOf(this.showPrecision)+1;if(e<=qr.length-1){var t=qr[e];this.setShowPrecision(t)}}},{key:"seek",value:function(e){if(this.player.debug.log("Playback","seek()",e),this.controlType===ye.normal){if("true"===e.hasRecord){var t=e.time;"min"===e.type&&(t=60*e.time);var r=function(e){var t={};return e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60}),t}(t);if(this._playbackListStartTimestamp){var i=new Date(this._playbackListStartTimestamp).setHours(r.hour,r.min,r.second,0);r.timestamp=i;var a=this._findMoreInfoByTimestamp(i);r&&a.more&&(r.more=a.more)}this.player.emit(Ct.playbackSeek,r)}}else if(this.controlType===ye.simple){var n=e.time;this.player.emit(Ct.playbackSeek,{ts:n})}}},{key:"currentTimeScroll",value:function(){this.player.emit(Ct.playbackTimeScroll)}},{key:"_findMoreInfoByTimestamp",value:function(e){var t=null;return this.playbackList.forEach((function(r,i){r.startTimestamp<=e&&r.endTimestamp>=e&&(t=r)})),t}},{key:"_isTimeInPlaybackList",value:function(e){var t=!1;return this.playbackList.forEach((function(r,i){r.startTimestamp<=e&&r.endTimestamp>=e&&(t=!0)})),t}},{key:"getControlType",value:function(){return this.controlType}},{key:"isControlTypeNormal",value:function(){return this.controlType===ye.normal}},{key:"isControlTypeSimple",value:function(){return this.controlType===ye.simple}}])}(Ho),lb=function(e){function t(e){var r;S(this,t),r=_(this,t),r.player=e,r.TAG_NAME="zoom",r.bindEvents=[],r.isDragging=!1,r.currentZoom=1,r.prevVideoElementStyleTransform=null,r.prevVideoElementStyleScale=null,r.maxScale=5,r.tempPosition={x:0,y:0},r.videoPosition={left:0,top:0};var i=r.player,a=i.events.proxy;i.debug;r.player.on(Ct.zooming,(function(e){if(e){r.player.$container.classList.add("jb-pro-zoom-control"),r._bindEvents();var t=r.player.video.$videoElement.style.transform,i=r.player.video.$videoElement.offsetLeft,a=r.player.video.$videoElement.offsetTop;i=parseFloat(i),a=parseFloat(a),i&&(r.videoPosition.left=i),a&&(r.videoPosition.top=a),r.prevVideoElementStyleTransform=t;var n=t.match(/scale\([0-9., ]*\)/g);if(n&&n[0]){var o=n[0].replace("scale(","").replace(")","");r.prevVideoElementStyleScale=o.split(",")}}else{r.player.$container.classList.remove("jb-pro-zoom-control"),r._unbindEvents(),r._resetVideoPosition(),r.player.$container.style.cursor="auto";var s=r.prevVideoElementStyleTransform;r.player.video.$videoElement.style.transform=s,r.prevVideoElementStyleTransform=null,r.prevVideoElementStyleScale=null,Bn()&&r.player._opt.useWebFullScreen&&r.player.resize()}}));var n=a(window,Bn()?"touchend":"mouseup",(function(e){r.handleMouseUp(e)}));return r.bindEvents.push(n),e.debug.log("zoom","init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debug.log("zoom","destroy")}},{key:"_bindEvents",value:function(){var e=this,t=this.player,r=t.events.proxy,i=(t.debug,r(this.player.$container,Bn()?"touchmove":"mousemove",(function(t){e.handleMouseMove(t)})));this.bindEvents.push(i);var a=r(this.player.$container,Bn()?"touchstart":"mousedown",(function(t){e.handleMouseDown(t)}));this.bindEvents.push(a);var n=r(window,Bn()?"touchend":"mouseup",(function(t){e.handleMouseUp(t)}));this.bindEvents.push(n)}},{key:"_unbindEvents",value:function(){this.bindEvents.forEach((function(e){e&&e()}))}},{key:"handleMouseMove",value:function(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();var t=Ao(e),r=t.posX,i=t.posY,a=this.tempPosition.x-r,n=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-a,this.videoPosition.top=this.videoPosition.top-n,this.tempPosition.x=r,this.tempPosition.y=i,this.updateVideoPosition()}}},{key:"handleMouseDown",value:function(e){e.stopPropagation();var t=go(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();var r=Ao(e),i=r.posX,a=r.posY;this.player.$container.style.cursor="grabbing",this.tempPosition.x=i,this.tempPosition.y=a,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}},{key:"handleMouseUp",value:function(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debug.log("zoom","handleMouseUp is dragging false"))}},{key:"updateVideoPosition",value:function(){var e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}},{key:"_resetVideoPosition",value:function(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}},{key:"narrowPrecision",value:function(){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale())}},{key:"expandPrecision",value:function(){this.currentZoom>=this.maxScale||(this.currentZoom+=1,this.updateVideoElementScale())}},{key:"updatePrevVideoElementStyleScale",value:function(e){this.prevVideoElementStyleScale=e}},{key:"updateVideoElementScale",value:function(){var e=this.player.video.$videoElement,t=e.style.transform,r=1,i=1;if(this.prevVideoElementStyleScale){var a=this.prevVideoElementStyleScale[0];void 0!==a&&(r=a,i=a);var n=this.prevVideoElementStyleScale[1];void 0!==n&&(i=n)}i=Gn(i),r=Gn(r);var o,s=.5*r*(this.currentZoom-1)+r,l=.5*i*(this.currentZoom-1)+i;o=-1===t.indexOf("scale(")?t+" scale(".concat(s,",").concat(l,")"):t.replace(/scale\([0-9., ]*\)/,"scale(".concat(s,",").concat(l,")")),this.player.debug.log("zoom","updateVideoElementScale end is ".concat(s,", ").concat(l," style is ").concat(o)),e.style.transform=o}}])}(Ho),cb=function(e){function t(e){var r;S(this,t),r=_(this,t),r.player=e,r.faceDetector=null,r.objectDetector=null,r.imageDetector=null,r.occlusionDetector=null,r.initFaceDetector(),r.initObjectDetector(),r.initImageDetector(),r.initOcclusionDetector();var i="init";return r.faceDetector&&(i+=" and use faceDetector"),r.objectDetector&&(i+=" and use objectDetector"),r.imageDetector&&(i+=" and use imageDetector"),r.occlusionDetector&&(i+=" and use occlusionDetector"),r.player.debug.log("AiLoader",i),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debug.log("AiLoader","destroy")}},{key:"initFaceDetector",value:function(){var e=this;if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){var t=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});t.load().then((function(){e.player.debug.log("AiLoader","init face detector success"),e.faceDetector=t,e.faceDetector.on("jessibuca-pro-face-detector-info",(function(t){if(e.player.emit(Ct.aiFaceDetectorInfo,t),e.player._opt.aiFaceDetectShowRect){var r=e.player._opt.aiFaceDetectRectConfig||{},i=(t.list||[]).map((function(e){return e.type="rect",e.color=r.borderColor||"#0000FF",e.lineWidth=r.borderWidth||2,e}));e.player.video&&e.player.video.addAiContentToCanvas(i)}}))}))}}},{key:"initObjectDetector",value:function(){var e=this;if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){var t=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});t.load().then((function(){e.player.debug.log("AiLoader","init object detector success"),e.objectDetector=t,e.objectDetector.on("jessibuca-pro-object-detector-info",(function(t){if(e.player.emit(Ct.aiObjectDetectorInfo,t),e.player._opt.aiObjectDetectShowRect){var r=[],i=e.player._opt.aiObjectDetectRectConfig||{};(t.list||[]).forEach((function(e){var t={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},a={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};r.push(t,a)})),e.player.video&&e.player.video.addAiContentToCanvas(r)}}))}))}}},{key:"initImageDetector",value:function(){var e=this;if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){var t=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});t.load().then((function(){e.player.debug.log("AiLoader","init image detector success"),e.imageDetector=t}))}}},{key:"initOcclusionDetector",value:function(){var e=this;if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){var t=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});t.load().then((function(){e.player.debug.log("AiLoader","init occlusion detector success"),e.occlusionDetector=t}))}}},{key:"updateFaceDetectorConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}},{key:"updateObjectDetectorConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}},{key:"updateImageDetectorConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}},{key:"updateOcclusionDetectorConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}])}(Ho),ub=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.LOG_NAME="Contextmenu",r.menuList=[],r.$contextmenus=e.control.$contextmenus,Bn()?r.player.debug.warn(r.LOG_NAME,"not support mobile"):r.init(),e.debug.log(r.LOG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.menuList=[],this.player.debug.log(this.LOG_NAME,"destroy")}},{key:"isShow",get:function(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}},{key:"show",value:function(){qu(this.player.$container,"jb-pro-contextmenus-show")}},{key:"hide",value:function(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}},{key:"init",value:function(){var e=this,t=this.player,r=t.events.proxy;t.debug;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((function(t){e.addMenuItem(t)})),r(this.player.$container,"contextmenu",(function(t){t.preventDefault(),e.show();var r=t.clientX,i=t.clientY,a=e.player.$container.getBoundingClientRect(),n=a.height,o=a.width,s=a.left,l=a.top,c=e.$contextmenus.getBoundingClientRect(),u=c.height,d=c.width,h=r-s,p=i-l;r+d>s+o&&(h=o-d),i+u>l+n&&(p=n-u),xn(e.$contextmenus,{left:"".concat(h,"px"),top:"".concat(p,"px")})})),r(this.player.$container,"click",(function(t){Qu(t,e.$contextmenus)||e.hide()})),this.player.on(Ct.blur,(function(){e.hide()}))}},{key:"_validateMenuItem",value:function(e){var t=!0;return e.content||(this.player.debug.warn(this.LOG_NAME,"content is required"),t=!1),t}},{key:"addMenuItem",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=Ro(na);if(t=Object.assign({},r,t),this._validateMenuItem(t)){var i=this.player,a=i.events.proxy,n=(i.debug,Hn()),o='\n
\n ').concat(t.content,"\n
\n "),s=Array.from(this.$contextmenus.children)[t.index];s?s.insertAdjacentHTML("beforebegin",o):Ku(this.$contextmenus,o);var l=this.$contextmenus.querySelector(".jb-pro-contextmenu-".concat(n));t.click&&a(l,"click",(function(r){r.preventDefault(),t.click.call(e.player,e,r),e.hide()})),this.menuList.push({uuid:n,$menuItem:l})}}}])}(Ho),db=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="WebrtcForSRSDecoder",r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(r,i){var a=t.rtcPeerConnection;a.createOffer().then((function(n){a.setLocalDescription(n),t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,n.sdp).then((function(e){t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp response and code is ".concat(e.code));var n=e;if(n&&0!==n.code)return i(n.msg);n?a.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:n})).then((function(){r()})).catch((function(e){i(e)})):i("sdp is null")})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}])}(ab),hb=function(e){function t(e){var r;return S(this,t),r=_(this,t,[e]),r.TAG_NAME="WebrtcForOthersDecoder",r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){b(t,"destroy",this,3)([]),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(r,i){var a=t.rtcPeerConnection;a.createOffer().then((function(n){a.setLocalDescription(n),t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,n.sdp).then((function(e){t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp response and code is ".concat(e.code)),e.text().then((function(e){t.player.debug.log(t.TAG_NAME,"getWebRtcRemoteSdp response");try{var n=JSON.parse(e);t.player.debug.log(t.TAG_NAME,"this is json sdp response"),0!=n.code&&(t.player.debug.log(t.TAG_NAME,"response json code ".concat(n.code)),i(new Error("response sdp json code: ".concat(n.code)))),e=n.sdp}catch(e){t.player.debug.log(t.TAG_NAME,"this is raw sdp response")}e?a.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((function(){r()})).catch((function(e){i(e)})):i("sdp is null")})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource response.text() error",e),i(e)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}])}(ab),pb=function(e){function t(e){var r;if(S(this,t),r=_(this,t),r.TAG_NAME="AliyunRtc",r.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");return r.aliyunRtc=window.AliRTS.createClient(),r.aliyunRtcRemoteStream=null,r.$videoElement=r.player.video.$videoElement,r.listenEvents(),r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"listenEvents",value:function(){var e=this;this.aliyunRtc.on("onError",(function(t){e.player.debug.log(e.TAG_NAME,"onError and code is ".concat(t.errorCode," and message: ").concat(t.message)),10400!==t.errorCode&&(e.player.debug.error(e.TAG_NAME,"onError and code is ".concat(t.errorCode," and message: ").concat(t.message)),e.player.emitError(Lt.aliyunRtcError,t))})),this.aliyunRtc.on("reconnect",(function(t){e.player.debug.log(e.TAG_NAME,"reconnect",t)}));var t="canplay",r="waiting",i="playing",a="media";this.aliyunRtc.on("onPlayEvent",(function(n){if(n.event===t)e.player.debug.log(e.TAG_NAME,"onPlayEvent and canplay");else if(n.event===r)e.player.debug.log(e.TAG_NAME,"onPlayEvent and playing - > waiting");else if(n.event===i)e.player.debug.log(e.TAG_NAME,"onPlayEvent and waiting -> playing");else if(n.event===a){var o=n.data,s={},l=0;if(o.audio){var c=Math.floor(o.audio.bytesReceivedPerSecond);l+=c,s.abps=c}if(o.video){var u=Math.floor(o.video.bytesReceivedPerSecond);l+=u,s.vbps=u}e.player.updateStats(s),e.player.emit(Ct.kBps,(l/1024).toFixed(2))}}))}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(r,i){t.aliyunRtc.isSupport({isReceiveVideo:!0}).then((function(){t.aliyunRtc.subscribe(e,{}).then((function(e){t.aliyunRtcRemoteStream=e,e.play(t.$videoElement),r()})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((function(e){t.player.debug.error(t.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}},{key:"getVideoCurrentTime",value:function(){var e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}}])}(Ho),fb=function(){function e(t){S(this,e),this.player=t,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this._init(),this.player.debug.log(this.TAG_NAME,"init")}return w(e,[{key:"destroy",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"getCurrentCpuState",value:function(){return this.currentLevel}},{key:"_init",value:function(){var e=this;Io(zo())?this.player.debug.log(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((function(t){var r=(t||[]).find((function(e){return"cpu"===e.source}));if(r){switch(e.latestCpuInfo=r,r.state){case"nominal":e.currentLevel=0;break;case"fair":e.currentLevel=1;break;case"serious":e.currentLevel=2;break;case"critical":e.currentLevel=3;break;default:e.currentLevel=-1}e.player.emit(Ct.pressureObserverCpu,e.currentLevel)}})),this.observer&&this.observer.observe("cpu"))}}])}(),mb=function(t){function r(e){var t;S(this,r);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=_(this,r,[e]),t.TAG_NAME="DynamicWatermark",t.isPauseAnimation=!1,t.isStopAnimation=!1,t.rafID=null,t.speed=i.speed||.2,t.isDynamic=!0,t.shadowRootDynamicDom=null,t.isGhost=!0===i.isGhost,t.ghostConfig={on:i.on||5,off:i.off||5},t.waterMarkWillRemove=!1,t.waterMarkWillAdd=!1,t.player.once(Ct.start,(function(){var e=i.content,r=t.player.getVideoInfo();r||(r={width:200,height:200}),t.update({text:{content:e,fontSize:i.fontSize||18,color:i.color||"white"},left:r.width*Math.random(),top:r.height*Math.random(),opacity:i.opacity||.15}),t.startAnimation()})),t.player.debug.log(t.TAG_NAME,"int"),t}return k(r,t),w(r,[{key:"destroy",value:function(){b(r,"destroy",this,3)([]),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}},{key:"startAnimation",value:function(){var t=this;if(!this.rafID){var r=1,i=1,a=Math.random(),n={width:0,height:0},o=function(){try{if(Io(t.isPauseAnimation)&&t.shadowRootDynamicDom&&t.shadowRootInnerDom){var s=t.shadowRootInnerDom,l=t.shadowRootDynamicDom,c=s.getBoundingClientRect(),u=l.getBoundingClientRect();if(u.width&&u.height&&(n.width=u.width,n.height=u.height),!t.shadowRootInnerDom.contains(t.shadowRootDynamicDom))return t.isGhost?Io(t.waterMarkWillAdd)&&(t.waterMarkWillAdd=!0,setTimeout((function(){t._addDom(c,n),t.waterMarkWillAdd=!1}),1e3*t.ghostConfig.off)):t._addDom(c,n),void(0!==t.speed&&requestAnimationFrame(o));var d=Math.min(1,0===t.speed?0:t.speed?t.speed:.2),h=u.left-c.left,p=u.top-c.top;h+=d*i*a,p+=d*r*(1-a),h+n.width>c.width?(i=-1,a=Math.random()):h<0&&(i=1,a=Math.random()),p+n.height>c.height?(r=-1,a=Math.random()):p<0&&(r=1,a=Math.random()),h=Math.min(c.width-n.width,h),p=Math.min(c.height-n.height,p);var f=h/c.width*100,m=p/c.height*100;t.shadowRootDynamicDom.style.left="".concat(f,"%"),t.shadowRootDynamicDom.style.top="".concat(m,"%"),Io(t.waterMarkWillRemove)&&t.isGhost&&(t.waterMarkWillRemove=!0,setTimeout((function(){t._removeDom(),t.waterMarkWillRemove=!1}),1e3*t.ghostConfig.on))}}catch(e){}if(t.isStopAnimation)return t.isStopAnimation=!1,cancelAnimationFrame(t.rafID),void(t.rafID=null);0!==t.speed&&requestAnimationFrame(o)};this.rafID=requestAnimationFrame(o)}}},{key:"_addDom",value:function(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);var r=e.width*Math.random(),i=e.height*Math.random();r=Math.min(e.width-2*t.width,r),i=Math.min(e.height-2*t.height,i),this.shadowRootDynamicDom.style.left="".concat(r,"px"),this.shadowRootDynamicDom.style.top="".concat(i,"px")}}},{key:"resumeAnimation",value:function(){this.isPauseAnimation=!1}},{key:"pauseAnimation",value:function(){this.isPauseAnimation=!0}},{key:"stopAnimation",value:function(){this.isStopAnimation=!0}}])}($o),gb=function(e){function t(e){var r;S(this,t);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=_(this,t),r._opt={},r.TAG_NAME="Player",r.$container=e;var a,n=Lo();if(r._opt=Object.assign({},n,i),r.debug=new Za(r),r.debug.log(r.TAG_NAME,"init"),r._opt.forceNoOffscreen=!0,r._canPlayAppleMpegurl=!1,(Nn()||On())&&(r._canPlayAppleMpegurl=bo(),r.debug.log(r.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",r._canPlayAppleMpegurl)),Bn()&&(r.debug.log(r.TAG_NAME,"isMobile and set _opt.controlAutoHide false"),r._opt.controlAutoHide=!1,Bo(tn.isEnabled)&&Bo(r._opt.useWebFullScreen)&&(r.debug.log(r.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),r._opt.useWebFullScreen=!1),Io(tn.isEnabled)&&Io(r._opt.useWebFullScreen)&&(r.debug.log(r.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),r._opt.useWebFullScreen=!0)),Uo()&&(r.debug.log(r.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),r._opt.videoRenderSupportScale=!1,fo()&&Bo(r._opt.isHls)&&Io(r._opt.supportHls265)&&(r.debug.log(r.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),r._opt.supportHls265=!0)),Io(r._opt.playFailedAndReplay)&&(r.debug.log(r.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),r._opt.webglAlignmentErrorReplay=!1,r._opt.webglContextLostErrorReplay=!1,r._opt.autoWasm=!1,r._opt.mseDecodeErrorReplay=!1,r._opt.mediaSourceTsIsMaxDiffReplay=!1,r._opt.wcsDecodeErrorReplay=!1,r._opt.wasmDecodeErrorReplay=!1,r._opt.simdDecodeErrorReplay=!1,r._opt.videoElementPlayingFailedReplay=!1,r._opt.networkDelayTimeoutReplay=!1,r._opt.widthOrHeightChangeReplay=!1,r._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,r._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,r._opt.heartTimeoutReplay=!1,r._opt.loadingTimeoutReplay=!1,r._opt.websocket1006ErrorReplay=!1,r._opt.streamErrorReplay=!1,r._opt.streamEndReplay=!1),r._opt.hiddenControl&&(r.debug.log(r.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(r._opt.operateBtns).forEach((function(e){r._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(r._opt.operateBtns[e]=!1)})),r._opt.showBandwidth=!1,r._opt.extendOperateBtns=[],r._opt.controlHtml="",r.isPlayback()&&(r._opt.playbackConfig.showControl=!1)),r._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(r._opt.forceNoOffscreen=!0,r._opt.useOffscreen=!1):r._opt.useOffscreen=!0),r._opt.isMpeg4&&(r.debug.log(r.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),r._opt.useWCS=!1,r._opt.useMSE=!1,r._opt.isNakedFlow=!1,r._opt.useSIMD=!1,r._opt.isFmp4=!1,r._opt.useWasm=!0),r.isPlayback()&&(r._opt.mseDecoderUseWorker=!1),r._opt.poster&&(r._opt.background=r._opt.poster),Io(r._opt.muted)&&(r._opt.isNotMute=!0),r._opt.mseDecoderUseWorker&&(r._opt.mseDecoderUseWorker=!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker),Io(r._opt.mseDecoderUseWorker)&&r.debug.log(r.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(r.isOldHls()||r.isWebrtcH264()||r.isAliyunRtc())&&(r.debug.log(r.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and _opt.recordType is webm"),r._opt.useWCS=!1,r._opt.useMSE=!1,r._opt.isNakedFlow=!1,r._opt.useSIMD=!1,r._opt.isFmp4=!1,r._opt.useWasm=!1,r._opt.recordType=H),r._opt.isNakedFlow&&(r.debug.log(r.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),r._opt.mseDecodeAudio=!1),Un()&&(r.debug.log(r.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),r._opt.mseDecodeAudio=!1),!r.isOldHls()&&!r.isWebrtcH264()){if(r._opt.useWCS){var o="VideoEncoder"in window,s=Kn();r._opt.useWCS=o,r._opt.useWCS&&r._opt.isH265&&(r._opt.useWCS=s),r._opt.useWCS||r.debug.warn(r.TAG_NAME,"\n useWCS is true,\n and supportWCS is ".concat(o,", supportHevcWCS is ").concat(s," , _opt.isH265 is ").concat(r._opt.isH265,"\n so set useWCS false")),r._opt.useWCS&&(r._opt.useOffscreen?r._opt.wcsUseVideoRender=!1:r._opt.wcsUseVideoRender&&(r._opt.wcsUseVideoRender=Yn()&&Qn(),r._opt.wcsUseVideoRender||r.debug.warn(r.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(r._opt.useMSE){var l=function(){var e=!1;return"MediaSource"in self&&(e=!0),e}()||function(){var e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(e=!0),e}(),c=qn()||function(){var e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(self.ManagedMediaSource.isTypeSupported(Lr)||self.ManagedMediaSource.isTypeSupported(Pr)||self.ManagedMediaSource.isTypeSupported(Br)||self.ManagedMediaSource.isTypeSupported(Ir)||self.ManagedMediaSource.isTypeSupported(Mr))&&(e=!0),e}();r._opt.useMSE=l,r._opt.useMSE&&r._opt.isH265&&(r._opt.useMSE=c),r._opt.useMSE||r.debug.warn(r.TAG_NAME,"\n useMSE is true,\n and supportMSE is ".concat(l,", supportHevcMSE is ").concat(c," , _opt.isH265 is ").concat(r._opt.isH265,"\n so set useMSE false"))}}if(Io(r._opt.useMSE)&&(r._opt.mseDecodeAudio=!1),r._opt.useMSE?(r._opt.useWCS&&r.debug.warn(r.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),r._opt.forceNoOffscreen||r.debug.warn(r.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),r._opt.useWCS=!1,r._opt.forceNoOffscreen=!0):r._opt.useWCS,r._opt.isWebrtc&&r._opt.demuxUseWorker&&(r.debug.warn(r.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),r._opt.demuxUseWorker=!1),r._opt.isHls&&r._opt.demuxUseWorker&&(r.debug.warn(r.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),r._opt.demuxUseWorker=!1),r._opt.isAliyunRtc&&r._opt.demuxUseWorker&&(r.debug.warn(r.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),r._opt.demuxUseWorker=!1),r.isStreamWebTransport()&&r._opt.demuxUseWorker&&(r.debug.warn(r.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),r._opt.demuxUseWorker=!1),Io(r._opt.demuxUseWorker)&&(r._opt.mseDecoderUseWorker=!1),r.isPlayback()&&(r._opt.mseDecoderUseWorker=!1),r._opt.useMThreading&&(r._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,r._opt.useMThreading||r.debug.warn(r.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),r._opt.useSIMD||-1!==r._opt.decoder.indexOf("-simd")){var u=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),d=Uo();r._opt.useSIMD=u&&Io(d),r._opt.useSIMD||r.debug.warn(r.TAG_NAME,"useSIMD is true, but not support(isSupportSimd is ".concat(u," ,isIphone is ").concat(d,") so set useSIMD false"))}if(r._opt.useSIMD?-1===r._opt.decoder.indexOf("-simd")?r._opt.useMThreading?r._opt.decoder=r._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):r._opt.decoder=r._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):r._opt.useMThreading&&(r._opt.decoder=r._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==r._opt.decoder.indexOf("-simd")?r._opt.useMThreading?r._opt.decoder=r._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):r._opt.decoder=r._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):r._opt.useMThreading&&(r._opt.decoder=r._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==r._opt.decoder.indexOf("-simd")?r._opt.useMThreading?(r._opt.decoderAudio=r._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),r._opt.decoderHard=r._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),r._opt.decoderHardNotWasm=r._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(r._opt.decoderAudio=r._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),r._opt.decoderHard=r._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),r._opt.decoderHardNotWasm=r._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):r._opt.useMThreading?(r._opt.decoderAudio=r._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),r._opt.decoderHard=r._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),r._opt.decoderHardNotWasm=r._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(r._opt.decoderAudio=r._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),r._opt.decoderHard=r._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),r._opt.decoderHardNotWasm=r._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),Io(r._opt.hasAudio)&&(r._opt.operateBtns.audio=!1),Io(r._opt.hasVideo)&&(r._opt.operateBtns.fullscreen=!1,r._opt.operateBtns.screenshot=!1,r._opt.operateBtns.record=!1,r._opt.operateBtns.ptz=!1,r._opt.operateBtns.quality=!1,r._opt.operateBtns.zoom=!1),r._opt.qualityConfig&&0===r._opt.qualityConfig.length&&r._opt.operateBtns.quality&&(r._opt.operateBtns.quality=!1,r.debug.warn(r.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),Bo(r._opt.useWebGPU)&&(r._opt.useWebGPU=function(){var e=!1;return"gpu"in navigator&&(e=!0),e}(),Io(r._opt.useWebGPU)&&r.debug.warn(r.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),r._opt.hasControl=r._hasControl(),r._loading=!1,r._playing=!1,r._playbackPause=!1,r._hasLoaded=!1,r._zooming=!1,r._destroyed=!1,r._closed=!1,r._checkHeartTimeout=null,r._checkLoadingTimeout=null,r._checkStatsInterval=null,r._checkVisibleHiddenTimeout=null,r._startBpsTime=null,r._isPlayingBeforePageHidden=!1,r._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},r._allStatsData={},r._faceDetectActive=!1,r._objectDetectActive=!1,r._occlusionDetectActive=!1,r._imageDetectActive=!1,r._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},r._videoTimestamp=0,r._audioTimestamp=0,r._latestAudioTimestamp=0,r._videoIframeIntervalTs=0,r._streamQuality=r._opt.defaultStreamQuality||"",!r._streamQuality&&r._opt.qualityConfig.length>0&&(r._streamQuality=r._opt.qualityConfig[0]||""),r._visibility=!0,r._lastestVisibilityChangeTimestamp=null,r._tempWorkerStats=null,r._historyFpsList=[],r._historyVideoDiffList=[],r._tempStreamList=[],r._tempInnerPlayBgobj=null,r._flvMetaData=null,r._flvMetaDataFps=null,r._mseWorkerData={},Io(r._opt.useMSE)&&Io(r._opt.useWCS)&&!r.isWebrtcH264()&&!r.isOldHls()&&(r._opt.useWasm=!0),(r.isOldHls()||r.isWebrtcH264())&&(r._opt.hasVideo=!0,r._opt.hasAudio=!0),r._opt.hasVideo||(r._opt.useMSE=!1,r._opt.useWCS=!1),r._opt.useWasm&&(r._opt.useOffscreen?r._opt.wasmUseVideoRender=!1:r._opt.wasmUseVideoRender&&(r._opt.wasmUseVideoRender=zn()&&Yn()&&Qn(),r._opt.wasmUseVideoRender||r.debug.warn(r.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")),r._opt.useSIMD?r.debug.log(r.TAG_NAME,"use simd wasm"):r.debug.log(r.TAG_NAME,"use wasm")),r._opt.useWasm&&(r._opt.useFaceDetector&&window.JessibucaProFaceDetector||r._opt.useObjectDetector&&window.JessibucaProObjectDetector||r._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||r._opt.useImageDetector&&window.JessibucaProImageDetector)?(r.ai=new cb(r),r._opt.useFaceDetector&&window.JessibucaProFaceDetector||(r._opt.operateBtns.aiFace=!1),r._opt.useObjectDetector&&window.JessibucaProObjectDetector||(r._opt.operateBtns.aiObject=!1),r._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(r._opt.operateBtns.aiOcclusion=!1),r._opt.useImageDetector&&r._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(r.imageDetectActive=!0)):(r._opt.operateBtns.aiObject=!1,r._opt.operateBtns.aiFace=!1,r._opt.operateBtns.aiOcclusion=!1),r._opt.useFaceDetector&&(r._opt.useWasm&&window.JessibucaProFaceDetector||r.debug.warn(r.TAG_NAME,"use face detector, useWasm is ".concat(r._opt.useWasm," and window.JbProFaceDetector is null"))),r._opt.useObjectDetector&&(r._opt.useWasm&&window.JessibucaProObjectDetector||r.debug.warn(r.TAG_NAME,"use object detector, useWasm is ".concat(r._opt.useWasm," and window.JbProObjectDetector is null"))),r._opt.useOcclusionDetector&&(r._opt.useWasm&&window.JessibucaProOcclusionDetector||r.debug.warn(r.TAG_NAME,"use occlusion detector, useWasm is ".concat(r._opt.useWasm," and window.JessibucaProOcclusionDetector is null"))),r._opt.useImageDetector&&(r._opt.useWasm&&window.JessibucaProImageDetector||r.debug.warn(r.TAG_NAME,"use image detector, useWasm is ".concat(r._opt.useWasm," and window.JessibucaProImageDetector is null"))),r._opt.useVideoRender&&(r._opt.useWasm&&!r._opt.useOffscreen?(r._opt.wasmUseVideoRender=zn()&&Yn()&&Qn(),r._opt.wasmUseVideoRender||r.debug.warn(r.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):r._opt.useWCS&&!r._opt.useOffscreen&&(r._opt.wcsUseVideoRender=Yn()&&Qn(),r._opt.wcsUseVideoRender||r.debug.warn(r.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),r._opt.useCanvasRender&&(r._opt.useMSE&&Io(r._opt.mseDecoderUseWorker)&&(r._opt.mseUseCanvasRender=!0),r._opt.useWasm&&(r._opt.wasmUseVideoRender=!1),r._opt.useWCS&&(r._opt.wcsUseVideoRender=!1),r.isOldHls()&&!Nn()&&(r._opt.hlsUseCanvasRender=!0),r.isWebrtcH264()&&(r._opt.webrtcUseCanvasRender=!0)),r._opt.useVideoRender=!1,r._opt.useCanvasRender=!1,r._opt.useWasm?r._opt.wasmUseVideoRender?r._opt.useVideoRender=!0:r._opt.useCanvasRender=!0:r._opt.useWCS?r._opt.wcsUseVideoRender?r._opt.useVideoRender=!0:r._opt.useCanvasRender=!0:r._opt.useMSE?r._opt.mseUseCanvasRender?r._opt.useCanvasRender=!0:r._opt.useVideoRender=!0:r.isOldHls()?r._opt.hlsUseCanvasRender?r._opt.useCanvasRender=!0:r._opt.useVideoRender=!0:r.isWebrtcH264()&&(r._opt.webrtcUseCanvasRender?r._opt.useCanvasRender=!0:r._opt.useVideoRender=!0),a=r,Object.defineProperty(a,"rect",{get:function(){var e={};return a.$container&&(e=a.$container.getBoundingClientRect(),e.width=Math.max(e.width,a.$container.clientWidth),e.height=Math.max(e.height,a.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(a,e,{get:function(){return a.rect[e]||0}})})),r.events=new Go(r),r._opt.hasVideo&&(r.video=new hs(r),r.recorder=new bl(r)),r.isOldHls()?(r.hlsDecoder=new Iv(r),r.loaded=!0):r.isWebrtcH264()?(r._opt.isWebrtcForZLM?r.webrtc=new ob(r):r._opt.isWebrtcForSRS?r.webrtc=new db(r):r._opt.isWebrtcForOthers?r.webrtc=new hb(r):r.webrtc=new nb(r),r.loaded=!0):r.isAliyunRtc()?(r.aliyunRtcDecoder=new pb(r),r.loaded=!0):(r.isUseHls265()&&(r.hlsDecoder=new ib(r)),r.isWebrtcH265()&&(r.webrtc=new nb(r)),Io(_o(r._opt))?r.decoderWorker=new Cl(r):r.loaded=!0),r._opt.hasAudio&&(r.audio=new Ls(r)),r.stream=null,r.demux=null,r._lastVolume=null,r._isMute=null,r._isInZoom=!1,r._playingStartTimestamp=null,r.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,r.isMSEAudioDecoderError=!1,r.isMSEPlaybackRateChangePause=!1,r.isPlayFailedAndPaused=!1,r._opt.useWCS&&(r.webcodecsDecoder=new Uu(r),!r._opt.hasAudio&&Io(r._opt.demuxUseWorker)&&(r.loaded=!0)),r._opt.useMSE&&Io(r._opt.mseDecoderUseWorker)&&(r.mseDecoder=new cd(r),!r._opt.hasAudio&&Io(r._opt.demuxUseWorker)&&(r.loaded=!0)),r.control=new ed(r),r._opt.contextmenuBtns.length>0&&Io(r._opt.disableContextmenu)&&In()?r.contextmenu=new ub(r):Bo(r._opt.disableContextmenu)&&r._opt.contextmenuBtns.length>0&&In()&&r.debug.warn(r.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),r.isPlayback()&&(r.playback=new sb(r,r._opt.playbackConfig)),r._opt.operateBtns.zoom&&(r.zoom=new lb(r)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&Io(r._opt.supportLockScreenPlayAudio&&On())&&(r.keepScreenOn=new dd(r)),function(e){try{var t=function(t){go(t)===e.$container&&(e.emit(xt.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};tn.on("change",t),e.events.destroys.push((function(){tn.off("change",t)}))}catch(e){}if(e.on(Ct.decoderWorkerInit,(function(){e.debug.log("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(Ct.play,(function(){e.loading=!1})),e.on(Ct.fullscreen,(function(t){if(t)try{tn.request(e.$container).then((function(){})).catch((function(t){e.debug.error("player","fullscreen request error",t),Bn()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){Bn()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{tn.exit().then((function(){e.webFullscreen&&(e.webFullscreen=!1)})).catch((function(t){e.debug.error("player","fullscreen exit error",t),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),Bn()&&e.on(Ct.webFullscreen,(function(t){t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(xt.fullscreen,e.fullscreen)})),e.on(Ct.resize,(function(){e.video&&e.video.resize()})),e._opt.debug){var r=[Ct.timeUpdate,Ct.currentPts,Ct.videoSEI],i=[Ct.stats,Ct.playbackStats,Ct.playbackTimestamp,Ct.flvMetaData,Ct.playToRenderTimes,Ct.audioInfo,Ct.videoInfo];Object.keys(Ct).forEach((function(t){e.on(Ct[t],(function(a){if(!r.includes(t)){var n;i.includes(t)&&(a=JSON.stringify(a));for(var o=arguments.length,s=new Array(o>1?o-1:0),l=1;l1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),Bo(r)&&this.decoderWorker&&Object.keys(e).forEach((function(r){t.decoderWorker.updateWorkConfig({key:r,value:e[r]})}))}},{key:"init",value:function(){var e=this;return new Promise((function(t,r){e.video||e._opt.hasVideo&&(e.video=new hs(e)),e.audio||e._opt.hasAudio&&(e.audio=new Ls(e)),e.stream||(e.stream=new js(e)),e.isOldHls()?(e.hlsDecoder||(e.hlsDecoder=new Iv(e),e.loaded=!0),t()):e.isWebrtcH264()?(e.webrtc||(e._opt.isWebrtcForZLM?e.webrtc=new ob(e):e._opt.isWebrtcForSRS?e.webrtc=new db(e):e._opt.isWebrtcForOthers?e.webrtc=new hb(e):e.webrtc=new nb(e),e.loaded=!0),t()):e.isAliyunRtc()?(e.aliyunRtcDecoder||(e.aliyunRtcDecoder=new pb(e),e.loaded=!0),t()):(e.demux||e._opt.hasVideo&&!e.isUseWorkerDemuxAndDecode&&(e.demux=new Mu(e)),e._opt.useWCS&&(e.webcodecsDecoder||(e.webcodecsDecoder=new Uu(e))),e._opt.useMSE&&Io(e._opt.mseDecoderUseWorker)&&(e.mseDecoder||(e.mseDecoder=new cd(e))),e.isUseHls265()&&(e.hlsDecoder||(e.hlsDecoder=new ib(e))),e.isWebrtcH265()&&(e.webrtc||(e.webrtc=new nb(e))),e.decoderWorker?e.loaded?t():e.once(Ct.decoderWorkerInit,(function(){e.isDestroyedOrClosed()?(e.debug.error(e.TAG_NAME,"init() failed and player is destroyed"),r("init() failed and player is destroyed")):(e.loaded=!0,t())})):_o(e._opt)?t():(e.decoderWorker=new Cl(e),e.once(Ct.decoderWorkerInit,(function(){e.isDestroyedOrClosed()?(e.debug.error(e.TAG_NAME,"init() failed and player is destroyed"),r("init() failed and player is destroyed")):(e.loaded=!0,t())}))))}))}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,a){if(!e&&!t._opt.url)return a("url is empty");t._closed=!1,t.loading=!0,t.playing=!1,t._times.playInitStart=Tn(),e||(e=t._opt.url),t._opt.url=e,t.control&&t._opt.loadingBackground&&t.control.initLoadingBackground(),t.init().then((function(){t.debug.log(t.TAG_NAME,"play() init and next fetch stream"),t._times.playStart=Tn(),t._opt.isNotMute&&t.mute(!1),t.enableWakeLock(),t.checkLoadingTimeout(),t.stream?(t.stream.once(Lt.fetchError,(function(e){t.emitError(Lt.fetchError,e)})),t.stream.once(Lt.websocketError,(function(e){t.emitError(Lt.websocketError,e)})),t.stream.once(Ct.streamEnd,(function(e){t.emit(Ct.streamEnd,e)})),t.stream.once(Lt.hlsError,(function(e){t.emitError(Lt.hlsError,e)})),t.stream.once(Lt.webrtcError,(function(e){t.emitError(Lt.webrtcError,e)})),t.stream.once(Ct.streamSuccess,(function(){i(),t._times.streamResponse=Tn(),t.video&&t.video.play(),t.checkStatsInterval(),t.isPlayback()&&t.playback&&t.playback.startCheckStatsInterval()})),t.stream.fetchStream(e,r)):(t.debug.warn(t.TAG_NAME,"play() this.stream is null and is isDestroyedOrClosed is ".concat(t.isDestroyedOrClosed())),a("this.stream is null"))})).catch((function(e){a(e)}))}))}},{key:"playForControl",value:function(){var e=this;return new Promise((function(t,r){e.debug.log(e.TAG_NAME,"playForControl() and pauseAndNextPlayUseLastFrameShow is ".concat(e._opt.pauseAndNextPlayUseLastFrameShow)),e._opt.pauseAndNextPlayUseLastFrameShow&&e._tempInnerPlayBgobj&&e._tempInnerPlayBgobj.loadingBackground&&e.updateOption({loadingBackground:e._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:e._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:e._tempInnerPlayBgobj.loadingBackgroundHeight}),e.play().then((function(e){t(e)})).catch((function(e){r(e)}))}))}},{key:"close",value:function(){var e=this;return new Promise((function(t,r){e._close().then((function(){e.video&&e.video.clearView(),t()})).catch((function(e){r(e)}))}))}},{key:"resumeAudioAfterPause",value:function(){this.lastVolume&&Io(this._isMute)&&(this.volume=this.lastVolume)}},{key:"_close",value:function(){var e=A(v().mark((function e(){return v().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.playing=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},e.t0=this.decoderWorker,!e.t0){e.next=19;break}return e.next=18,this.decoderWorker.destroy();case 18:this.decoderWorker=null;case 19:if(e.t1=this.stream,!e.t1){e.next=24;break}return e.next=23,this.stream.destroy();case 23:this.stream=null;case 24:if(this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),e.t2=this.hlsDecoder,!e.t2){e.next=32;break}return e.next=31,this.hlsDecoder.destroy();case 31:this.hlsDecoder=null;case 32:if(this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),e.t3=this.audio,!e.t3){e.next=39;break}return e.next=38,this.audio.destroy();case 38:this.audio=null;case 39:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"pause",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(r,i){t?e.close().then((function(){r()})).catch((function(e){i(e)})):e._close().then((function(){r()})).catch((function(e){i(e)}))}))}},{key:"pauseForControl",value:function(){var e=this;return new Promise((function(t,r){if(e.debug.log(e.TAG_NAME,"_pauseInner()"),e._opt.pauseAndNextPlayUseLastFrameShow&&e.video){var i=e.video.screenshot("","png",.92,"base64");if(i){var a=e.getVideoInfo();a?(e.debug.log(e.TAG_NAME,"pauseForControl() and loadingBackground width is ".concat(a.width," and height is ").concat(a.height)),e._tempInnerPlayBgobj={loadingBackground:i,loadingBackgroundWidth:a.width,loadingBackgroundHeight:a.height}):e.debug.warn(e.TAG_NAME,"pauseForControl() and videoInfo is null")}else e.debug.warn(e.TAG_NAME,"pauseForControl() and loadingBackground is null")}e.pause().then((function(e){t(e)})).catch((function(e){r(e)}))}))}},{key:"isAudioMute",value:function(){var e=!0;return this.audio&&(e=this.audio.isMute),e}},{key:"isAudioNotMute",value:function(){return!this.isAudioMute()}},{key:"mute",value:function(e){this.audio&&this.audio.mute(e)}},{key:"resize",value:function(){this.video&&this.video.resize()}},{key:"startRecord",value:function(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}},{key:"stopRecordAndSave",value:function(e,t){var r=this;return new Promise((function(i,a){r.recorder||a("recorder is null"),r.recording?(r._opt.useWasm&&r.decoderWorker&&r.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),r.recorder.stopRecordAndSave(e,t).then((function(e){i(e)})).catch((function(e){a(e)}))):a("recorder is not recording")}))}},{key:"_hasControl",value:function(){var e=this,t=!1,r=!1;return Object.keys(this._opt.operateBtns).forEach((function(t){e._opt.operateBtns[t]&&-1===(""+t).indexOf("Fn")&&(r=!0)})),(this._opt.showBandwidth||r)&&(t=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(t=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(t=!0),this._opt.controlHtml&&(t=!0),t}},{key:"useWasmDecode",value:function(){return Io(this._opt.useMSE)&&Io(this._opt.useWCS)}},{key:"canVideoTrackWritter",value:function(){var e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&Io(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&Io(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}},{key:"checkHeartTimeout$2",value:function(){if(Io(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed"));if(Io(this.isHistoryFpsListAllZero()))return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero"));if(0!==this._stats.fps)return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but fps is ".concat(this._stats.fps)));if(Io(this.visibility)&&0!==this._stats.vbps)return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but page is not visibility and vbps is ".concat(this._stats.vbps)));var e=this._historyFpsList.join(",");this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ".concat(this._stats.vbps," and\n current fps is ").concat(this._stats.fps," and\n history FpsList is ").concat(e," and\n current visibility is ").concat(this.visibility," and")),this.emit(Ct.timeout,Ct.delayTimeout),this.emit(Ct.delayTimeout)}else this.debug.log(this.TAG_NAME,"checkHeartTimeout$2 playbackPause is ".concat(this.playbackPause,", playing is ").concat(this.playing))}},{key:"checkStatsInterval",value:function(){var e=this;this._checkStatsInterval=setInterval((function(){e.updateStats()}),1e3)}},{key:"checkLoadingTimeout",value:function(){var e=this;this._checkLoadingTimeout=setTimeout((function(){e.playing?e.debug.warn(e.TAG_NAME,"checkLoadingTimeout but loading is ".concat(e.loading," and playing is ").concat(e.playing)):e.isDestroyedOrClosed()?e.debug&&e.debug.warn(e.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(e.debug.warn(e.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),e.emit(Ct.timeout,Ct.loadingTimeout),e.emit(Ct.loadingTimeout))}),1e3*this._opt.loadingTimeout)}},{key:"clearCheckLoadingTimeout",value:function(){this._checkLoadingTimeout&&(this.debug.log(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}},{key:"clearStatsInterval",value:function(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}},{key:"handleRender",value:function(){this.isDestroyedOrClosed()?this.debug&&this.debug.warn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(Ct.start)),this.playing||(this.playing=!0))}},{key:"updateStats",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._startBpsTime||(this._startBpsTime=Tn()),eo(e.ts)){var t=parseInt(e.ts,10);this._stats.ts=t,null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}eo(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),eo(e.mseTs)&&(this._stats.mseTs=e.mseTs),eo(e.buf)&&(this._stats.buf=e.buf),eo(e.netBuf)&&(this._stats.netBuf=e.netBuf),eo(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));var r=Tn();if(!(r-this._startBpsTime<1e3)){null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);var i=0,a=0,n=0,o=0,s=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),a=this.mseDecoder.checkSourceBufferStore(),a=a.toFixed(2),n=this.mseDecoder.getDecodeDiffTimes(),o=this.mseDecoder.getDecodePlaybackRate(),s=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),a=this.video.checkSourceBufferStore(),a=a.toFixed(2),o=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(n=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));var l=0,c=0,u=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),l=this.hlsDecoder.getDemuxBufferedListLength(),u=this.hlsDecoder.getDemuxVideoBufferedListLength(),c=this.hlsDecoder.getDemuxAudioBufferedListLength());var d=0,h=0,p=0,f=!1,m=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(h=this._tempWorkerStats.demuxBufferDelay,p=this._tempWorkerStats.audioDemuxBufferDelay,d=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,m=this._tempWorkerStats.pushLatestDelay,f=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay):this.demux&&(d=this.demux.getInputByteLength(),m=this.demux.getPushLatestDelay(),f=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(h=this.demux.bufferList.length));var g=0,y=0;this.audio&&this.audio.bufferList&&(g=this.audio.bufferList.length,y=parseInt(g*this.audio.oneBufferDuration,10));var v=0,A=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(v=this.video.bufferList&&this.video.bufferList.length||0);var b=this.video.getStreamFps(),_=b>0?1e3/b:0;A=parseInt(_*v+_*h,10)}var k=0;this.videoTimestamp>0&&(k=this._stats.dts-this.videoTimestamp);var w=k+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);var S=this.getVideoCurrentTime(),E=this._stats.videoCurrentTime,T=-1;E&&S&&(T=(S-E).toFixed(2),S=S.toFixed(2));var C=0;this.audioTimestamp>0&&(C=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:g,audioBufferDelayTs:y,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:v,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:A,demuxBuffer:h,pushLatestDelay:m,audioDemuxBuffer:p,streamBuffer:d,mseDelay:i,mseStore:a,mseDecodeDiffTimes:n,mseDecodePlaybackRate:o,msePendingBuffer:s,wcsDecodeDiffTimes:n,hlsDelay:i,hlsDemuxLength:l,hlsDemuxAudioLength:c,hlsDemuxVideoLength:u,delayTs:k,totalDelayTs:w,isStreamTsMoreThanLocal:f,videoCurrentTime:S,videoCurrentTimeDiff:T,audioSyncVideo:C});var x=null,R=null,D="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){x=function(e,t){var r=3,i=t||25;return e<.33*i?r=0:e<.5*i?r=1:e<.83*i&&(r=2),r}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=x;var L=this.checkVideoSmooth(this._allStatsData);D=L.reason,R=L.result,this._allStatsData.videoSmooth=R}this.emit(Ct.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===W&&this.emit(Lt.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._stats.videoCurrentTimeDiff),eo(x)&&this.emit(Ct.performance,x),eo(R)&&this.emit(Ct.videoSmooth,R,D)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._stats.isDropping=!1,this._startBpsTime=r}}},{key:"resetStats",value:function(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={}}},{key:"checkVideoSmooth",value:function(e){var t=!0,r="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:r};if(0===e.vbps&&Io(this._opt.isHls)&&(r="vbpsIsZero",this.debug.log(this.TAG_NAME,"checkVideoSmooth false because ".concat(r)),t=!1),t&&e.isDropping&&(r="isDroppingIsTrue",this.debug.log(this.TAG_NAME,"checkVideoSmooth false because ".concat(r)),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){var i=function(e){var t=Math.max.apply(Math,g(e)),r=Math.min.apply(Math,g(e));return e.filter((function(e){return e!==t&&e!==r}))}(this._historyFpsList),a=i.reduce((function(e,t){return e+t}),0)/i.length,n=.83*a;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff&&(r="videoCurrentTimeDiffIsNotNormal",this.debug.log(this.TAG_NAME,"checkVideoSmooth false because videoCurrentTimeDiff is ".concat(e.videoCurrentTimeDiff)),t=!1),{result:t,reason:r}}},{key:"enableWakeLock",value:function(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}},{key:"releaseWakeLock",value:function(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}},{key:"clearBufferDelay",value:function(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}},{key:"doDestroy",value:function(){this.emit(Ct.beforeDestroy)}},{key:"handlePlayToRenderTimes",value:function(){if(this.isDestroyedOrClosed())this.debug.log(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");else{var e=this.getPlayToRenderTimes();this.emit(Ct.playToRenderTimes,e)}}},{key:"getPlayToRenderTimes",value:function(){var e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}},{key:"getOption",value:function(){return this._opt}},{key:"getPlayType",value:function(){return this._opt.playType}},{key:"isPlayer",value:function(){return this._opt.playType===N}},{key:"isPlayback",value:function(){return this._opt.playType===z}},{key:"isDemuxSetCodecInit",value:function(){var e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}},{key:"isDemuxDecodeFirstIIframeInit",value:function(){var e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}},{key:"isAudioPlaybackRateSpeed",value:function(){var e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}},{key:"getPlayingTimestamp",value:function(){return this._stats.pTs}},{key:"getRecordingType",value:function(){var e=null;return this.recorder&&(e=this.recorder.getType()),e}},{key:"getRecordingByteLength",value:function(){var e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}},{key:"getRecordingDuration",value:function(){var e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}},{key:"getDecodeType",value:function(){var e="",t=this.getOption();return this.isWebrtcH264()?le:this.isAliyunRtc()?ue:this.isOldHls()?ce:(t.useMSE&&(e+=re+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=ie+" "),t.useWasm&&(e+=ne+" ",t.useSIMD&&(e+=oe+" "),t.useMThreading&&(e+=se+" ")),t.useOffscreen&&(e+=ae+" "),e)}},{key:"getDemuxType",value:function(){return this._opt.demuxType}},{key:"getRenderType",value:function(){var e="";return this.video&&(e=this.video.getType()),e}},{key:"getCanvasRenderType",value:function(){var e="";return this.video&&(e=this.video.getCanvasType()),e}},{key:"getAudioEngineType",value:function(){var e="";return this.audio&&(e=this.audio.getEngineType()),e}},{key:"getStreamType",value:function(){var e="";return this.stream&&(e=this.stream.getStreamType()),e}},{key:"getAllStatsData",value:function(){return this._allStatsData}},{key:"isFlvDemux",value:function(){return this._opt.demuxType===W}},{key:"isM7SDemux",value:function(){return this._opt.demuxType===J}},{key:"isNakedFlowDemux",value:function(){return this._opt.demuxType===Q}},{key:"isMpeg4Demux",value:function(){return this._opt.demuxType===Z}},{key:"isTsDemux",value:function(){return this._opt.demuxType===ee}},{key:"isFmp4Demux",value:function(){return this._opt.demuxType===X}},{key:"togglePerformancePanel",value:function(e){this.updateOption({showPerformance:e}),this.emit(Ct.togglePerformancePanel,e)}},{key:"setScaleMode",value:function(e){var t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case yr:t.isFullResize=!1,t.isResize=!1;break;case vr:t.isFullResize=!1,t.isResize=!0;break;case Ar:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(Ct.viewResizeChange,e)}},{key:"startVisibilityHiddenTimeout",value:function(){var e=this;this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((function(){e.emit(Ct.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}},{key:"clearVisibilityHiddenTimeout",value:function(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}},{key:"faceDetect",value:function(e){this.faceDetectActive=e,Io(e)&&this.video&&this.video.addAiContentToCanvas([])}},{key:"objectDetect",value:function(e){this.objectDetectActive=e,Io(e)&&this.video&&this.video.addAiContentToCanvas([])}},{key:"occlusionDetect",value:function(e){this.occlusionDetectActive=e}},{key:"downloadNakedFlowFile",value:function(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}},{key:"downloadFmp4File",value:function(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}},{key:"downloadMpeg4File",value:function(){var e=new Blob([this._tempStreamList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}},{key:"hasCacheOnGopBuffer",value:function(){var e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,r=this._allStatsData.maxFps,i=!1;return e&&t&&r&&(i=1e3/r*t>e),i}},{key:"addContentToCanvas",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}},{key:"addContentToContainer",value:function(){}},{key:"sendWebsocketMessage",value:function(e){var t=this.getStreamType();t===I||t===F+" "+I?this.stream.sendMessage(e):this.debug.warn(this.TAG_NAME,"sendWebsocketMessage: stream type is not websocket, current stream type is ".concat(this.getStreamType()))}},{key:"checkIsInRender",value:function(){var e=this._stats;return e.vbps>0&&e.fps>0}},{key:"setControlHtml",value:function(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}},{key:"clearControlHtml",value:function(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}},{key:"updateWatermark",value:function(e){this.singleWatermark&&this.singleWatermark.update(e)}},{key:"removeWatermark",value:function(){this.singleWatermark&&this.singleWatermark.remove()}},{key:"getVideoInfo",value:function(){var e=null;return this.video&&(e=this.video.getVideoInfo()),e}},{key:"getAudioInfo",value:function(){var e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}},{key:"getVideoPlaybackQuality",value:function(){var e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}},{key:"emitError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(Ct.error,e,t),this.emit(e,t)}},{key:"updateHistoryFpsList",value:function(e,t){this.playbackPause||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}},{key:"isHistoryFpsListAllZero",value:function(){var e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(var r=0;r0){e=!1;break}return e}},{key:"isUseHls265",value:function(){return Bo(this._opt.isHls)&&Bo(this._opt.supportHls265)}},{key:"isHls",value:function(){return Bo(this._opt.isHls)}},{key:"isOldHls",value:function(){return Bo(this._opt.isHls)&&Io(this._opt.supportHls265)}},{key:"isWebrtcNotH265",value:function(){return Bo(this._opt.isWebrtc)&&Io(this._opt.isWebrtcH265)}},{key:"isWebrtcH264",value:function(){return Bo(this._opt.isWebrtc)&&Io(this._opt.isWebrtcH265)}},{key:"isWebrtcH265",value:function(){return Bo(this._opt.isWebrtc)&&Bo(this._opt.isWebrtcH265)}},{key:"isAliyunRtc",value:function(){return Bo(this._opt.isAliyunRtc)}},{key:"isUseHls265UseMse",value:function(){return this.isUseHls265()&&this.isUseMSE()}},{key:"isStreamWebTransport",value:function(){return this.getStreamType()===U}},{key:"isPlaybackCacheBeforeDecodeForFpsRender",value:function(){return this.isPlayback()&&Bo(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&Bo(this._opt.useWCS)}},{key:"isPlaybackUseWCS",value:function(){return this.isPlayback()&&Bo(this._opt.useWCS)}},{key:"isPlaybackUseMSE",value:function(){return this.isPlayback()&&Bo(this._opt.useMSE)}},{key:"isPlayUseMSE",value:function(){return this.isPlayer()&&Bo(this._opt.useMSE)}},{key:"isInWebFullscreen",value:function(){return this._opt.useWebFullScreen&&Bn()&&this.fullscreen}},{key:"getPlaybackRate",value:function(){var e=1;return Bo(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}},{key:"isPlaybackOnlyDecodeIFrame",value:function(){return Bo(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame}},{key:"pushTempStream",value:function(e){var t=new Uint8Array(e);this._tempStreamList.push(t)}},{key:"updateLoadingText",value:function(e){this.loading&&this.control&&this.control.updateLoadingText(e)}},{key:"getVideoCurrentTime",value:function(){var e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}},{key:"addMemoryLog",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i0){var i=r/1e3;this._flvMetaDataFps=i}}$n(t.hasAudio)&&Io(t.hasAudio)&&(this.debug.log("updateMetaData","hasAudio",t.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=t.hasAudio),$n(t.hasVideo)&&Io(t.hasVideo)&&(this.debug.log("updateMetaData","hasVideo",t.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=t.hasVideo)}this.emit(Ct.flvMetaData,e)}},{key:"getMetaData",value:function(){return this._flvMetaData}},{key:"getExtendBtnList",value:function(){return this.control.getExtendBtnList().map((function(e){return{name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap}}))}},{key:"getCpuLevel",value:function(){var e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}},{key:"isRecordTypeFlv",value:function(){return this.recorder&&this._opt.recordType===V}},{key:"isRecordTypeMp4",value:function(){return this.recorder&&this._opt.recordType===G}},{key:"isRecordTypeWebm",value:function(){return this.recorder&&this._opt.recordType===H}},{key:"isDemuxInWorker",value:function(){return this._opt.useWasm||this._opt.demuxUseWorker}},{key:"isUseMSE",value:function(){return Bo(this._opt.useMSE)}},{key:"isUseWCS",value:function(){return Bo(this._opt.useWCS)}},{key:"isUseWASM",value:function(){return Bo(this._opt.useWasm)}},{key:"isMseDecoderUseWorker",value:function(){return this.isUseMSE()&&Bo(this._opt.mseDecoderUseWorker)}},{key:"getAudioSyncVideoDiff",value:function(){return this.audioTimestamp-this.getRenderCurrentPts()}},{key:"getMseVideoBufferDelayTime",value:function(){var e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}},{key:"updateCurrentPts",value:function(e){this.updateStats({currentPts:e}),this.emit(Ct.currentPts,e)}},{key:"getRenderCurrentPts",value:function(){var e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}},{key:"openSyncAudioAndVideo",value:function(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}},{key:"showTipsMessageByCode",value:function(e){if(this.control){var t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}},{key:"showTipsMessageByContent",value:function(e){this.control&&e&&this.control.showTipsMessage(e)}},{key:"hideTipsMessage",value:function(){this.control&&this.control.hideTipsMessage()}},{key:"decoderCheckFirstIFrame",value:function(){Bo(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}},{key:"isHlsCanVideoPlay",value:function(){return this._canPlayAppleMpegurl&&this.isOldHls()}},{key:"setPtzPosition",value:function(e){this.control&&this.control.updatePtzPosition(e)}},{key:"setPlayFailedAndPaused",value:function(){this.isPlayFailedAndPaused=!0}},{key:"getMseMineType",value:function(){var e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}},{key:"getMaxDelayTs",value:function(){return this._opt.videoBuffer+this._opt.videoBufferDelay}},{key:"isMseVideoStateInited",value:function(){return!this.video||this.video.getReadyStateInited()}}])}(Ho),yb=function(){function r(e){S(this,r);var t=e.fromSampleRate,i=e.toSampleRate,a=e.channels,n=e.inputBufferSize;if(!t||!i||!a)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=t,this.toSampleRate=i,this.channels=a||0,this.inputBufferSize=n,this.initialize()}return w(r,[{key:"initialize",value:function(){this.fromSampleRate==this.toSampleRate?(this.resampler=function(e){return e},this.ratioWeight=1):(this.fromSampleRate0?u:0)]*n+t[s+(h+u)]*o;a+=i,s=Math.floor(a)*h}for(u=0;u0&&s=l)){for(o=0;o0?o:0)]*n;h+=n,n=0;break}for(o=0;o=0?t=213:(t=85,(e=-e-1)<0&&(e=32767)),r=Ab(e,vb,8),r>=8?127^t:(i=r<<4,i|=r<2?e>>4&15:e>>r+3&15,i^t)}(e)})),t}function _b(e){var t=[];return Array.prototype.slice.call(e).forEach((function(e,r){t[r]=function(e){var t=0;e<0?(e=132-e,t=127):(e+=132,t=255);var r=Ab(e,vb,8);return r>=8?127^t:(r<<4|e>>r+3&15)^t}(e)})),t}var kb=function(e){function t(e){var r;S(this,t);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r=_(this,t),r._opt={},e&&(r.player=e),r.TAG_NAME="talk";var a=Ro(ea);return r._opt=Object.assign({},a,i),r._opt.sampleRate=parseInt(r._opt.sampleRate,10),r._opt.sampleBitsWidth=parseInt(r._opt.sampleBitsWidth,10),r.audioContext=null,r.gainNode=null,r.recorder=null,r.workletRecorder=null,r.biquadFilter=null,r.userMediaStream=null,r.clearWorkletUrlTimeout=null,r.bufferSize=512,r._opt.audioBufferLength=r.calcAudioBufferLength(),r.audioBufferList=[],r.socket=null,r.socketStatus=Pt,r.mediaStreamSource=null,r.heartInterval=null,r.checkGetUserMediaTimeout=null,r.wsUrl=null,r.startTimestamp=0,r.sequenceId=0,r.tempTimestamp=null,r.tempG711BufferList=[],r.tempRtpBufferList=[],r.tempPcmBufferList=[],r.events=new Go(r),r._initTalk(),r.player||(r.debug=new Za(r)),r._opt.encType!==ci&&r._opt.encType!==ui||8e3===r._opt.sampleRate&&16===r._opt.sampleBitsWidth||r.warn(r.TAG_NAME,"\n encType is ".concat(r._opt.encType," and sampleBitsWidth is ").concat(r._opt.sampleBitsWidth,", set sampleBitsWidth to ").concat(r._opt.sampleBitsWidth,"。\n ").concat(r._opt.encType," only support sampleRate 8000 and sampleBitsWidth 16")),r.log(r.TAG_NAME,"init",JSON.stringify(r._opt)),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.clearWorkletUrlTimeout&&(clearTimeout(this.clearWorkletUrlTimeout),this.clearWorkletUrlTimeout=null),this.userMediaStream&&(this.userMediaStream.getTracks&&this.userMediaStream.getTracks().forEach((function(e){e.stop()})),this.userMediaStream=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.recorder&&(this.recorder.disconnect(),this.recorder.onaudioprocess=null,this.recorder=null),this.biquadFilter&&(this.biquadFilter.disconnect(),this.biquadFilter=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.workletRecorder&&(this.workletRecorder.disconnect(),this.workletRecorder=null),this.socket&&(this.socketStatus===Bt&&this._sendClose(),this.socket.close(),this.socket=null),this._stopHeartInterval(),this._stopCheckGetUserMediaTimeout(),this.audioContext=null,this.gainNode=null,this.recorder=null,this.audioBufferList=[],this.sequenceId=0,this.wsUrl=null,this.tempTimestamp=null,this.tempRtpBufferList=[],this.tempG711BufferList=[],this.tempPcmBufferList=[],this.startTimestamp=0,this.log(this.TAG_NAME,"destroy")}},{key:"addRtpToBuffer",value:function(e){var t=e.length+this.tempRtpBufferList.length,r=new Uint8Array(t);r.set(this.tempRtpBufferList,0),r.set(e,this.tempRtpBufferList.length),this.tempRtpBufferList=r}},{key:"addG711ToBuffer",value:function(e){var t=e.length+this.tempG711BufferList.length,r=new Uint8Array(t);r.set(this.tempG711BufferList,0),r.set(e,this.tempG711BufferList.length),this.tempG711BufferList=r}},{key:"addPcmToBuffer",value:function(e){var t=e.length+this.tempPcmBufferList.length,r=new Uint8Array(t);r.set(this.tempPcmBufferList,0),r.set(e,this.tempPcmBufferList.length),this.tempG711ButempPcmBufferListfferList=r}},{key:"downloadRtpFile",value:function(){this.debug.log(this.TAG_NAME,"downloadRtpFile");var e=new Blob([this.tempRtpBufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".rtp",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadRtpFile",e)}}},{key:"downloadG711File",value:function(){this.debug.log(this.TAG_NAME,"downloadG711File");var e=new Blob([this.tempG711BufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+"."+this._opt.encType,t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadG711File",e)}}},{key:"downloadPcmFile",value:function(){this.debug.log(this.TAG_NAME,"downloadPcmFile");var e=new Blob([this.tempPcmBufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+"."+this._opt.encType,t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadRtpFile",e)}}},{key:"downloadFile",value:function(){this._opt.packetType===Ji?this.downloadRtpFile():this._opt.encType===ci||this._opt.encType===ui?this.downloadG711File():this.downloadPcmFile()}},{key:"calcAudioBufferLength",value:function(){var e=this._opt,t=e.sampleRate;e.sampleBitsWidth;return 8*t*.02/8}},{key:"socketStatusOpen",get:function(){return this.socketStatus===Bt}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r1?a-1:0),o=1;o do talk"),e.emit(Ct.talkStreamOpen),t(),e._doTalk()})),i(e.socket,Xi,(function(t){e.log(e.TAG_NAME,"websocket message",t.data)})),i(e.socket,Yi,(function(t){e.socketStatus=It,e.warn(e.TAG_NAME,"websocket close -> reject",t),e.emit(Ct.talkStreamClose),r(t)})),i(e.socket,Qi,(function(t){e.socketStatus=Mt,e.error(e.TAG_NAME,"websocket error -> reject",t),e.emit(Ct.talkStreamError,t),r(t)}))}))}},{key:"_sendClose",value:function(){}},{key:"_initTalk",value:function(){this._initMethods(),this._opt.engine===Zi?this._initWorklet():this._opt.engine===$i&&this._initScriptProcessor(),this.log(this.TAG_NAME,"audioContext samplerate",this.audioContext.sampleRate)}},{key:"_initMethods",value:function(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.biquadFilter=this.audioContext.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.frequency.value=3e3,this.resampler=new yb({fromSampleRate:this.audioContext.sampleRate,toSampleRate:this._opt.sampleRate,channels:this._opt.numberChannels,inputBufferSize:this.bufferSize})}},{key:"_initScriptProcessor",value:function(){var e=this,t=this.audioContext.createScriptProcessor||this.audioContext.createJavaScriptNode;this.recorder=t.apply(this.audioContext,[this.bufferSize,this._opt.numberChannels,this._opt.numberChannels]),this.recorder.onaudioprocess=function(t){return e._onaudioprocess(t)}}},{key:"_initWorklet",value:function(){var e=this,t=ko((function(){var e=function(e){function t(e){var r;return S(this,t),r=_(this,t),r._cursor=0,r._bufferSize=e.processorOptions.bufferSize,r._buffer=new Float32Array(r._bufferSize),r}return k(t,e),w(t,[{key:"process",value:function(e,t,r){if(!e.length||!e[0].length)return!0;for(var i=0;i>8,t[s++]=255&l>>0}t[s++]=128,t[s++]=128+r,t[s++]=i/256,t[s++]=i%256,t[s++]=a/65536/256,t[s++]=a/65536%256,t[s++]=a%65536/256,t[s++]=a%65536%256,t[s++]=n/65536/256,t[s++]=n/65536%256,t[s++]=n%65536/256,t[s++]=n%65536%256;for(var c=t.concat(g(e)),u=new Uint8Array(c.length),d=0;d\n \n \n ').concat(g.watermark_txt,'\n \n \n ').concat(g.watermark_txt,'\n \n \n \n \n '),k=window.btoa(unescape(encodeURIComponent(_))),w=document.createElement("div");w.style.position="absolute",w.style.left="0px",w.style.top="0px",w.style.overflow="hidden",w.style.zIndex="9999999",w.style.width=s+"px",w.style.height=l+"px",w.style.display="block",w.style["-ms-user-select"]="none",w.style.backgroundImage="url(data:image/svg+xml;base64,".concat(k,")"),h.appendChild(w)}},{key:"_removeMark",value:function(){var e=this.defaultSettings,t=document.getElementById(e.watermark_id);if(t){var r=t.parentNode;r&&r.removeChild(t)}}},{key:"_calcTextSize",value:function(){var e=this.globalSetting,t=e.watermark_txt,r=e.watermark_font,i=e.watermark_fontsize,a=document.createElement("span");a.innerHTML=t,a.setAttribute("style","font-family: ".concat(r,"; font-size: ").concat(i,"px; visibility: hidden; display: inline-block")),document.querySelector("body").appendChild(a);var n={width:a.offsetWidth,height:a.offsetHeight};return a.remove(),n}}])}(),Eb="right",Tb="left",Cb="up",xb="down",Rb="leftUp",Db="leftDown",Lb="rightUp",Pb="rightDown",Bb="zoomExpand",Ib="zoomNarrow",Mb="apertureFar",Ub="apertureNear",Fb="focusFar",Ob="focusNear",Nb="setPos",jb="calPos",zb="delPos",Gb="wiperOpen",Hb="wiperClose",Vb="cruiseStart",Wb={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},Jb=[25,50,75,100,125,150,175,200,225,250],qb=[1,2,3,4,5,6,7,8,9,16],Kb=[16,48,80,112,144,160,176,192,208,224];function Yb(e){var t,r,i,a,n=e.type,o=e.speed,s=void 0===o?5:o,l=e.index,c=void 0===l?0:l,u=function(e){return Jb[(e=e||5)-1]||Jb[4]}(s);if(t=Wb[n],!t)return"";switch(n){case Cb:case xb:case Mb:case Ub:i=u;break;case Eb:case Tb:case Fb:case Ob:r=u;break;case Rb:case Db:case Lb:case Pb:r=u,i=u;break;case Bb:case Ib:a=function(e){return Kb[(e=e||5)-1]||Kb[4]}(s);break;case jb:case zb:case Nb:i=Qb(c);break;case Hb:case Gb:r=1;break;case Vb:r=Qb(c)}return function(e,t,r,i){var a=[];return a[0]=165,a[1]=15,a[2]=1,a[3]=0,a[4]=0,a[5]=0,a[6]=0,e&&(a[3]=e),t&&(a[4]=t),r&&(a[5]=r),i&&(a[6]=i),a[7]=(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6])%256,function(e){for(var t="",r=0;rt)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r===t?i[n]=Zb(e[n]):"object"==T(e[n])?i[n]=$b(e[n],t,r+1):i[n]=e[n]);return i}}function e_(){return(new Date).toLocaleString()}var t_=function(){function e(t){S(this,e);var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=t,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==r?void 0:r.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debug.log(this.TAG_NAME,"init")}return w(e,[{key:"destroy",value:function(){this.clear(),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"clear",value:function(){this.logSize=0,this.logTextArray=[]}},{key:"logCache",value:function(){var e="";try{for(var t=arguments.length,r=new Array(t),i=0;ithis.logMaxSize){var n=this.logTextArray.shift();this.logSize-=n.length}}},{key:"getLog",value:function(){return this.logTextArray.join("\n")}},{key:"getLogBlob",value:function(){var e=this.getLog();return new Blob([e],{type:"text/plain"})}},{key:"download",value:function(){var e=this.getLog();this.clear();var t=new Blob([e],{type:"text/plain"});os(t,"JbPro-"+e_()+".log")}}])}(),r_=function(e){function t(e){var r;return S(this,t),r=_(this,t),r.player=e,r.TAG_NAME="Network",r.online=r.isOnline(),r.prevOnline=r.online,r.interval=null,r._initListener(),r.player.debug.log(r.TAG_NAME,"init"),r}return k(t,e),w(t,[{key:"destroy",value:function(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debug.log(this.TAG_NAME,"destroy")}},{key:"_initListener",value:function(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}},{key:"_stopCheck",value:function(){this.interval&&(clearInterval(this.interval),this.interval=null)}},{key:"_startCheck",value:function(){var e=this;this.interval=setInterval((function(){e.isOnline()!==e.prevOnline&&(e.isOnline()?e._updateOnlineStatus():e._updateOfflineStatus())}),1e3)}},{key:"_updateOnlineStatus",value:function(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}},{key:"_updateOfflineStatus",value:function(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}},{key:"logStatus",value:function(){var e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debug.log(this.TAG_NAME,"prevOnline: ".concat(this.prevOnline,", online: ").concat(this.online,", status: ").concat(e," -> ").concat(t))}},{key:"isOnline",value:function(){return void 0===navigator.onLine||navigator.onLine}},{key:"isOffline",value:function(){return!this.isOnline()}}])}(Ho),i_=function(t){function r(){var e;S(this,r);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e=_(this,r),e._opt={},e.TAG_NAME="JbPro",e.$container=null,Object.keys(t).forEach((function(e){if(void 0===t[e])throw new Error('JbPro option "'.concat(e,'" can not be undefined'))})),e.originalOptions=t;var i=Do(),a=Object.assign({},i,t);a.url="",a.isMulti&&(a.debugUuid="xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))),e.debug=new Za(e),e.debug.log("JbPro","init");var n,o,s,l=t.container;if("string"==typeof t.container&&(l=document.querySelector(t.container)),!l)throw e.debug.error("JbPro","JbPro need container option and now container is",t.container),new Error("JbPro need container option");if(a.decoder&&Io(-1!==a.decoder.indexOf("decoder-pro.js")||-1!==a.decoder.indexOf("decoder-pro-simd.js")))throw e.debug.error("JbPro","JbPro decoder ".concat(a.decoder," must be decoder-pro.js or decoder-pro-simd.js")),new Error("JbPro decoder ".concat(a.decoder," must be decoder-pro.js or decoder-pro-simd.js"));if("CANVAS"===l.nodeName||"VIDEO"===l.nodeName)throw e.debug.error("JbPro","JbPro container type can not be ".concat(l.nodeName," type")),new Error("JbPro container type can not be ".concat(l.nodeName," type"));if(a.videoBuffer>=a.heartTimeout)throw e.debug.error("JbPro","JbPro videoBuffer ".concat(a.videoBuffer,"s must be less than heartTimeout ").concat(a.heartTimeout,"s")),new Error("JbPro videoBuffer ".concat(a.videoBuffer,"s must be less than heartTimeout ").concat(a.heartTimeout,"s"));if(e._checkHasCreated(l))throw e.debug.error("JbPro","JbPro container has been created and can not be created again",l),new Error("JbPro container has been created and can not be created again",l);if(!l.classList)throw e.debug.error(e.TAG_NAME,"JbPro container is invalid, must be a DOM Element",l),new Error("JbPro container is invalid, must be a DOM Element",l);if(a.videoBuffer>10&&console.warn("JbPro","videoBuffer ".concat(a.videoBuffer,"s is too long, will black screen for ").concat(a.videoBuffer,"s , it is recommended to set it to less than 10s")),l.classList.add("jb-pro-container"),n=l,o=be,s=Hn(),n&&(n.dataset?n.dataset[o]=s:n.setAttribute("data-"+o,s)),Io(a.isLive)){var c=document.createElement("video");return u(e,(c.muted=!0,c.setAttribute("controlsList","nodownload"),c.disablePictureInPicture="disablePictureInPicture",c.style.position="absolute",c.style.top=0,c.style.left=0,c.style.height="100%",c.style.width="100%",l.appendChild(c),e.$videoElement=c,e.$container=l,void(e._opt=a)))}if(delete a.container,eo(a.videoBuffer)&&(a.videoBuffer=1e3*Number(a.videoBuffer)),eo(a.videoBufferDelay)&&(a.videoBufferDelay=1e3*Number(a.videoBufferDelay)),eo(a.networkDelay)&&(a.networkDelay=1e3*Number(a.networkDelay)),eo(a.aiFaceDetectInterval)&&(a.aiFaceDetectInterval=1e3*Number(a.aiFaceDetectInterval)),eo(a.aiObjectDetectInterval)&&(a.aiObjectDetectInterval=1e3*Number(a.aiObjectDetectInterval)),eo(a.timeout)&&(Zn(a.loadingTimeout)&&(a.loadingTimeout=a.timeout),Zn(a.heartTimeout)&&(a.heartTimeout=a.timeout)),eo(a.autoWasm)&&(Zn(a.decoderErrorAutoWasm)&&(a.decoderErrorAutoWasm=a.autoWasm),Zn(a.hardDecodingNotSupportAutoWasm)&&(a.hardDecodingNotSupportAutoWasm=a.autoWasm)),eo(a.aiFaceDetectLevel)&&Zn(a.aiFaceDetectWidth)){var d=Ta[a.aiFaceDetectLevel];d&&(a.aiFaceDetectWidth=d)}if(eo(a.aiObjectDetectLevel)&&Zn(a.aiObjectDetectWidth)){var h=Ca[a.aiObjectDetectLevel];h&&(a.aiObjectDetectWidth=h)}return Bo(a.isCrypto)&&(a.isM7sCrypto=!0),e._opt=a,e._destroyed=!1,e.$container=l,e._tempPlayBgObj={},e._tempVideoLastIframeInfo={},e._tempPlayerIsMute=!0,e._loadingTimeoutReplayTimes=0,e._heartTimeoutReplayTimes=0,e._streamErrorReplayTimes=0,e._streamEndReplayTimes=0,e._websocket1006ErrorReplayTimes=0,e.events=new Go(e),e._opt.isUseNewFullscreenWatermark?e.watermark=new Sb(e):e.watermark=new wb(e),e.memoryLogger=new t_(e),e.network=new r_(e),e._websocket1006ErrorRetryLog=[],e._mseDecodeErrorRetryLog=[],e._wcsDecodeErrorRetryLog=[],e._isNetworkOfflinePaused=!1,e._isNetworkOfflinePausedAndNextPlayConfig={},e.widthOrHeightChangeReplayDelayTimeout=null,e.streamErrorReplayDelayTimeout=null,e.streamEndReplayDelayTimeout=null,e.$loadingBgImage=null,e.$loadingBg=null,e._initPlayer(l,a),e._initWatermark(),e._initNetwork(),e.debug.log("JbPro",'init success and version is "4-1-2024"'),console.log('JbPro Version is "4-1-2024"'),e}return k(r,t),w(r,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,r){e.debug.log("JbPro","destroy()"),e._destroyed=!0,e.off(),e._removeTimeout(),e.$videoElement&&(e.$videoElement.pause(),e.$videoElement.currentTime=0,e.$videoElement.srcObject&&(e.$videoElement.srcObject=null,e.$videoElement.removeAttribute("srcObject")),e.$videoElement.src&&(e.$videoElement.src="",e.$videoElement.removeAttribute("src")),e.$container&&e.$container.removeChild(e.$videoElement),e.$videoElement=null),e._removeLoadingBackgroundForIOS(),e.player?e.player.destroy().then((function(){e.player=null,e._destroy(),t()})).catch((function(){r()})):(e._destroy(),t())}))}},{key:"_removeTimeout",value:function(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null)}},{key:"_destroy",value:function(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.talk&&(this.talk.destroy(),this.talk=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=be,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debug&&this.debug.log("JbPro","destroy end"),this._opt=null,this.debug=null}},{key:"_resetReplayTimes",value:function(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}},{key:"_getOriginalOpt",value:function(){var e=Do();return Object.assign({},e,this.originalOptions)}},{key:"_initPlayer",value:function(e,t){this.player=new gb(e,t),this._bindEvents()}},{key:"_initTalk",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.talk&&(this.talk.destroy(),this.talk=null),this.player&&(e.debug=this.player._opt.debug),this.talk=new kb(this.player,e),this.debug.log("JbPro","_initTalk",this.talk.getOption()),this._bindTalkEvents()}},{key:"_resetPlayer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(r,i){e.debug.log(e.TAG_NAME,"_resetPlayer()",JSON.stringify(t));var a=function(){e._opt.url="",e._opt.playOptions={},e._opt=Object.assign(e._opt,t),e._initPlayer(e.$container,e._opt)};e.player?e.player.destroy().then((function(){e.player=null,a(),e.debug.log(e.TAG_NAME,"_resetPlayer() end"),r()})).catch((function(){i()})):(a(),e.debug.log(e.TAG_NAME,"_resetPlayer() end"),r())}))}},{key:"_bindEvents",value:function(){var e=this,t=this;Object.keys(xt).forEach((function(r){e.player.on(xt[r],(function(){for(var e=arguments.length,i=new Array(e),a=0;a0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(r,i){e.debug.log("JbPro","pause() ".concat(t)),(e._opt.pauseAndNextPlayUseLastFrameShow||e._opt.replayUseLastFrameShow)&&(e._tempPlayBgObj=e._getVideoLastIframeInfo()),e._tempPlayerIsMute=e.isMute(),e._pause(t).then((function(e){r(e)})).catch((function(e){i(e)}))}))}},{key:"_pause",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise((function(r,i){if(e.debug.log("JbPro","_pause() ".concat(t)),e.isDestroyed())return i("JbPro is destroyed");e._resetReplayTimes(),e.player?e.player.pause(t).then((function(e){r(e)})).catch((function(e){i(e)})):i("player is null")}))}},{key:"close",value:function(){var e=this;return new Promise((function(t,r){e.debug.log("JbPro","close()"),e._opt.url="",e._resetReplayTimes(),e.player?e.player.close().then((function(){t()})).catch((function(e){r(e)})):r("player is null")}))}},{key:"clearView",value:function(){this.debug.log("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===de?this.player.video.clearView():this.debug.warn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debug.warn("JbPro","clearView","player is null")}},{key:"play",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,a){if(e.debug.log("JbPro","play() ".concat(t),JSON.stringify(r)),!t&&!e._opt.url)return e.emit(Ct.error,Lt.playError),void a("url is null and this._opt.url is null");if(t&&(t=(""+t).trim(),-1===t.indexOf("http:")&&-1===t.indexOf("https:")&&-1===t.indexOf("webrtc:")&&-1===t.indexOf("ws:")&&-1===t.indexOf("wss:")&&-1===t.indexOf("wt:")&&-1===t.indexOf("artc:")))return a("url ".concat(t,' must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol'));if(Io(e._opt.isLive))return e.$videoElement.controls="controls",e.$videoElement.muted=!1,e.$videoElement.src=t,e.$videoElement.play(),void i(e.$videoElement);if(e._opt.isM7sCrypto){var n=r.cryptoKey||e._opt.playOptions.cryptoKey,o=r.cryptoIV||e._opt.playOptions.cryptoIV;if(e._opt.m7sCryptoKey&&(!n||!o)){var s=e._opt.m7sCryptoKey.split(".");n=Co(s[0]),o=Co(s[1])}if(!n||!o){var l=t||e._opt.url;return void e._cryptoPlay(l).then((function(n){var o=n.cryptoIV,s=n.cryptoKey;e._opt.playOptions.cryptoKey=s,e._opt.playOptions.cryptoIV=o,r.cryptoIV=o,r.cryptoKey=s,e._playBefore(t,r).then((function(){i()})).catch((function(e){a(e)}))})).catch((function(e){a(e)}))}e._opt.playOptions.cryptoKey=n,e._opt.playOptions.cryptoIV=o,r.cryptoIV=o,r.cryptoKey=n}else if(e._opt.isXorCrypto){var c=r.cryptoKey||e._opt.playOptions.cryptoKey,u=r.cryptoIV||e._opt.playOptions.cryptoIV;if(e._opt.xorCryptoKey&&(!c||!u)){var d=e._opt.xorCryptoKey.split(".");c=Co(d[0]),u=Co(d[1])}c&&u&&(e._opt.playOptions.cryptoKey=c,e._opt.playOptions.cryptoIV=u,r.cryptoIV=u,r.cryptoKey=c)}e._playBefore(t,r).then((function(){i()})).catch((function(e){a(e)}))}))}},{key:"_playBefore",value:function(e,t){var r=this;return new Promise((function(i,a){if(r.player)if(e)if(r._opt.url)if(e===r._opt.url)if(r.player.playing)r.debug.log("JbPro","_playBefore","playing and resolve()"),i();else{r.debug.log("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");var n=r._getOriginalOpt();(r._opt.pauseAndNextPlayUseLastFrameShow||r._opt.replayUseLastFrameShow)&&r._tempPlayBgObj&&r._tempPlayBgObj.loadingBackground&&(n=Object.assign(n,r._tempPlayBgObj)),Io(r._tempPlayerIsMute)&&(n.isNotMute=!0,r._tempPlayerIsMute=!0);var o=r._opt.url,s=r._opt.playOptions;r._resetPlayer(n).then((function(){r._play(o,s).then((function(){i()})).catch((function(e){r.debug.error("JbPro","_playBefore this.player.play error",e),r.emit(Ct.crashLog,r.getCrashLog("this.player.play 1",e)),a(e)}))})).catch((function(e){r.debug.error("JbPro","_resetPlayer error",e)}))}else{r.debug.log("JbPro","_playBefore","\n this._url.url is ".concat(r._opt.url,"\n and new url is ").concat(e,"\n and destroy and play new url"));var l=r._getOriginalOpt();r._resetPlayer(l).then((function(){r._play(e,t).then((function(){i()})).catch((function(e){r.debug.error("JbPro","_playBefore _play error",e),r.emit(Ct.crashLog,r.getCrashLog("this.player.play 2",e)),a(e)}))})).catch((function(e){r.debug.error("JbPro","_resetPlayer error",e)}))}else r._play(e,t).then((function(){i()})).catch((function(e){r.debug.error("JbPro","_playBefore _play error",e),r.emit(Ct.crashLog,r.getCrashLog("this.player.play 3",e)),a(e)}));else{var c=r._getOriginalOpt();(r._opt.pauseAndNextPlayUseLastFrameShow||r._opt.replayUseLastFrameShow)&&r._tempPlayBgObj&&r._tempPlayBgObj.loadingBackground&&(c=Object.assign(c,r._tempPlayBgObj)),Io(r._tempPlayerIsMute)&&(c.isNotMute=!0,r._tempPlayerIsMute=!0);var u=r._opt.url,d=r._opt.playOptions;r._resetPlayer(c).then((function(){r._play(u,d).then((function(){i()})).catch((function(e){r.debug.error("JbPro","_playBefore _play error",e),r.emit(Ct.crashLog,r.getCrashLog("this.player.play 4",e)),a(e)}))})).catch((function(e){r.debug.error("JbPro","_resetPlayer error",e)}))}else e?r._play(e,t).then((function(){i()})).catch((function(e){r.debug.error("JbPro","_playBefore _play error",e),r.emit(Ct.crashLog,r.getCrashLog("this.player.play 5",e)),a(e)})):r._play(r._opt.url,r._opt.playOptions).then((function(){i()})).catch((function(e){r.debug.error("JbPro","_playBefore _play error",e),r.emit(Ct.crashLog,r.getCrashLog("this.player.play 6",e)),a(e)}))}))}},{key:"_cryptoPlay",value:function(e){var t=this;return new Promise((function(r,i){var a,n=function(e){var t=(e||document.location.toString()).split("//"),r=t[1].indexOf("/"),i=t[1].substring(r);return-1!=i.indexOf("?")&&(i=i.split("?")[0]),i}(e),o=t._opt.cryptoKeyUrl,s="",l=xo(e);if(o){if(s=o,t._opt.isM7sCrypto&&-1===s.indexOf("/crypto/?stream=")){var c=xo(o);s=c.origin+Ae+"?stream=".concat(n)}}else o=l.origin+Ae,s=o+"?stream=".concat(n);t.player.debug.log("JbPro","_cryptoPlay() cryptoKeyUrl: ".concat(s," and opt.cryptoKeyUrl: ").concat(t._opt.cryptoKeyUrl)),(a=s,new Promise((function(e,t){Nl.get(a).then((function(t){e(t)})).catch((function(e){t(e)}))}))).then((function(e){if(e){var t=e.split("."),a=Co(t[0]),n=Co(t[1]);n&&a?r({cryptoIV:n,cryptoKey:a}):i("get cryptoIV or cryptoKey error")}else i("cryptoKeyUrl: getM7SCryptoStreamKey ".concat(s," res is null"))})).catch((function(e){i(e)}))}))}},{key:"playback",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,a){if(t.debug.log("JbPro","playback() ".concat(e,", options: ").concat(JSON.stringify(r))),Io(t._opt.isLive))return a("this._opt.isLive is false, can not playback");var n=Lo(),o=Object.assign({},n.playbackConfig,t._opt.playbackConfig,r);o.isUseFpsRender||o.isCacheBeforeDecodeForFpsRender&&(o.isCacheBeforeDecodeForFpsRender=!1,t.debug.warn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===o.rateConfig.length&&o.showRateBtn&&(o.showRateBtn=!1,t.debug.warn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),o.controlType,ye.simple,t._resetPlayer({videoBuffer:0,playbackConfig:o,playType:z,openWebglAlignment:!0,useMSE:o.useMSE,useWCS:o.useWCS,useSIMD:!0}).then((function(){t.play(e,r).then((function(){i()})).catch((function(e){a(e)}))})).catch((function(e){a(e)}))}))}},{key:"playbackPause",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.debug.log("JbPro","playbackPause() ".concat(t)),this._opt.playType===N?Promise.reject("playType is player, can not call playbackPause method"):new Promise((function(r,i){if(!e.player)return i("player is null");Bo(t)?e._pause().then((function(){r()})).catch((function(e){i(e)})):(e.player.playbackPause=!0,r())}))}},{key:"playbackResume",value:function(){var e=this;return this.debug.log("JbPro","playbackResume()"),this._opt.playType===N?Promise.reject("playType is player, can not call playbackResume method"):new Promise((function(t,r){if(!e.player)return r("player is null");e.player.playbackPause=!1,t()}))}},{key:"forward",value:function(e){var t=this;return this.debug.log("JbPro","forward() ".concat(e)),Io(this._opt.isLive)||this._opt.playType===N?Promise.reject("forward() method only just for playback type"):Jn(Number(e))?new Promise((function(r,i){t.player?(e=Cn(Number(e),.1,32),t.player.decoderWorker&&t.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),t.player.playback.setRate(e),t.player.video&&t.player.video.setRate(e),t.player.audio&&t.player.audio.setRate(e),(t.player.isPlaybackUseWCS()||t.player.isPlaybackUseMSE())&&(t.player.demux.dropBuffer$2(),t.player.isPlaybackCacheBeforeDecodeForFpsRender()&&t.player.demux.initPlaybackCacheLoop()),r()):i("player is not playing")})):Promise.reject('forward() params "rate": '.concat(e," must be number type"))}},{key:"playbackForward",value:function(e){return this.forward(e)}},{key:"normal",value:function(){return this.forward(1)}},{key:"playbackNormal",value:function(){return this.normal()}},{key:"updatePlaybackForwardMaxRateDecodeIFrame",value:function(e){this.debug.log("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() ".concat(e)),e=Number(e),e=Cn(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debug.warn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null")}},{key:"setPlaybackStartTime",value:function(e){this.debug.log("JbPro","setPlaybackStartTime() ".concat(e));var t=co(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debug.warn("JbPro","setPlaybackStartTime() control type is normal and timestamp: ".concat(e," is not valid")):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debug.warn("JbPro","setPlaybackStartTime() control type is simple and timestamp: ".concat(e," is more than ").concat(this.player.playback.totalDuration)):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debug.warn("JbPro","setPlaybackStartTime() playType is not playback"):this.debug.warn("JbPro","setPlaybackStartTime() player is null")}},{key:"setPlaybackShowPrecision",value:function(e){this.debug.log("JbPro","setPlaybackShowPrecision() ".concat(e)),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debug.warn("JbPro","control type is not normal , not support!"):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}},{key:"playbackCurrentTimeScroll",value:function(){this.debug.log("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debug.warn("JbPro","control type is not normal , not support!"):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}},{key:"playbackClearCacheBuffer",value:function(){this.debug.log("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}},{key:"getPlaybackCurrentRate",value:function(){if(this.player){if(this.player.isPlayback())return this.player.getPlaybackRate();this.debug.warn("JbPro","playType is not playback")}else this.debug.warn("JbPro","player is null")}},{key:"updatePlaybackLocalOneFrameTimestamp",value:function(e){this.debug.log("JbPro","updatePlaybackLocalOneFrameTimestamp() ".concat(e)),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}},{key:"setStreamQuality",value:function(e){this.debug.log("JbPro","setStreamQuality() ".concat(e)),this.player?this.player._opt.operateBtns.quality?(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debug.warn("JbPro","quality: ".concat(e," is not in qualityList")):this.debug.warn("JbPro","player._opt.operateBtns.quality is false"):this.debug.warn("JbPro","player is null")}},{key:"_play",value:function(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(a,n){if(!t.player)return n("player is null");var o=!1;t._opt.url&&t._opt.url!==r&&(o=!0),t._opt.url=r,t._opt.playOptions=i;var u=r.split("?")[0],d=u.startsWith("http://")||u.startsWith("https://"),h=u.startsWith("webrtc://"),p=u.startsWith("artc://"),f=u.startsWith("wt://"),m=u.startsWith("ws://")||u.startsWith("wss://"),g=d||m,y=d&&u.endsWith(".m3u8"),v=g&&u.endsWith(".flv"),A=g&&(u.endsWith(".fmp4")||u.endsWith(".mp4")),b=g&&u.endsWith(".mpeg4"),_=g&&(u.endsWith(".h264")||u.endsWith(".h265")),k=g&&u.endsWith(".ts"),w=t._opt.isWebrtcForZLM||!1,S=t._opt.isWebrtcForSRS||!1,E=t._opt.isWebrtcForOthers||!1;h&&(-1!==r.indexOf("/index/api/webrtc")?(w=!0,S=!1,E=!1):-1!==r.indexOf("/rtc/v1/play/")&&(S=!0,w=!1,E=!1));var T=null,C=null;if(v&&Io(t._opt.isFlv)&&t._resetDemuxType("isFlv"),A&&Io(t._opt.isFmp4)&&t._resetDemuxType("isFmp4"),b&&Io(t._opt.isMpeg4)&&t._resetDemuxType("isMpeg4"),_&&Io(t._opt.isNakedFlow)&&t._resetDemuxType("isNakedFlow"),k&&Io(t._opt.isTs)&&t._resetDemuxType("isTs"),d?T=y?c:l:f?T=R:h?T=x:p?T=D:m&&(T=s),t._opt.isNakedFlow?C=Q:t._opt.isFmp4?C=X:t._opt.isMpeg4?C=Z:t._opt.isFlv?C=W:t._opt.isTs?C=ee:y?C=q:h?C=K:p?C=$:f?C=Y:m&&(C=J),!T||!C)return t._opt.playFailedAndPausedShowMessage&&t.showErrorMessageTips("url is not support"),n("play url ".concat(r," is invalid, protocol is ").concat(L[T],", demuxType is ").concat(C));t.debug.log("JbPro","play url ".concat(r," protocol is ").concat(L[T],", demuxType is ").concat(C));var P=function(){t.player.once(Lt.webglAlignmentError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webglAlignmentError but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.webglAlignmentError,e)),t.player&&t.player._opt.webglAlignmentErrorReplay){t.debug.log("JbPro","webglAlignmentError");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({openWebglAlignment:!0}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","webglAlignmentError and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webglAlignmentError,{},e),t.debug.error("JbPro","webglAlignmentError and play error",r)}))})).catch((function(e){t.debug.error("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webglAlignmentError,{},e),t.debug.log("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webglAlignmentError,{},e),t.debug.error("JbPro","webglAlignmentError and pause error",r)}))}})),t.player.once(Lt.webglContextLostError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webglContextLostError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.webglContextLostError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.webglContextLostErrorReplay){t.debug.log("JbPro","webglContextLostError");var i=t._opt.url,a=t._opt.playOptions,n={};t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","webglContextLostError and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.webglContextLostError,r,e),t.debug.error("JbPro","webglContextLostError and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.webglContextLostError,r,e),t.debug.error("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webglContextLostError,r,e),t.debug.log("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.webglContextLostError,r,e),t.debug.error("JbPro","webglAlignmentError and pause error",i)}))}}})),t.player.once(Lt.mediaSourceH265NotSupport,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceH265NotSupport,e)),t.player&&t.player._opt.hardDecodingNotSupportAutoWasm){t.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceH265NotSupport,e),t.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceH265NotSupport,{},e),t.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",r)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceH265NotSupport,{},e),t.debug.log("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceH265NotSupport,{},e),t.debug.error("JbPro","mediaSourceH265NotSupport and pause error",r)}))}})),t.player.once(Lt.mediaSourceFull,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceFull but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceFull,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mseDecodeErrorReplay){var i=t._opt.url,a=t._opt.playOptions,n={},o=t.player._opt.decoderErrorAutoWasm,s=!0;o?n={useMSE:!1,useWCS:!1}:t._checkIsMeaningfulRetry(Qa)?t._mseDecodeErrorRetryLog.push(Tn()):(o=!0,s=!1,n={useMSE:!1,useWCS:!1}),t.debug.log("JbPro","mediaSourceFull and auto wasm ".concat(Io(s)?" and is not meaningful Retry":""," [mse-> ").concat(o?"wasm":"mse","] reset player and play")),t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","mediaSourceFull and reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceFull,r,e),t.debug.error("JbPro","mediaSourceFull and reset player and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceFull,r,e),t.debug.error("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceFull,r,e),t.debug.log("JbPro","mediaSourceFull and autoWasm is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceFull,r,e),t.debug.error("JbPro","mediaSourceFull and pause error",i)}))}}})),t.player.once(Lt.mediaSourceAppendBufferError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceAppendBufferError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceAppendBufferError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mseDecodeErrorReplay){var i=t._opt.url,a=t._opt.playOptions,n={},o=t.player._opt.decoderErrorAutoWasm,s=!0;o?n={useMSE:!1,useWCS:!1}:t._checkIsMeaningfulRetry(Qa)?t._mseDecodeErrorRetryLog.push(Tn()):(o=!0,s=!1,n={useMSE:!1,useWCS:!1}),t.player.isMSEAudioDecoderError&&(t.player.debug.log("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),n.mseDecodeAudio=!1),t.debug.log("JbPro","mediaSourceAppendBufferError and auto wasm ".concat(Io(s)?" and is not meaningful Retry":""," [mse-> ").concat(o?"wasm":"mse","] reset player and play")),t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAppendBufferError,r,e),t.debug.error("JbPro","mediaSourceAppendBufferError and reset player and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAppendBufferError,r,e),t.debug.error("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAppendBufferError,r,e),t.debug.log("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAppendBufferError,r,e),t.debug.error("JbPro","mediaSourceAppendBufferError and pause error",i)}))}}})),t.player.once(Lt.mseSourceBufferError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mseSourceBufferError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mseSourceBufferError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mseDecodeErrorReplay){var i=t._opt.url,a=t._opt.playOptions,n={};if(t.player._opt.mseDecoderUseWorker)n={mseDecoderUseWorker:!1},t.debug.log("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{var o=t.player._opt.decoderErrorAutoWasm,s=!0;o?n={useMSE:!1,useWCS:!1}:t._checkIsMeaningfulRetry(Qa)?t._mseDecodeErrorRetryLog.push(Tn()):(o=!0,s=!1,n={useMSE:!1,useWCS:!1}),t.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(t.debug.log("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),n={useMSE:!1,useWCS:!1}),t.debug.log("JbPro","mseSourceBufferError auto wasm ".concat(Io(s)?" and is not meaningful Retry":""," [mse-> ").concat(o?"wasm":"mse","] reset player and play"))}t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","mseSourceBufferError reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mseSourceBufferError,r,e),t.debug.error("JbPro","mseSourceBufferError reset player and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mseSourceBufferError,r,e),t.debug.error("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mseSourceBufferError,r,e),t.debug.log("JbPro","mseSourceBufferError and autoWasm is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mseSourceBufferError,r,e),t.debug.error("JbPro","mseSourceBufferError and pause error:",i)}))}}})),t.player.once(Lt.mediaSourceBufferedIsZeroError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceBufferedIsZeroError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceBufferedIsZeroError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mseDecodeErrorReplay){var i=t._opt.url,a=t._opt.playOptions,n={},o=t.player._opt.decoderErrorAutoWasm,s=!0;o?n={useMSE:!1,useWCS:!1}:t._checkIsMeaningfulRetry(Qa)?t._mseDecodeErrorRetryLog.push(Tn()):(o=!0,s=!1,n={useMSE:!1,useWCS:!1}),t.debug.log("JbPro","mediaSourceBufferedIsZeroError auto wasm ".concat(Io(s)?" and is not meaningful Retry":""," [mse-> ").concat(o?"wasm":"mse","] reset player and play")),t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceBufferedIsZeroError,r,e),t.debug.error("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceBufferedIsZeroError,r,e),t.debug.error("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceBufferedIsZeroError,r,e),t.debug.log("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceBufferedIsZeroError,r,e),t.debug.error("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)}))}}})),t.player.once(Lt.mseAddSourceBufferError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mseAddSourceBufferError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mseAddSourceBufferError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.hardDecodingNotSupportAutoWasm){t.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");var i=t._opt.url,a=t._opt.playOptions,n={useMSE:!1,useWCS:!1};t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mseAddSourceBufferError,r,e),t.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mseAddSourceBufferError,r,e),t.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mseAddSourceBufferError,r,e),t.debug.log("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mseAddSourceBufferError,r,e),t.debug.error("JbPro","mseAddSourceBufferError and pause error",i)}))}}})),t.player.once(Lt.mediaSourceDecoderConfigurationError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceDecoderConfigurationError,e)),t.player&&t.player._opt.hardDecodingNotSupportAutoWasm){t.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");var r=t._opt.url,i=t._opt.playOptions,a={useMSE:!1,useWCS:!1};t._resetPlayer(a).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceDecoderConfigurationError,e),t.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceDecoderConfigurationError,e),t.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",r)}))}else{var n=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(n).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceDecoderConfigurationError,e),t.debug.log("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceDecoderConfigurationError,e),t.debug.error("JbPro","mediaSourceDecoderConfigurationError and pause error",r)}))}})),t.player.once(Lt.mediaSourceTsIsMaxDiff,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceTsIsMaxDiff but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceTsIsMaxDiff,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mediaSourceTsIsMaxDiffReplay){t.debug.log("JbPro","mediaSourceTsIsMaxDiff reset player and play");var i=t._opt.url,a=t._opt.playOptions,n={};t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceTsIsMaxDiff,r,e),t.debug.error("JbPro","mediaSourceTsIsMaxDiff replay error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceTsIsMaxDiff,r,e),t.debug.error("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceTsIsMaxDiff,r,e),t.debug.log("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceTsIsMaxDiff,r,e),t.debug.error("JbPro","mediaSourceTsIsMaxDiff and pause error",i)}))}}})),t.player.once(Lt.mseWidthOrHeightChange,(function(r){if(t.isDestroyed())t.debug.log("JbPro","mseWidthOrHeightChange but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.mseWidthOrHeightChange,r));var i=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.widthOrHeightChangeReplay){t.debug.log("JbPro","mseWidthOrHeightChange and reset player and play");var a=t._opt.url,n=t._opt.playOptions,o={};t.player._opt.replayUseLastFrameShow&&(o=Object.assign({},o,i,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(o.isNotMute=!0),t._resetPlayer(o).then((function(){t.player._opt.widthOrHeightChangeReplayDelayTime>0?t.widthOrHeightChangeReplayDelayTimeout=setTimeout((function(){t.isDestroyed()?t.debug.log("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):t.play(a,n).then((function(){t.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mseWidthOrHeightChange,i,r),t.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)}))}),1e3*t.player._opt.widthOrHeightChangeReplayDelayTime):t.play(a,n).then((function(){t.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mseWidthOrHeightChange,i,r),t.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)}))})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mseWidthOrHeightChange,i,r),t.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{var s=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(s).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mseWidthOrHeightChange,i,r),t.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mseWidthOrHeightChange,i,r),t.debug.error("JbPro","mseWidthOrHeightChange error and pause error",e)}))}}})),t.player.once(Lt.mediaSourceAudioG711NotSupport,(function(r){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceAudioG711NotSupport but player is destroyed");else{var i=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mediaSourceAudioG711NotSupportReplay){t.debug.log("JbPro","mediaSourceAudioG711NotSupport and reset player and play");var a=t._opt.url,n=t._opt.playOptions,o={mseDecodeAudio:!1};t.player._opt.replayUseLastFrameShow&&(o=Object.assign({},o,i,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(o.isNotMute=!0),t._resetPlayer(o).then((function(){t.play(a,n).then((function(){t.debug.log("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioG711NotSupport,i,r),t.debug.error("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)}))})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioG711NotSupport,i,r),t.debug.error("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{var s=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(s).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioG711NotSupport,i,r),t.debug.error("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioG711NotSupport,i,r),t.debug.error("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)}))}}})),t.player.once(Lt.mediaSourceAudioInitTimeout,(function(r){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceAudioInitTimeout but player is destroyed");else{var i=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mediaSourceAudioInitTimeoutReplay){t.debug.log("JbPro","mediaSourceAudioInitTimeout and reset player and play");var a=t._opt.url,n=t._opt.playOptions,o={mseDecodeAudio:!1};t.player._opt.replayUseLastFrameShow&&(o=Object.assign({},o,i,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(o.isNotMute=!0),t._resetPlayer(o).then((function(){t.play(a,n).then((function(){t.debug.log("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioInitTimeout,i,r),t.debug.error("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)}))})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioInitTimeout,i,r),t.debug.error("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{var s=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(s).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioInitTimeout,i),t.debug.error("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioInitTimeout,i),t.debug.error("JbPro","mediaSourceAudioInitTimeout error and pause error",e)}))}}})),t.player.once(Lt.mediaSourceAudioNoDataTimeout,(function(r){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed");else{var i=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.mediaSourceAudioInitTimeoutReplay){t.debug.log("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");var a=t._opt.url,n=t._opt.playOptions,o={mseDecodeAudio:!1};t.player._opt.replayUseLastFrameShow&&(o=Object.assign({},o,i,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(o.isNotMute=!0),t._resetPlayer(o).then((function(){t.play(a,n).then((function(){t.debug.log("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioNoDataTimeout,i,r),t.debug.error("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)}))})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioNoDataTimeout,i,r),t.debug.error("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{var s=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(s).then((function(){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioNoDataTimeout,i),t.debug.error("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceAudioNoDataTimeout,i),t.debug.error("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)}))}}})),t.player.once(Lt.mediaSourceUseCanvasRenderPlayFailed,(function(e){if(t.isDestroyed())t.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.mediaSourceUseCanvasRenderPlayFailed,e)),t.player&&t.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&t.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){t.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed relayType is ".concat(t.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType," and reset player and play"));var r=t._opt.url,i=t._opt.playOptions,a={},n=t.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;n===de?a={useMSE:!1,useWCS:!1}:n===he&&(a={useVideoRender:!0,useCanvasRender:!1}),t._resetPlayer(a).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceUseCanvasRenderPlayFailed,e),t.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",r)}))})).catch((function(e){t.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",e)}))}else{var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.mediaSourceUseCanvasRenderPlayFailed,e),t.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",r)}))}})),t.player.once(Lt.webcodecsH265NotSupport,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webcodecsH265NotSupport but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.webcodecsH265NotSupport,e)),t.player&&t.player._opt.hardDecodingNotSupportAutoWasm){t.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsH265NotSupport,e),t.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",r)}))})).catch((function(e){t.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webcodecsH265NotSupport,e),t.debug.log("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsH265NotSupport,e),t.debug.error("JbPro","webcodecsH265NotSupport and pause error",r)}))}})),t.player.once(Lt.webcodecsUnsupportedConfigurationError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.webcodecsUnsupportedConfigurationError,e)),t.player&&t.player._opt.hardDecodingNotSupportAutoWasm){t.debug.log("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsUnsupportedConfigurationError,e),t.debug.error("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsUnsupportedConfigurationError,e),t.debug.error("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",r)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webcodecsUnsupportedConfigurationError,e),t.debug.log("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsUnsupportedConfigurationError,e),t.debug.error("JbPro","webcodecsUnsupportedConfigurationError and pause error",r)}))}})),t.player.once(Lt.webcodecsDecodeConfigureError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.webcodecsDecodeConfigureError,e)),t.player&&t.player._opt.hardDecodingNotSupportAutoWasm){t.debug.log("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeConfigureError,e),t.debug.error("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeConfigureError,e),t.debug.error("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",r)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeConfigureError,e),t.debug.log("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeConfigureError,e),t.debug.error("JbPro","webcodecsDecodeConfigureError and pause error",r)}))}})),t.player.once(Lt.webcodecsDecodeError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webcodecsDecodeError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.webcodecsDecodeError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.wcsDecodeErrorReplay){var i=t._opt.url,a=t._opt.playOptions,n={},o=t.player._opt.decoderErrorAutoWasm,s=!0;o?n={useMSE:!1,useWCS:!1}:t._checkIsMeaningfulRetry(Xa)?t._wcsDecodeErrorRetryLog.push(Tn()):(o=!0,s=!1,n={useMSE:!1,useWCS:!1}),t.debug.log("JbPro","webcodecs decode error autoWasm ".concat(Io(s)?" and is not meaningful Retry":""," [wcs-> ").concat(o?"wasm":"wcs","] reset player and play")),t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","webcodecs decode error reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeError,r,e),t.debug.error("JbPro","webcodecs decode error reset player and play error",i)}))})).catch((function(){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeError,r,e),t.debug.error("JbPro","webcodecs decode error _resetPlayer error")}))}else{var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeError,r,e),t.debug.log("JbPro","webcodecs decode error and autoWasm is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.webcodecsDecodeError,r,e),t.debug.error("JbPro","webcodecs decode error and pause error",i)}))}}})),t.player.once(Lt.wcsWidthOrHeightChange,(function(r){if(t.isDestroyed())t.debug.log("JbPro","wcsWidthOrHeightChange but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.wcsWidthOrHeightChange,r));var i=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.widthOrHeightChangeReplay){t.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play");var a=t._opt.url,n=t._opt.playOptions,o={};t.player._opt.replayUseLastFrameShow&&(o=Object.assign({},o,i,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(o.isNotMute=!0),t._resetPlayer(o).then((function(){t._opt.widthOrHeightChangeReplayDelayTime>0?t.widthOrHeightChangeReplayDelayTimeout=setTimeout((function(){t.isDestroyed()?t.debug.log("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):t.play(a,n).then((function(){t.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wcsWidthOrHeightChange,i,r),t.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)}))}),1e3*t._opt.widthOrHeightChangeReplayDelayTime):t.play(a,n).then((function(){t.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wcsWidthOrHeightChange,i,r),t.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)}))})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wcsWidthOrHeightChange,i,r),t.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{var s=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(s).then((function(){t.emit(Ct.playFailedAndPaused,Lt.wcsWidthOrHeightChange,i,r),t.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wcsWidthOrHeightChange,i,r),t.debug.error("JbPro","wcsWidthOrHeightChange error and pause error",e)}))}}})),t.player.once(Lt.wasmDecodeError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","wasmDecodeError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.wasmDecodeError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.wasmDecodeErrorReplay){t.debug.log("JbPro","wasm decode error and reset player and play");var i=t._opt.url,a=t._opt.playOptions,n={};t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","wasm decode error and reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.wasmDecodeError,r,e),t.debug.error("JbPro","wasm decode error and reset player and play error",i)}))})).catch((function(){t.emit(Ct.playFailedAndPaused,Lt.wasmDecodeError,r,e),t.debug.error("JbPro","wasm decode error and _resetPlayer error")}))}else{var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.emit(Ct.playFailedAndPaused,Lt.wasmDecodeError,r,e),t.debug.log("JbPro","wasm decode error and wasmDecodeErrorReplay is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.wasmDecodeError,r,e),t.debug.error("JbPro","wasm decode error and pause error",i)}))}}})),t.player.once(Lt.simdDecodeError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","simdDecodeError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.simdDecodeError,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.simdDecodeErrorReplay){t.debug.log("JbPro","simdDecodeError error simdDecodeErrorReplayType is ".concat(t.player._opt.simdDecodeErrorReplayType," and reset player and play"));var i=t._opt.url,a=t._opt.playOptions,n={};t.player._opt.simdDecodeErrorReplayType===ne&&(n={useSIMD:!1}),t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","simdDecodeError and reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.simdDecodeError,r,e),t.debug.error("JbPro","simdDecodeError and reset player and play error",i)}))})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.simdDecodeError,r,e),t.debug.error("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.emit(Ct.playFailedAndPaused,Lt.simdDecodeError,r,e),t.debug.error("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.simdDecodeError,r,e),t.debug.error("JbPro","simdDecodeError error and pause error",i)}))}}})),t.player.once(Lt.wasmWidthOrHeightChange,(function(r){if(t.isDestroyed())t.debug.log("JbPro","wasmWidthOrHeightChange but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.wasmWidthOrHeightChange,r));var i=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.widthOrHeightChangeReplay){t.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play");var a=t._opt.url,n=t._opt.playOptions,o={};t.player._opt.replayUseLastFrameShow&&(o=Object.assign({},o,i,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(o.isNotMute=!0),t._resetPlayer(o).then((function(){t._opt.widthOrHeightChangeReplayDelayTime>0?t.widthOrHeightChangeReplayDelayTimeout=setTimeout((function(){t.isDestroyed()?t.debug.log("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):t.play(a,n).then((function(){t.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wasmWidthOrHeightChange,i,r),t.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)}))}),1e3*t._opt.widthOrHeightChangeReplayDelayTime):t.play(a,n).then((function(){t.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wasmWidthOrHeightChange,i,r),t.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)}))})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wasmWidthOrHeightChange,i,r),t.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{var s=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(s).then((function(){t.emit(Ct.playFailedAndPaused,Lt.wasmWidthOrHeightChange,i,r),t.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((function(e){t.emit(Ct.playFailedAndPaused,Lt.wasmWidthOrHeightChange,i),t.debug.error("JbPro","wasmWidthOrHeightChange error and pause error",e)}))}}})),t.player.once(Lt.wasmUseVideoRenderError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","wasmUseVideoRenderError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.wasmUseVideoRenderError,e)),t.debug.log("JbPro","wasmUseVideoRenderError and reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.wasmUseVideoRenderError,{},e),t.debug.error("JbPro","wasmUseVideoRenderError and reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.wasmUseVideoRenderError,{},e),t.debug.error("JbPro","wasmUseVideoRenderError and _resetPlayer error",r)}))}})),t.player.once(Lt.videoElementPlayingFailed,(function(e){if(t.isDestroyed())t.debug.log("JbPro","videoElementPlayingFailed but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.videoElementPlayingFailed,e)),t.player&&t.player._opt.videoElementPlayingFailedReplay){t.debug.log("JbPro","videoElementPlayingFailed and useMSE is ".concat(t._opt.useMSE," and reset player and play"));var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useMSE:!1,useVideoRender:!1,useCanvasRender:!0}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.videoElementPlayingFailed,{},e),t.debug.error("JbPro","videoElementPlayingFailed and reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.videoElementPlayingFailed,{},e),t.debug.error("JbPro","videoElementPlayingFailed and _resetPlayer error",r)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.videoElementPlayingFailed,{},e),t.debug.error("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.videoElementPlayingFailed,{},e),t.debug.error("JbPro","videoElementPlayingFailed and _pause error",r)}))}})),t.player.once(Lt.simdH264DecodeVideoWidthIsTooLarge,(function(e){if(t.isDestroyed())t.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(t.emit(Ct.crashLog,t.getCrashLog(Lt.simdH264DecodeVideoWidthIsTooLarge,e)),t.player&&t.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){t.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({useSIMD:!1}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.simdH264DecodeVideoWidthIsTooLarge,{},e),t.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",r)}))})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.simdH264DecodeVideoWidthIsTooLarge,{},e),t.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",r)}))}else{var a=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(a).then((function(){t.emit(Ct.playFailedAndPaused,Lt.simdH264DecodeVideoWidthIsTooLarge,{},e),t.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.simdH264DecodeVideoWidthIsTooLarge,{},e),t.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",r)}))}})),t.player.once(Ct.networkDelayTimeout,(function(e){if(t.player._opt.networkDelayTimeoutReplay){if(t.isDestroyed())return void t.debug.log("JbPro","networkDelayTimeout but player is destroyed");t.emit(Ct.crashLog,t.getCrashLog(Ct.networkDelayTimeout,e));var r=t._getVideoLastIframeInfo();t.debug.log("JbPro","network delay time out and reset player and play");var i=t._opt.url,a=t._opt.playOptions,n={};t.player&&t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log("JbPro","wasm decode error and reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Ct.networkDelayTimeout,r,e),t.debug.error("JbPro","wasm decode error and reset player and play error",i)}))})).catch((function(){t.emit(Ct.playFailedAndPaused,Ct.networkDelayTimeout,r,e),t.debug.error("JbPro","wasm decode error and _resetPlayer error")}))}})),t.player.once(Ct.flvDemuxBufferSizeTooLarge,(function(e){if(t.isDestroyed())t.debug.log("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed");else{var r=t._getVideoLastIframeInfo();if(t.player._opt.flvDemuxBufferSizeTooLargeReplay){t.emit(Ct.crashLog,t.getCrashLog(Ct.flvDemuxBufferSizeTooLarge,e)),t.debug.log("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");var i=t._opt.url,a=t._opt.playOptions,n={};t.player&&t.player._opt.replayUseLastFrameShow&&(n=Object.assign({},n,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(n.isNotMute=!0),t._resetPlayer(n).then((function(){t.play(i,a).then((function(){t.debug.log(t.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((function(i){t.emit(Ct.playFailedAndPaused,Ct.flvDemuxBufferSizeTooLarge,r,e),t.debug.error(t.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)}))})).catch((function(){t.emit(Ct.playFailedAndPaused,Ct.flvDemuxBufferSizeTooLarge,r,e),t.debug.error(t.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(t._opt.flvDemuxBufferSizeTooLargeEmitFailed){t.debug.log(t.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");var o=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(o).then((function(){t.emit(Ct.playFailedAndPaused,Lt.flvDemuxBufferSizeTooLarge,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.flvDemuxBufferSizeTooLarge,r,e),t.debug.error(t.TAG_NAME,"flv Demux Buffer Size Too Large",i)}))}}})),t.player.once(Lt.fetchError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","fetchError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.fetchError,e));var r=t._getVideoLastIframeInfo(),i=t._isNeedNetworkDisconnectReplay();if(t.player._opt.streamErrorReplay||i){i?t.debug.log("JbPro","fetch error and network is disconnect and reset player and play"):t.debug.log("JbPro","fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ".concat(t._streamErrorReplayTimes,", streamErrorReplayDelayTime is ").concat(t._opt.streamErrorReplayDelayTime,", next replay"));var a={};t.player._opt.replayUseLastFrameShow&&(a=Object.assign({},a,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(a.isNotMute=!0);var n=t._opt.playOptions,o=t._opt.url,s=i?1:t._opt.streamErrorReplayDelayTime;t._resetPlayer(a).then((function(){t.streamErrorReplayDelayTimeout=setTimeout((function(){if(t.isDestroyed())t.debug.log("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(t.network.isOffline())return t.debug.log("JbPro","fetch error and network is offline and wait network online to play , so return"),t._isNetworkOfflinePaused=!0,void(t._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:n,type:Lt.fetchError});t._streamErrorReplayTimes++,t.play(o,n).then((function(){t.debug.log("JbPro","fetch error and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.fetchError,{},e),t.debug.error("JbPro","fetch error and reset player and play error",r)}))}}),1e3*s)})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.fetchError,{},e),t.debug.error("JbPro","fetch error and _resetPlayer error",r)}))}else{t.debug.log("JbPro","fetch error and pause player");var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.fetchError,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.fetchError,r,e),t.debug.error("JbPro","fetch error and pause",i)}))}}})),t.player.once(Ct.streamEnd,(function(e){if(t.isDestroyed())t.debug.log("JbPro","streamEnd but player is destroyed and return");else{t.emit(Ct.crashLog,t.getCrashLog(Ct.streamEnd,e));var r=t._getVideoLastIframeInfo(),i=t._checkIsMeaningfulRetry(Ya),a=""+e=="1006"&&t.player._opt.websocket1006ErrorReplay,n=a&&i,o=t.player._opt.streamEndReplay,s=t._isNeedNetworkDisconnectReplay();if(n||o||s){s?t.debug.log("JbPro","streamEnd and network is disconnect and reset player and play"):n?t.debug.log("JbPro","streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ".concat(t._websocket1006ErrorReplayTimes," , delay ").concat(t._opt.websocket1006ErrorReplayDelayTime,"s reset player and play")):t.debug.log("JbPro","streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ".concat(t._streamEndReplayTimes," , delay ").concat(t._opt.streamEndReplayDelayTime,"s reset player and play"));var l=t._opt.playOptions,c=t._opt.url;t._websocket1006ErrorRetryLog.push(Tn());var u={};t.player._opt.replayUseLastFrameShow&&(u=Object.assign({},u,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(u.isNotMute=!0);var d=n?t._opt.websocket1006ErrorReplayDelayTime:t._opt.streamEndReplayDelayTime;s&&(d=1),t._initLoadingBackgroundForIOS(r),t._resetPlayer(u).then((function(){t.streamEndReplayDelayTimeout=setTimeout((function(){if(t._removeLoadingBackgroundForIOS(),t.isDestroyed())s?t.debug.log("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):n?t.debug.log("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):t.debug.log("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(t.network.isOffline())return n?t.debug.log("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):t.debug.log("JbPro","streamEnd and network is offline and wait network online to play , so return"),t._isNetworkOfflinePaused=!0,void(t._isNetworkOfflinePausedAndNextPlayConfig={url:c,options:l,type:n?Lt.websocket1006Error:Lt.streamEnd});n?t._websocket1006ErrorReplayTimes++:t._streamEndReplayTimes++,t.play(c,l).then((function(){n?t.debug.log("JbPro","streamEnd and 1006 error and reset player and play success"):t.debug.log("JbPro","streamEnd and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.streamEnd,{},e),n?t.debug.error("JbPro","streamEnd and 1006 error and reset player and play error",r):t.debug.error("JbPro","streamEnd and reset player and play error",r)}))}}),1e3*d)})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.streamEnd,{},e),n?t.debug.error("JbPro","streamEnd and 1006 and _resetPlayer error",r):t.debug.error("JbPro","streamEnd and _resetPlayer error",r)}))}else{a?t.debug.log("JbPro","streamEnd pause player "+(Io(i)?"and is not meaningful retry":"")):t.debug.log("JbPro","streamEnd pause player");var h=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(h).then((function(){t.emit(Ct.playFailedAndPaused,Ct.streamEnd,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Ct.streamEnd,r,e),t.debug.error("JbPro","streamEnd pause",i)}))}}})),t.player.once(Lt.websocketError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","websocketError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.websocketError,e));var r=t._getVideoLastIframeInfo(),i=t._isNeedNetworkDisconnectReplay();if(t.player._opt.streamErrorReplay||i){i?t.debug.log("JbPro","websocketError error and network is disconnect and reset player and play"):t.debug.log("JbPro","websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ".concat(t._streamErrorReplayTimes," and streamErrorReplayDelayTime is ").concat(t._opt.streamErrorReplayDelayTime,", next replay"));var a={};t.player._opt.replayUseLastFrameShow&&(a=Object.assign({},a,r,{loadingIcon:t.player._opt.replayShowLoadingIcon})),Io(t.isMute())&&(a.isNotMute=!0);var n=t._opt.playOptions,o=t._opt.url,s=i?1:t._opt.streamErrorReplayDelayTime;t._resetPlayer(a).then((function(){t.streamErrorReplayDelayTimeout=setTimeout((function(){if(t.isDestroyed())i?t.debug.log("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):t.debug.log("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(t.network.isOffline())return t.debug.log("JbPro","websocketError error and network is offline and wait network online to play , so return"),t._isNetworkOfflinePaused=!0,void(t._isNetworkOfflinePausedAndNextPlayConfig={url:o,options:n,type:Lt.websocketError});t._streamErrorReplayTimes++,t.play(o,n).then((function(){t.debug.log("JbPro","websocketError error and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.fetchError,{},e),t.debug.error("JbPro","websocketError error and reset player and play error",r)}))}}),1e3*s)})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.fetchError,{},e),t.debug.error("JbPro","websocketError error and _resetPlayer error",r)}))}else{t.debug.log("JbPro","websocketError and pause player");var l=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(l).then((function(){t.emit(Ct.playFailedAndPaused,Lt.websocketError,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.websocketError,r,e),t.debug.error("JbPro","websocketError and pause",i)}))}}})),t.player.once(Lt.webrtcError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webrtcError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.webrtcError,e));var r=t._getVideoLastIframeInfo();t.debug.log("JbPro","webrtcError and pause player");var i=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(i).then((function(){t.emit(Ct.playFailedAndPaused,Lt.webrtcError,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.webrtcError,r,e),t.debug.error("JbPro","webrtcError and pause",i)}))}})),t.player.once(Lt.hlsError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","hlsError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.hlsError,e));var r=t._getVideoLastIframeInfo();t.debug.log("JbPro","hlsError and pause player");var i=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(i).then((function(){t.emit(Ct.playFailedAndPaused,Lt.hlsError,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.hlsError,r,e),t.debug.error("JbPro","hlsError and pause",i)}))}})),t.player.once(Lt.aliyunRtcError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","aliyunRtcError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.aliyunRtcError,e));var r=t._getVideoLastIframeInfo();t.debug.log("JbPro","aliyunRtcError and pause player");var i=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(i).then((function(){t.emit(Ct.playFailedAndPaused,Lt.aliyunRtcError,r,e)})).catch((function(i){t.emit(Ct.playFailedAndPaused,Lt.aliyunRtcError,r,e),t.debug.error("JbPro","aliyunRtcError and pause",i)}))}})),t.player.once(Lt.decoderWorkerInitError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","decoderWorkerInitError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.decoderWorkerInitError,e)),t.debug.log("JbPro","decoderWorkerInitError and pause player");var r=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(r).then((function(){t.emit(Ct.playFailedAndPaused,Lt.decoderWorkerInitError,{},e)})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.decoderWorkerInitError,{},e),t.debug.error("JbPro","decoderWorkerInitError and pause",r)}))}})),t.player.once(Lt.videoElementPlayingFailedForWebrtc,(function(e){if(t.isDestroyed())t.debug.log("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.videoElementPlayingFailedForWebrtc,e)),t.debug.log("JbPro","videoElementPlayingFailedForWebrtc and pause player");var r=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(r).then((function(){t.emit(Ct.playFailedAndPaused,Lt.videoElementPlayingFailedForWebrtc,{},e)})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.videoElementPlayingFailedForWebrtc,{},e),t.debug.error("JbPro","videoElementPlayingFailedForWebrtc and pause",r)}))}})),t.player.once(Lt.videoInfoError,(function(e){if(t.isDestroyed())t.debug.log("JbPro","videoInfoError but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Lt.videoInfoError,e)),t.debug.log("JbPro","videoInfoError and pause player");var r=!1===t._opt.playFailedUseLastFrameShow;t.player.setPlayFailedAndPaused(),t._pause(r).then((function(){t.emit(Ct.playFailedAndPaused,Lt.videoInfoError,{},e)})).catch((function(r){t.emit(Ct.playFailedAndPaused,Lt.videoInfoError,{},e),t.debug.error("JbPro","videoInfoError and pause",r)}))}})),t.player.once(Ct.webrtcStreamH265,(function(e){if(t.isDestroyed())t.debug.log("JbPro","webrtcStreamH265 but player is destroyed");else{t.debug.log("JbPro","webrtcStreamH265 and reset player and play");var r=t._opt.url,i=t._opt.playOptions;t._resetPlayer({isWebrtcH265:!0}).then((function(){t.play(r,i).then((function(){t.debug.log("JbPro","webrtcStreamH265 and reset player and play success")})).catch((function(r){t.emit(Ct.playFailedAndPaused,Ct.webrtcStreamH265,{},e),t.debug.error("JbPro","webrtcStreamH265 and reset player and play error",r)}))})).catch((function(){t.emit(Ct.playFailedAndPaused,Ct.webrtcStreamH265,{},e),t.debug.error("JbPro","webrtcStreamH265 and _resetPlayer error")}))}})),t.player.on(Ct.delayTimeout,(function(e){if(t.isDestroyed())t.debug.log("JbPro","delay timeout but player is destroyed");else{t.emit(Ct.crashLog,t.getCrashLog(Ct.delayTimeout,e));var r=t._getVideoLastIframeInfo();if(t.player&&t.player._opt.heartTimeoutReplay&&(t._heartTimeoutReplayTimes10&&this.debug.warn("JbPro","setBufferTime() buffer time is ".concat(e," second, is too large, video will show blank screen until cache ").concat(e," second buffer data"));var t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debug.warn("JbPro","setBufferTime() player is null")}},{key:"setBufferDelayTime",value:function(e){this.debug.log("JbPro","setBufferDelayTime() ".concat(e)),(e=Number(e))<.2&&this.debug.warn("JbPro","setBufferDelayTime() buffer time delay is ".concat(e," second, is too small"));var t=1e3*(e=Cn(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debug.warn("JbPro","setBufferDelayTime() player is null")}},{key:"setRotate",value:function(e){this.debug.log("JbPro","setRotate() ".concat(e)),e=parseInt(e,10),this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?(this.player.updateOption({rotate:e}),this.resize()):this.debug.warn("JbPro","setRotate() player is null")):this.debug.warn("JbPro","setRotate() rotate is ".concat(e," and this._opt.rotate is ").concat(this._opt.rotate))}},{key:"setMirrorRotate",value:function(e){this.debug.log("JbPro","setMirrorRotate() ".concat(e)),e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debug.warn("JbPro","setMirrorRotate() player is null")):this.debug.warn("JbPro","setMirrorRotate() mirrorRotate is ".concat(e," and this._opt.mirrorRotate is ").concat(this._opt.mirrorRotate))}},{key:"setAspectRatio",value:function(e){this.debug.log("JbPro","setAspectRatio() ".concat(e)),e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debug.warn("JbPro","setAspectRatio() player is null")):this.debug.warn("JbPro","setAspectRatio() aspectRatio is ".concat(e," and this._opt.aspectRatio is ").concat(this._opt.mirrorRotate))}},{key:"hasLoaded",value:function(){return!0}},{key:"_hasLoaded",value:function(){return this.player&&this.player.loaded||!1}},{key:"setKeepScreenOn",value:function(){this.debug.log("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debug.warn("JbPro","setKeepScreenOn() player is not ready")}},{key:"setFullscreen",value:function(e){this.debug.log("JbPro","setFullscreen() ".concat(e));var t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debug.warn("JbPro","setFullscreen() fullscreen is ".concat(t," and this.player.fullscreen is ").concat(this.player.fullscreen)):this.debug.warn("JbPro","setFullscreen() player is not ready")}},{key:"setWebFullscreen",value:function(e){this.debug.log("JbPro","setWebFullscreen() ".concat(e));var t=!!e;this.player?this.player.webFullscreen=t:this.debug.warn("JbPro","setWebFullscreen() player is not ready")}},{key:"screenshot",value:function(e,t,r,i){return this.debug.log("JbPro","screenshot() ".concat(e," ").concat(t," ").concat(r," ").concat(i)),this.player&&this.player.video?this.player.video.screenshot(e,t,r,i):(this.debug.warn("JbPro","screenshot() player is not ready"),null)}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(r,i){t.debug.log("JbPro","screenshotWatermark()",e),t.player&&t.player.video?t.player.video.screenshotWatermark(e).then((function(e){r(e)})).catch((function(e){i(e)})):(t.debug.warn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}},{key:"startRecord",value:function(e,t){var r=this;return new Promise((function(i,a){if(r.debug.log("JbPro","startRecord() ".concat(e," ").concat(t)),!r.player)return r.debug.warn("JbPro","startRecord() player is not ready"),a("player is not ready");r.player.playing?(r.player.startRecord(e,t),i()):(r.debug.warn("JbPro","startRecord() player is not playing"),a("not playing"))}))}},{key:"stopRecordAndSave",value:function(e,t){var r=this;return new Promise((function(i,a){r.debug.log("JbPro","stopRecordAndSave() ".concat(e," ").concat(t)),r.player&&r.player.recording?r.player.stopRecordAndSave(e,t).then((function(e){i(e)})).catch((function(e){a(e)})):a("not recording")}))}},{key:"isPlaying",value:function(){var e=!1;return this.player&&(e=this.player.isPlaying()),e}},{key:"isLoading",value:function(){return!!this.player&&this.player.loading}},{key:"isPause",value:function(){var e=!1;return this._opt.playType===N?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===z&&this.player&&(e=this.player.playbackPause),e}},{key:"isPaused",value:function(){return this.isPause()}},{key:"isPlaybackPause",value:function(){var e=!1;return this._opt.playType===z&&this.player&&(e=this.player.playbackPause),e}},{key:"isMute",value:function(){var e=!0;return this.player&&(e=this.player.isAudioMute()),e}},{key:"isRecording",value:function(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}},{key:"isFullscreen",value:function(){var e=!1;return this.player&&(e=this.player.fullscreen),e}},{key:"isWebFullscreen",value:function(){var e=!1;return this.player&&(e=this.player.webFullscreen),e}},{key:"clearBufferDelay",value:function(){this.debug.log("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debug.warn("JbPro","clearBufferDelay() player is not init")}},{key:"setNetworkDelayTime",value:function(e){this.debug.log("JbPro","setNetworkDelayTime() ".concat(e)),(e=Number(e))<1&&this.debug.warn("JbPro","setNetworkDelayTime() network delay is ".concat(e," second, is too small"));var t=1e3*(e=Cn(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debug.warn("JbPro","setNetworkDelayTime() player is null")}},{key:"getDecodeType",value:function(){var e="";return this.player&&(e=this.player.getDecodeType()),e}},{key:"getRenderType",value:function(){var e="";return this.player&&(e=this.player.getRenderType()),e}},{key:"getAudioEngineType",value:function(){var e="";return this.player&&(e=this.player.getAudioEngineType()),e}},{key:"getPlayingTimestamp",value:function(){var e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}},{key:"getStatus",value:function(){var e=Ni;return this.player&&(e=this.player.loading?Ui:this.player.playing?Fi:Oi),e}},{key:"getPlayType",value:function(){return this.player?this.player._opt.playType:N}},{key:"togglePerformancePanel",value:function(e){this.debug.log("JbPro","togglePerformancePanel() ".concat(e));var t=this.player._opt.showPerformance,r=!t;$n(e)&&(r=e),r!==t?this.player?this.player.togglePerformancePanel(r):this.debug.warn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debug.warn("JbPro","togglePerformancePanel() failed, showPerformance is prev: ".concat(t," === now: ").concat(r))}},{key:"openZoom",value:function(){this.debug.log("JbPro","openZoom()"),this.player?this.player.zooming=!0:this.debug.warn("JbPro","openZoom() failed, this.player is not init")}},{key:"closeZoom",value:function(){this.debug.log("JbPro","closeZoom()"),this.player?this.player.zooming=!1:this.debug.warn("JbPro","closeZoom() failed, this.player is not init")}},{key:"isZoomOpen",value:function(){var e=!1;return this.player&&(e=this.player.zooming),e}},{key:"toggleZoom",value:function(e){this.debug.log("JbPro","toggleZoom() ".concat(e)),$n(e)||(e=!this.isZoomOpen()),Bo(e)?this.openZoom():Io(!1)&&this.closeZoom()}},{key:"expandZoom",value:function(){this.debug.log("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debug.warn("JbPro","expandZoom() failed, zoom is not open or not init")}},{key:"narrowZoom",value:function(){this.debug.log("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debug.warn("JbPro","narrowZoom failed, zoom is not open or not init")}},{key:"getCurrentZoomIndex",value:function(){var e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}},{key:"startTalk",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,a){t.debug.log("JbPro","startTalk()",e,r),t._initTalk(r),t.talk.startTalk(e).then((function(){i(),t.talk.once(Ct.talkStreamClose,(function(){t.debug.warn("JbPro","talk stream close"),t.stopTalk().catch((function(e){}))})),t.talk.once(Ct.talkStreamError,(function(e){t.debug.warn("JbPro","talk stream error",e),t.stopTalk().catch((function(e){}))})),t.talk.once(Ct.talkStreamInactive,(function(){t.debug.warn("JbPro","talk stream inactive"),t.stopTalk().catch((function(e){}))}))})).catch((function(e){a(e)}))}))}},{key:"stopTalk",value:function(){var e=this;return new Promise((function(t,r){if(e.debug.log("JbPro","stopTalk()"),!e.talk)return r("stopTalk() talk is not init");e.talk.destroy(),t()}))}},{key:"getTalkVolume",value:function(){var e=this;return new Promise((function(t,r){if(!e.talk)return r("getTalkVolume() talk is not init");t(e.talk.volume)}))}},{key:"setTalkVolume",value:function(e){var t=this;return new Promise((function(r,i){if(t.debug.log("JbPro","setTalkVolume()",e),!t.talk)return i("setTalkVolume() talk is not init");t.talk.setVolume(e/100),r()}))}},{key:"setNakedFlowFps",value:function(e){var t=this;return new Promise((function(r,i){if(t.debug.log("JbPro","setNakedFlowFps()",e),Zn(e))return i("setNakedFlowFps() fps is empty");var a=Number(e);a=Cn(a,1,100),t._opt.nakedFlowFps=a,t.player?t.player.updateOption({nakedFlowFps:a}):t.debug.warn("JbPro","setNakedFlowFps() player is null"),r()}))}},{key:"getCrashLog",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(this.player){var r=this.player.getAllStatsData(),i=this.player,a={url:this._opt.url,playType:i.isPlayback()?"playback":"live",demuxType:i.getDemuxType(),decoderType:i.getDecodeType(),renderType:i.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:i.getAudioEngineType(),allTimes:r.pTs,timestamp:Tn(),type:e,error:Eo(t)||e};if(i.video){var n=i.video.videoInfo||{};a.videoInfo={encType:n.encType||"",width:n.width||"",height:n.height||""}}if(i.audio){var o=i.audio.audioInfo||{};a.audioInfo={encType:o.encType||"",sampleRate:o.sampleRate||"",channels:o.channels||""}}return a}}},{key:"updateDebugLevel",value:function(e){this.debug.log("JbPro","updateDebugLevel()",e),e===pe||e===fe?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debug.warn("JbPro","updateDebugLevel() player is null")):this.debug.warn("JbPro","updateDebugLevel() level is same, level: ".concat(e)):this.debug.warn("JbPro","updateDebugLevel() level is not valid, level: ".concat(e))}},{key:"updateWatermark",value:function(e){this.debug.log("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debug.warn("JbPro","updateWatermark() player is not init")}},{key:"removeWatermark",value:function(){this.debug.log("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debug.warn("JbPro","removeWatermark() player is not init")}},{key:"updateFullscreenWatermark",value:function(e){if(this.debug.log("JbPro","updateFullscreenWatermark()",e),ho(e)){this._opt.fullscreenWatermarkConfig=e;var t=ro(this.$container,e);if(!t.watermark_txt)return void this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debug.warn("JbPro","updateFullscreenWatermark() config is not valid, config: ".concat(e))}},{key:"removeFullscreenWatermark",value:function(){this.debug.log("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debug.warn("JbPro","removeFullscreenWatermark() watermark is not init")}},{key:"faceDetectOpen",value:function(){this.debug.log("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debug.warn("JbPro","faceDetectOpen() player is not init")}},{key:"faceDetectClose",value:function(){this.debug.log("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debug.warn("JbPro","faceDetectClose() player is not init")}},{key:"objectDetectOpen",value:function(){this.debug.log("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debug.warn("JbPro","objectDetectOpen() player is not init")}},{key:"objectDetectClose",value:function(){this.debug.log("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debug.warn("JbPro","objectDetectClose() player is not init")}},{key:"sendWebsocketMessage",value:function(e){this.debug.log("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debug.warn("JbPro","sendWebsocketMessage() player is not init")}},{key:"addContentToCanvas",value:function(e){this.debug.log("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debug.warn("JbPro","addContentToCanvas() player is not init")}},{key:"clearContentToCanvas",value:function(){this.debug.log("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debug.warn("JbPro","clearContentToCanvas() player is not init")}},{key:"addContentToContainer",value:function(e){this.debug.log("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debug.warn("JbPro","addContentToContainer() player is not init")}},{key:"clearContentToContainer",value:function(){this.debug.log("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debug.warn("JbPro","clearContentToContainer() player is not init")}},{key:"setControlHtml",value:function(e){this.debug.log("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debug.warn("JbPro","setControlHtml() player is not init")}},{key:"clearControlHtml",value:function(){this.debug.log("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debug.warn("JbPro","clearControlHtml() player is not init")}},{key:"getVideoInfo",value:function(){var e=null;return this.player&&(e=this.player.getVideoInfo()),e}},{key:"getAudioInfo",value:function(){var e=null;return this.player&&(e=this.player.getAudioInfo()),e}},{key:"setSm4CryptoKey",value:function(e){this.debug.log("JbPro","setSm4CryptoKey()",e),32===(e=""+e).length?(this._opt.sm4CryptoKey=e,this.player?this.player.updateOption({sm4CryptoKey:e},!0):this.debug.warn("JbPro","setSm4CryptoKey() player is null")):this.debug.warn("JbPro","setSm4CryptoKey() key is invalid and length is ".concat(e.length," !== 32"))}},{key:"setM7sCryptoKey",value:function(e){this.debug.log("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debug.warn("JbPro","setM7sCryptoKey() player is null")}},{key:"setXorCryptoKey",value:function(e){this.debug.log("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debug.warn("JbPro","setXorCryptoKey() player is null")}},{key:"updateLoadingText",value:function(e){this.debug.log("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debug.warn("JbPro","updateLoadingText() player is null")}},{key:"updateIsEmitSEI",value:function(e){this.debug.log("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debug.warn("JbPro","updateIsEmitSEI() player is null")}},{key:"getPTZCmd",value:function(e,t){if(this.debug.log("JbPro","getPTZCmd()",e),e)return this.player?Yb({type:e,index:0,speed:t}):void this.debug.warn("JbPro","getPTZCmd() player is null");this.debug.warn("JbPro","getPTZCmd() ptz is null")}},{key:"downloadTempNakedFlowFile",value:function(){var e=this;return new Promise((function(t,r){e.player?(e.player.downloadNakedFlowFile(),t()):r("player is not init")}))}},{key:"downloadTempFmp4File",value:function(){var e=this;return new Promise((function(t,r){e.player?(e.player.downloadFmp4File(),t()):r("player is not init")}))}},{key:"downloadTempMpeg4File",value:function(){var e=this;return new Promise((function(t,r){e.player?(e.player.downloadMpeg4File(),t()):r("player is not init")}))}},{key:"downloadTempRtpFile",value:function(){var e=this;return new Promise((function(t,r){e.talk?(e.talk.downloadRtpFile(),t()):r("talk is not init")}))}},{key:"downloadMemoryLog",value:function(){this.memoryLogger&&this.memoryLogger.download()}},{key:"_getVideoLastIframeInfo",value:function(){var e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}},{key:"getExtendBtnList",value:function(){this.debug.log("JbPro","getExtendBtnList()");var e=[];return this.player?e=this.player.getExtendBtnList():this.debug.warn("JbPro","getExtendBtnList() player is null"),e}},{key:"getFlvMetaData",value:function(){this.debug.log("JbPro","getFlvMetaData()");var e=null;return this.player?e=this.player.getMetaData():this.debug.warn("JbPro","getFlvMetaData() player is null"),e}},{key:"updateAiFaceDetectInterval",value:function(e){this.debug.log("JbPro","updateAiFaceDetectInterval()",e);var t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debug.warn("JbPro","updateAiFaceDetectInterval() player is null")}},{key:"updateAiFaceDetectLevel",value:function(e){if(this.debug.log("JbPro","updateAiFaceDetectLevel()",e),Ta[e]){var t=Ta[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debug.warn("JbPro","updateAiFaceDetectLevel() player is null")}else this.debug.warn("JbPro","'updateAiFaceDetectLevel() level ".concat(e," is invalid'"))}},{key:"updateAiObjectDetectInterval",value:function(e){this.debug.log("JbPro","updateAiObjectDetectInterval()",e);var t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debug.warn("JbPro","updateAiObjectDetectInterval() player is null")}},{key:"updateAiObjectDetectLevel",value:function(e){if(this.debug.log("JbPro","updateAiObjectDetectLevel()",e),Ca[e]){var t=Ca[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debug.warn("JbPro","updateAiObjectDetectLevel() player is null")}else this.debug.warn("JbPro","'updateAiObjectDetectLevel() level ".concat(e," is invalid'"))}},{key:"setCryptoKeyUrl",value:function(e){this.debug.log("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e)}},{key:"showErrorMessageTips",value:function(e){this.debug.log("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debug.warn("JbPro","showErrorMessageTips() player is null"))}},{key:"setPtzPosition",value:function(e){this.debug.log("JbPro","setPtzPosition()",e),e&&!uo(e)&&(this.player?this.player.setPtzPosition(e):this.debug.warn("JbPro","setPtzPosition() player is null"))}},{key:"hideErrorMessageTips",value:function(){this.debug.log("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debug.warn("JbPro","hideErrorMessageTips() player is null")}},{key:"getContainerRect",value:function(){return this._getContainerRect()}},{key:"proxy",value:function(e,t,r,i){return this.events.proxy(e,t,r,i)}},{key:"_checkIsMeaningfulRetry",value:function(e){var t=!0,r=[];if(e===Ya?r=this._websocket1006ErrorRetryLog:e===Qa?r=this._mseDecodeErrorRetryLog:e===Xa&&(r=this._wcsDecodeErrorRetryLog),this.debug.log(this.TAG_NAME,"_checkIsMeaningfulRetry() type is ".concat(e,", and retryLog is ").concat(r.join(","))),r.length>=5){var i=r[0],a=r[r.length-1],n=a-i;n<=1e4&&(this.debug.warn(this.TAG_NAME,"retry type is ".concat(e,", and retry length is ").concat(r.length,", and start is ").concat(i," and end is ").concat(a," and diff is ").concat(n)),t=!1)}return t}},{key:"_initLoadingBackgroundForIOS",value:function(e){(On()||Nn())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debug.log(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||Bn()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}},{key:"_doInitLoadingBackground",value:function(e){var t=this,r=this._getContainerRect(),i=r.height,a=this.player._opt;a.hasControl&&!a.controlAutoHide&&(i-=a.playType===z?gr:mr);var n=r.width,o=i,s=a.rotate;270!==s&&90!==s||(n=i,o=r.width),this.$loadingBgImage.width=n,this.$loadingBgImage.height=o,this.$loadingBgImage.src=e.loadingBackground;var l=(r.width-n)/2,c=(i-o)/2,u="contain";a.isResize||(u="fill"),a.isFullResize&&(u="none");var d="";"none"===a.mirrorRotate&&s&&(d+=" rotate("+s+"deg)"),"level"===a.mirrorRotate?d+=" rotateY(180deg)":"vertical"===a.mirrorRotate&&(d+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=u),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=l+"px",this.$loadingBgImage.style.top=c+"px",this.$loadingBgImage.complete?qu(this.$loadingBg,"show"):this.$loadingBgImage.onload=function(){qu(t.$loadingBg,"show"),t.$loadingBgImage.onload=null}}},{key:"_doInitLoadingBackgroundForRatio",value:function(e){var t=this,r=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect(),a=i.width,n=i.height,o=this.player._opt,s=0;o.hasControl&&!o.controlAutoHide&&(s=o.playType===z?gr:mr,n-=s);var l=e.loadingBackgroundWidth,c=e.loadingBackgroundHeight,u=l/c,d=r[0]/r[1];if(this.$loadingBgImage.src=e.loadingBackground,u>d){var h=d*c/l;this.$loadingBgImage.style.width=100*h+"%",this.$loadingBgImage.style.height="calc(100% - ".concat(s,"px)"),this.$loadingBgImage.style.padding="0 ".concat((a-a*h)/2,"px")}else{var p=l/d/c;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height="calc(".concat(100*p,"% - ").concat(s,"px)"),this.$loadingBgImage.style.padding=(n-n*p)/2+"px 0"}this.$loadingBgImage.complete?qu(this.$loadingBg,"show"):this.$loadingBgImage.onload=function(){qu(t.$loadingBg,"show"),t.$loadingBgImage.onload=null}}},{key:"_initLoadingBg",value:function(){if(!this.$loadingBg){var e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}},{key:"_removeLoadingBackgroundForIOS",value:function(){if(this.$loadingBg){if(this.debug.log(this.TAG_NAME,"_removeLoadingBackgroundForIOS()"),!Xu(this.$loadingBg)){var e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}},{key:"_getContainerRect",value:function(){var e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}},{key:"_isNeedNetworkDisconnectReplay",value:function(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}}])}(Ho);return i_.ERROR=Lt,i_.EVENTS=xt,window.JessibucaPro=i_,window.JbPro=i_,window.WebPlayerPro=i_,i_}))}).call(this,a("c8ba"),a("4362"))}}]);