FastBee/docker/data/nginx/vue/static/js/chunk-32fb41e4.bae1fc65.js
2025-07-07 09:21:15 +08:00

1 line
945 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-32fb41e4"],{2900:function(e,t,i){(function(r,n){var a,s,o=i("c973").default,l=i("448a").default,c=i("7ec2").default,u=i("ded3b").default,d=i("643a").default,h=i("a128").default,f=i("3740").default,p=i("61e5").default,g=i("ed6d").default,m=i("7037").default,A=i("970b").default,y=i("5bc3").default;i("a4d3"),i("e01a"),i("d28b"),i("944a"),i("d9e2"),i("99af"),i("a874"),i("cb29"),i("4de4"),i("7db0"),i("c740"),i("a630"),i("caad"),i("a15b"),i("d81d"),i("14d9"),i("13d5"),i("fb6a"),i("4e82"),i("a434"),i("c19f"),i("ace4"),i("b0c0"),i("6c57"),i("e9c4"),i("0c47"),i("4ec9"),i("4057"),i("23dc"),i("a9e3"),i("f00c"),i("9129"),i("aff5"),i("b680"),i("e439"),i("dbb4"),i("3410"),i("b64b"),i("1f68"),i("131a"),i("d3b7"),i("4ae1"),i("f8c9"),i("4d63"),i("c607"),i("ac1f"),i("5377"),i("2c3e"),i("00b4"),i("25f0"),i("2532"),i("3ca3"),i("466d"),i("38cf"),i("5319"),i("841c"),i("1276"),i("498a"),i("c7cd"),i("cfc3"),i("4a9b"),i("fd87"),i("8b09"),i("143c"),i("5cc6"),i("84c3"),i("fb2c"),i("907a"),i("9a8c"),i("a975"),i("735e"),i("c1ac"),i("d139"),i("3a7b"),i("986a"),i("1d02"),i("d5d6"),i("20bf"),i("82f8"),i("e91f"),i("60bd"),i("5f96"),i("3280"),i("3fcc"),i("ec97"),i("ca91"),i("25a1"),i("cd26"),i("3c5d"),i("2954"),i("649e"),i("219c"),i("170b"),i("b39a"),i("72f7"),i("1b3b"),i("3d71"),i("c6e3"),i("81b2"),i("159b"),i("ddb0"),i("0eb6"),i("b7ef"),i("8bd4"),i("2b3d"),i("bf19"),i("9861"),function(r){a=r,s="function"===typeof a?a.call(t,i,t,e):a,void 0===s||(e.exports=s)}((function(){"use strict";var e=function(){function e(){A(this,e)}return y(e,[{key:"on",value:function(e,t,i){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:i}),this}},{key:"once",value:function(e,t,i){var r=this;function n(){r.off(e,n);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];t.apply(i,s)}return n._=t,this.on(e,n,i)}},{key:"emit",value:function(e){for(var t=((this.e||(this.e={}))[e]||[]).slice(),i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];for(var a=0;a<t.length;a+=1)t[a].fn.apply(t[a].ctx,r);return this}},{key:"off",value:function(e,t){var i=this.e||(this.e={});if(e){var r=i[e],n=[];if(r&&t)for(var a=0,s=r.length;a<s;a+=1)r[a].fn!==t&&r[a].fn._!==t&&n.push(r[a]);return n.length?i[e]=n:delete i[e],this}Object.keys(i).forEach((function(e){delete i[e]})),delete this.e}}])}(),t="fetch",i="websocket",a="worker",s="player",v="playbackTF",b="mp4",w="webm",k="flv",E="webTransport",T="nakedFlow",S={flv:"FLV",m7s:"m7s",hls:"HLS",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流"},_="canvas",C="video",R="debug",D="warn",x="click",L={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:s,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!1,isCrypto:!1},I={playType:s,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isWebrtc:!1,isWebrtcForZLM:!1,isNakedFlow:!1,debug:!1,debugLevel:D,debugUuid:"",isMulti:!1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!1,replayUseLastFrameShow:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,mseCorrectTimeDuration:20,keepScreenOn:!0,isNotMute:!1,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,aiFace:!1,aiObject:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingText:"",background:"",backgroundLoadingShow:!1,loadingBackground:"",decoder:"decoder-pro.js",decoderWASM:"",url:"",rotate:0,mirrorRotate:"none",playbackConfig:{playList:[],fps:"",showControl:!0,showRateBtn:!1,rateConfig:[],isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:2,demuxType:k,useWasm:!1,useWCS:!1,useSIMD:!0,wcsUseVideoRender:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,useMSE:!1,useOffscreen:!1,useWebGPU:!1,mseDecodeErrorReplay:!0,wcsDecodeErrorReplay:!0,wasmDecodeErrorReplay:!0,autoWasm:!0,webglAlignmentErrorReplay:!0,webglContextLostErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:4,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:b,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,ptzClickType:x,ptzStopEmitDelay:.3,ptzZoomShow:!1,ptzApertureShow:!1,ptzFocusShow:!1,ptzMoreArrow:!1,weiXinInAndroidAudioBufferSize:4800,isCrypto:!1,cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectWidth:192,aiObjectDetectWidth:192,videoRenderSupportScale:!0,mediaSourceTsIsMaxDiffReplay:!0,controlHtml:""},B="init",P="initVideo",M="initAudio",O="audioCode",F="videoCode",j="videoCodec",U="closeEnd",N={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",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",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",mseSourceBufferError:"mseSourceBufferError",mseAddSourceBufferError:"mseAddSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackPrecision:"playbackPrecision",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",crashLog:"crashLog",focus:"focus",blur:"blur",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetector:"aiFaceDetector",playFailedAndPaused:"playFailedAndPaused",audioResumeState:"audioResumeState"},G={load:N.load,timeUpdate:N.timeUpdate,videoInfo:N.videoInfo,audioInfo:N.audioInfo,error:N.error,kBps:N.kBps,start:N.start,timeout:N.timeout,loadingTimeout:N.loadingTimeout,loadingTimeoutRetryEnd:N.loadingTimeoutRetryEnd,delayTimeout:N.delayTimeout,delayTimeoutRetryEnd:N.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:N.webFullscreen,play:N.play,pause:N.pause,mute:N.mute,stats:N.stats,performance:N.performance,recordingTimestamp:N.recordingTimestamp,recordStart:N.recordStart,recordEnd:N.recordEnd,recordBlob:N.recordBlob,playToRenderTimes:N.playToRenderTimes,playbackSeek:N.playbackSeek,playbackStats:N.playbackStats,playbackTimestamp:N.playbackTimestamp,playbackPauseOrResume:N.playbackPauseOrResume,playbackPreRateChange:N.playbackPreRateChange,playbackRateChange:N.playbackRateChange,ptz:N.ptz,streamQualityChange:N.streamQualityChange,zooming:N.zooming,crashLog:N.crashLog,focus:N.focus,blur:N.blur,visibilityHiddenTimeout:N.visibilityHiddenTimeout,visibilityChange:N.visibilityChange,websocketOpen:N.websocketOpen,websocketClose:N.websocketClose,networkDelayTimeout:N.networkDelayTimeout,aiObjectDetectorInfo:N.aiObjectDetectorInfo,playFailedAndPaused:N.playFailedAndPaused,audioResumeState:N.audioResumeState},z={talkStreamClose:N.talkStreamClose,talkStreamError:N.talkStreamError,talkStreamInactive:N.talkStreamInactive,talkGetUserMediaTimeout:N.talkGetUserMediaTimeout},H={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:N.mseSourceBufferFull,mseSourceBufferError:N.mseSourceBufferError,mseAddSourceBufferError:N.mseAddSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",mediaSourceTsIsMaxDiff:"mediaSourceTsIsMaxDiff",mediaSourceUseCanvasRenderPlayFailed:"mediaSourceUseCanvasRenderPlayFailed",wasmDecodeError:"wasmDecodeError",hlsError:"hlsError",webrtcError:"webrtcError",webglAlignmentError:"webglAlignmentError",wasmWidthOrHeightChange:"wasmWidthOrHeightChange",mseWidthOrHeightChange:"mseWidthOrHeightChange",wcsWidthOrHeightChange:"wcsWidthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:N.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",webglContextLostError:"webglContextLostError"},W="notConnect",V="open",K={download:"download",base64:"base64",blob:"blob"},q="download",Q={7:"H264(AVC)",12:"H265(HEVC)"},Y="H264(AVC)",J="H265(HEVC)",X={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)"},$={10:"AAC",7:"ALAW",8:"MULAW"},Z=6,ee="webcodecs",te="webgl",ie="webgpu",re="offscreen",ne="mse",ae='video/mp4; codecs="avc1.64002A"',se='video/mp4; codecs="hev1.1.6.L123.b0"',oe="oneHour",le="halfHour",ce="fiveMin",ue={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},de=["oneHour","halfHour","tenMin","fiveMin"],he=["up","right","down","left","left-up","right-up","left-down","right-down"],fe="stop",pe="fiStop",ge="g711a",me="g711u",Ae={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},ye="canplay",ve="waiting",be="timeupdate",we="ratechange",ke="The user aborted a request",Ee="AbortError",Te="AbortError",Se="worklet",_e={encType:ge,packetType:"rtp",rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,debug:!1,debugLevel:D,testMicrophone:!1,audioBufferLength:160,engine:Se,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4},Ce="worklet",Re="script",De="active",xe={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},Le={content:"",click:null,index:0},Ie={container:"",maxSplit:4,split:1,supportDblclickContainerFullscreen:!0,style:{border:"#343434",borderSelect:"#FFCC00",background:"#000"}},Be={dblSelected:"multiDblSelected",selected:"multiSelected",mouseOver:"multiMouseover",mouseOut:"multiMouseout",mouseUp:"multiMouseup"},Pe="3-1",Me="4-1",Oe=y((function e(t){A(this,e),this.log=function(e){if(t._opt.debug&&t._opt.debugLevel==R){for(var i,r=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",n=arguments.length,a=new Array(1<n?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];(i=console).log.apply(i,["JessibucaPro".concat(r,":[✅✅✅][").concat(e,"]")].concat(a))}},this.warn=function(e){if(t._opt.debug&&(t._opt.debugLevel==R||t._opt.debugLevel==D)){for(var i,r=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",n=arguments.length,a=new Array(1<n?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];(i=console).log.apply(i,["JessibucaPro".concat(r,":[❗❗❗][").concat(e,"]")].concat(a))}},this.error=function(e){for(var i,r=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",n=arguments.length,a=new Array(1<n?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];(i=console).error.apply(i,["JessibucaPro".concat(r,":[❌❌❌][").concat(e,"]")].concat(a))}})),Fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof r?r:"undefined"!=typeof self?self:{};function je(e,t){return e(t={exports:{}},t.exports),t.exports}var Ue=je((function(e){var t,i,r,n,a;t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,r=function(){for(var e,i=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,n=i.length,a={};r<n;r++)if((e=i[r])&&e[1]in t){for(r=0;r<e.length;r++)a[i[0][r]]=e[r];return a}return!1}(),n={change:r.fullscreenchange,error:r.fullscreenerror},a={request:function(e,i){return new Promise(function(n,a){var s=function(){this.off("change",s),n()}.bind(this),o=(this.on("change",s),(e=e||t.documentElement)[r.requestFullscreen](i));o instanceof Promise&&o.then(s).catch(a)}.bind(this))},exit:function(){return new Promise(function(e,i){var n,a;this.isFullscreen?(n=function(){this.off("change",n),e()}.bind(this),this.on("change",n),(a=t[r.exitFullscreen]())instanceof Promise&&a.then(n).catch(i)):e()}.bind(this))},toggle:function(e,t){return this.isFullscreen?this.exit():this.request(e,t)},onchange:function(e){this.on("change",e)},onerror:function(e){this.on("error",e)},on:function(e,i){e=n[e],e&&t.addEventListener(e,i,!1)},off:function(e,i){e=n[e],e&&t.removeEventListener(e,i,!1)},raw:r},r?(Object.defineProperties(a,{isFullscreen:{get:function(){return Boolean(t[r.fullscreenElement])}},element:{enumerable:!0,get:function(){return t[r.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(t[r.fullscreenEnabled])}}}),i?e.exports=a:window.screenfull=a):i?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}));function Ne(e){return e[0]>>4==10&&0===e[1]}function Ge(){}function ze(e){for(var t=null,i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],r=0;!t&&r<i.length;){var n=i[r];try{var a={preserveDrawingBuffer:!0};t=e.getContext(n,a)}catch(e){console.error(e),t=null}t&&"function"==typeof t.getParameter||(t=null),++r}return t}function He(e){e=(0<arguments.length&&void 0!==e?e:"").split(",");for(var t=atob(e[1]),i=(e=e[0].replace("data:","").replace(";base64",""),t.length),r=new Uint8Array(i);i--;)r[i]=t.charCodeAt(i);return new File([r],"file",{type:e})}function We(){return(new Date).getTime()}function Ve(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function Ke(e,t,i){e&&("object"==m(t)&&Object.keys(t).forEach((function(i){Ke(e,i,t[i])})),e.style[t]=i)}function qe(e,t,i){return i=!(2<arguments.length&&void 0!==i)||i,e?(e=getComputedStyle(e,null).getPropertyValue(t),i?parseFloat(e):e):0}function Qe(){return(performance&&"function"==typeof performance.now?performance:Date).now()}function Ye(e){var t=0,i=Qe();return function(r){var n;st(r)&&(t+=r,1e3<=(n=(r=Qe())-i))&&(e(t/n*1e3),i=r,t=0)}}Ue.isEnabled;try{if("object"==("undefined"===typeof WebAssembly?"undefined":m(WebAssembly))&&"function"==typeof WebAssembly.instantiate){var Je=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));Je instanceof WebAssembly.Module&&(new WebAssembly.Instance(Je),WebAssembly.Instance)}}catch(e){}function Xe(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function $e(){var e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:-1<e.indexOf("chrome")&&-1<e.indexOf("safari"),Firefox:-1<e.indexOf("firefox"),Opera:-1<e.indexOf("opera"),Safari:-1<e.indexOf("safari")&&-1==e.indexOf("chrome"),Edge:-1<e.indexOf("edge"),QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(var r in i)if(i[r]){var n="";if("IE"===r){var a=e.match(/(msie\s|trident.*rv:)([\w.]+)/);a&&2<a.length&&(n=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===r){for(var s in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[s].type&&(r="360");var o=e.match(/chrome\/([\d.]+)/);o&&1<o.length&&(n=o[1])}else if("Firefox"===r){var l=e.match(/firefox\/([\d.]+)/);l&&1<l.length&&(n=l[1])}else if("Opera"===r){var c=e.match(/opera\/([\d.]+)/);c&&1<c.length&&(n=c[1])}else if("Safari"===r){var u=e.match(/version\/([\d.]+)/);u&&1<u.length&&(n=u[1])}else if("Edge"===r){var d=e.match(/edge\/([\d.]+)/);d&&1<d.length&&(n=d[1])}else if("QQBrowser"===r){var h=e.match(/qqbrowser\/([\d.]+)/);h&&1<h.length&&(n=h[1])}t.type=r,t.version=parseInt(n)}return t}function Ze(){var e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function et(){var e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&e.match(/Safari/gi)}function tt(e,t){var i;return 0===arguments.length?null:(t=t||"{y}-{m}-{d} {h}:{i}:{s}",e="object"==m(e)?e:(e=+(e=10===(""+e).length?1e3*parseInt(e):e),new Date(e)),i={y:e.getFullYear(),m:e.getMonth()+1,d:e.getDate(),h:e.getHours(),i:e.getMinutes(),s:e.getSeconds(),a:e.getDay()},t.replace(/{(y|m|d|h|i|s|a)+}/g,(function(e,t){var r=i[t];return"a"===t?["一","二","三","四","五","六","日"][r-1]:(r=0<e.length&&r<10?"0"+r:r)||0})))}function it(){return"VideoFrame"in window}function rt(e){var t;return"string"!=typeof e||(t=Number(e),isNaN(t))?e:t}function nt(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function at(e,t){var i,r,n=!1;return function a(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];n?(i=o,r=this):(n=!0,e.apply(this,o),setTimeout((function(){n=!1,i&&(a.apply(r,i),i=null,r=null)}),t))}}function st(e){return"[object Number]"===Object.prototype.toString.call(e)}function ot(){var e=!1;return"MediaStreamTrackGenerator"in window||e}function lt(){var e=!1;return"MediaStream"in window||e}function ct(e){return null==e}function ut(e){return!0===e||!1===e}function dt(e){return!ct(e)}function ht(e){var t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000"},rect:{color:"",lineWidth:2,width:"",height:""},html:""},i=Object.assign(t.image,e.image||{}),r=Object.assign(t.text,e.text||{});return Object.assign(t,e,{image:i,text:r})}function ft(e,t){return e={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""},{watermark_parent_node:(e=Object.assign(e,t)).container,watermark_alpha:e.opacity,watermark_angle:e.angle,watermark_fontsize:e.fontSize,watermark_color:e.color,watermark_font:e.fontFamily,watermark_txt:e.text}}function pt(e,t){return new Promise((function(i,r){var n=ht(t);if(!n.image.src&&!n.text.content)return i(e);var a=document.createElement("canvas"),s=(a.width=t.width,a.height=t.height,a.getContext("2d")),o=0,l=0;st(n.left)?o=n.left:st(n.right)&&(o=a.width-n.right),st(n.top)?l=n.top:st(n.bottom)&&(l=a.height-n.bottom);var c=new Image;c.src=e,c.onload=function(){if(s.drawImage(c,0,0),n.image&&n.image.src){var e=new Image;e.src=n.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=function(){o-=n.image.width,s.drawImage(e,o,l,n.image.width,n.image.height),i(a.toDataURL(t.format,t.quality))},e.onerror=function(e){r()}}else n.text&&n.text.content&&(s.font=n.text.fontSize+"px 宋体",s.fillStyle=n.text.color,s.textAlign="right",s.fillText(n.text.content,o,l),i(a.toDataURL(t.format,t.quality)))},c.onerror=function(e){r(e)}}))}function gt(e){var t,i;return-1<e&&(t=e%60,i=(i=Math.floor(e/3600))<10?"0"+i+":":i+":",(e=Math.floor(e/60)%60)<10&&(i+="0"),i+=e+":",(t=Math.round(t))<10&&(i+="0"),i+=t.toFixed(0)),i}function mt(e){var t,i,r="";return-1<e&&(t=Math.floor(e/60/60)%60,i=Math.floor(e/60)%60,e%=60,i=Math.round(i),r=t<10?"0"+t+":":t+":",i<10&&(r+="0"),r+=i+":",e<10&&(r+="0"),r+=e),r}function At(e,t){var i=Math.floor(t/60/60)%60,r=Math.floor(t/60)%60;t%=60;return new Date(e).setHours(i,r,t,0)}function yt(e){return(""+e).length}function vt(e){return!e||0!==Object.keys(e).length}function bt(e){return"string"==typeof e}var wt=function(){return e=window.navigator.userAgent,/MicroMessenger/i.test(e)&&(e=window.navigator.userAgent.toLowerCase(),/android/i.test(e));var e};function kt(e){return e=e||window.event,e.target||e.srcElement}function Et(e){return"function"==typeof e}function Tt(e){var t=0,i=0,r=e||window.event;return r.pageX||r.pageY?(t=r.pageX,i=r.pageY):(r.clientX||r.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function St(e){return Mt(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)}function _t(e){return e=e.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1],e=new Blob([e],{type:"application/javascript"}),URL.createObjectURL(e)}function Ct(e){e.close?e.close():e.destroy&&e.destroy()}function Rt(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function Dt(e){e=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/");for(var t=window.atob(e),i=new Uint8Array(t.length),r=0;r<t.length;++r)i[r]=t.charCodeAt(r);return i}function xt(t){var i="";if("object"==m(t))try{i=JSON.stringify(t),i=JSON.parse(i)}catch(e){i=t}else i=t;return i}function Lt(){return xt(L)}function It(){return xt(I)}function Bt(e){return e[0]>>4==1&&0===e[1]}function Pt(e){return!0===e||"true"===e}function Mt(e){return!0!==e&&"true"!==e}var Ot=function(){function e(t){A(this,e),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=t}return y(e,[{key:"proxy",value:function(e,t,i){var r=this,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(e){if(Array.isArray(t))return t.map((function(t){return r.proxy(e,t,i,n)}));e.addEventListener(t,i,n);var a=function(){Et(e.removeEventListener)&&e.removeEventListener(t,i,n)};return this.destroys.push(a),a}}},{key:"destroy",value:function(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((function(e){return e()}))}}])}(),Ft="undefined"!=typeof Float32Array?Float32Array:Array;function jt(){var e=new Ft(16);return Ft!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Ut(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}function Nt(e,t,i){var r=new Ft(3);return r[0]=e,r[1]=t,r[2]=i,r}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),Je=new Ft(3),Ft!=Float32Array&&(Je[0]=0,Je[1]=0,Je[2]=0),_r=new Ft(4),Ft!=Float32Array&&(_r[0]=0,_r[1]=0,_r[2]=0,_r[3]=0);var Gt=function(){function e(t,i){A(this,e),this.gl=t,i&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),i=this._initShaderProgram(),this._programInfo={program:i,attribLocations:{vertexPosition:t.getAttribLocation(i,"aVertexPosition"),texturePosition:t.getAttribLocation(i,"aTexturePosition")},uniformLocations:{projectionMatrix:t.getUniformLocation(i,"uProjectionMatrix"),modelMatrix:t.getUniformLocation(i,"uModelMatrix"),viewMatrix:t.getUniformLocation(i,"uViewMatrix"),rgbatexture:t.getUniformLocation(i,"rgbaTexture"),ytexture:t.getUniformLocation(i,"yTexture"),utexture:t.getUniformLocation(i,"uTexture"),vtexture:t.getUniformLocation(i,"vTexture"),isyuv:t.getUniformLocation(i,"isyuv")}},this._buffers=this._initBuffers(),this._rgbatexture=this._createTexture(),this._ytexture=this._createTexture(),this._utexture=this._createTexture(),this._vtexture=this._createTexture()}return y(e,[{key:"destroy",value:function(){this.gl.deleteProgram(this._programInfo.program),this.gl.deleteBuffer(this._buffers.position),this.gl.deleteBuffer(this._buffers.texPosition),this.gl.deleteBuffer(this._buffers.indices),this.gl.deleteTexture(this._rgbatexture),this.gl.deleteTexture(this._ytexture),this.gl.deleteTexture(this._utexture),this.gl.deleteTexture(this._vtexture),this._programInfo=null,this._buffers=null,this._rgbatexture=null,this._ytexture=null,this._utexture=null,this._vtexture=null}},{key:"_initShaderProgram",value:function(){var e=this._loadShader(this.gl.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),t=this._loadShader(this.gl.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 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\n void main(void) {\n\n if (isyuv>0) {\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 "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}},{key:"_loadShader",value:function(e,t){var i=this.gl;e=i.createShader(e);return i.shaderSource(e,t),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(e)),i.deleteShader(e),null)}},{key:"_initBuffers",value:function(){var e=this.gl,t=e.createBuffer(),i=(e.bindBuffer(e.ARRAY_BUFFER,t),[-1,-1,1,-1,1,1,-1,1]);e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var r=(r=[]).concat([0,1],[1,1],[1,0],[0,0]),n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW),r=e.createBuffer();return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:n,indices:r}}},{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,i){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),i?(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,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}},{key:"_calRect",value:function(e,t,i,r,n,a){var s=2*e/n-1;r=2*(a-t-r)/a-1,e=2*(e+i)/n-1,i=2*(a-t)/a-1;return[s,r,e,r,e,i,s,i]}},{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,i,r,n){var a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,n),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"renderYUV",value:function(e,t,i){var r=i.slice(0,e*t),n=i.slice(e*t,e*t*5/4),a=(i=i.slice(e*t*5/4,e*t*3/2),this.gl);this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,n),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"drawDom",value:function(e,t,i,r,n){var a=this.gl;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._rgbatexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),this._buffers.positions=this._calRect(i,r,n.width,n.height,e,t),this._drawScene(e,t,!1)}}])}(),zt=function(){function e(t){var i=this;A(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){i.pipeline=e,i.matrixGroupInfo=i._initMatrixGroupInfo(),i.hasInited=!0}))}return y(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]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST}),r=(t=(e.queue.writeBuffer(i,0,t),new Float32Array([0,1,1,1,1,0,0,0])),e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST})),n=(t=(e.queue.writeBuffer(r,0,t),new Uint16Array([0,1,2,0,2,3])),e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST}));return e.queue.writeBuffer(n,0,t),{positionBuffer:i,texpositionBuffer:r,indexBuffer:n}}},{key:"_initPipeline",value:function(){var e=this;return new Promise((function(t,i){var r=e.gpu.device,n=e.gpu.format;n={layout:"auto",vertex:{module:r.createShaderModule({code:"\n\n @binding(0) @group(0) var<uniform> uModelMatrix : mat4x4<f32>;\n @binding(1) @group(0) var<uniform> uViewMatrix : mat4x4<f32>;\n @binding(2) @group(0) var<uniform> uProjectionMatrix : mat4x4<f32>;\n\n struct VertexOutput {\n @builtin(position) Position : vec4<f32>,\n @location(0) vTexturePosition : vec2<f32>,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4<f32>,\n @location(1) aTexturePosition : vec2<f32>\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4<f32> = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4<f32>(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:r.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var yTexture: texture_2d<f32>;\n @group(1) @binding(2) var uTexture: texture_2d<f32>;\n @group(1) @binding(3) var vTexture: texture_2d<f32>;\n\n const YUV2RGB : mat4x4<f32> = mat4x4<f32>( 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<f32>\n ) -> @location(0) vec4<f32> {\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<f32>(y, u, v, 1.0)*YUV2RGB;\n }\n\n "}),entryPoint:"main",targets:[{format:n}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};r.createRenderPipelineAsync(n).then((function(e){t(e)})).catch((function(e){i(e)}))}))}},{key:"_initMatrixGroupInfo",value:function(){var e,t,i,r,n,a,s,o,l,c,u,d=this.gpu.device,h=this.pipeline,f=jt(),p=(e=(t=g=1)/((p=-1)-g),y=1/((i=-1)-t),o=1/((s=.1)-(a=100)),(l=f)[0]=-2*e,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=-2*y,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=2*o,l[11]=0,l[12]=(p+g)*e,l[13]=(t+i)*y,l[14]=(a+s)*o,l[15]=1,jt()),g=(Ut(p),jt()),m=(e=g,t=Nt(0,0,0),i=Nt(0,0,-1),y=Nt(0,1,0),a=t[0],s=t[1],t=t[2],o=y[0],l=y[1],y=y[2],c=i[0],u=i[1],i=i[2],Math.abs(a-c)<1e-6&&Math.abs(s-u)<1e-6&&Math.abs(t-i)<1e-6?Ut(e):(c=a-c,u=s-u,i=t-i,A=l*(i*=m=1/Math.hypot(c,u,i))-y*(u*=m),y=y*(c*=m)-o*i,o=o*u-l*c,(m=Math.hypot(A,y,o))?(A*=m=1/m,y*=m,o*=m):o=y=A=0,l=u*o-i*y,r=i*A-c*o,n=c*y-u*A,(m=Math.hypot(l,r,n))?(l*=m=1/m,r*=m,n*=m):n=r=l=0,e[0]=A,e[1]=l,e[2]=c,e[3]=0,e[4]=y,e[5]=r,e[6]=u,e[7]=0,e[8]=o,e[9]=n,e[10]=i,e[11]=0,e[12]=-(A*a+y*s+o*t),e[13]=-(l*a+r*s+n*t),e[14]=-(c*a+u*s+i*t),e[15]=1),d.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST})),A=(d.queue.writeBuffer(m,0,p),d.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST})),y=(d.queue.writeBuffer(A,0,g),d.createBuffer({size:64,usage:window.GPUBufferUsage.UNIFORM|window.GPUBufferUsage.COPY_DST}));return d.queue.writeBuffer(y,0,f),{modelMatrixBuffer:m,viewMatrixBuffer:A,projectMatrixBuffer:y,group:d.createBindGroup({label:"group0",layout:h.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:m}},{binding:1,resource:{buffer:A}},{binding:2,resource:{buffer:y}}]})}}},{key:"_initTextureGroupInfo",value:function(e,t){var i=this.gpu.device,r=this.pipeline,n=i.createTexture({size:[e,t],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),a=i.createTexture({size:[e/2,t/2],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT});e=i.createTexture({size:[e/2,t/2],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),t=i.createSampler({magFilter:"linear",minFilter:"linear"}),i=i.createBindGroup({label:"group1",layout:r.getBindGroupLayout(1),entries:[{binding:0,resource:t},{binding:1,resource:n.createView()},{binding:2,resource:a.createView()},{binding:3,resource:e.createView()}]});return{yTexture:n,uTexture:a,vTexture:e,group:i}}},{key:"_drawScene",value:function(){var e=this.gpu.device,t=this.gpu.context,i=e.createCommandEncoder();t={colorAttachments:[{view:t.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:this.depthTexture.createView(),depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}},t=i.beginRenderPass(t);t.setPipeline(this.pipeline),t.setBindGroup(0,this.matrixGroupInfo.group),t.setBindGroup(1,this.textureGroupInfo.group),t.setVertexBuffer(0,this.buffers.positionBuffer),t.setVertexBuffer(1,this.buffers.texpositionBuffer),t.setIndexBuffer(this.buffers.indexBuffer,"uint16"),t.drawIndexed(6),t.end(),e.queue.submit([i.finish()])}},{key:"renderYUV",value:function(e,t,i){var r,n,a;this.hasInited&&(r=i.slice(0,e*t),n=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2),a=this.gpu.device,this.depthTexture||(this.depthTexture=this.gpu.device.createTexture({size:[e,t],format:"depth24plus",usage:window.GPUTextureUsage.RENDER_ATTACHMENT})),this.textureGroupInfo||(this.textureGroupInfo=this._initTextureGroupInfo(e,t)),a.queue.writeTexture({texture:this.textureGroupInfo.yTexture},r,{bytesPerRow:e,rowsPerImage:t},[e,t]),a.queue.writeTexture({texture:this.textureGroupInfo.uTexture},n,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),a.queue.writeTexture({texture:this.textureGroupInfo.vTexture},i,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),this._drawScene())}},{key:"clear",value:function(){}}])}(),Ht=function(e){function t(){var e;return A(this,t),e=p(this,t),e.videoInfo={width:null,height:null,encType:null},e.init=!1,e}return g(t,e),y(t,[{key:"destroy",value:function(){this.resetInit(),this.off()}},{key:"resetInit",value:function(){this.videoInfo={width:null,height:null,encType:null},this.init=!1}},{key:"getHasInit",value:function(){return this.init}},{key:"updateVideoInfo",value:function(e){dt(e.encTypeCode)&&(this.videoInfo.encType=Q[e.encTypeCode]),dt(e.encType)&&(this.videoInfo.encType=e.encType),dt(e.width)&&(this.videoInfo.width=e.width),dt(e.height)&&(this.videoInfo.height=e.height),dt(this.videoInfo.encType)&&dt(this.videoInfo.height)&&dt(this.videoInfo.width)&&!this.init&&(this.player.emit(N.videoInfo,this.videoInfo),this.init=!0)}},{key:"getVideoInfo",value:function(){return this.videoInfo}},{key:"clearView",value:function(){}},{key:"play",value:function(){}},{key:"pause",value:function(){}},{key:"getType",value:function(){return""}},{key:"getCanvasType",value:function(){return""}},{key:"isPlaying",value:function(){return!0}},{key:"addContentToCanvas",value:function(){}},{key:"getPlaybackQuality",value:function(){return null}}])}(e),Wt="object"==("undefined"===typeof window?"undefined":m(window))&&window.window===window?window:"object"==("undefined"===typeof self?"undefined":m(self))&&self.self===self?self:"object"==("undefined"===typeof r?"undefined":m(r))&&r.global===r?r:void 0;function Vt(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Yt(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function Kt(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function qt(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(i)}}var Qt=Wt.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Yt="object"!=("undefined"===typeof window?"undefined":m(window))||window!==Wt?function(){}:"download"in HTMLAnchorElement.prototype&&!Qt?function(e,t,i){var r=Wt.URL||Wt.webkitURL,n=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,n.origin!==location.origin?Kt(n.href)?Vt(e,t,i):qt(n,n.target="_blank"):qt(n)):(n.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(n.href)}),4e4),setTimeout((function(){qt(n)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){var r;t=t||e.name||"download","string"==typeof e?Kt(e)?Vt(e,t,i):((r=document.createElement("a")).href=e,r.target="_blank",setTimeout((function(){qt(r)}))):navigator.msSaveOrOpenBlob((e=e,void 0===(i=i)?i={autoBom:!1}:"object"!=m(i)&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.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),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return Vt(e,t,i);t="application/octet-stream"===e.type,i=/constructor/i.test(Wt.HTMLElement)||Wt.safari;var n,a,s,o=/CriOS\/[\d]+/.test(navigator.userAgent);(o||t&&i||Qt)&&"undefined"!=typeof FileReader?((n=new FileReader).onloadend=function(){var e=n.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");r?r.location.href=e:location=e,r=null},n.readAsDataURL(e)):(a=Wt.URL||Wt.webkitURL,s=a.createObjectURL(e),r?r.location=s:location.href=s,r=null,setTimeout((function(){a.revokeObjectURL(s)}),4e4))},Jt=function(){function e(t,i){A(this,e),this.gl=t,i&&this.gl.pixelStorei(this.gl.UNPACK_ALIGNMENT,1),t=this._initShaderProgram(),this.shaderProgram=t,this.programInfo={program:t,attribLocations:{vertexPosition:this.gl.getAttribLocation(t,"aVertexPosition")},uniformLocations:{linewidth:this.gl.getUniformLocation(t,"uLineWidth"),rect:this.gl.getUniformLocation(t,"uRect"),linecolor:this.gl.getUniformLocation(t,"uLineColor"),resolution:this.gl.getUniformLocation(t,"uResolution")}},this.buffers=this._initBuffers()}return y(e,[{key:"destroy",value:function(){this.gl.deleteProgram(this.shaderProgram),this.gl.deleteBuffer(this.buffers.position),this.gl.deleteBuffer(this.buffers.indices),this.shaderProgram=null,this.buffers=null}},{key:"_initShaderProgram",value:function(){var e=this.gl,t=this._loadShader(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n void main(void) {\n gl_Position = aVertexPosition;\n }\n "),i=this._loadShader(e.FRAGMENT_SHADER,"\n precision highp float;\n uniform float uLineWidth;\n uniform vec4 uRect;\n uniform vec3 uLineColor;\n uniform vec2 uResolution;\n\n\n float inBox(vec2 st, vec4 rect){\n\n vec2 bl = step(rect.xy,st);\n float pct = bl.x * bl.y;\n\n vec2 tr = step(st, rect.zw);\n pct *= tr.x * tr.y;\n\n return pct;\n }\n\n void main(void) {\n\n vec2 cur = gl_FragCoord.xy/uResolution;\n\n float xlinewidth = uLineWidth/uResolution.x;\n float ylinewidth = uLineWidth/uResolution.y;\n\n // vec4 outRect = uRect + vec4(-1.*xlinewidth/2., -1.*ylinewidth/2., xlinewidth/2., ylinewidth/2.);\n // vec4 inRect = uRect + vec4(xlinewidth/2., ylinewidth/2., -1.*xlinewidth/2., -1.*ylinewidth/2.);\n\n vec4 outRect = uRect + vec4(-1.*xlinewidth/2., -1.*ylinewidth/2., xlinewidth/2., ylinewidth/2.);\n vec4 inRect = uRect;\n\n float a = inBox(cur, outRect);\n float b = inBox(cur, inRect);\n\n gl_FragColor = mix(vec4(0., 0., 0., 0.), vec4(uLineColor.rgb, 1.0), a-b);\n\n }\n "),r=e.createProgram();return e.attachShader(r,t),e.attachShader(r,i),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS)?r:(console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(r)),null)}},{key:"_loadShader",value:function(e,t){var i=this.gl;e=i.createShader(e);return i.shaderSource(e,t),i.compileShader(e),i.getShaderParameter(e,i.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(e)),i.deleteShader(e),null)}},{key:"_createTexture",value:function(){var e=this.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}},{key:"_initBuffers",value:function(){var e=this.gl,t=e.createBuffer(),i=(e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,1,1,-1,1]),e.STATIC_DRAW),e.createBuffer());return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,indices:i}}},{key:"_drawScene",value:function(e){var t=e,i=(e=t.canvasWidth,t.canvasHeight),r=t.rect,n=t.lineWidth,a=t.lineColor,s=this.gl,o=this.buffers,l=this.programInfo;s.viewport(0,0,e,i),s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),s.bindBuffer(s.ARRAY_BUFFER,o.position),s.vertexAttribPointer(l.attribLocations.vertexPosition,2,s.FLOAT,!1,0,0),s.enableVertexAttribArray(l.attribLocations.vertexPosition),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,o.indices),s.useProgram(l.program),s.uniform2f(l.uniformLocations.resolution,e,i),s.uniform4f(l.uniformLocations.rect,r[0],r[1],r[2],r[3]),s.uniform1f(l.uniformLocations.linewidth,n),s.uniform3f(l.uniformLocations.linecolor,a[0],a[1],a[2]),s.drawElements(s.TRIANGLES,6,s.UNSIGNED_SHORT,0)}},{key:"drawBox",value:function(e){var t=e,i=(e=t.x,t.y),r=t.width,n=t.height,a=t.lineWidth,s=t.lineColor,o=t.canvasWidth,l=t.canvasHeight,c=(c=e/o,n=(l-i-n)/l,e=(e+r)/o,r=(l-i)/l,(i=new Ft(4))[0]=c,i[1]=n,i[2]=e,i[3]=r,i);s=Nt(1,0,0);this._drawScene({canvasWidth:o,canvasHeight:l,rect:c,lineWidth:a,lineColor:s})}}])}(),Xt=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e;var r=document.createElement("canvas");return r.style.position="absolute",r.style.top=0,r.style.left=0,i.$videoElement=r,e.$container.appendChild(i.$videoElement),i.context2D=null,i.contextGl=null,i.webglRender=null,i.webglRectRender=null,i.webGPURender=null,i.isWebglContextLost=!1,i.bitmaprenderer=null,i.renderType=null,i.controlHeight=0,i.proxyDestroyList=[],i.tempCanvasContentList=[],i._initCanvasRender(),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),0<this.proxyDestroyList.length&&(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:"",encTypeCode:""},this.tempCanvasContentList=[],this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}},{key:"_initContextGl",value:function(){var e,t=this,i=this.player.events["proxy"];this.contextGl=ze(this.$videoElement),this.contextGl?(e=i(this.$videoElement,"webglcontextlost",(function(e){e.preventDefault(),t.player.debug.error("canvasVideo","webglcontextlost error",e),t.isWebglContextLost=!0,t.webglRender&&(t.webglRender.destroy(),t.webglRender=null),t.webglRectRender&&(t.webglRectRender.destroy(),t.webglRectRender=null),t.contextGl=null,setTimeout((function(){t.contextGl=ze(t.$videoElement),t.contextGl&&t.contextGl.getContextAttributes().stencil?(t.webglRender=new Gt(t.contextGl,t.player._opt.openWebglAlignment),t.webglRectRender=new Jt(t.contextGl,t.player._opt.openWebglAlignment),t.isWebglContextLost=!1):(t.player.debug.error("canvasVideo","webglcontextlost error, getContextAttributes().stencil is false"),t.player.emit(H.webglContextLostError))}),500)})),i=i(this.$videoElement,"webglcontextrestored",(function(e){e.preventDefault(),t.player.debug.log("canvasVideo","webglcontextrestored ",e)})),this.webglRender=new Gt(this.contextGl,this.player._opt.openWebglAlignment),this.webglRectRender=new Jt(this.contextGl,this.player._opt.openWebglAlignment),this.proxyDestroyList.push(e,i)):this.player.debug.error("canvasVideo","_initContextGl() createContextGL error")}},{key:"_initContextGPU",value:function(){var e=this,t=this.$videoElement;new Promise((function(e,i){navigator.gpu?navigator.gpu.requestAdapter().then((function(r){r?r.requestDevice().then((function(n){if(n){var a=t.getContext("webgpu");if(a){var s=navigator.gpu.getPreferredCanvasFormat();a.configure({device:n,format:s,alphaMode:"opaque"}),e({adapter:r,device:n,context:a,format:s})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((function(e){i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((function(e){i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")})).then((function(t){e.webGPURender=new zt(t),e.player.debug.log("canvasVideo","webGPURender init success")})).catch((function(t){e.player.debug.error("canvasVideo","createWebGPUContext error is ".concat(t," and next use webgl render")),e.renderType=te,e._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,i,r){e=e||We(),r=r||K.download;var n=.92;!Ae[t]&&K[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(n=Number(i));var a=Ae[t]||Ae.png;i=this.$videoElement.toDataURL(a,n);if(r===K.base64)return i;var s=He(i);if(r===K.blob)return s;if(r===K.download){var o=a.split("/")[1];Yt(s,e+"."+o)}}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(i,r){(e=(e=bt(e)?{filename:e}:e)||{}).width=t.videoInfo.width,e.height=t.videoInfo.height,e.filename=e.filename||We(),e.format=e.format?Ae[e.format]:Ae.png,e.quality=Number(e.quality)||.92,e.type=e.type||K.download;var n=t.$videoElement.toDataURL(e.format,e.quality);pt(n,e).then((function(t){if(e.type===K.base64)i(n);else{var r=He(t);if(e.type===K.blob)i(r);else if(e.type===K.download){i();var a=e.format.split("/")[1];Yt(r,e.filename+"."+a)}}})).catch((function(e){r(e)}))}))}},{key:"render",value:function(){}},{key:"clearView",value:function(){}},{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,i=this.player.height;if(e.hasControl&&!e.controlAutoHide){var r=this.controlHeight;Xe()&&this.player.fullscreen&&e.useWebFullScreen?t-=r:i-=r}var n=this.$videoElement.width,a=this.$videoElement.height,s=e.rotate,o=(t-n)/2,l=(i-a)/2,c=(270!==s&&90!==s||(n=this.$videoElement.height,a=this.$videoElement.width),t/n),u=i/a,d=u<c?u:c,h=(e.isResize||c!=u&&(d=c+","+u),"scale("+(d=e.isFullResize?u<c?c:u:d)+")");"none"===e.mirrorRotate&&s&&(h+=" rotate("+s+"deg)"),"level"===e.mirrorRotate?h+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(h+=" rotateX(180deg)"),this.$videoElement.style.transform=h,this.$videoElement.style.left=o+"px",this.$videoElement.style.top=l+"px"}},{key:"initFps",value:function(){}},{key:"setStreamFps",value:function(){}},{key:"getStreamFps",value:function(){return 25}},{key:"getType",value:function(){return _}},{key:"getCanvasType",value:function(){return this.renderType===ie?ie:te}},{key:"addContentToCanvas",value:function(){this.tempCanvasContentList=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]}}])}(Ht),$t=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.yuvList=[],i.controlHeight=38,i.tempTextCanvas=null,i.tempTextCanvasCtx=null,i.player.debug.log("CanvasVideo","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(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")}},{key:"_initContext2D",value:function(){this.context2D=this.$videoElement.getContext("2d",0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}},{key:"_initCanvasRender",value:function(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ee,this._initContext2D()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ne,this._initContext2D()):this.player._opt.isHls&&this.player._opt.useCanvasRender?(this.renderType="hls",this._initContext2D()):this._supportOffscreen()?(this.renderType=re,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=ie,this._initContextGPU()):(this.renderType=te,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,i=this;switch(this.player.videoTimestamp=e.ts||0,this.renderType!==ne&&(t={ts:e.ts||0,fps:!0},this.player.updateStats(t)),this.renderType){case re:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case te:case ie:if(!this.isWebglContextLost){var r=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector&&(r=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output})),this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector&&(r=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output})),this.renderType===ie)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,r)}catch(e){this.player.debug.error("CanvasVideoLoader","doRender webgpu render and error: "+e.toString())}else if(this.renderType===te)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,r),this.doAddContentToWebGlCanvas()}catch(e){this.player.debug.error("CanvasVideoLoader","doRender webgl render context is lost ".concat(this.contextGl.isContextLost()," and error: ")+e.toString())}}break;case ee:if(Et(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((function(t){i.context2D.drawImage(t,0,0,i.$videoElement.width,i.$videoElement.height),Ct(e.videoFrame),i.doAddContentToCanvas()}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),Ct(e.videoFrame),this.doAddContentToCanvas();break;case ne:case"hls":this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height),this.doAddContentToCanvas()}}},{key:"clearView",value:function(){var e,t,i,r=this;switch(this.renderType){case re:e=this.$videoElement.width,t=this.$videoElement.height,(i=document.createElement("canvas")).width=e,i.height=t,e=window.createImageBitmap(i,0,0,e,t),i.width=0,i.height=0,e.then((function(e){r.bitmaprenderer.transferFromImageBitmap(e)}));break;case te:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case ie:this.webGPURender.clear();break;case ee:case ne:case"hls":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(){if(0<this.tempCanvasContentList.length&&this.context2D){var e={ctx:this.context2D,list:this.tempCanvasContentList},t=e.ctx,i=e.list;t.save(),(i||[]).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()}}},{key:"doAddContentToWebGlCanvas",value:function(){var e=this;0<this.tempCanvasContentList.length&&this.contextGl&&this.webglRectRender&&this.tempCanvasContentList.forEach((function(t){var i=t.x,r=t.y;if("rect"===t.type){var n=t.width,a=t.height,s=(s=t.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),o=t.lineWidth||4;n&&a&&e.webglRectRender.drawBox({x:i,y:r,width:n,height:a,lineColor:s,lineWidth:o,canvasWidth:e.$videoElement.width,canvasHeight:e.$videoElement.height})}else if("text"===t.type){var l=t.text||"";l&&(n=t.fontSize||20,a=t.color||"#008000",e.tempTextCanvas||e._initTempTextCanvas(),e.tempTextCanvasCtx.clearRect(0,0,e.tempTextCanvas.width,e.tempTextCanvas.height),e.tempTextCanvasCtx.font=n+"px Arial",e.tempTextCanvasCtx.fillStyle=a,e.tempTextCanvasCtx.textBaseline="top",e.tempTextCanvasCtx.fillText(l,0,0),e.webglRender.drawDom(e.$videoElement.width,e.$videoElement.height,i,r,e.tempTextCanvas))}}))}}])}(Xt),Zt=function(){function e(t){A(this,e),this.player=t,this.configList=[],this.shadowRoot=null,this.shadowRootRealDom=null,this.shadowRootInnerDom=null,this.scale=1,this._initDom(),this.player.debug.log("SingleWatermark","int")}return y(e,[{key:"destroy",value:function(){this.configList=[],this.shadowRootInnerDom=null,this.scale=1,this.shadowRoot&&(this.player.$container.removeChild(this.shadowRootRealDom),this.shadowRoot=null,this.shadowRootInnerDom=null),this.player.debug.log("SingleWatermark","destroy")}},{key:"resize",value:function(){this._resizeDom()}},{key:"_initDom",value:function(){var e=this.player.$container,t=null,i=document.createElement("div"),r=(i.setAttribute("style","pointer-events: none !important;display: block !important;"),t="function"==typeof i.attachShadow?i.attachShadow({mode:"open"}):i.shadowRoot||i,document.createElement("div")),n=(r.setAttribute("style","position: absolute; top: 0; left: 0; width: 0; height: 0;display: none;"),t.appendChild(r),e.children),a=Math.floor(Math.random()*(n.length-1));n[a]?e.insertBefore(i,n[a]):e.appendChild(i),this.shadowRootInnerDom=r,this.shadowRootRealDom=i,this.shadowRoot=t}},{key:"update",value:function(e){this._removeDom();var t=[];Array.isArray(e)?t=e:vt(e)&&t.push(e),e=t.map((function(e){return ht(e)})),this.configList=e,this._updateDom()}},{key:"_resizeDom",value:function(){this.player.$container;var e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(0<i.height&&0<i.width){var r=i.width,n=i.height,a=this.player._opt,s=t,o=e;if(a.hasControl&&!a.controlAutoHide){var l=a.playType===v?48:38;Xe()&&this.player.fullscreen&&a.useWebFullScreen?o-=l:s-=l}var c=a.rotate,u=(o-r)/2,d=(s-n)/2,h=(270!==c&&90!==c||(r=i.height,n=i.width),o/r),f=s/n,p=f<h?f:h,g=(a.isResize||h!=f&&(p=h+","+f),"scale("+(p=a.isFullResize?f<h?h:f:p)+")");"none"===a.mirrorRotate&&c&&(g+=" rotate("+c+"deg)"),"level"===a.mirrorRotate?g+=" rotateY(180deg)":"vertical"===a.mirrorRotate&&(g+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?h:p,this.shadowRootInnerDom.style.transform=g,this.shadowRootInnerDom.style.left=u+"px",this.shadowRootInnerDom.style.top=d+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}}},{key:"_updateDom",value:function(){var e=this;this.shadowRoot&&this.configList.forEach((function(t){var i=document.createElement("div"),r=null;t.image&&t.image.src?((r=document.createElement("img")).style.height="100%",r.style.width="100%",r.style.objectFit="contain",r.src=t.image.src):t.text&&t.text.content?r=document.createTextNode(t.text.content):(t.rect&&t.rect.color&&t.rect.width||t.html)&&(r=document.createElement("div")),r&&(i.appendChild(r),i.style.visibility="",i.style.position="absolute",i.style.display="block",i.style["-ms-user-select"]="none",i.style["-moz-user-select"]="none",i.style["-webkit-user-select"]="none",i.style["-o-user-select"]="none",i.style["user-select"]="none",i.style["-webkit-touch-callout"]="none",i.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",i.style["-webkit-text-size-adjust"]="none",i.style["-webkit-touch-callout"]="none",i.style.opacity=t.opacity,st(t.left)&&(i.style.left=t.left+"px"),st(t.right)&&(i.style.right=t.right+"px"),st(t.top)&&(i.style.top=t.top+"px"),st(t.bottom)&&(i.style.bottom=t.bottom+"px"),t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor),i.style.overflow="hidden",i.style.zIndex="9999999",t.image&&t.image.src?(i.style.width=t.image.width+"px",i.style.height=t.image.height+"px"):t.text&&t.text.content?(i.style.fontSize=t.text.fontSize+"px",i.style.color=t.text.color):t.rect&&t.rect.color&&t.rect.width?(i.style.width=t.rect.width+"px",i.style.height=t.rect.height+"px",i.style.borderWidth=t.rect.lineWidth+"px",i.style.borderStyle="solid",i.style.borderColor=t.rect.color):t.html&&(i.innerHTML=t.html,i.style.width=t.width+"px",i.style.height=t.height+"px"),e.shadowRootInnerDom.appendChild(i))}))}},{key:"remove",value:function(){this._removeDom()}},{key:"_removeDom",value:function(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}])}(),ei=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e;var r=document.createElement("video"),n=document.createElement("canvas"),a=(n=(r.muted=!0,r.style.position="absolute",r.style.top=0,r.style.left=0,i._delayPlay=!1,e.$container.appendChild(r),i.$videoElement=r,i.$canvasElement=n,i.canvasContext=n.getContext("2d"),i.mediaStream=null,i.vwriter=null,e.canVideoTrackWritter()&&ot()&&lt()&&(i.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),i.mediaStream=new MediaStream([i.trackGenerator]),r.srcObject=i.mediaStream,i.vwriter=i.trackGenerator.writable.getWriter()),i.fixChromeVideoFlashBug(),i.resize(),i.eventListenList=[],i.tempContentList=[],i.contentWatermark=null,i.player.events)["proxy"],r=n(i.$videoElement,"canplay",(function(){i.player.debug.log("Video","canplay"),i._delayPlay&&i._play()})),n(i.$videoElement,"waiting",(function(){i.player.debug.log("Video","waiting")}))),s=n(i.$videoElement,"loadedmetadata",(function(){i.player.debug.log("Video","loadedmetadata")})),o=n(i.$videoElement,"timeupdate",(function(t){t=parseInt(t.timeStamp,10),(i.player._opt.isWebrtc||i.player._opt.isHls)&&i.player.emit(N.timeUpdate,t),e._opt.isWebrtc&&e.handleRender()}));n=n(i.$videoElement,"error",(function(){i.player.debug.error("Video","Error "+i.$videoElement.error.code+"; details: "+i.$videoElement.error.message)}));return i.eventListenList.push(r,a,o,n,s),i.player.debug.log("Video","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){var e;if(f(t,"destroy",this,3)([]),this.eventListenList&&(this.eventListenList.forEach((function(e){e()})),this.eventListenList=[]),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()&&((e=this.player.$container).style.backdropFilter="none",e.style.transform="none"),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}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),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")}},{key:"fixChromeVideoFlashBug",value:function(){var e;this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()&&((e=this.player.$container).style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)")}},{key:"_isNeedAddBackDropFilter",value:function(){var e=$e().type.toLowerCase();return"chrome"===e||"edge"===e}},{key:"isPause",value:function(){var e=!0;return this.$videoElement?this.$videoElement.paused:e}},{key:"_getVideoReadyState",value:function(){var e=0;return this.$videoElement?this.$videoElement.readyState:e}},{key:"_getVideoCurrentTime",value:function(){var e=0;return this.$videoElement?this.$videoElement.currentTime:e}},{key:"play",value:function(){var e;this.$videoElement&&(e=this._getVideoReadyState(),this.player.debug.log("Video","play and readyState: "+e),0===e?(this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),this._delayPlay=!0):this._play())}},{key:"_play",value:function(){var e=this;this.$videoElement&&this.$videoElement.play().then((function(){e._delayPlay=!1,e.player.debug.log("Video","_play success"),setTimeout((function(){e.isPlaying()||(e.player.debug.warn("Video","play failed and retry play"),e._play())}),100)})).catch((function(t){e.player.debug.error("Video","_play error",t)}))}},{key:"pause",value:function(e){var t=this;this.isPlaying()&&(e?this.$videoElement&&this.$videoElement.pause():setTimeout((function(){t.$videoElement&&t.$videoElement.pause()}),100))}},{key:"clearView",value:function(){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,i,r){e=e||We(),r=r||K.download;var n=.92;!Ae[t]&&K[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(n=Number(i));i=this.$videoElement;var a=this.$canvasElement,s=(a.width=i.videoWidth,a.height=i.videoHeight,this.canvasContext.drawImage(i,0,0,a.width,a.height),Ae[t]||Ae.png);i=a.toDataURL(s,n);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,r===K.base64)return i;var o=He(i);if(r===K.blob)return o;if(r===K.download){var l=s.split("/")[1];Yt(o,e+"."+l)}}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(i,r){bt(e)&&(e={filename:e});var n=t.$videoElement,a=((e=e||{}).width=n.videoWidth,e.height=n.videoHeight,e.filename=e.filename||We(),e.format=e.format?Ae[e.format]:Ae.png,e.quality=Number(e.quality)||.92,e.type=e.type||K.download,t.$canvasElement);a.width=n.videoWidth,a.height=n.videoHeight,t.canvasContext.drawImage(n,0,0,a.width,a.height);var s=a.toDataURL(e.format,e.quality);t.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,pt(s,e).then((function(t){if(e.type===K.base64)i(s);else{var r=He(t);if(e.type===K.blob)i(r);else if(e.type===K.download){i();var n=e.format.split("/")[1];Yt(r,e.filename+"."+n)}}})).catch((function(e){r(e)}))}))}},{key:"initCanvasViewSize",value:function(){this.resize()}},{key:"clear",value:function(){var e=this.$videoElement,t=e.buffered;t=t.length?t.end(t.length-1):0;e.currentTime=t}},{key:"render",value:function(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.$videoElement.paused&&this.player.debug.warn("Video","render error, video is paused"),this.player.videoTimestamp=e.ts||0,this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),Ct(e.videoFrame);else if(e.output){var t=e.output;this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector&&(t=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output})),i=t=this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector?this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output}):t,e={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:e.ts},i=new VideoFrame(i,e),this.vwriter.write(i),Ct(i)}this.doAddContentToWatermark()}else this.player.debug.warn("Video","render and this.vwriter is null");var i}},{key:"resize",value:function(){var e=this.player.width,t=this.player.height,i=this.player._opt,r=i.rotate;if(i.hasControl&&!i.controlAutoHide){var n=i.playType===v?48:38;Xe()&&this.player.fullscreen&&i.useWebFullScreen?e-=n:t-=n}this.$videoElement.width=e,this.$videoElement.height=t,270!==r&&90!==r||(this.$videoElement.width=t,this.$videoElement.height=e);var a=(e-this.$videoElement.width)/2,s=(t-this.$videoElement.height)/2,o="contain",l=(i.isResize||(o="fill"),i.isFullResize&&(o="none"),"");"none"===i.mirrorRotate&&r&&(l+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?l+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(l+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=o),this.$videoElement.style.transform=l,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=s+"px"}},{key:"getType",value:function(){return C}},{key:"isPlaying",value:function(){return this.$videoElement&&Mt(this.$videoElement.paused)&&Mt(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}},{key:"addContentToCanvas",value:function(){this.tempContentList=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]}},{key:"doAddContentToWatermark",value:function(){var e;0<this.tempContentList.length?(this.contentWatermark||(this.contentWatermark=new Zt(this.player),this.contentWatermark.resize()),e=this.tempContentList.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.contentWatermark.update(e)):this.contentWatermark&&this.contentWatermark.remove()}},{key:"getPlaybackQuality",value:function(){var e,t=null;return this.$videoElement&&("function"==typeof this.$videoElement.getVideoPlaybackQuality&&(e=this.$videoElement.getVideoPlaybackQuality(),t={droppedVideoFrames:e.droppedVideoFrames||e.corruptedVideoFrames,totalVideoFrames:e.totalVideoFrames,creationTime:e.creationTime}),t={droppedVideoFrames:video.webkitDroppedFrameCount,totalVideoFrames:video.webkitDecodedFrameCount,creationTime:We()}),t}}])}(Ht),ti=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.controlHeight=48,i.bufferList=[],i.playing=!1,i.playInterval=null,i.fps=1,i.preFps=1,i.streamFps=0,i.playbackRate=1,i._firstTimestamp=null,i._renderFps=0,i._startfpsTime=null,i._startFpsTimestamp=null,i._hasCalcFps=!1,i.player.on(N.playbackPause,(function(e){e?(i.pause(),i.player.playback.isPlaybackPauseClearCache&&i.clear()):i.resume()})),i.player.debug.log("CanvasPlaybackLoader","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){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,f(t,"destroy",this,3)([]),this.player.debug.log("CanvasPlaybackLoader","destroy")}},{key:"_initCanvasRender",value:function(){this.player._opt.useWebGPU?(this.renderType=ie,this._initContextGPU()):(this.renderType=te,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(){var e;0<this.bufferList.length&&!this.player.seeking&&(e=this.bufferList.shift())&&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){if(this.getCanvasType()===te)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.isContextLost()," and error: ")+e.toString())}else if(this.getCanvasType()===ie)try{this.webGPURender?this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e):this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init")}catch(e){this.player.debug.error("CanvasPlaybackLoader","doRender webgpu render and error: "+e.toString())}}},{key:"_updateStats",value:function(e){this.player.updateStats({fps:!0,ts:e}),this._startfpsTime||(this._startfpsTime=e,this._startFpsTimestamp=We());var t=e,i=We(),r=i-this._startFpsTimestamp;r<=1e3?this._renderFps+=1:(this.player.emit(N.playbackStats,{fps:this._renderFps,start:this._startfpsTime,end:t,timestamp:r,dataTimestamp:t-this._startfpsTime,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:e}),this._renderFps=0,this._startfpsTime=t,this._startFpsTimestamp=i)}},{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=Ve(this.player.playback.fps,1,100),this.fps=this.preFps)}},{key:"setFps",value:function(e){e!==this.fps?(100<e&&this.player.debug.warn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debug.warn("CanvasPlaybackLoader","setFps min",e),this.fps=Ve(e,1,100),this.player.debug.log("CanvasPlaybackLoader","setFps ".concat(this.preFps," -> ")+this.fps),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader","setFps, same fps "+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,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,buffer:e.output},i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader","buffer size is "+this.bufferSize),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){var r=function(e){var t,i=e[0],r=null,n=1;if(0<e.length&&(t=e[1])&&1e5<t.ts-i.ts&&(i=t,n=2),i)for(var a=n;a<e.length;a++){var s=e[a];s&&1e3<=s.ts-i.ts&&e[a-1].ts-i.ts<1e3&&(r=a+1)}return r}(this.bufferList);null!==r&&r!==this.preFps&&(this.player.debug.log("CanvasPlaybackLoader","calc fps is ".concat(r," pre fps is ").concat(this.preFps," and updatePreFps")),this.setStreamFps(r))}if(!i){var n=this.bufferList.length,a=n/(this.fps*this.playbackRate);this.player.debug.log("CanvasPlaybackLoader","rate is",a),a<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(a*this.playbackRate)),this.player.debug.warn("CanvasPlaybackLoader","rate is",a,"fps is",this.fps,"bufferListLength is",n))}}},{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;0<t?this.delayTimeout=setTimeout((function(){e.initVideo()}),t):this.initVideo()}},{key:"clearView",value:function(){this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}},{key:"clear",value:function(){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}}])}(Xt),ii=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return y(e,null,[{key:"getLoaderFactory",value:function(e){return e.useMSE?e.mseUseCanvasRender?$t:ei:e.isHls?e.useCanvasRender?$t:ei:e.isWebrtc?ei:e.useWCS?!e.useOffscreen&&e.wcsUseVideoRender?ei:$t:e.playType===v?ti:e.wasmUseVideoRender&&!e.useOffscreen?ei:$t}}])}(),ri=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.bufferList=[],i.player=e,i.scriptNode=null,i.workletProcessorNode=null,i.hasInitScriptNode=!1,i.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),i.gainNode=i.audioContext.createGain(),e=i.audioContext.createBufferSource(),e.buffer=i.audioContext.createBuffer(1,1,22050),e.connect(i.audioContext.destination),e.noteOn?e.noteOn(0):e.start(0),i.audioBufferSourceNode=e,i.mediaStreamAudioDestinationNode=i.audioContext.createMediaStreamDestination(),i.audioEnabled(!0),i.gainNode.gain.value=0,i.playing=!1,i.audioSyncVideoOption={diff:null},i.audioInfo={encType:"",channels:"",sampleRate:""},i.init=!1,i.hasAudio=!1,i.on(N.videoSyncAudio,(function(e){i.audioSyncVideoOption=e})),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=Ge,this.scriptNode=null),this.workletProcessorNode&&(this.workletProcessorNode.port.onmessage=Ge,this.workletProcessorNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off()}},{key:"resetInit",value:function(){this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1}},{key:"getAudioInfo",value:function(){return this.audioInfo}},{key:"updateAudioInfo",value:function(e){e.encTypeCode&&(this.audioInfo.encType=$[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(N.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:"initScriptNode",value:function(){}},{key:"initMobileScriptNode",value:function(){}},{key:"initWorkletScriptNode",value:function(){}},{key:"getEngineType",value:function(){return""}},{key:"mute",value:function(e){e?(this.isMute||this.player.emit(N.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(N.mute,e),this.setVolume(.5))}},{key:"setVolume",value:function(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=Ve(e,0,1),this.gainNode.gain.value=e,this.player.emit(N.volumechange,this.player.volume))}},{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.audioContext.destination),this.gainNode)&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.clear()}},{key:"audioEnabled",value:function(e){e?this.isStateSuspended()&&(this.audioContext.resume(),this.player.emit(N.audioResumeState,{state:this.audioContext.state,isRunning:this.isStateRunning()})):this.isStateRunning()&&this.audioContext.suspend()}},{key:"isStateRunning",value:function(){return"running"===this.audioContext.state}},{key:"isStateSuspended",value:function(){return"suspended"===this.audioContext.state}},{key:"clear",value:function(){this.bufferList=[]}},{key:"play",value:function(e,t){}},{key:"pause",value:function(){this.audioSyncVideoOption={diff:null},this.playing=!1}},{key:"resume",value:function(){this.playing=!0}},{key:"setRate",value:function(e){}},{key:"getAudioBufferSize",value:function(){return 0}}])}(e),ni=function(){function e(t,i,r,n){A(this,e),this.player=t,this.audio=i,this.channel=r,this.bufferSize=n}return y(e,[{key:"extract",value:function(e,t){for(var i=this.provide(t),r=0;r<i.size;r++)e[2*r]=i.left[r],e[2*r+1]=i.right[r];return this.audio.tempAudioTimestamp=i.ts,i.size}},{key:"provide",value:function(e){var t=new Float32Array(e),i=new Float32Array(e),r=0,n=0,a=0,s=e/this.bufferSize,o=this.audio.bufferList;if(o.length>s){for(var l=0;l<s;l++){var c=o.shift();2===this.channel?(t.set(c.buffer[0],a),i.set(c.buffer[1],a)):(t.set(c.buffer[0],a),i.set(c.buffer[0],a)),a+=this.bufferSize,n=c.ts}r=t.length}return{size:r,ts:n,left:t,right:i}}},{key:"destroy",value:function(){this.buffer=null,this.channel=null}}])}(),ai=function(){function e(){A(this,e),this._vector=new Float32Array,this._position=0,this._frameCount=0}return y(e,[{key:"vector",get:function(){return this._vector}},{key:"position",get:function(){return this._position}},{key:"startIndex",get:function(){return 2*this._position}},{key:"frameCount",get:function(){return this._frameCount}},{key:"endIndex",get:function(){return 2*(this._position+this._frameCount)}},{key:"clear",value:function(){this.receive(this._frameCount),this.rewind()}},{key:"put",value:function(e){this._frameCount+=e}},{key:"putSamples",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=(t=2*(t=t||0),2*(i=0<=i?i:(e.length-t)/2)),n=(this.ensureCapacity(i+this._frameCount),this.endIndex);this.vector.set(e.subarray(t,t+r),n),this._frameCount+=i}},{key:"putBuffer",value:function(e,t){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=t||0,0<=i||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}},{key:"receive",value:function(e){0<=e&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}},{key:"receiveSamples",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,i=this.startIndex;e.set(this._vector.subarray(i,i+2*t)),this.receive(t)}},{key:"extract",value:function(e){var t=this.startIndex+2*(1<arguments.length&&void 0!==arguments[1]?arguments[1]:0);e.set(this._vector.subarray(t,t+2*(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)))}},{key:"ensureCapacity",value:function(){var e=parseInt(2*(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0));this._vector.length<e?((e=new Float32Array(e)).set(this._vector.subarray(this.startIndex,this.endIndex)),this._vector=e,this._position=0):this.rewind()}},{key:"ensureAdditionalCapacity",value:function(){this.ensureCapacity(this._frameCount+(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0))}},{key:"rewind",value:function(){0<this._position&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}])}(),si=function(){function e(t){A(this,e),t?(this._inputBuffer=new ai,this._outputBuffer=new ai):this._inputBuffer=this._outputBuffer=null}return y(e,[{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()}}])}(),oi=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.reset(),i._rate=1,i}return g(t,e),y(t,[{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),e=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(e)}},{key:"transpose",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;for(var t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,r=this._outputBuffer.vector,n=this._outputBuffer.endIndex,a=0,s=0;this.slopeCount<1;)r[n+2*s]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],r[n+2*s+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],s+=1,this.slopeCount+=this._rate;if(--this.slopeCount,1!==e)e:for(;;){for(;1<this.slopeCount;)if(--this.slopeCount,(a+=1)>=e-1)break e;var o=i+2*a;r[n+2*s]=(1-this.slopeCount)*t[o]+this.slopeCount*t[o+2],r[n+2*s+1]=(1-this.slopeCount)*t[o+1]+this.slopeCount*t[o+3],s+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],s}}])}(si);function li(){}var ci=function(e){function t(e,i){var r;A(this,t);var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:li;return r=p(this,t,[i]),r.callback=n,r.sourceSound=e,r.historyBufferSize=22050,r._sourcePosition=0,r.outputBufferPosition=0,r._position=0,r}return g(t,e),y(t,[{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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=new Float32Array(2*e);e=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=e,this.inputBuffer.putSamples(t,0,e)}},{key:"extract",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t),t=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition),this.outputBuffer.extract(e,this.outputBufferPosition,t),e=this.outputBufferPosition+t;return this.outputBufferPosition=Math.min(this.historyBufferSize,e),this.outputBuffer.receive(Math.max(e-this.historyBufferSize,0)),this._position+=t,t}},{key:"handleSampleData",value:function(e){this.extract(e.data,4096)}},{key:"clear",value:function(){f(t,"clear",this,3)([]),this.outputBufferPosition=0}}])}(function(){function e(t){A(this,e),this._pipe=t}return y(e,[{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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;this.outputBuffer.frameCount<e;){var t=16384-this.inputBuffer.frameCount;if(this.fillInputBuffer(t),this.inputBuffer.frameCount<16384)break;this._pipe.process()}}},{key:"clear",value:function(){this._pipe.clear()}}])}()),ui=[[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]],di=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i._quickSeek=!0,i.midBufferDirty=!1,i.midBuffer=null,i.overlapLength=0,i.autoSeqSetting=!0,i.autoSeekSetting=!0,i._tempo=1,i.setParameters(44100,0,0,8),i}return g(t,e),y(t,[{key:"clear",value:function(){f(t,"clear",this,3)([]),this.clearMidBuffer()}},{key:"clearMidBuffer",value:function(){this.midBufferDirty&&(this.midBufferDirty=!1,this.midBuffer=null)}},{key:"setParameters",value:function(e,t,i,r){0<e&&(this.sampleRate=e),0<r&&(this.overlapMs=r),0<t?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,0<i?(this.seekWindowMs=i,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){this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,e=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(e+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=this.sampleRate*(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)/1e3;e=e<16?16:e,this.overlapLength=e-=e%8,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}},{key:"checkLimits",value:function(e,t,i){return e<t?t:i<e?i:e}},{key:"calculateSequenceParameters",value:function(){var e;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(e=28.333333333333332+-10/1.5*this._tempo,e=this.checkLimits(e,15,25),this.seekWindowMs=Math.floor(e+.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,i,r=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;r<this.seekLength;r+=1)(i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer))>t&&(t=i,e=r);return e}},{key:"seekBestOverlapPositionStereoQuick",value:function(){var e,t,i,r,n,a=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,r=0,n=0;a<4;a+=1){for(var s=0;ui[a][s]&&!((n=r+ui[a][s])>=this.seekLength);)(i=this.calculateCrossCorrelationStereo(2*n,this.refMidBuffer))>t&&(t=i,e=n),s+=1;r=e}return e}},{key:"preCalculateCorrelationReferenceStereo",value:function(){for(var e,t,i=0;i<this.overlapLength;i+=1)t=i*(this.overlapLength-i),e=2*i,this.refMidBuffer[e]=this.midBuffer[e]*t,this.refMidBuffer[1+e]=this.midBuffer[1+e]*t}},{key:"calculateCrossCorrelationStereo",value:function(e,t){var i=this._inputBuffer.vector;e+=this._inputBuffer.startIndex;for(var r,n=0,a=2,s=2*this.overlapLength;a<s;a+=2)r=a+e,n+=i[r]*t[a]+i[r+1]*t[a+1];return n}},{key:"overlap",value:function(e){this.overlapStereo(2*e)}},{key:"overlapStereo",value:function(e){for(var t,i,r,n,a,s=this._inputBuffer.vector,o=(e+=this._inputBuffer.startIndex,this._outputBuffer.vector),l=this._outputBuffer.endIndex,c=0,u=1/this.overlapLength;c<this.overlapLength;c+=1)i=(this.overlapLength-c)*u,r=c*u,o[(a=(t=2*c)+l)+0]=s[(n=t+e)+0]*r+this.midBuffer[0+t]*i,o[a+1]=s[n+1]*r+this.midBuffer[1+t]*i}},{key:"process",value:function(){var e;if(null===this.midBuffer){if(this._inputBuffer.frameCount<this.overlapLength)return;this.midBuffer=new Float32Array(2*this.overlapLength),this._inputBuffer.receiveSamples(this.midBuffer,this.overlapLength)}for(;this._inputBuffer.frameCount>=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),0<(t=this.seekWindowLength-2*this.overlapLength)&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);var t=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(t,t+2*this.overlapLength)),this.skipFract+=this.nominalSkip,e=Math.floor(this.skipFract),this.skipFract-=e,this._inputBuffer.receive(e)}}}])}(si);function hi(e,t){return 1e-10<(t<e?e-t:t-e)}var fi=function(){function e(){A(this,e),this.transposer=new oi(!1),this.stretch=new di(!1),this._inputBuffer=new ai,this._intermediateBuffer=new ai,this._outputBuffer=new ai,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}return y(e,[{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,hi(this._tempo,e)&&(this.stretch.tempo=this._tempo),hi(this._rate,t)&&(this.transposer.rate=this._rate),1<this._rate?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(){(1<this._rate?(this.stretch.process(),this.transposer):(this.transposer.process(),this.stretch)).process()}}])}(),pi=function(){function e(t,i,r){A(this,e),this.player=t,this.audio=i,this.soundTouch=new fi,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new ci(r,this.soundTouch)}return y(e,[{key:"setRate",value:function(e){this.soundTouch.tempo=e}},{key:"provide",value:function(e){for(var t=new Float32Array(2*e),i=this.filter.extract(t,e),r=new Float32Array(i),n=new Float32Array(i),a=0;a<i;a++)r[a]=t[2*a],n[a]=t[2*a+1];return{size:i,left:r,right:n,ts:this.audio.tempAudioTimestamp||0}}},{key:"destroy",value:function(){this.soundTouch&&(this.soundTouch.clear(),this.soundTouch=null),this.filter&&(this.filter=null)}}])}(),gi=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.defaultPlaybackRate=1,i.playbackRate=1,i.rateProcessor=null,i.processor=null,i.scriptNodeInterval=null,i.audioBufferSize=1024,i.engineType=e._opt.audioEngine||Re,(wt()&&null===e._opt.audioEngine||i.engineType===De)&&(i.audioBufferSize=e._opt.weiXinInAndroidAudioBufferSize||4800),i.scriptStartTime=0,i.player.debug.log("AudioContext","init",{audioBufferSize:i.audioBufferSize}),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=1024,this.engineType=Re,this.player.debug.log("AudioContext","destroy")}},{key:"getAudioBufferSize",value:function(){return this.audioBufferSize}},{key:"oneBufferDuration",get:function(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}},{key:"isActiveEngineType",get:function(){return this.engineType===De}},{key:"initProcessor",value:function(){this.processor=new ni(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new pi(this.player,this,this.processor)}},{key:"initScriptNode",value:function(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.player._opt.audioEngine?this.player._opt.audioEngine===Ce&&Rt()?this.initWorkletScriptNode():this.player._opt.audioEngine===De?this.initIntervalScriptNode():this.player._opt.audioEngine===Re?this.initProcessScriptNode():this.autoInitScriptNode():this.autoInitScriptNode())}},{key:"autoInitScriptNode",value:function(){wt()?this.initIntervalScriptNode():!Ze()&&Rt()?this.initWorkletScriptNode():this.initProcessScriptNode()}},{key:"getEngineType",value:function(){return this.engineType}},{key:"isPlaybackRateSpeed",value:function(){return this.playbackRate>this.defaultPlaybackRate}},{key:"initProcessScriptNode",value:function(){var e=this;this.engineType=Re;var t=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);t.onaudioprocess=function(t){t=t.outputBuffer,e.handleScriptNodeCallback(t)},t.connect(this.gainNode),this.scriptNode=t,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}},{key:"initIntervalScriptNode",value:function(){var e=this;this.scriptStartTime=0,this.engineType=De;var t=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((function(){var t=e.audioContext.createBufferSource(),i=e.audioContext.createBuffer(e.audioInfo.channels,e.audioBufferSize,e.audioContext.sampleRate);e.handleScriptNodeCallback(i,(function(){e.scriptStartTime<e.audioContext.currentTime&&(e.player.debug.log("AudioContext","script start time ".concat(e.scriptStartTime," is less than current time ")+e.audioContext.currentTime),e.scriptStartTime=e.audioContext.currentTime),t.buffer=i,t.connect(e.gainNode),t.start(e.scriptStartTime),e.scriptStartTime+=i.duration}))}),t),this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}},{key:"initWorkletScriptNode",value:function(){var e=this;this.engineType=Ce,this.audioContext&&this.audioContext.audioWorklet.addModule(_t((function(){var e=function(e){function t(){var e;return A(this,t),e=p(this,t),e.audioBufferSize=1024,e.start=!1,e.channels=1,e.samplesArray=[],e.offset=0,e.state=0,e.port.onmessage=function(t){"init"===t.data.message?(e.audioBufferSize=t.data.audioBufferSize,e.start=t.data.start,e.channels=t.data.channels,e.state=0,e.offset=0,e.samplesArray=[]):"stop"===t.data.message?(e.state=0,e.start=!1,e.offset=0,e.samplesArray=[]):"data"===t.data.message?e.samplesArray.push(t.data.buffer):"zero"===t.data.message&&e.samplesArray.push({left:new Float32Array(e.audioBufferSize).fill(0),right:new Float32Array(e.audioBufferSize).fill(0)})},e}return g(t,e),y(t,[{key:"process",value:function(e,t,i){var r=t[0][0],n=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&4<=this.samplesArray.length)this.state=2;else if(2===this.state)for(var a=this.samplesArray[0],s=0;s<r.length;s++)1===this.channels?r[s]=a.left[s+this.offset]:2===this.channels&&(r[s]=a.left[s+this.offset],n)&&(n[s]=a.right[s+this.offset]);else 1===this.channels?r.fill(0):2===this.channels&&(r.fill(0),n)&&n.fill(0);return this.offset+=128,this.offset===this.audioBufferSize&&(this.offset=0,2===this.state&&this.samplesArray.shift(),0===this.samplesArray.length)&&(this.state=0),this.start}}])}(h(AudioWorkletProcessor));registerProcessor("worklet-processor",e)}))).then((function(){if(e.audioContext){var t=[1];2===e.audioInfo.channels&&(t=[1,1]),e.workletProcessorNode=new AudioWorkletNode(e.audioContext,"worklet-processor",{numberOfOutputs:e.audioInfo.channels,outputChannelCount:t}),e.workletProcessorNode.connect(e.gainNode),e.gainNode.connect(e.audioContext.destination),e.gainNode.connect(e.mediaStreamAudioDestinationNode),e.hasInitScriptNode=!0,e.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:e.audioBufferSize,start:!0,channels:e.audioInfo.channels}),e.workletProcessorNode.port.onmessage=function(t){e.workletProcessorNode?e.audioContext?e.handleScriptNodeCallback(e.workletProcessorNode,null,!0):e.workletProcessorNode.port.postMessage({message:"zero"}):e.player.debug.error("AudioContext","workletProcessorNode is null")}}else e.player.debug.error("AudioContext","initWorkletScriptNode audioContext is null")}))}},{key:"handleScriptNodeCallback",value:function(e,t){var i,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=(t=t||Ge,e.length);r&&(i=e,n=this.audioBufferSize);var a,s=this.audioInfo.channels;this.bufferList.length&&this.playing?(a=this.player._opt).syncAudioAndVideo&&a.hasVideo&&(this.calcPlaybackRateBySync(),1e3<this.audioSyncVideoOption.diff)?(this.player.debug.warn("AudioContext","audioSyncVideoOption more than diff :".concat(this.audioSyncVideoOption.diff,", waiting")),r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,s)):0===(a=this._provide(n)).size?r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,s):(a&&a.ts&&(this.player.audioTimestamp=a.ts),r?i.port.postMessage({message:"data",buffer:a}):this.fillScriptNodeOutputBuffer(e,s,a)):r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,s),t()}},{key:"fillScriptNodeOutputBuffer",value:function(e,t,i){if(1===t){var r=e.getChannelData(0);i&&0!==i.size?r.set(i.left):r.fill(0)}else if(2===t){var n=e.getChannelData(0),a=e.getChannelData(1);i&&0!==i.size?(n.set(i.left),a.set(i.right)):(n.fill(0),a.fill(0))}}},{key:"play",value:function(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.player._opt.syncAudioAndVideo||this.calcPlaybackRateByBuffer()):this.player.debug.error("AudioContext","play has not init script node"))}},{key:"calcPlaybackRateBySync",value:function(){if(!this.isMute&&this.playing){var e=this.playbackRate;this.audioSyncVideoOption.diff<-1e3?(this.player.debug.warn("AudioContext","audioSyncVideoOption -1000 less than diff :".concat(this.audioSyncVideoOption.diff,", speed up")),e=this.defaultPlaybackRate+.1):-500<this.audioSyncVideoOption.diff&&(e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}},{key:"calcPlaybackRateByBuffer",value:function(){if(!this.isMute&&this.playing){var e=this.playbackRate,t=Math.floor(1e3/this.oneBufferDuration);this.bufferList.length>t?(this.player.debug.warn("AudioContext","bufferList length ".concat(this.bufferList.length," more than ").concat(t,", speed up")),e=this.defaultPlaybackRate+.1):this.bufferList.length<t/2&&(e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}},{key:"updatePlaybackRate",value:function(e){this.rateProcessor&&(this.playbackRate=e,this.rateProcessor.setRate(this.playbackRate))}},{key:"_provide",value:function(e){return(1===this.playbackRate?this.processor:this.rateProcessor).provide(e)}}])}(ri),mi=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.$video=e.video.$videoElement,i.init=!1,i.player._opt.hlsUseCanvasRender&&(i.$video=i.player.hlsDecoder.$videoElement),i.audioInfo={encType:"",channels:"",sampleRate:""},i.player.debug.log("Audio","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.resetInit(),this.off(),this.player.debug.log("Audio","destroy")}},{key:"resetInit",value:function(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}},{key:"getAudioInfo",value:function(){return this.audioInfo}},{key:"updateAudioInfo",value:function(e){dt(e.encTypeCode)&&(this.audioInfo.encType=$[e.encTypeCode]),dt(e.encType)&&(this.audioInfo.encType=e.encType),dt(e.channels)&&(this.audioInfo.channels=e.channels),dt(e.sampleRate)&&(this.audioInfo.sampleRate=e.sampleRate),dt(this.audioInfo.sampleRate)&&dt(this.audioInfo.channels)&&dt(this.audioInfo.encType)&&!this.init&&(this.player.emit(N.audioInfo,this.audioInfo),this.init=!0)}},{key:"isPlaying",get:function(){return!0}},{key:"volume",get:function(){return Pt(this.$video.muted)?0:this.$video.volume}},{key:"isMute",get:function(){return 0===this.$video.volume||Pt(this.$video.muted)}},{key:"mute",value:function(e){this.setVolume(e?0:this.player.lastVolume||.5)}},{key:"setVolume",value:function(e){e=parseFloat(e),isNaN(e)||(e=Ve(e,0,1),this.$video.muted&&(this.$video.muted=!1),this.$video.volume=e,this.player.emit(N.volumechange,this.player.volume))}},{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}}])}(e),Ai=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.player.on(N.playbackPause,(function(e){i.listenPlaybackPause(e)})),i.player.debug.log("AudioPlaybackContext","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this.player.debug.log("AudioPlaybackLoader","destroy")}},{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;0<t?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))}},{key:"play",value:function(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.player._opt.syncAudioAndVideo||this.calcPlaybackRateByBuffer()):this.player.debug.error("AudioPlaybackContext","play has not init script node"))}}])}(gi),yi=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return y(e,null,[{key:"getLoaderFactory",value:function(e){return e.playType===v?Ai:e.isHls||e.isWebrtc?mi:gi}}])}(),vi=function(e){function i(e){var t;return A(this,i),t=p(this,i),t.player=e,t.playing=!1,t.abortController=new AbortController,t.streamRate=Ye((function(t){e.emit(N.kBps,(t/1024).toFixed(2))})),t.streamRateInterval=null,e.debug.log("FetchStream","init"),t}return g(i,e),y(i,[{key:"destroy",value:function(){this.abort(),this.off(),this.streamRate=null,this.stopStreamRateInterval(),this.player.debug.log("FetchStream","destroy")}},{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,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=this.player["demux"];this.player._times.streamStart=We(),i=Object.assign({signal:this.abortController.signal},{headers:i.headers||{}}),fetch(e,i).then((function(e){if(e.ok&&200<=e.status&&e.status<=299)if(t.emit(N.streamSuccess),t.startStreamRateInterval(),"undefined"!=typeof WritableStream)e.body.pipeTo(new WritableStream({write:function(e){return t.streamRate&&t.streamRate(e.byteLength),r.dispatch(e)},close:function(){r.close()},abort:function(e){r.close();var i=e.toString();-1===i.indexOf(ke)&&-1===i.indexOf(Ee)&&e.name!==Te&&(t.abort(),t.emit(H.fetchError,e),t.player.emit(N.error,H.fetchError))}}));else{t.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");var i=e.body.getReader(),n=function(){i.read().then((function(e){var i=e,a=(e=i.done,i.value);e?r.close():(t.streamRate&&t.streamRate(a.byteLength),r.dispatch(a),n())})).catch((function(e){r.close();var i=e.toString();-1===i.indexOf(ke)&&-1===i.indexOf(Ee)&&e.name!==Te&&(t.abort(),t.emit(H.fetchError,e),t.player.emit(N.error,H.fetchError))}))};n()}else 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(),t.emit(H.fetchError,"fetch response status is ".concat(e.status," and ok is ")+e.ok),t.player.emit(N.error,H.fetchError)})).catch((function(e){"AbortError"!==e.name&&(r.close(),t.abort(),t.emit(H.fetchError,e),t.player.emit(N.error,H.fetchError))}))}},{key:"abort",value:function(){this.abortController&&(this.abortController.abort(),this.abortController=null)}},{key:"getStreamType",value:function(){return t}}])}(e),bi=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.socket=null,i.socketStatus=W,i.wsUrl=null,i.socketDestroyFnList=[],i.streamRate=Ye((function(t){e.emit(N.kBps,(t/1024).toFixed(2))})),i.streamRateInterval=null,e.debug.log("WebsocketStream","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debug.log("WebsocketStream","destroy")}},{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,i=t.debug,r=t.events.proxy,n=t.demux;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";var a=r(this.socket,"open",(function(){i.log("WebsocketStream","socket open"),e.socketStatus=V,e.emit(N.streamSuccess),e.player.emit(N.websocketOpen),e.startStreamRateInterval()})),s=r(this.socket,"message",(function(t){e.streamRate&&e.streamRate(t.data.byteLength),e._handleMessage(t.data)})),o=r(this.socket,"close",(function(){i.log("WebsocketStream","socket close"),e.socketStatus="close",e.player.emit(N.websocketClose),e.emit(N.streamEnd)})),l=r(this.socket,"error",(function(t){i.log("WebsocketStream","socket error"),e.socketStatus="error",e.emit(H.websocketError,t),e.player.emit(N.error,H.websocketError),n.close(),i.log("WebsocketStream","socket error:",t)}));this.socketDestroyFnList.push(a,s,o,l)}},{key:"_closeWebSocket",value:function(){this.socketDestroyFnList.forEach((function(e){return e()})),this.socket&&(this.socket.close(),this.socket=null),this.socketStatus=W,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")}},{key:"fetchStream",value:function(e,t){this.player._times.streamStart=We(),this.wsUrl=e,this._createWebSocket()}},{key:"sendMessage",value:function(e){this.socket?this.socketStatus===V?this.socket.send(e):this.player.debug.error("WebsocketStream","websocket send message error and socket status is "+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}}])}(e),wi=function(e){function t(e){var i;return A(this,t),i=p(this,t),(i.player=e).debug.log("HlsStream","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.off(),this.player.debug.log("HlsStream","destroy")}},{key:"fetchStream",value:function(e){var t=this,i=this.player["hlsDecoder"];this.player._times.streamStart=We(),i.loadSource(e).then((function(){t.player.debug.log("HlsStream","loadSource success"),t.emit(N.streamSuccess)})).catch((function(e){t.emit(H.hlsError,e),t.emit(N.error,H.hlsError)}))}},{key:"getStreamType",value:function(){return"hls"}}])}(e),ki=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.webrctUrl=null,e.debug.log("WebrtcStream","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.webrctUrl=null,this.off(),this.player.debug.log("WebrtcStream","destroy")}},{key:"fetchStream",value:function(e){var t=this,i=this.player["webrtc"];this.player._times.streamStart=We(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),i.loadSource(this.webrctUrl).then((function(){t.player.debug.log("WebrtcStream","loadSource success"),t.emit(N.streamSuccess)})).catch((function(e){t.emit(H.webrtcError,e),t.emit(N.error,H.webrtcError)}))}},{key:"getStreamType",value:function(){return"webrtc"}}])}(e),Ei=function(t){function i(e){var t;return A(this,i),t=p(this,i),t.player=e,t.transport=null,t.wtUrl=null,t.streamRate=Ye((function(t){e.emit(N.kBps,(t/1024).toFixed(2))})),t.streamRateInterval=null,e.debug.log("WebTransportLoader","init"),t}return g(i,t),y(i,[{key:"destroy",value:function(){this.abort(),this.off(),this.player.debug.log("WebTransportLoader","destroy")}},{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;d(t.events);var i=t.demux;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((function(){e.emit(N.streamSuccess),e.startStreamRateInterval(),e.transport.createBidirectionalStream().then((function(e){e.readable.pipeTo(new WritableStream(i.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=We(),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"webTransport"}}])}(e),Ti=function(e){function r(e){var t;return A(this,r),t=p(this,r),t.player=e,t.workUrl=null,e.debug.log("WorkerStream","init"),t}return g(r,e),y(r,[{key:"destroy",value:function(){this.workUrl=null,this.off(),this.player.debug.log("WorkerStream","destroy")}},{key:"sendMessage",value:function(e){this.player.decoderWorker.workerSendMessage(e)}},{key:"fetchStream",value:function(e){this.workUrl=e,this.player._times.streamStart=We(),this.player.decoderWorker.workerFetchStream(e)}},{key:"getStreamType",value:function(){var e=this.player._opt.protocol;return a+" "+(2===e?t:i)}}])}(e),Si=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return y(e,null,[{key:"getLoaderFactory",value:function(e){var t=e.protocol,i=e.useWasm,r=e.playType;return 2===t?r!==s||i&&!St(e)?Ti:vi:1===t?r!==s||i&&!St(e)?Ti:bi:3===t?wi:4===t?ki:5===t?Ei:void 0}}])}(),_i=je((function(e){function t(e,n){if(!e)throw"First parameter is required.";n=new i(e,n=n||{type:"video"});var a=this;function s(t){t&&(n.initCallback=function(){t(),t=n.initCallback=null});var i=new r(e,n);(f=new i(e,n)).record(),h("recording"),n.disableLogs||console.log("Initialized recorderType:",f.constructor.name,"for output-type:",n.type)}function o(e){function t(t){if(f){Object.keys(f).forEach((function(e){"function"!=typeof f[e]&&(a[e]=f[e])}));var i,r=f.blob;if(!r){if(!t)throw"Recording failed.";f.blob=r=t}if(r&&!n.disableLogs&&console.log(r.type,"->",A(r.size)),e){try{i=c.createObjectURL(r)}catch(t){}"function"==typeof e.call?e.call(a,i):e(i)}n.autoWriteToDisk&&u((function(e){var t={};t[n.type+"Blob"]=e,L.Store(t)}))}else"function"==typeof e.call?e.call(a,""):e("")}e=e||function(){},f?"paused"===a.state?(a.resumeRecording(),setTimeout((function(){o(e)}),1)):("recording"===a.state||n.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',a.state),n.disableLogs||console.log("Stopped recording "+n.type+" stream."),"gif"!==n.type?f.stop(t):(f.stop(),t()),h("stopped")):g()}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function u(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i,r=(t||f||{}).blob;r?"undefined"==typeof Worker||navigator.mozGetUserMedia?((i=new FileReader).readAsDataURL(r),i.onload=function(t){e(t.target.result)}):((i=function(e){try{var t=c.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return c.revokeObjectURL(t),i}catch(e){}}(l)).onmessage=function(t){e(t.data)},i.postMessage(r)):(n.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout((function(){u(e,t)}),1e3))}function d(e){e=e||0,"paused"!==a.state?"stopped"!==a.state&&(e>=a.recordingDuration?o(a.onRecordingStopped):(e+=1e3,setTimeout((function(){d(e)}),1e3))):setTimeout((function(){d(e)}),1e3)}function h(e){a&&(a.state=e,"function"==typeof a.onStateChanged.call?a.onStateChanged.call(a,e):a.onStateChanged(e))}var f,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+n.type+" recorder.";function g(){!0!==n.disableLogs&&console.warn(p)}var m={startRecording:function(t){return n.disableLogs||console.log("RecordRTC version: ",a.version),(n=t?new i(e,t):n).disableLogs||console.log("started recording "+n.type+" stream."),f?(f.clearRecordedData(),f.record(),h("recording"),a.recordingDuration&&d()):s((function(){a.recordingDuration&&d()})),a},stopRecording:o,pauseRecording:function(){f?"recording"===a.state?(h("paused"),f.pause(),n.disableLogs||console.log("Paused recording.")):n.disableLogs||console.warn("Unable to pause the recording. Recording state: ",a.state):g()},resumeRecording:function(){f?"paused"===a.state?(h("recording"),f.resume(),n.disableLogs||console.log("Resumed recording.")):n.disableLogs||console.warn("Unable to resume the recording. Recording state: ",a.state):g()},initRecorder:s,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return a.recordingDuration=e,a.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){a.onRecordingStopped=e}}},clearRecordedData:function(){f?(f.clearRecordedData(),n.disableLogs||console.log("Cleared old recorded data.")):g()},getBlob:function(){if(f)return f.blob;g()},getDataURL:u,toURL:function(){if(f)return c.createObjectURL(f.blob);g()},getInternalRecorder:function(){return f},save:function(e){f?y(f.blob,e):g()},getFromDisk:function(e){f?t.getFromDisk(n.type,e):g()},setAdvertisementArray:function(e){n.advertisement=[];for(var t=e.length,i=0;i<t;i++)n.advertisement.push({duration:i,image:e[i]})},blob:null,bufferSize:0,sampleRate:0,buffer:null,reset:function(){"recording"!==a.state||n.disableLogs||console.warn("Stop an active recorder."),f&&"function"==typeof f.clearRecordedData&&f.clearRecordedData(),f=null,h("inactive"),a.blob=null},onStateChanged:function(e){n.disableLogs||console.log("Recorder state changed:",e)},state:"inactive",getState:function(){return a.state},destroy:function(){var e=n.disableLogs;n={disableLogs:!0},a.reset(),h("destroyed"),m=a=null,k.AudioContextConstructor&&(k.AudioContextConstructor.close(),k.AudioContextConstructor=null),n.disableLogs=e,n.disableLogs||console.log("RecordRTC is destroyed.")},version:"5.6.2"};if(this){for(var v in m)this[v]=m[v];a=this}else a=m;return m}function i(e,t){return t.recorderType||t.type||(t.audio&&t.video?t.type="video":t.audio&&!t.video&&(t.type="audio")),t.recorderType&&!t.type&&(t.recorderType===C||t.recorderType===_||t.recorderType===M?t.type="video":t.recorderType===I?t.type="gif":t.recorderType===S?t.type="audio":t.recorderType===T&&(b(e,"audio").length&&b(e,"video").length||!b(e,"audio").length&&b(e,"video").length?t.type="video":b(e,"audio").length&&!b(e,"video").length&&(t.type="audio"))),"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&(t.mimeType||(t.mimeType="video/webm"),t.type||(t.type=t.mimeType.split("/")[0]),t.bitsPerSecond),t.type||(t.mimeType&&(t.type=t.mimeType.split("/")[0]),t.type)||(t.type="audio"),t}function r(e,t){var i;return(f||u||d)&&(i=S),"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&!f&&(i=T),"video"===t.type&&(f||d)&&(i=C,"undefined"!=typeof ReadableStream)&&(i=M),"gif"===t.type&&(i=I),"canvas"===t.type&&(i=_),E()&&i!==_&&i!==I&&"undefined"!=typeof MediaRecorder&&"requestData"in MediaRecorder.prototype&&(b(e,"video").length||b(e,"audio").length)&&("audio"===t.type?"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("audio/webm")&&(i=T):"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("video/webm")&&(i=T)),e instanceof Array&&e.length&&(i=P),t.recorderType&&(i=t.recorderType),!t.disableLogs&&i&&i.name&&console.log("Using recorderType:",i.name||i.constructor.name),!i&&p?T:i}function a(e){this.addStream=function(t){t&&(e=t)},this.mediaType={audio:!0,video:!0},this.startRecording=function(){var i,r,n,a,s=this.mediaType,o=this.mimeType||{audio:null,video:null,gif:null};if("function"!=typeof s.audio&&E()&&!b(e,"audio").length&&(s.audio=!1),"function"!=typeof s.video&&E()&&!b(e,"video").length&&(s.video=!1),"function"!=typeof s.gif&&E()&&!b(e,"video").length&&(s.gif=!1),!s.audio&&!s.video&&!s.gif)throw"MediaStream must have either audio or video tracks.";s.audio&&(i=null,"function"==typeof s.audio&&(i=s.audio),this.audioRecorder=new t(e,{type:"audio",bufferSize:this.bufferSize,sampleRate:this.sampleRate,numberOfAudioChannels:this.numberOfAudioChannels||2,disableLogs:this.disableLogs,recorderType:i,mimeType:o.audio,timeSlice:this.timeSlice,onTimeStamp:this.onTimeStamp}),s.video||this.audioRecorder.startRecording()),s.video&&(i=null,"function"==typeof s.video&&(i=s.video),r=e,E()&&s.audio&&"function"==typeof s.audio&&(a=b(e,"video")[0],h?((r=new g).addTrack(a),i&&i===C&&(i=T)):(r=new g).addTrack(a)),this.videoRecorder=new t(r,{type:"video",video:this.video,canvas:this.canvas,frameInterval:this.frameInterval||10,disableLogs:this.disableLogs,recorderType:i,mimeType:o.video,timeSlice:this.timeSlice,onTimeStamp:this.onTimeStamp,workerPath:this.workerPath,webAssemblyPath:this.webAssemblyPath,frameRate:this.frameRate,bitrate:this.bitrate}),s.audio||this.videoRecorder.startRecording()),s.audio&&s.video&&(n=this,a=!0===E(),!0===(a=!(s.audio instanceof S&&s.video||!0!==s.audio&&!0!==s.video&&s.audio!==s.video)&&a)?(n.audioRecorder=null,n.videoRecorder.startRecording()):n.videoRecorder.initRecorder((function(){n.audioRecorder.initRecorder((function(){n.videoRecorder.startRecording(),n.audioRecorder.startRecording()}))}))),s.gif&&(i=null,"function"==typeof s.gif&&(i=s.gif),this.gifRecorder=new t(e,{type:"gif",frameRate:this.frameRate||200,quality:this.quality||10,disableLogs:this.disableLogs,recorderType:i,mimeType:o.gif}),this.gifRecorder.startRecording())},this.stopRecording=function(e){e=e||function(){},this.audioRecorder&&this.audioRecorder.stopRecording((function(t){e(t,"audio")})),this.videoRecorder&&this.videoRecorder.stopRecording((function(t){e(t,"video")})),this.gifRecorder&&this.gifRecorder.stopRecording((function(t){e(t,"gif")}))},this.pauseRecording=function(){this.audioRecorder&&this.audioRecorder.pauseRecording(),this.videoRecorder&&this.videoRecorder.pauseRecording(),this.gifRecorder&&this.gifRecorder.pauseRecording()},this.resumeRecording=function(){this.audioRecorder&&this.audioRecorder.resumeRecording(),this.videoRecorder&&this.videoRecorder.resumeRecording(),this.gifRecorder&&this.gifRecorder.resumeRecording()},this.getBlob=function(e){var t={};return this.audioRecorder&&(t.audio=this.audioRecorder.getBlob()),this.videoRecorder&&(t.video=this.videoRecorder.getBlob()),this.gifRecorder&&(t.gif=this.gifRecorder.getBlob()),e&&e(t),t},this.destroy=function(){this.audioRecorder&&(this.audioRecorder.destroy(),this.audioRecorder=null),this.videoRecorder&&(this.videoRecorder.destroy(),this.videoRecorder=null),this.gifRecorder&&(this.gifRecorder.destroy(),this.gifRecorder=null)},this.getDataURL=function(e){function t(e,t){var i;"undefined"!=typeof Worker?((i=function(e){e=c.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"}));var t,i=new Worker(e);if(void 0!==c)t=c;else{if("undefined"==typeof webkitURL)throw"Neither URL nor webkitURL detected.";t=webkitURL}return t.revokeObjectURL(e),i}((function(e){postMessage((new FileReaderSync).readAsDataURL(e))}))).onmessage=function(e){t(e.data)},i.postMessage(e)):((i=new FileReader).readAsDataURL(e),i.onload=function(e){t(e.target.result)})}this.getBlob((function(i){i.audio&&i.video?t(i.audio,(function(r){t(i.video,(function(t){e({audio:r,video:t})}))})):i.audio?t(i.audio,(function(t){e({audio:t})})):i.video&&t(i.video,(function(t){e({video:t})}))}))},this.writeToDisk=function(){t.writeToDisk({audio:this.audioRecorder,video:this.videoRecorder,gif:this.gifRecorder})},this.save=function(e){(e=e||{audio:!0,video:!0,gif:!0}).audio&&this.audioRecorder&&this.audioRecorder.save("string"==typeof e.audio?e.audio:""),e.video&&this.videoRecorder&&this.videoRecorder.save("string"==typeof e.video?e.video:""),e.gif&&this.gifRecorder&&this.gifRecorder.save("string"==typeof e.gif?e.gif:"")}}t.version="5.6.2",(e.exports=t).getFromDisk=function(e,t){if(!t)throw"callback is mandatory.";console.log("Getting recorded "+("all"===e?"blobs":e+" blob ")+" from disk!"),L.Fetch((function(i,r){"all"!==e&&r===e+"Blob"&&t&&t(i),"all"===e&&t&&t(i,r.replace("Blob",""))}))},t.writeToDisk=function(e){console.log("Writing recorded blob(s) to disk!"),(e=e||{}).audio&&e.video&&e.gif?e.audio.getDataURL((function(t){e.video.getDataURL((function(i){e.gif.getDataURL((function(e){L.Store({audioBlob:t,videoBlob:i,gifBlob:e})}))}))})):e.audio&&e.video?e.audio.getDataURL((function(t){e.video.getDataURL((function(e){L.Store({audioBlob:t,videoBlob:e})}))})):e.audio&&e.gif?e.audio.getDataURL((function(t){e.gif.getDataURL((function(e){L.Store({audioBlob:t,gifBlob:e})}))})):e.video&&e.gif?e.video.getDataURL((function(t){e.gif.getDataURL((function(e){L.Store({videoBlob:t,gifBlob:e})}))})):e.audio?e.audio.getDataURL((function(e){L.Store({audioBlob:e})})):e.video?e.video.getDataURL((function(e){L.Store({videoBlob:e})})):e.gif&&e.gif.getDataURL((function(e){L.Store({gifBlob:e})}))},a.getFromDisk=t.getFromDisk,a.writeToDisk=t.writeToDisk,t.MRecordRTC=a,(e=void 0!==Fe?Fe:null)&&"undefined"==typeof window&&void 0!==Fe&&(Fe.navigator={userAgent:"Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",getUserMedia:function(){}},Fe.console||(Fe.console={}),void 0!==Fe.console.log&&void 0!==Fe.console.error||(Fe.console.error=Fe.console.log=Fe.console.log||function(){console.log(arguments)}),"undefined"==typeof document&&(e.document={documentElement:{appendChild:function(){return""}}},document.createElement=document.captureStream=document.mozCaptureStream=function(){var e={getContext:function(){return e},play:function(){},pause:function(){},drawImage:function(){},toDataURL:function(){return""},style:{}};return e},e.HTMLVideoElement=function(){}),"undefined"==typeof location&&(e.location={protocol:"file:",href:"",hash:""}),"undefined"==typeof screen&&(e.screen={width:0,height:0}),void 0===c&&(e.URL={createObjectURL:function(){return""},revokeObjectURL:function(){return""}}),e.window=Fe);var s,o=window.requestAnimationFrame,l=(void 0===o&&("undefined"!=typeof webkitRequestAnimationFrame?o=webkitRequestAnimationFrame:"undefined"!=typeof mozRequestAnimationFrame?o=mozRequestAnimationFrame:"undefined"!=typeof msRequestAnimationFrame?o=msRequestAnimationFrame:void 0===o&&(s=0,o=function(e,t){var i=(new Date).getTime(),r=Math.max(0,16-(i-s)),n=setTimeout((function(){e(i+r)}),r);return s=i+r,n})),window.cancelAnimationFrame),c=(e=(void 0===l&&("undefined"!=typeof webkitCancelAnimationFrame?l=webkitCancelAnimationFrame:"undefined"!=typeof mozCancelAnimationFrame?l=mozCancelAnimationFrame:"undefined"!=typeof msCancelAnimationFrame?l=msCancelAnimationFrame:void 0===l&&(l=function(e){clearTimeout(e)})),window.AudioContext),void 0===e&&("undefined"!=typeof webkitAudioContext&&(e=webkitAudioContext),"undefined"!=typeof mozAudioContext)&&(e=mozAudioContext),window.URL),u=(void 0===c&&"undefined"!=typeof webkitURL&&(c=webkitURL),"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia)&&(navigator.getUserMedia=navigator.mozGetUserMedia),!(-1===navigator.userAgent.indexOf("Edge")||!navigator.msSaveBlob&&!navigator.msSaveOrOpenBlob)),d=!!window.opera||-1!==navigator.userAgent.indexOf("OPR/"),h=-1<navigator.userAgent.toLowerCase().indexOf("firefox")&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!d&&!u&&!!navigator.webkitGetUserMedia||v()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),p=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),g=(p&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(f=!(p=!1)),window.MediaStream);function A(e){var t;return 0===e?"0 Bytes":(t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10),(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t])}function y(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1],r=(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")&&(t=(r=t.split("."))[0],i=r[1]),(t||Math.round(9999999999*Math.random())+888888888)+"."+i);return void 0!==navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(e,r):void 0!==navigator.msSaveBlob?navigator.msSaveBlob(e,r):((t=document.createElement("a")).href=c.createObjectURL(e),t.download=r,t.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(t),"function"==typeof t.click?t.click():(t.target="_blank",t.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),void c.revokeObjectURL(t.href))}function v(){return"undefined"!=typeof window&&"object"==m(window.process)&&"renderer"===window.process.type||!("undefined"==typeof n||"object"!=m(n.versions)||!n.versions.electron)||"object"==("undefined"===typeof navigator?"undefined":m(navigator))&&"string"==typeof navigator.userAgent&&0<=navigator.userAgent.indexOf("Electron")}function b(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function w(e,t){!("srcObject"in t)&&"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0!==(g=void 0===g&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:g)&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=y,t.getTracks=b,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,r=new EBML.Decoder,n=EBML.tools,a=new FileReader;a.onload=function(e){r.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var a=n.makeMetadataSeekable(i.metadatas,i.duration,i.cues),s=this.result.slice(i.metadataSize);a=new Blob([a,s],{type:"video/webm"});t(a)},a.readAsArrayBuffer(e)},t.bytesToSize=A,t.isElectron=v;var k={};function E(){var e,t,i,r;return!!(h||p||u)||(t=navigator.userAgent,i=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10),(f||d)&&(e=t.indexOf("Chrome"),i=t.substring(e+7)),-1!==(t=(i=-1!==(t=i.indexOf(";"))?i.substring(0,t):i).indexOf(" "))&&(i=i.substring(0,t)),r=parseInt(""+i,10),isNaN(r)&&(i=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),49<=r)}function T(e,t){var i,r=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&&(b(e,"video").length&&b(e,"audio").length&&(navigator.mozGetUserMedia?(i=new g).addTrack(b(e,"audio")[0]):i=new g(b(e,"audio")),e=i),t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType)&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg");var n,a=[];function s(){r.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(r.timestamps[r.timestamps.length-1],r.timestamps)}function o(e){return n&&n.mimeType?n.mimeType:e.mimeType||"video/webm"}function l(){a=[],n=null,r.timestamps=[]}this.getArrayOfBlobs=function(){return a},this.record=function(){r.blob=null,r.clearRecordedData(),r.timestamps=[],c=[],a=[];var l=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",l),n=n&&null,f&&!E()&&(l="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&l.mimeType&&!MediaRecorder.isTypeSupported(l.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",l.mimeType),l.mimeType="audio"===t.type?"audio/webm":"video/webm");try{n=new MediaRecorder(e,l),t.mimeType=l.mimeType}catch(i){n=new MediaRecorder(e)}l.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in n&&!1===n.canRecordMimeType(l.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",l.mimeType)),n.ondataavailable=function(e){e.data&&c.push("ondataavailable: "+A(e.data.size)),"number"!=typeof t.timeSlice?!e.data||!e.data.size||e.data.size<100||r.blob?r.recordingCallback&&(r.recordingCallback(new Blob([],{type:o(l)})),r.recordingCallback=null):(r.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:o(l)}),r.recordingCallback&&(r.recordingCallback(r.blob),r.recordingCallback=null)):e.data&&e.data.size&&(a.push(e.data),s(),"function"==typeof t.ondataavailable)&&(e=t.getNativeBlob?e.data:new Blob([e.data],{type:o(l)}),t.ondataavailable(e))},n.onstart=function(){c.push("started")},n.onpause=function(){c.push("paused")},n.onresume=function(){c.push("resumed")},n.onstop=function(){c.push("stopped")},n.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 (",l.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)),!r.manuallyStopped&&n&&"inactive"===n.state?(delete t.timeslice,n.start(6e5)):setTimeout(void 0,1e3),"inactive"!==n.state)&&"stopped"!==n.state&&n.stop()},"number"==typeof t.timeSlice?(s(),n.start(t.timeSlice)):n.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},r.manuallyStopped=!0,n&&(this.recordingCallback=e,"recording"===n.state&&n.stop(),"number"==typeof t.timeSlice)&&setTimeout((function(){r.blob=new Blob(a,{type:o(t)}),r.recordingCallback(r.blob)}),100)},this.pause=function(){n&&"recording"===n.state&&n.pause()},this.resume=function(){n&&"paused"===n.state&&n.resume()},this.clearRecordedData=function(){n&&"recording"===n.state&&r.stop(l),l()},this.getInternalRecorder=function(){return n},this.blob=null,this.getState=function(){return n&&n.state||"inactive"};var c=[];this.getAllStates=function(){return c},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1),r=this,function i(){if(n&&!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 r.stop()):void setTimeout(i,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function S(e,i){if(!b(e,"audio").length)throw"Your stream has no audio tracks.";var r,n=this,a=[],s=[],o=!1,l=0,u=2,d=(i=i||{}).desiredSampRate;function h(){if(!1!==i.checkForInactiveTracks)if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function f(e,t){function i(e,t){var i,r=e.numberOfAudioChannels,n=e.leftBuffers.slice(0),a=e.rightBuffers.slice(0),s=e.sampleRate,o=e.internalInterleavedLength;e=e.desiredSampRate;function l(e,t,i){var r=Math.round(e.length*(t/i)),n=[],a=Number((e.length-1)/(r-1));n[0]=e[0];for(var s,o=1;o<r-1;o++){var l=o*a,c=Number(Math.floor(l)).toFixed(),u=Number(Math.ceil(l)).toFixed();n[o]=(s=e[c],u=e[u],s+(u-s)*(l-c))}return n[r-1]=e[e.length-1],n}function c(e,t){for(var i=new Float64Array(t),r=0,n=e.length,a=0;a<n;a++){var s=e[a];i.set(s,r),r+=s.length}return i}function u(e,t,i){for(var r=i.length,n=0;n<r;n++)e.setUint8(t+n,i.charCodeAt(n))}2===r&&(n=c(n,o),a=c(a,o),e)&&(n=l(n,e,s),a=l(a,e,s)),1===r&&(n=c(n,o),e)&&(n=l(n,e,s)),e&&(s=e),2===r&&(i=function(e,t){for(var i=e.length+t.length,r=new Float64Array(i),n=0,a=0;a<i;)r[a++]=e[n],r[a++]=t[n],n++;return r}(n,a));o=(i=1===r?n:i).length,e=new ArrayBuffer(44+2*o);var d=new DataView(e);u(d,0,"RIFF"),d.setUint32(4,36+2*o,!0),u(d,8,"WAVE"),u(d,12,"fmt "),d.setUint32(16,16,!0),d.setUint16(20,1,!0),d.setUint16(22,r,!0),d.setUint32(24,s,!0),d.setUint32(28,s*r*2,!0),d.setUint16(32,2*r,!0),d.setUint16(34,16,!0),u(d,36,"data"),d.setUint32(40,2*o,!0);for(var h=o,f=44,p=0;p<h;p++)d.setInt16(f,32767*i[p],!0),f+=2;if(t)return t({buffer:e,view:d});postMessage({buffer:e,view:d})}var r,n,a;e.noWorker?i(e,(function(e){t(e.buffer,e.view)})):(r=i,r=c.createObjectURL(new Blob([r.toString(),";this.onmessage = function (eee) {"+r.name+"(eee.data);}"],{type:"application/javascript"})),(n=new Worker(r)).workerURL=r,(a=n).onmessage=function(e){t(e.data.buffer,e.data.view),c.revokeObjectURL(a.workerURL),a.terminate()},a.postMessage(e))}!0===i.leftChannel&&(u=1),(!(u=1===i.numberOfAudioChannels?1:u)||u<1)&&(u=2),i.disableLogs||console.log("StereoAudioRecorder is set to record number of channels: "+u),void 0===i.checkForInactiveTracks&&(i.checkForInactiveTracks=!0),this.record=function(){if(!1===h())throw"Please make sure MediaStream is active.";w(),E=v=!1,o=!0,void 0!==i.timeSlice&&S()},this.stop=function(e){e=e||function(){},o=!1,f({desiredSampRate:d,sampleRate:y,numberOfAudioChannels:u,internalInterleavedLength:l,leftBuffers:a,rightBuffers:1===u?[]:s,noWorker:i.noWorker},(function(t,i){n.blob=new Blob([i],{type:"audio/wav"}),n.buffer=new ArrayBuffer(i.buffer.byteLength),n.view=i,n.sampleRate=d||y,n.bufferSize=A,n.length=l,E=!1,e&&e(n.blob)}))},(t.Storage=void 0===t.Storage?{AudioContextConstructor:null,AudioContext:window.AudioContext||window.webkitAudioContext}:t.Storage).AudioContextConstructor&&"closed"!==t.Storage.AudioContextConstructor.state||(t.Storage.AudioContextConstructor=new t.Storage.AudioContext);var p=t.Storage.AudioContextConstructor,g=p.createMediaStreamSource(e),m=[0,256,512,1024,2048,4096,8192,16384],A=void 0===i.bufferSize?4096:i.bufferSize;if(-1!==m.indexOf(A)||i.disableLogs||console.log("Legal values for buffer-size are "+JSON.stringify(m,null,"\t")),p.createJavaScriptNode)r=p.createJavaScriptNode(A,u,u);else{if(!p.createScriptProcessor)throw"WebAudio API has no support on this browser.";r=p.createScriptProcessor(A,u,u)}g.connect(r),i.bufferSize||(A=r.bufferSize);var y=void 0!==i.sampleRate?i.sampleRate:p.sampleRate||44100,v=((y<22050||96e3<y)&&!i.disableLogs&&console.log("sample-rate must be under range 22050 and 96000."),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate),!1);function w(){a=[],l=0,v=o=E=!(s=[]),p=null,n.leftchannel=a,n.rightchannel=s,n.numberOfAudioChannels=u,n.desiredSampRate=d,n.sampleRate=y,n.recordingLength=l,T={left:[],right:[],recordingLength:0}}function k(){r&&(r.onaudioprocess=null,r.disconnect(),r=null),g&&(g.disconnect(),g=null),w()}this.pause=function(){v=!0},this.resume=function(){if(!1===h())throw"Please make sure MediaStream is active.";o?v=!1:(i.disableLogs||console.log("Seems recording has been restarted."),this.record())},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,o&&this.stop(k),k()},this.name="StereoAudioRecorder";var E=!(this.toString=function(){return this.name}),T=(r.onaudioprocess=function(e){var t,c;v||(!1===h()&&(i.disableLogs||console.log("MediaStream seems stopped."),r.disconnect(),o=!1),o?(E||(E=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback()),t=e.inputBuffer.getChannelData(0),t=new Float32Array(t),a.push(t),2===u&&(e=e.inputBuffer.getChannelData(1),c=new Float32Array(e),s.push(c)),l+=A,n.recordingLength=l,void 0!==i.timeSlice&&(T.recordingLength+=A,T.left.push(t),2===u)&&T.right.push(c)):g&&(g.disconnect(),g=null))},p.createMediaStreamDestination?r.connect(p.createMediaStreamDestination()):r.connect(p.destination),this.leftchannel=a,this.rightchannel=s,this.numberOfAudioChannels=u,this.desiredSampRate=d,this.sampleRate=y,n.recordingLength=l,{left:[],right:[],recordingLength:0});function S(){o&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(T.left.length?(f({desiredSampRate:d,sampleRate:y,numberOfAudioChannels:u,internalInterleavedLength:T.recordingLength,leftBuffers:T.left,rightBuffers:1===u?[]:T.right},(function(e,t){t=new Blob([t],{type:"audio/wav"}),i.ondataavailable(t),setTimeout(S,i.timeSlice)})),T={left:[],right:[],recordingLength:0}):setTimeout(S,i.timeSlice))}}function _(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var r,n,a,s=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),o=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(s&&l&&l[2]&&(o=parseInt(l[2],10)),s&&o<52&&(i=!1),i=!t.useWhammyRecorder&&i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)r=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";r=e.canvas}else!navigator.mozGetUserMedia||t.disableLogs||console.error("Canvas recording is NOT supported in Firefox.");this.record=function(){if(a=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in r?e=r.captureStream(25):"mozCaptureStream"in r?e=r.mozCaptureStream(25):"webkitCaptureStream"in r&&(e=r.webkitCaptureStream(25));try{var s=new g;s.addTrack(b(e,"video")[0]),e=s}catch(e){}if(!e)throw"captureStream API are NOT available.";(n=new T(e,{mimeType:t.mimeType||"video/webm"})).record()}else f.frames=[],h=(new Date).getTime(),d();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){var r;"canvas"===e.nodeName.toLowerCase()&&(r=f.frames.length,f.frames.forEach((function(e,i){var n=r-i;t.disableLogs||console.log(n+"/"+r+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(n,r),n=e.image.toDataURL("image/webp",1);f.frames[i].image=n})),t.disableLogs||console.log("Generating WebM")),i()};var c=!(this.stop=function(e){a=!1;var r=this;i&&n?n.stop(e):this.getWebPImages((function(){f.compile((function(i){t.disableLogs||console.log("Recording finished!"),r.blob=i,r.blob.forEach&&(r.blob=new Blob([],{type:"video/webm"})),e&&e(r.blob),f.frames=[]}))}))});function u(){f.frames=[],c=a=!1}function d(){if(c)return h=(new Date).getTime(),setTimeout(d,500);var i,r,n;"canvas"===e.nodeName.toLowerCase()?(i=(new Date).getTime()-h,h=(new Date).getTime(),f.frames.push({image:(n=(r=document.createElement("canvas")).getContext("2d"),r.width=e.width,r.height=e.height,n.drawImage(e,0,0),r),duration:i}),a&&setTimeout(d,t.frameInterval)):html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-h;if(!i)return setTimeout(d,t.frameInterval);h=(new Date).getTime(),f.frames.push({image:e.toDataURL("image/webp",1),duration:i}),a&&setTimeout(d,t.frameInterval)}})}this.pause=function(){c=!0,n instanceof T&&n.pause()},this.resume=function(){c=!1,n instanceof T?n.resume():a||this.record()},this.clearRecordedData=function(){a&&this.stop(u),u()},this.name="CanvasRecorder",this.toString=function(){return this.name};var h=(new Date).getTime(),f=new R.Video(100)}function C(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-o;return t?n?(o=(new Date).getTime(),setTimeout(i,100)):(o=(new Date).getTime(),s.paused&&s.play(),u.drawImage(s,0,0,c.width,c.height),l.frames.push({duration:t,image:c.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}(t=t||{}).frameInterval||(t.frameInterval=10),t.disableLogs||console.log("Using frames-interval:",t.frameInterval);var r=!(this.record=function(){t.width||(t.width=320),t.height||(t.height=240),t.video||(t.video={width:t.width,height:t.height}),t.canvas||(t.canvas={width:t.width,height:t.height}),c.width=t.canvas.width||320,c.height=t.canvas.height||240,u=c.getContext("2d"),t.video&&t.video instanceof HTMLVideoElement?(s=t.video.cloneNode(),t.initCallback&&t.initCallback()):(s=document.createElement("video"),w(e,s),s.onloadedmetadata=function(){t.initCallback&&t.initCallback()},s.width=t.video.width,s.height=t.video.height),s.muted=!0,s.play(),o=(new Date).getTime(),l=new R.Video,t.disableLogs||(console.log("canvas resolutions",c.width,"*",c.height),console.log("video width/height",s.width||c.width,"*",s.height||c.height)),i(t.frameInterval)}),n=!(this.stop=function(e){e=e||function(){},r=!0;var i=this;setTimeout((function(){var r,n,a,s,o,u,d,h,f,p,g,m,A,y,v,b,w;r=l.frames,n=-1,s=a=null,o=function(r){l.frames=r,t.advertisement&&t.advertisement.length&&(l.frames=t.advertisement.concat(l.frames)),l.compile((function(t){i.blob=t,i.blob.forEach&&(i.blob=new Blob([],{type:"video/webm"})),e&&e(i.blob)}))},(u=document.createElement("canvas")).width=c.width,u.height=c.height,h=u.getContext("2d"),f=[],p=-1===n,g=n&&0<n&&n<=r.length?n:r.length,m=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),A=a&&0<=a&&a<=1?a:0,y=s&&0<=s&&s<=1?s:0,v=!1,b=-1,w=(d={length:g,functionToLoop:function(e,t){function i(){!v&&s-n<=s*y||(p&&(v=!0),f.push(r[t])),e()}var n,a,s,o;v?i():((o=new Image).onload=function(){h.drawImage(o,0,0,c.width,c.height);var e=h.getImageData(0,0,c.width,c.height);n=0,a=e.data.length,s=e.data.length/4;for(var t=0;t<a;t+=4){var r=e.data[t],l=e.data[t+1],u=e.data[t+2];Math.sqrt(Math.pow(+r,2)+Math.pow(+l,2)+Math.pow(+u,2))<=m*A&&n++}i()},o.src=r[t].image)},callback:function(){(f=f.concat(r.slice(g))).length<=0&&f.push(r[r.length-1]),o(f)}}).length,function e(){++b!==w?setTimeout((function(){d.functionToLoop(e,b)}),1):d.callback()}()}),10)});function a(){l.frames=[],n=!(r=!0)}this.pause=function(){n=!0},this.resume=function(){n=!1,r&&this.record()},this.clearRecordedData=function(){r||this.stop(a),a()},this.name="WhammyRecorder",this.toString=function(){return this.name};var s,o,l,c=document.createElement("canvas"),u=c.getContext("2d")}void 0!==e?k.AudioContext=e:"undefined"!=typeof webkitAudioContext&&(k.AudioContext=webkitAudioContext),t.Storage=k,t.MediaStreamRecorder=T,t.StereoAudioRecorder=S,t.CanvasRecorder=_,t.WhammyRecorder=C,D.prototype.add=function(e,t){if("toDataURL"in(e="canvas"in e?e.canvas:e)&&(e=e.toDataURL("image/webp",this.quality)),!/^data:image\/webp;base64,/gi.test(e))throw"Input must be formatted properly as a base64 encoded DataURI of type image/webp";this.frames.push({image:e,duration:t||this.duration})},D.prototype.compile=function(e){i=x,i=c.createObjectURL(new Blob([i.toString(),"this.onmessage = function (eee) {"+i.name+"(eee.data);}"],{type:"application/javascript"})),t=new Worker(i),c.revokeObjectURL(i);var t,i=t;i.onmessage=function(t){t.data.error?console.error(t.data.error):e(t.data)},i.postMessage(this.frames)};var R={Video:D};function D(e){this.frames=[],this.duration=e||1,this.quality=.8}function x(e){function t(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i<e.length;i+=8)t.push(parseInt(e.substr(i,8),2));return new Uint8Array(t)}function i(e){for(var r=[],n=0;n<e.length;n++){var a=e[n].data,s=(a="string"==typeof(a="number"==typeof(a="object"==m(a)?i(a):a)?t(a.toString(2)):a)?new Uint8Array(a.split("").map((function(e){return e.charCodeAt(0)}))):a).size||a.byteLength||a.length,o=Math.ceil(Math.ceil(Math.log(s)/Math.log(2))/8);s=s.toString(2),s=new Array(7*o+7+1-s.length).join("0")+s,o=new Array(o).join("0")+"1"+s;r.push(function(e){for(var t=[];0<e;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}(e[n].id)),r.push(t(o)),r.push(a)}return new Blob(r,{type:"video/webm"})}function r(e){for(var t=0,i={};t<e.length;){var n=e.substr(t,4),a=(a=t,parseInt(e.substr(a+4,4).split("").map((function(e){return e=e.charCodeAt(0).toString(2),new Array(8-e.length+1).join("0")+e})).join(""),2)),s=e.substr(t+4+4,a);t+=8+a,i[n]=i[n]||[],"RIFF"===n||"LIST"===n?i[n].push(r(s)):i[n].push(s)}return i}e=new function(e){var t=function(e){if(e[0]){for(var t=e[0].width,i=e[0].height,r=e[0].duration,n=1;n<e.length;n++)r+=e[n].duration;return{duration:r,width:t,height:i}}postMessage({error:"Something went wrong. Maybe WebP format is not supported in the current browser."})}(e);if(!t)return[];for(var r,n=[{id:440786851,data:[{data:1,id:17030},{data:1,id:17143},{data:4,id:17138},{data:8,id:17139},{data:"webm",id:17026},{data:2,id:17031},{data:2,id:17029}]},{id:408125543,data:[{id:357149030,data:[{data:1e6,id:2807729},{data:"whammy",id:19840},{data:"whammy",id:22337},{data:(r=t.duration,[].slice.call(new Uint8Array(new Float64Array([r]).buffer),0).map((function(e){return String.fromCharCode(e)})).reverse().join("")),id:17545}]},{id:374648427,data:[{id:174,data:[{data:1,id:215},{data:1,id:29637},{data:0,id:156},{data:"und",id:2274716},{data:"V_VP8",id:134},{data:"VP8",id:2459272},{data:1,id:131},{id:224,data:[{data:t.width,id:176},{data:t.height,id:186}]}]}]}]}],a=0,s=0;a<e.length;){for(var o=[],l=0;o.push(e[a]),l+=e[a].duration,++a<e.length&&l<3e4;);var c={id:524531317,data:function(e,t,i){return[{data:e,id:231}].concat(i.map((function(e){var i=function(e){var t=0;if(e.keyframe&&(t|=128),e.invisible&&(t|=8),e.lacing&&(t|=e.lacing<<1),e.discardable&&(t|=1),127<e.trackNum)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:i,id:163}})))}(s,0,o)};n[1].data.push(c),s+=l}return i(n)}(e.map((function(e){var t=function(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),r=0,n=[];r<4;r++)n[r]=t.charCodeAt(i+3+r);return{width:16383&(n[1]<<8|n[0]),height:16383&(n[3]<<8|n[2]),data:t,riff:e}}(r(atob(e.image.slice(23))));return t.duration=e.duration,t}))),postMessage(e)}t.Whammy=R;var L={init:function(){var e,t,i,r=this;function n(e){e.createObjectStore(r.dataStoreName)}function a(){var t=e.transaction([r.dataStoreName],"readwrite");function i(e){t.objectStore(r.dataStoreName).get(e).onsuccess=function(t){r.callback&&r.callback(t.target.result,e)}}r.videoBlob&&t.objectStore(r.dataStoreName).put(r.videoBlob,"videoBlob"),r.gifBlob&&t.objectStore(r.dataStoreName).put(r.gifBlob,"gifBlob"),r.audioBlob&&t.objectStore(r.dataStoreName).put(r.audioBlob,"audioBlob"),i("audioBlob"),i("videoBlob"),i("gifBlob")}"undefined"!=typeof indexedDB&&void 0!==indexedDB.open?(t=this.dbName||location.href.replace(/\/|:|#|%|\.|\[|\]/g,""),(i=indexedDB.open(t,1)).onerror=r.onError,i.onsuccess=function(){(e=i.result).onerror=r.onError,e.setVersion&&1!==e.version?e.setVersion(1).onsuccess=function(){n(e),a()}:a()},i.onupgradeneeded=function(e){n(e.target.result)}):console.error("IndexedDB API are not available in this browser.")},Fetch:function(e){return this.callback=e,this.init(),this},Store:function(e){return this.audioBlob=e.audioBlob,this.videoBlob=e.videoBlob,this.gifBlob=e.gifBlob,this.init(),this},onError:function(e){console.error(JSON.stringify(e,null,"\t"))},dataStoreName:"recordRTC",dbName:null};function I(e,t){"undefined"==typeof GIFEncoder&&((i=document.createElement("script")).src="https://www.webrtc-experiment.com/gif-recorder.js",(document.body||document.documentElement).appendChild(i)),t=t||{};var i,r,n=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement,a=(this.record=function(){"undefined"!=typeof GIFEncoder&&u?(n||(t.width||(t.width=r.offsetWidth||320),t.height||(t.height=r.offsetHeight||240),t.video||(t.video={width:t.width,height:t.height}),t.canvas||(t.canvas={width:t.width,height:t.height}),s.width=t.canvas.width||320,s.height=t.canvas.height||240,r.width=t.video.width||320,r.height=t.video.height||240),(h=new GIFEncoder).setRepeat(0),h.setDelay(t.frameRate||200),h.setQuality(t.quality||10),h.start(),"function"==typeof t.onGifRecordingStarted&&t.onGifRecordingStarted(),f=o((function e(i){if(!0!==p.clearedRecordedData){if(a)return setTimeout((function(){e(i)}),100);f=o(e),i-d<90||(!n&&r.paused&&r.play(),n||c.drawImage(r,0,0,s.width,s.height),t.onGifPreview&&t.onGifPreview(s.toDataURL("image/png")),h.addFrame(c),d=i)}})),t.initCallback&&t.initCallback()):setTimeout(p.record,1e3)},!(this.stop=function(e){e=e||function(){},f&&l(f),this.blob=new Blob([new Uint8Array(h.stream().bin)],{type:"image/gif"}),e(this.blob),h.stream().bin=[]})),s=(this.pause=function(){a=!0},this.resume=function(){a=!1},this.clearRecordedData=function(){p.clearedRecordedData=!0,h&&(h.stream().bin=[])},this.name="GifRecorder",this.toString=function(){return this.name},document.createElement("canvas")),c=s.getContext("2d"),u=(n&&(e instanceof CanvasRenderingContext2D?s=(c=e).canvas:e instanceof HTMLCanvasElement&&(c=e.getContext("2d"),s=e)),!0);n||((r=document.createElement("video")).muted=!0,r.autoplay=!0,r.playsInline=!0,u=!1,r.onloadedmetadata=function(){u=!0},w(e,r),r.play());var d,h,f=null,p=this}function B(e,t){t=t||"multi-streams-mixer";var i=[],r=!1,n=document.createElement("canvas"),a=n.getContext("2d"),s=(n.style.opacity=0,n.style.position="absolute",n.style.zIndex=-1,n.style.top="-1000em",n.style.left="-1000em",n.className=t,(document.body||document.documentElement).appendChild(n),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0,this),o=window.AudioContext;void 0===o&&("undefined"!=typeof webkitAudioContext&&(o=webkitAudioContext),"undefined"!=typeof mozAudioContext)&&(o=mozAudioContext),window.URL,"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia)&&(navigator.getUserMedia=navigator.mozGetUserMedia);var l=window.MediaStream,c=(void 0!==(l=void 0===l&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:l)&&void 0===l.prototype.stop&&(l.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),{});function u(){var e,t,a;r||(e=i.length,t=!1,a=[],i.forEach((function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:a.push(e)})),t?(n.width=t.stream.width,n.height=t.stream.height):a.length?(n.width=1<e?2*a[0].width:a[0].width,n.height=a[0].height*(9!==e&&10!==e?7!==e&&8!==e?5!==e&&6!==e?3!==e&&4!==e?1:2:3:4:5)):(n.width=s.width||360,n.height=s.height||240),t&&t instanceof HTMLVideoElement&&d(t),a.forEach((function(e,t){d(e,t)})),setTimeout(u,s.frameInterval))}function d(e,t){var i,n,s,o;r||(n=i=0,s=e.width,o=e.height,1===t&&(i=e.width),2===t&&(n=e.height),3===t&&(i=e.width,n=e.height),4===t&&(n=2*e.height),5===t&&(i=e.width,n=2*e.height),6===t&&(n=3*e.height),7===t&&(i=e.width,n=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(n=e.stream.top),void 0!==e.stream.width&&(s=e.stream.width),void 0!==e.stream.height&&(o=e.stream.height),a.drawImage(e,i,n,s,o),"function"==typeof e.stream.onRender&&e.stream.onRender(a,i,n,s,o,t))}function h(e){var i,r,n=document.createElement("video");return i=e,!("srcObject"in(r=n))&&"mozSrcObject"in r?r.mozSrcObject=i:r.srcObject=i,n.className=t,n.muted=!0,n.volume=0,n.width=e.width||s.width||360,n.height=e.height||s.height||240,n.play(),n}function f(t){i=[],(t=t||e).forEach((function(e){var t;e.getTracks().filter((function(e){return"video"===e.kind})).length&&((t=h(e)).stream=e,i.push(t))}))}void 0!==o?c.AudioContext=o:"undefined"!=typeof webkitAudioContext&&(c.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){u()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";(t=t instanceof Array?t:[t]).forEach((function(t){var r,n=new l;t.getTracks().filter((function(e){return"video"===e.kind})).length&&((r=h(t)).stream=t,i.push(r),n.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])),t.getTracks().filter((function(e){return"audio"===e.kind})).length&&(r=s.audioContext.createMediaStreamSource(t),s.audioDestination=s.audioContext.createMediaStreamDestination(),r.connect(s.audioDestination),n.addTrack(s.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])),e.push(n)}))},this.releaseStreams=function(){i=[],r=!0,s.gainNode&&(s.gainNode.disconnect(),s.gainNode=null),s.audioSources.length&&(s.audioSources.forEach((function(e){e.disconnect()})),s.audioSources=[]),s.audioDestination&&(s.audioDestination.disconnect(),s.audioDestination=null),s.audioContext&&s.audioContext.close(),s.audioContext=null,a.clearRect(0,0,n.width,n.height),n.stream&&(n.stream.stop(),n.stream=null)},this.resetVideoStreams=function(e){f(e=!e||e instanceof Array?e:[e])},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){r=!1,f(),"captureStream"in n?a=n.captureStream():"mozCaptureStream"in n?a=n.mozCaptureStream():s.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features"),t=new l,a.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)}));var t,i=n.stream=t,a=function(){c.AudioContextConstructor||(c.AudioContextConstructor=new c.AudioContext),s.audioContext=c.AudioContextConstructor,s.audioSources=[],!0===s.useGainNode&&(s.gainNode=s.audioContext.createGain(),s.gainNode.connect(s.audioContext.destination),s.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){e.getTracks().filter((function(e){return"audio"===e.kind})).length&&(t++,e=s.audioContext.createMediaStreamSource(e),!0===s.useGainNode&&e.connect(s.gainNode),s.audioSources.push(e))})),t)return s.audioDestination=s.audioContext.createMediaStreamDestination(),s.audioSources.forEach((function(e){e.connect(s.audioDestination)})),s.audioDestination.stream}();return a&&a.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){i.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),i}}function P(e,t){e=e||[];var i,r,n=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 n;i=new B(e,t.elementClass||"multi-streams-mixer"),n=[],e.forEach((function(e){b(e,"video").forEach((function(e){n.push(e)}))})),n.length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(r=new T(i.getMixedStream(),t)).record()},this.stop=function(e){r&&r.stop((function(t){n.blob=t,e(t),n.clearRecordedData()}))},this.pause=function(){r&&r.pause()},this.resume=function(){r&&r.resume()},this.clearRecordedData=function(){r&&(r.clearRecordedData(),r=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(n){if(!n)throw"First parameter is required.";n instanceof Array||(n=[n]),e.concat(n),r&&i&&(i.appendStreams(n),t.previewStream)&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream())},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function M(e,t){var i,r,n;function a(o,l){if(!t.workerPath&&!l)return i=!1,fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(e){e.arrayBuffer().then((function(e){a(o,e)}))}));!t.workerPath&&l instanceof ArrayBuffer&&(l=new Blob([l],{type:"text/javascript"}),t.workerPath=c.createObjectURL(l)),t.workerPath||console.error("workerPath parameter is missing."),(r=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),r.addEventListener("message",(function(a){"READY"===a.data?(r.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),new ReadableStream({start:function(r){var n=document.createElement("canvas"),a=document.createElement("video"),s=!0;a.srcObject=e,a.muted=!0,a.height=t.height,a.width=t.width,a.volume=0,a.onplaying=function(){n.width=t.width,n.height=t.height;var e=n.getContext("2d"),o=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),r.close()),s&&(s=!1,t.onVideoProcessStarted)&&t.onVideoProcessStarted(),e.drawImage(a,0,0),"closed"!==r._controlledReadableStream.state)try{r.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),o)},a.play()}}).pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):r.postMessage(e.data.buffer,[e.data.buffer])}}))):!a.data||n||s.push(a.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(){n=!(s=[]),this.blob=null,a(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){n=!0},this.resume=function(){n=!1};var s=[];this.stop=function(e){i=!0;var t,n=this;t=function(){n.blob=new Blob(s,{type:"video/webm"}),e(n.blob)},r?(r.addEventListener("message",(function(e){null===e.data&&(r.terminate(),r=null,t())})),r.postMessage(null)):t()},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=!(s=[]),this.blob=null},this.blob=null}t.DiskStorage=L,t.GifRecorder=I,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var r=this;r.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{r.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{r.recordRTC.stopRecording((function(i){r.blob=r.recordRTC.getBlob(),r.blob&&r.blob.size?e(i):t("Empty blob.",r.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{r.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{r.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{r.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(r.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(r.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(r.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(r.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(r.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=M})),Ci=function(){function e(t){A(this,e),this._buffer=t,this._buffer_index=0,this._total_bytes=t.byteLength,this._total_bits=8*t.byteLength,this._current_word=0,this._current_word_bits_left=0}return y(e,[{key:"destroy",value:function(){this._buffer=null}},{key:"_fillCurrentWord",value:function(){var e,t=this._total_bytes-this._buffer_index;t<=0?console.error("ExpGolomb: _fillCurrentWord() but no bytes available",this._total_bytes,this._buffer_index):(t=Math.min(4,t),(e=new Uint8Array(4)).set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(e.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t)}},{key:"readBits",value:function(e){var t,i;return 32<e&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left?(t=this._current_word>>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t):(t=this._current_word_bits_left?this._current_word:0,t>>>=32-this._current_word_bits_left,e-=this._current_word_bits_left,this._fillCurrentWord(),e=Math.min(e,this._current_word_bits_left),i=this._current_word>>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t<<e|i)}},{key:"readBool",value:function(){return 1===this.readBits(1)}},{key:"readByte",value:function(){return this.readBits(8)}},{key:"_skipLeadingZero",value:function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>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)}}])}(),Ri=function(){function e(){A(this,e)}return y(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,a=0;a<i;a++)2<=a&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(r[n]=t[a],n++);return new Uint8Array(r.buffer,0,n)}},{key:"parseSPS",value:function(t){var i=e._ebsp2rbsp(t),r=new Ci(i);r.readByte();t=r.readByte();var n=(r.readByte(),r.readByte());r.readUEG();var a=e.getProfileString(t),s=e.getLevelString(n),o=1,l=420,c=8;if((100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t||138===t||144===t)&&(3===(o=r.readUEG())&&r.readBits(1),o<=3&&(l=[0,420,422,444][o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool()))for(var u=3!==o?8:12,d=0;d<u;d++)r.readBool()&&(d<6?e._skipScalingList(r,16):e._skipScalingList(r,64));if(r.readUEG(),n=r.readUEG(),0===n)r.readUEG();else if(1===n){r.readBits(1),r.readSEG(),r.readSEG();for(var h=r.readUEG(),f=0;f<h;f++)r.readSEG()}t=r.readUEG(),r.readBits(1),n=r.readUEG();var p=r.readUEG(),g=r.readBits(1);0===g&&r.readBits(1),r.readBits(1);var m=0,A=0,y=0,v=0,b=(r.readBool()&&(m=r.readUEG(),A=r.readUEG(),y=r.readUEG(),v=r.readUEG()),1),w=1,k=0,E=!0,T=0,S=0,_=(r.readBool()&&(r.readBool()&&(0<(x=r.readByte())&&x<16?(b=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][x-1],w=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][x-1]):255===x&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())),r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool())&&r.readBits(24),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool())&&(x=r.readBits(32),D=r.readBits(32),E=r.readBool(),T=D,S=2*x,k=T/S),1),C=(1===b&&1===w||(_=b/w),0),R=0;R=0===o?(C=1,2-g):(C=3===o?1:2,(1===o?2:1)*(2-g));var D=16*(n+1),x=16*(p+1)*(2-g);D-=(m+A)*C,x-=(y+v)*R,n=Math.ceil(D*_);return r.destroy(),r=null,{profile_string:a,level_string:s,bit_depth:c,ref_frames:t,chroma_format:l,chroma_format_string:e.getChromaFormatString(l),frame_rate:{fixed:E,fps:k,fps_den:S,fps_num:T},sar_ratio:{width:b,height:w},codec_size:{width:D,height:x},present_size:{width:n,height:x}}}},{key:"parseSPS$2",value:function(t){for(var i=t.subarray(1,4),r="avc1.",n=0;n<3;n++){var a=i[n].toString(16);a.length<2&&(a="0"+a),r+=a}var s=e._ebsp2rbsp(t),o=new Ci(s);o.readByte();t=o.readByte();var l=(o.readByte(),o.readByte());o.readUEG();var c=e.getProfileString(t),u=e.getLevelString(l),d=1,h=420,f=8,p=8;if((100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t||138===t||144===t)&&(3===(d=o.readUEG())&&o.readBits(1),d<=3&&(h=[0,420,422,444][d]),f=o.readUEG()+8,p=o.readUEG()+8,o.readBits(1),o.readBool()))for(var g=3!==d?8:12,m=0;m<g;m++)o.readBool()&&(m<6?e._skipScalingList(o,16):e._skipScalingList(o,64));o.readUEG();var A=o.readUEG();if(0===A)o.readUEG();else if(1===A){o.readBits(1),o.readSEG(),o.readSEG();for(var y=o.readUEG(),v=0;v<y;v++)o.readSEG()}A=o.readUEG();var b=(o.readBits(1),o.readUEG()),w=o.readUEG(),k=o.readBits(1);0===k&&o.readBits(1),o.readBits(1);var E=0,T=0,S=0,_=0,C=(o.readBool()&&(E=o.readUEG(),T=o.readUEG(),S=o.readUEG(),_=o.readUEG()),1),R=1,D=0,x=!0,L=0,I=0,B=(o.readBool()&&(o.readBool()&&(0<(F=o.readByte())&&F<16?(C=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][F-1],R=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][F-1]):255===F&&(C=o.readByte()<<8|o.readByte(),R=o.readByte()<<8|o.readByte())),o.readBool()&&o.readBool(),o.readBool()&&(o.readBits(4),o.readBool())&&o.readBits(24),o.readBool()&&(o.readUEG(),o.readUEG()),o.readBool())&&(F=o.readBits(32),O=o.readBits(32),x=o.readBool(),L=O,I=2*F,D=L/I),1),P=(1===C&&1===R||(B=C/R),0),M=0;M=0===d?(P=1,2-k):(P=3===d?1:2,(1===d?2:1)*(2-k));var O=16*(b+1),F=16*(w+1)*(2-k);O-=(E+T)*P,F-=(S+_)*M,b=Math.ceil(O*B);return o.destroy(),o=null,{codec_mimetype:r,profile_idc:t,level_idc:l,profile_string:c,level_string:u,chroma_format_idc:d,bit_depth:f,bit_depth_luma:f,bit_depth_chroma:p,ref_frames:A,chroma_format:h,chroma_format_string:e.getChromaFormatString(h),frame_rate:{fixed:x,fps:D,fps_den:I,fps_num:L},sar_ratio:{width:C,height:R},codec_size:{width:O,height:F},present_size:{width:b,height:F}}}},{key:"_skipScalingList",value:function(e,t){for(var i,r=8,n=8,a=0;a<t;a++)0!==n&&(i=e.readSEG(),n=(r+i+256)%256),r=0===n?r:n}},{key:"getProfileString",value:function(e){switch(e){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}},{key:"getLevelString",value:function(e){return(e/10).toFixed(1)}},{key:"getChromaFormatString",value:function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}])}(),Di=function(){function e(t){A(this,e),this.buffer=t,this.buflen=t.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}return y(e,[{key:"read",value:function(e){for(var t,i=0;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,t=8<this.bufoff+e?8-this.bufoff:e,i=(i<<=t)+(this.buffer[this.bufpos]>>8-this.bufoff-t&255>>8-t),this.bufoff+=t,e-=t,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return i}},{key:"look",value:function(e){var t=this.bufpos,i=this.bufoff;e=this.read(e);return this.bufpos=t,this.bufoff=i,e}},{key:"read_golomb",value:function(){var e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<<e)+this.read(e)-1}}])}();function xi(e){var t={},i=new DataView(e.buffer),r=i.getUint8(0),n=i.getUint8(1);if(i.getUint8(2),i.getUint8(3),1!==r||0===n)return{};var a=1+(3&i.getUint8(4));if(3!=a&&4!=a)return{};var s=31&i.getUint8(5);if(0==s)return{};for(var o=6,l=0;l<s;l++){var c=i.getUint16(o,!1);if(o+=2,0!==c){var u=new Uint8Array(e.buffer,o,c);c=(o+=c,Ri.parseSPS(u));if(0===l){t.sps=u,t.timescale=1e3,t.codecWidth=c.codec_size.width,t.codecHeight=c.codec_size.height,t.presentWidth=c.present_size.width,t.presentHeight=c.present_size.height,t.profile=c.profile_string,t.level=c.level_string,t.bitDepth=c.bit_depth,t.chromaFormat=c.chroma_format,t.sarRatio=c.sar_ratio,t.frameRate=c.frame_rate,!1!==c.frame_rate.fixed&&0!==c.frame_rate.fps_num&&0!==c.frame_rate.fps_den||(t.frameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3});c=t.frameRate.fps_den;var d=t.frameRate.fps_num;t.refSampleDuration=t.timescale*(c/d);for(var h=u.subarray(1,4),f="avc1.",p=0;p<3;p++){var g=h[p].toString(16);g.length<2&&(g="0"+g),f+=g}t.codec=f}}}var m=i.getUint8(o);if(0===m)return{};o++;for(var A=0;A<m;A++){var y,v=i.getUint16(o,!1);o+=2,0!==v&&(y=new Uint8Array(e.buffer,o,v),o+=v,t.pps=y)}if(t.videoType="avc",t.sps){var b=t.sps.byteLength,w=new Uint8Array([b>>>24&255,b>>>16&255,b>>>8&255,255&b]),k=new Uint8Array(b+4);k.set(w,0),k.set(t.sps,4),t.sps=k}if(t.pps){var E=t.pps.byteLength,T=new Uint8Array([E>>>24&255,E>>>16&255,E>>>8&255,255&E]),S=new Uint8Array(E+4);S.set(T,0),S.set(t.pps,4),t.pps=S}return t}function Li(e){var t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,t=new Uint8Array(t+4);return t.set(i,0),t.set(e,4),t}function Ii(e){return 31&e[0]}function Bi(e){return e===Z}function Pi(e){return 7!==e&&8!==e&&!Bi(e)}var Mi=function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),n=0,a=0;a<i;a++)2<=a&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(r[n]=t[a],n++);return new Uint8Array(r.buffer,0,n)};function Oi(e){var t={width:0,height:0,profile:0,level:0};e=e.slice(5);do{var i={};if(e.length<23)break;if(i.configurationVersion=e[0],1!=i.configurationVersion)break;i.general_profile_space=e[1]>>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];for(var r=e[22],n=e.slice(23),a=0;a<r&&!(n.length<3);a++){var s=63&n[0],o=n[1]<<8|n[2];n=n.slice(3);for(var l=0;l<o&&!(n.length<2);l++){var c,u=n[0]<<8|n[1];if(n.length<2+u)break;n=n.slice(2),33==s&&((c=new Uint8Array(u)).set(n.slice(0,u),0),i.psps=function(e){var t,i,r={},n=e.length,a=[],s=new Di(e);s.read(1),s.read(6),s.read(6),s.read(3);for(var o=2;o<n;o++)o+2<n&&3==s.look(24)?(a.push(s.read(8)),a.push(s.read(8)),o+=2,s.read(8)):a.push(s.read(8));return e=new Uint8Array(a),e=new Di(e),r.sps_video_parameter_set_id=e.read(4),r.sps_max_sub_layers_minus1=e.read(3),r.sps_temporal_id_nesting_flag=e.read(1),r.profile_tier_level=function(e,t){var i={};i.profile_space=e.read(2),i.tier_flag=e.read(1),i.profile_idc=e.read(5),i.profile_compatibility_flags=e.read(32),i.general_progressive_source_flag=e.read(1),i.general_interlaced_source_flag=e.read(1),i.general_non_packed_constraint_flag=e.read(1),i.general_frame_only_constraint_flag=e.read(1),e.read(32),e.read(12),i.level_idc=e.read(8),i.sub_layer_profile_present_flag=[],i.sub_layer_level_present_flag=[];for(var r=0;r<t;r++)i.sub_layer_profile_present_flag[r]=e.read(1),i.sub_layer_level_present_flag[r]=e.read(1);if(0<t)for(var n=t;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 a=0;a<t;a++)i.sub_layer_profile_present_flag[a]&&(i.sub_layer_profile_space[a]=e.read(2),i.sub_layer_tier_flag[a]=e.read(1),i.sub_layer_profile_idc[a]=e.read(5),i.sub_layer_profile_compatibility_flag[a]=e.read(32),i.sub_layer_progressive_source_flag[a]=e.read(1),i.sub_layer_interlaced_source_flag[a]=e.read(1),i.sub_layer_non_packed_constraint_flag[a]=e.read(1),i.sub_layer_frame_only_constraint_flag[a]=e.read(1),e.read(32),e.read(12)),i.sub_layer_level_present_flag[a]?i.sub_layer_level_idc[a]=e.read(8):i.sub_layer_level_idc[a]=1;return i}(e,r.sps_max_sub_layers_minus1),r.sps_seq_parameter_set_id=e.read_golomb(),r.chroma_format_idc=e.read_golomb(),r.separate_colour_plane_flag=3==r.chroma_format_idc?e.read(1):0,r.pic_width_in_luma_samples=e.read_golomb(),r.pic_height_in_luma_samples=e.read_golomb(),r.conformance_window_flag=e.read(1),r.conformance_window_flag?(t=1+(r.chroma_format_idc<2),i=1+(r.chroma_format_idc<3),r.conf_win_left_offset=e.read_golomb()*i,r.conf_win_right_offset=e.read_golomb()*i,r.conf_win_top_offset=e.read_golomb()*t,r.conf_win_bottom_offset=e.read_golomb()*t):(r.conf_win_left_offset=0,r.conf_win_right_offset=0,r.conf_win_top_offset=0,r.conf_win_bottom_offset=0),r}(c),t.profile=i.general_profile_idc,t.level=i.general_level_idc/30,t.width=i.psps.pic_width_in_luma_samples-(i.psps.conf_win_left_offset+i.psps.conf_win_right_offset),t.height=i.psps.pic_height_in_luma_samples-(i.psps.conf_win_top_offset+i.psps.conf_win_bottom_offset)),n=n.slice(u)}}}while(0);return t.codecWidth=t.width||1920,t.codecHeight=t.height||1080,t.presentHeight=t.codecHeight,t.presentWidth=t.codecWidth,t.timescale=1e3,t.refSampleDuration=1e3/23976*1e3,t.videoType="hevc",t}function Fi(e){return(126&e[0])>>1}var ji=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.fileName="",i._isRecording=!1,i._recordingTimestamp=0,i.recordingInterval=null,i.sps=null,i.pps=null,i.vps=null,i.codecId=null,i.mdatBytesLength=0,i.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},i}return g(t,e),y(t,[{key:"destroy",value:function(){this._reset()}},{key:"isH264",get:function(){return 7===this.codecId}},{key:"isH265",get:function(){return 12===this.codecId}},{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,i,r){}},{key:"handleAddTrack",value:function(e){}},{key:"stopRecordAndSave",value:function(){}},{key:"startRecordingInterval",value:function(){}},{key:"stopRecordingInterval",value:function(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}},{key:"getToTalByteLength",value:function(){}},{key:"_reset",value:function(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.mdatBytesLength=0}},{key:"initMetaData",value:function(e,t){var i,r=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=r,7===t)i=xi(r);else if(12===t){i=function(e){var t=23,i=e[23];if(32!=(63&i))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is "+i),{};t+=2,++t;i=e[27]|e[26]<<8;var r=(t+=2,e.slice(28,28+i)),n=e[t+=i];if(33!=(63&n))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is "+n),{};t+=2;n=e[1+ ++t]|e[t]<<8;var a=e.slice(t+=2,t+n),s=e[t+=n];if(34!=(63&s))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and pps tag is "+s),{};t+=2;s=e[1+ ++t]|e[t]<<8,e=e.slice(t+=2,t+s),t=new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n]);var o=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),l=new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i]);n=new Uint8Array(4+n),n.set(t,0),n.set(a,4),t=new Uint8Array(4+s),t.set(o,0),t.set(e,4),a=new Uint8Array(4+i);return a.set(l,0),a.set(r,4),{sps:n,pps:t,vps:a}}(r);var n=Oi(e);i=Object.assign(i,n)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType)&&(this.metaInfo.videoType=i.videoType)}}])}(e),Ui=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.totalByteLength=0,i._startRecordingTimestamp=null,e.debug.log("RecorderRTC","init"),i}return g(t,e),y(t,[{key:"_reset",value:function(){f(t,"_reset",this,3)([]),this.totalByteLength=0,this._startRecordingTimestamp=null,this.recorder&&(this.recorder.destroy(),this.recorder=null)}},{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this._reset(),this.player.debug.log("RecorderRTC","destroy")}},{key:"getSeekableBlob",value:function(e){var t=new EBML.Reader,i=new EBML.Decoder,r=EBML.tools,n=new FileReader;return new Promise((function(a,s){n.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();var n=r.makeMetadataSeekable(t.metadatas,t.duration,t.cues),s=this.result.slice(t.metadataSize);n=new Blob([n,s],{type:"video/webm"});a(n)},n.readAsArrayBuffer(e)}))}},{key:"startRecord",value:function(){var e=this,t=this.player.debug,i={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:function(i){t.log("RecorderRTC","record timestamp :"+i),null===e._startRecordingTimestamp&&(e._startRecordingTimestamp=i),e._recordingTimestamp=(i-e._startRecordingTimestamp)/1e3},ondataavailable:function(i){e.totalByteLength+=i.size,t.log("RecorderRTC","ondataavailable",i.size)},disableLogs:!this.player._opt.debug};try{var r=null;if(this.player.getRenderType()===_?r=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?r=this.player.video.mediaStream:this.player._opt.isHls||this.player._opt.useMSE||this.player._opt.useWCS?r=this.player.video.$videoElement.captureStream(25):this.player._opt.isWebrtc&&(r=this.player.webrtc.videoStream),r){if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){var n=this.player.audio.mediaStreamAudioDestinationNode.stream;if(0<n.getAudioTracks().length){var a=n.getAudioTracks()[0];a&&a.enabled&&r.addTrack(a)}}this.recorder=_i(r,i)}else t.error("RecorderRTC","startRecord error and can not create stream"),this.emit(N.recordCreateError)}catch(i){t.error("RecorderRTC","startRecord error",i),this.emit(N.recordCreateError)}this.recorder&&(this._isRecording=!0,this.player.emit(N.recording,!0),this.recorder.startRecording(),t.log("RecorderRTC","start recording"),this.player.emit(N.recordStart),this.startRecordingInterval())}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(N.recordingTimestamp,e._recordingTimestamp)}),1e3)}},{key:"stopRecordAndSave",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:q,i=1<arguments.length?arguments[1]:void 0;return new Promise((function(r,n){e.recorder&&e._isRecording||n("recorder is not ready"),i&&e.setFileName(i),e.recorder.stopRecording((function(){e.player.debug.log("RecorderRTC","stop recording");var i=(e.fileName||We())+"."+w;if(e.recorder.getBlob(),"blob"===t){var n=e.recorder.getBlob();r(n),e.player.emit(N.recordBlob,n)}else r(),e.recorder.save(i);e.player.emit(N.recordEnd),e._reset(),e.player.emit(N.recording,!1)}))}))}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}},{key:"getTotalDuration",value:function(){return this.recordTime}},{key:"getType",value:function(){return w}},{key:"initMetaData",value:function(){}}])}(ji),Ni=function(){function e(){A(this,e)}return y(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 i=e.constants={};i.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]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.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]),i.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]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,i=null,r=Array.prototype.slice.call(arguments,1),n=r.length,a=0;a<n;a++)t+=r[a].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);for(var s=8,o=0;o<n;o++)i.set(r[o],s),s+=r[o].byteLength;return i}},{key:"generateInitSegment",value:function(t,i,r){var n=e.box(e.types.ftyp,e.constants.FTYP),a=e.box(e.types.free),s=8,o=new Uint8Array;r+s>=Math.pow(2,32)-1?(s=16,(o=new Uint8Array(r+s)).set(new Uint8Array([0,0,0,1]),0),o.set(e.types.mdat,4),o.set(new Uint8Array([r+8>>>56&255,r+8>>>48&255,r+8>>>40&255,r+8>>>32&255,r+8>>>24&255,r+8>>>16&255,r+8>>>8&255,r+8&255]),8)):((o=new Uint8Array(r+s))[0]=r+8>>>24&255,o[1]=r+8>>>16&255,o[2]=r+8>>>8&255,o[3]=r+8&255,o.set(e.types.mdat,4));for(var l=0;l<i.length;l++){var c=i[l];c.duration=c.refSampleDuration*c.sequenceNumber;for(var u=0;u<c.sequenceNumber;u++){var d=c.samples[u];d=(d.chunkOffset=n.byteLength+a.byteLength+s,d.data);o.set(d,s),s+=d.byteLength}}return r=e.moov(t,i),t=new Uint8Array(n.byteLength+r.byteLength+o.byteLength+a.byteLength),t.set(n,0),t.set(a,n.byteLength),t.set(o,n.byteLength+a.byteLength),t.set(r,n.byteLength+o.byteLength+a.byteLength),t}},{key:"moov",value:function(t,i){for(var r=t.timescale,n=t.duration,a=i.length,s=e.mvhd(r,n),o=new Uint8Array,l=0;l<a;l++){var c=e.trak(i[l]),u=new Uint8Array(c.byteLength+o.byteLength);u.set(o,0),u.set(c,o.byteLength),(o=new Uint8Array(u.byteLength)).set(u,0)}return e.box(e.types.moov,s,o)}},{key:"mvhd",value:function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,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 i=t.id,r=t.duration,n=t.presentWidth;t=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,t>>>8&255,255&t,0,0]))}},{key:"edts",value:function(t,i){return e.box(e.types.edts,e.elst(t,i))}},{key:"elst",value:function(t,i){for(var r=0,n=0;n<i;n++)"video"===t[n].type&&(r+=t[n].duration);var a=t[i].duration;return 0===r&&(r=t[i].refSampleDuration),e.box(e.types.elst,new Uint8Array([0,0,0,0,0,0,0,2,r>>>24&255,r>>>16&255,r>>>8&255,255&r,255,255,255,255,0,1,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a,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 i=t.timescale/t.refSampleDuration;t=i*t.duration/t.timescale;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){var i=e.constants.HDLR_VIDEO;return e.box(e.types.hdlr,i)}},{key:"minf",value:function(t){var i=e.box(e.types.vmhd,e.constants.VMHD);return e.box(e.types.minf,i,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 i=t.samples,r=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:i[0].duration}],n=[i[0].duration],a=i.length,s=0;s<a;s++)for(var o=0;o<r.length;o++)i[s].duration===r[o].duration?r[o].num++:n.indexOf(i[s].duration)<0&&(n.push(i[s].duration),r.push({No:2,num:0,sampleDelte:1,chunkNo:s+1,duration:i[s].duration}));return e.box(e.types.stbl,e.stsd(t),e.stts(r),e.stss(i),e.stsc(r),e.stsz(i),e.stco(r,i))}},{key:"stts",value:function(t){var i=t.length,r=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),n=r.byteLength,a=new Uint8Array(n+8*i);a.set(r,0);for(var s=0;s<i;s++)a.set(new Uint8Array([t[s].num>>>24&255,t[s].num>>>16&255,t[s].num>>>8&255,255&t[s].num,t[s].sampleDelte>>>24&255,t[s].sampleDelte>>>16&255,t[s].sampleDelte>>>8&255,255&t[s].sampleDelte]),n),n+=8;return e.box(e.types.stts,a)}},{key:"stss",value:function(t){for(var i=[],r=t.length,n=0;n<r;n++)!0===t[n].isKeyframe&&i.push(n+1);var a=i.length,s=new Uint8Array([0,0,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a]),o=s.byteLength,l=new Uint8Array(o+4*a);l.set(s,0);for(var c=0;c<a;c++)l.set(new Uint8Array([i[c]>>>24&255,i[c]>>>16&255,i[c]>>>8&255,255&i[c]]),o),o+=4;return e.box(e.types.stss,l)}},{key:"stsc",value:function(t){var i=t.length,r=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),n=r.byteLength,a=new Uint8Array(n+12*i);a.set(r,0);for(var s=0;s<i;s++){var o=t[s].chunkNo,l=t[s].num,c=t[s].sampleDelte;a.set(new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c>>>24&255,c>>>16&255,c>>>8&255,255&c]),n),n+=12}return e.box(e.types.stsc,a)}},{key:"stsz",value:function(t){var i=t.length,r=new Uint8Array([0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),n=r.byteLength,a=new Uint8Array(n+4*i);a.set(r,0);for(var s=0;s<i;s++){var o=t[s].data.byteLength;a.set(new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o]),n),n+=4}return e.box(e.types.stsz,a)}},{key:"stco",value:function(t,i){return i=i[0].chunkOffset,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 i=t.channelCount;t=t.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,t>>>8&255,255&t,0,0]);return e.box(e.types[".mp3"],i)}},{key:"mp4a",value:function(t){var i=t.channelCount,r=t.audioSampleRate;i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,i,e.esds(t))}},{key:"esds",value:function(t){t=t.config||[];var i=t.length;i=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(t).concat([6,1,2]));return e.box(e.types.esds,i)}},{key:"avc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=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,r>>>8&255,255&r,t>>>8&255,255&t,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,r,e.box(e.types.avcC,i))}},{key:"hvc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=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,r>>>8&255,255&r,t>>>8&255,255&t,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,r,e.box(e.types.hvcC,i))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){return t=t.id,t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]),e.box(e.types.trex,t)}},{key:"moof",value:function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))}},{key:"mfhd",value:function(t){return t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e.box(e.types.mfhd,t)}},{key:"traf",value:function(t,i){var r=t.id,n=(r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),i=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),e.sdtp(t));t=e.trun(t,n.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,n)}},{key:"sdtp",value:function(t){for(var i=t.samples||[],r=i.length,n=new Uint8Array(4+r),a=0;a<r;a++){var s=i[a].flags;n[a+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,n)}},{key:"trun",value:function(t,i){var r=t.samples||[],n=r.length,a=(t=12+16*n,new Uint8Array(t));a.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,(i+=8+t)>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var s=0;s<n;s++){var o=r[s].duration,l=r[s].size,c=r[s].flags,u=r[s].cts;a.set([o>>>24&255,o>>>16&255,o>>>8&255,255&o,l>>>24&255,l>>>16&255,l>>>8&255,255&l,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.isNonSync,0,0,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*s)}return e.box(e.types.trun,a)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();Ni.init();var Gi=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.tagName="recorderMP4",i.totalDuration=0,i.totalByteLength=0,i.bufferList=[],i.cacheTrack={},i.sequenceNumber=0,e.debug.log(i.tagName,"init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this._reset(),this.player.debug.log(this.tagName,"destroy")}},{key:"_reset",value:function(){f(t,"_reset",this,3)([]),this.totalDuration=0,this.totalByteLength=0,this.sequenceNumber=0,this.cacheTrack={},this.bufferList=[]}},{key:"startRecord",value:function(){var e=this.player.debug;this._isRecording=!0,this.player.emit(N.recording,!0),e.log(this.tagName,"start recording"),this.player.emit(N.recordStart),this.startRecordingInterval()}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(N.recordingTimestamp,e.getTotalDuration())}),1e3)}},{key:"formatFmp4Track",value:function(e,t,i,r){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:r,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}},{key:"handleAddNaluTrack",value:function(e,t,i,r){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,r)}},{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),i=(t.pts=t.dts+t.cts,t.data);if(t.isKeyframe)if(this.isH264){var r=new Uint8Array(this.sps.byteLength+this.pps.byteLength);r.set(this.sps,0),r.set(this.pps,this.sps.byteLength);var n=new Uint8Array(r.byteLength+i.byteLength);n.set(r,0),n.set(i,r.byteLength),t.data=n}else if(this.isH265){var a=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);a.set(this.vps,0),a.set(this.sps,this.vps.byteLength),a.set(this.pps,this.vps.byteLength+this.sps.byteLength),n=new Uint8Array(a.byteLength+i.byteLength),n.set(a,0),n.set(i,a.byteLength),t.data=n}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.tagName,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, isRecording is false ")}},{key:"getTotalDuration",value:function(){return this.totalDuration/1e3}},{key:"getType",value:function(){return b}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}},{key:"stopRecordAndSave",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:q,i=1<arguments.length?arguments[1]:void 0;return new Promise((function(r,n){if(!e.isRecording)return e.player.debug.error(e.tagName,"stop recording fail, isRecording is false "),n("stop recording fail, isRecording is false ");if(0===e.bufferList.length)return e.player.debug.error(e.tagName,"stop recording fail, this.bufferList.length is 0 "),n("stop recording fail, this.bufferList.length is 0 ");if(i&&e.setFileName(i),n=u({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),n=Ni.generateInitSegment({timescale:1e3,duration:e.totalDuration},[n],e.totalByteLength),e.player.debug.log(e.tagName,"stop recording"),n=new Blob([n],{type:"application/octet-stream"}),"blob"===t)r(n),e.player.emit(N.recordBlob,n);else{r(),r=(e.fileName||We())+"."+b;var a=window.URL.createObjectURL(n),s=window.document.createElement("a");s.download=r,s.href=a,r=window.document.createEvent("MouseEvents"),r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((function(){window.URL.revokeObjectURL(a)}),Ze()?1e3:0)}e._reset(),e.player.emit(N.recording,!1)}))}}])}(ji),zi=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return y(e,null,[{key:"getLoaderFactory",value:function(e){return e.recordType===b&&(e.useWasm||e.useMSE||e.useWCS)?Gi:Ui}}])}(),Hi=function(){function e(t){var i=this;A(this,e),this.player=t,this.destroyResolve=null,this.decoderWorker=new Worker(t._opt.decoder),this._initDecoderWorker(),t.debug.log("decoderWorker","init"),t.on(N.visibilityChange,(function(){i.updateWorkConfig({key:"visibility",value:t.visibility})}))}return y(e,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,i){e.player.loaded?(e.player.debug.log("decoderWorker","has loaded and post message to destroy"),e.decoderWorker.postMessage({cmd:"close"}),e.destroyResolve=t):(e.player.debug.log("decoderWorker","has not loaded and destroy directly"),e._destroy(),t())}))}},{key:"_destroy",value:function(){this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker=null),this.player.debug.log("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null)}},{key:"_initDecoderWorker",value:function(){var e=this,t=this.player,r=t.debug;d(t.events),this.decoderWorker.onmessage=function(t){var n=t.data;switch(n.cmd){case B:r.log("decoderWorker","onmessage:",B),e.decoderWorker&&e._initWork(),e.player.loaded||e.player.emit(N.load),e.player.emit(N.decoderWorkerInit);break;case F:r.log("decoderWorker","onmessage:",F,n.code),e.player._times.decodeStart||(e.player._times.decodeStart=We()),e.player.video.updateVideoInfo({encTypeCode:n.code});break;case j:r.log("decoderWorker","onmessage:",j,n.codecId),e.player.recorder&&e.player.recorder.initMetaData(n.buffer,n.codecId);break;case O:r.log("decoderWorker","onmessage:",O,n.code),e.player.audio&&e.player.audio.updateAudioInfo({encTypeCode:n.code});break;case P:r.log("decoderWorker","onmessage:",P,"width:".concat(n.w,",height:")+n.h),e.player.video.updateVideoInfo({width:n.w,height:n.h}),e.player._opt.openWebglAlignment||n.w/2%4==0||e.player.getRenderType()!==_?(e.player.video.initCanvasViewSize(),e.player._opt.playType===v&&(e.player.video.initFps(),e.player.video.initVideoDelay())):e.player.emit(H.webglAlignmentError);break;case M:r.log("decoderWorker","onmessage:",M,"channels:".concat(n.channels,",sampleRate:")+n.sampleRate),2<n.channels?(e.player.emit(N.error,H.audioChannelError),e.player.emit(H.audioChannelError,"audio channel is ".concat(n.channels,", max is 2"))):e.player.audio&&(e.player.audio.updateAudioInfo(n),e.player._opt.playType===s?e.player.audio.initScriptNode():e.player._opt.playType===v&&e.player.audio.initScriptNodeDelay());break;case"render":if(e.player.video)if(e.player._opt.playType===s){if(Mt(e.player.video.getHasInit()))return void r.warn("decoderWorker","onmessage render but video has not init");e.player.video.render(n),e.player.handleRender(),e.player.emit(N.timeUpdate,n.ts),e.player.updateStats({dfps:!0,buf:n.delay}),e.player._times.videoStart||(e.player._times.videoStart=We(),e.player.handlePlayToRenderTimes())}else e.player._opt.playType===v&&(e.player.updateStats({dfps:!0}),Mt(e.player.playbackPause)?(e.player.playback.isUseLocalCalculateTime&&e.player.playback.increaseLocalTimestamp(),e.player.playback.isUseFpsRender?e.player.video.pushData(n):e.player.video.render$2(n)):!e.player.playback.isPlaybackPauseClearCache&&e.player.playback.isCacheBeforeDecodeForFpsRender&&e.player.playback.isUseFpsRender&&e.player.video.pushData(n));else r.warn("decoderWorker","onmessage render but video is null");break;case"videoNalu":e.player.recorder&&e.player.recorder.isRecording&&e.player._opt.recordType===b&&e.player.recorder.handleAddNaluTrack(n.buffer,n.isIFrame,n.ts,n.cts);break;case"playAudio":e.player.audio?(e.player.playing&&e.player.audio||!e.player.video)&&(e.player._opt.hasVideo||e.player.handleRender(),e.player._opt.playType===s||e.player._opt.playType===v&&(Mt(e.player.playbackPause)||!e.player.playback.isPlaybackPauseClearCache&&e.player.playback.isCacheBeforeDecodeForFpsRender&&e.player.playback.isUseFpsRender))&&e.player.audio.play(n.buffer,n.ts):r.warn("decoderWorker","onmessage playAudio but audio is null");break;case"workerFetch":if(n.type===N.streamSuccess)e.player.stream?e.player.stream.emit(N.streamSuccess):r.warn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(n.type===N.streamRate)e.player.emit(N.kBps,(n.value/1024).toFixed(2));else if(n.type===N.streamEnd)e.player?(n.value===i&&e.player.emit(N.websocketClose),e.player.stream?e.player.stream.emit(N.streamEnd):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(n.type===H.websocketError)e.player&&e.player.stream?e.player.stream.emit(H.websocketError,n.value):r&&r.warn("decoderWorker","onmessage and workerFetch response websocket error but stream is null"),e.player&&e.player.emit(N.error,H.websocketError);else if(n.type===H.fetchError)e.player&&e.player.stream?e.player.stream.emit(H.fetchError,n.value):r&&r.warn("decoderWorker","onmessage and workerFetch response fetch error but stream is null"),e.player&&e.player.emit(N.error,H.fetchError);else if(n.type===N.streamAbps)e.player.updateStats({abps:n.value});else if(n.type===N.streamVbps)e.player._times.demuxStart||(e.player._times.demuxStart=We()),e.player.updateStats({vbps:n.value});else if(n.type===N.streamDts)e.player.updateStats({dts:n.value});else if(n.type===N.netBuf)e.player.updateStats({netBuf:n.value});else if(n.type===N.networkDelayTimeout)e.player.emit(N.networkDelayTimeout,n.value);else if(n.type===N.streamStats){var a=JSON.parse(n.value);e.player.updateStats({workerStats:a})}else n.type===N.websocketOpen&&e.player.emit(N.websocketOpen);break;case"iframeIntervalTs":e.player&&(e.player.videoIframeIntervalTs=n.value);break;case"playbackStreamVideoFps":e.player&&e.player.video&&e.player.video.setStreamFps(n.value);break;case"wasmError":n.message&&-1!==n.message.indexOf("Invalid NAL unit size")&&(e.player.emit(N.error,H.wasmDecodeError),e.player.emit(H.wasmDecodeError));break;case"wasmDecodeVideoNoResponseError":e.player.emit(N.error,H.wasmDecodeVideoNoResponseError),e.player.emit(H.wasmDecodeVideoNoResponseError);break;case"simdH264DecodeVideoWidthIsTooLarge":e.player.emit(N.error,H.simdH264DecodeVideoWidthIsTooLarge),e.player.emit(H.simdH264DecodeVideoWidthIsTooLarge);break;case"wasmWidthOrHeightChange":e.player.emit(N.error,H.wasmWidthOrHeightChange),e.player.emit(H.wasmWidthOrHeightChange);break;case U:r.log("decoderWorker","onmessage:",U),e._destroy();break;default:e.player[n.cmd]&&e.player[n.cmd](n)}}}},{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,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.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,isNakedFlow:this.player._opt.isNakedFlow,checkFirstIFrame:this.player._opt.checkFirstIFrame,isCrypto:this.player._opt.isCrypto};this.decoderWorker.postMessage({cmd:"init",opt:JSON.stringify(e)}),this.player._opt.isCrypto&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}},{key:"decodeVideo",value:function(e,t,i){this.player._opt.playType===s?this._decodeVideo(e,t,i):this.player._opt.playType===v&&(this.player.video.rate>=this.player._opt.playbackForwardMaxRateDecodeIFrame?i&&(this.player.debug.log("decoderWorker","current rate is ".concat(this.player.video.rate,",only decode i frame")),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}},{key:"_decodeVideo",value:function(e,t,i){t={type:2,ts:Math.max(t,0),isIFrame:i},this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}},{key:"_decodeVideoNoDelay",value:function(e,t,i){this.decoderWorker.postMessage({cmd:"videoDecode",buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}},{key:"decodeAudio",value:function(e,t){this.player._opt.playType===s?this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===v&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}},{key:"_decodeAudio",value:function(e,t){t={type:1,ts:Math.max(t,0)},this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}},{key:"_decodeAudioNoDelay",value:function(e,t){this.decoderWorker.postMessage({cmd:"audioDecode",buffer:e,ts:Math.max(t,0)},[e.buffer])}},{key:"updateWorkConfig",value:function(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:"updateConfig",key:e.key,value:e.value})}},{key:"workerFetchStream",value:function(e){var t=this.player["_opt"];t={protocol:t.protocol,isFlv:t.isFlv};this.decoderWorker.postMessage({cmd:"fetchStream",url:e,opt:JSON.stringify(t)})}},{key:"clearWorkBuffer",value:function(){this.decoderWorker.postMessage({cmd:"clearBuffer",needClear:0<arguments.length&&void 0!==arguments[0]&&arguments[0]})}},{key:"workerSendMessage",value:function(e){this.decoderWorker.postMessage({cmd:"sendWsMessage",message:e})}}])}(),Wi=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.stopId=null,i.firstTimestamp=null,i.startTimestamp=null,i.preDelayTimestamp=null,i.preLoopTimestamp=null,i.bufferStartDts=null,i.bufferStartLocalTs=null,i.preIframeTs=null,i.preTimestamp=null,i.preTimestampDuration=0,i.prevPayloadBufferSize=0,i.isStreamTsMoreThanLocal=!1,i.delay=-1,i.pushLatestDelay=-1,i.bufferList=[],i.dropping=!1,i.isPushDropping=!1,i.initInterval(),i.player.debug.log("CommonDemux","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.bufferList=[],this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.bufferStartDts=null,this.bufferStartLocalTs=null,this.preDelayTimestamp=null,this.preLoopTimestamp=null,this.preIframeTs=null,this.preTimestamp=null,this.preTimestampDuration=0,this.prevPayloadBufferSize=0,this.isStreamTsMoreThanLocal=!1,this.delay=-1,this.pushLatestDelay=-1,this.dropping=!1,this.isPushDropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}},{key:"isDropping",value:function(){return this.dropping||this.isPushDropping}},{key:"getDelay",value:function(e){var t,i;return e&&this.player.isDemuxDecodeFirstIIframeInit()?(this.preDelayTimestamp&&this.preDelayTimestamp>e?1e3<this.preDelayTimestamp-e&&this.player.debug.warn("CommonDemux","getDelay and preDelayTimestamp is ".concat(this.preDelayTimestamp," > timestamp is ").concat(e," more than ").concat(this.preDelayTimestamp-e,"ms")):this.firstTimestamp?e&&(t=Date.now()-this.startTimestamp,(i=e-this.firstTimestamp)<=t?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)):(this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1),this.preDelayTimestamp=e,this.delay):-1}},{key:"getDelayNotUpdateDelay",value:function(e){if(e&&this.player.isDemuxDecodeFirstIIframeInit())if(this.preDelayTimestamp&&1e3<this.preDelayTimestamp-e)this.player.debug.warn("CommonDemux","getDelayNotUpdateDelay and preDelayTimestamp is ".concat(this.preDelayTimestamp," > timestamp is ").concat(e," more than ").concat(this.preDelayTimestamp-e,"ms"));else if(this.firstTimestamp){var t,i=-1;return e&&(t=Date.now()-this.startTimestamp,e-=this.firstTimestamp,i=e<=t?t-e:e-t),i}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.debug.log("CommonDemux","init Interval"),this._loop(),this.stopId=setInterval((function(){var t=(new Date).getTime();e.preLoopTimestamp||(e.preLoopTimestamp=t),t-=e.preLoopTimestamp;100<t&&e.player.debug.warn("CommonDemux","loop demux diff time is "+t),e._loop(),e.preLoopTimestamp=(new Date).getTime()}),10)}},{key:"_loop",value:function(){var e,t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,r=this.player._opt.playType===s;if(this.bufferList.length)if(this.isPushDropping)this.player.debug.warn("CommonDemux","_loop isPushDropping is true and bufferList length is "+this.bufferList.length);else if(this.player._opt.useMSE&&this.player.mseDecoder&&this.player.mseDecoder.getSourceBufferUpdating())this.player.debug.warn("CommonDemux","_loop getSourceBufferUpdating is true and bufferList length is "+this.bufferList.length);else if(this.dropping){e=this.bufferList.shift();var n=this.getDelayNotUpdateDelay(e.ts);for(this.player.debug.warn("CommonDemux","_loop is dropping and data.ts is ".concat(e.ts,", data.isIFrame is ").concat(e.isIFrame," tempDelay is ").concat(n,", delay is ")+this.delay);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();e.isIFrame&&n<=this.getNotDroppingDelayTs()&&(this.player.debug.log("CommonDemux","_loop data isIFrame is true and delay is "+this.delay),this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>i+t&&r?this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux","_loop delay is ".concat(this.delay,", set dropping is true")),this.resetAllDelay(),this.dropping=!0):(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay<0&&this.player.debug.error("CommonDemux","_loop delay is ".concat(this.delay," bufferList is ")+this.bufferList);else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}},{key:"_doDecode",value:function(e,t,i,r){var n=this.player,a={ts:i,cts:4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,type:t,isIFrame:!1};2===t&&n._opt.playType===s&&this.calcNetworkDelay(i),n._opt.useWCS&&!n._opt.useOffscreen||n._opt.useMSE?(2===t&&(a.isIFrame=r),this.pushBuffer(e,a)):2===t?n.decoderWorker&&n.decoderWorker.decodeVideo(e,i,r):1===t&&n._opt.hasAudio&&n.decoderWorker&&n.decoderWorker.decodeAudio(e,i)}},{key:"_doDecoderDecode",value:function(e){var t=this.player,i=t.webcodecsDecoder,r=t.mseDecoder;1===e.type?t._opt.hasAudio&&t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts):2===e.type&&(t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE&&r.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts))}},{key:"pushBuffer",value:function(e,t){var i=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,n=this.player._opt.playType===s;if(1===t.type&&Ne(e))this.player.debug.log("CommonDemux","pushBuffer audio ts is ".concat(t.ts,", isAacCodecPacket is ")+Ne(e)),this._doDecoderDecode({ts:t.ts,payload:e,type:1});else{if(0<this.preTimestampDuration&&0<this.preTimestamp&&2===t.type){var a=t.ts-this.preTimestamp;a>=2*this.preTimestampDuration-5&&this.player.debug.error("CommonDemux","pushBuffer video\n ts is ".concat(t.ts,", preTimestamp is ").concat(this.preTimestamp,",\n diff is ").concat(a," and preTimestampDuration is ").concat(this.preTimestampDuration,"\n maybe trigger black screen or flower screen"))}if(0<this.preTimestamp&&t.ts<this.preTimestamp&&2===t.type&&36e5<this.preTimestamp-t.ts&&(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&&0<this.preTimestamp&&2===t.type&&this.player.debug.warn("CommonDemux","pushBuffer video\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 ")+this.prevPayloadBufferSize),n&&this.player.isDemuxDecodeFirstIIframeInit()){var o=this.getDelayNotUpdateDelay(t.ts);this.pushLatestDelay=o;var l=r+i;this.player._opt.useMSE?o>l&&this.delay<l&&0<this.delay&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&!1===this.player.mseDecoder.getSourceBufferUpdating()&&(this.player.debug.warn("CommonDemux","useMSE, pushLatestDelay is ".concat(o," > ").concat(r+i,", bufferList is ").concat(this.bufferList.length,", delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2()):o>l&&this.delay<l&&0<this.delay&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux","useWCS, pushLatestDelay is ".concat(o," > ").concat(r+i,",bufferList is ").concat(this.bufferList.length,", delay is ").concat(this.delay," and dropBuffer$2()")),this.dropBuffer$2())}2===t.type&&(0<this.preTimestamp&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts),1===t.type?this.bufferList.push({ts:t.ts,payload:e,type:1}):2===t.type&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:2,isIFrame:t.isIFrame})}}},{key:"dropBuffer$2",value:function(){var e,t,i;0<this.bufferList.length&&(this.isPushDropping=!0,0<=(e=this.bufferList.findIndex((function(e){return Pt(e.isIFrame)&&2===e.type})))?(this.bufferList=this.bufferList.slice(e),t=this.bufferList.shift(),i=this.getDelayNotUpdateDelay(t.ts),this._doDecoderDecode(t),this.isPushDropping=!1,this.player.debug.log("CommonDemux","dropBuffer$2() iFrameIndex is ".concat(e,",and bufferList length is ").concat(this.bufferList.length," and tempDelay is ").concat(i," ,delay is ").concat(this.delay," "))):this.isPushDropping=!1),0===this.bufferList.length&&(this.isPushDropping=!1)}},{key:"clearBuffer",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.player.debug.log("CommonDemux","clearBuffer,buffer length is ".concat(this.bufferList.length,", need clear is ")+e),e&&(this.bufferList=[]),this.resetAllDelay(),this.dropping=!0}},{key:"calcNetworkDelay",value:function(e){var t,i,r;this.player.isDemuxDecodeFirstIIframeInit()&&0<e&&(null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=We()):e<this.bufferStartDts&&(this.player.debug.warn("CommonDemux","calcNetworkDelay dts is ".concat(e," and bufferStartDts is ")+this.bufferStartDts),this.bufferStartDts=e,this.bufferStartLocalTs=We()),(r=(t=e-this.bufferStartDts)<(i=We()-this.bufferStartLocalTs)?i-t:0)>this.player._opt.networkDelay&&this.player._opt.playType===s&&(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(i," ,delay is ").concat(r,", _opt.networkDelay is ")+this.player._opt.networkDelay),this.player.emit(N.networkDelayTimeout,r)),this.player.updateStats({netBuf:r}))}},{key:"calcIframeIntervalTimestamp",value:function(e){var t;null===this.preIframeTs?this.preIframeTs=e:this.preIframeTs<e&&(t=e-this.preIframeTs,this.player&&(this.player.videoIframeIntervalTs=t),this.preIframeTs=e)}},{key:"getNotDroppingDelayTs",value:function(){return this.player._opt.videoBuffer+this.player._opt.videoBufferDelay/2}},{key:"getMaxDelayTs",value:function(){return this.player._opt.videoBuffer+this.player._opt.videoBufferDelay}},{key:"getPushLatestDelay",value:function(){return this.pushLatestDelay}},{key:"hasIframeInBufferList",value:function(){return this.bufferList.some((function(e){return 2===e.type&&e.isIFrame}))}},{key:"getInputByteLength",value:function(){return 0}},{key:"getIsStreamTsMoreThanLocal",value:function(){return this.isStreamTsMoreThanLocal}},{key:"close",value:function(){}},{key:"reset",value:function(){}}])}(e),Vi=[[Uint8Array,Int8Array],[Uint16Array,Int16Array],[Uint32Array,Int32Array,Float32Array],[Float64Array]],Ki=Symbol(32),qi=Symbol(16),Qi=Symbol(8),Yi=new Map;Vi.forEach((function(e,t){return e.forEach((function(e){return Yi.set(e,t)}))}));var Ji=function(){function e(t){A(this,e),this.g=t,this.consumed=0,t&&(this.need=t.next().value)}return y(e,[{key:"fillFromReader",value:function(e){return t=this,n=c().mark((function t(){var i,r,n;return c().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,e.read();case 2:return i=t.sent,r=i.done,n=i.value,t.abrupt("return",r?void this.close():(this.write(n),this.fillFromReader(e)));case 6:case"end":return t.stop()}}),t,this)})),new(r=(r=i=void 0)||Promise)((function(e,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(t){var i;t.done?e(t.value):((i=t.value)instanceof r?i:new r((function(e){e(i)}))).then(s,o)}l((n=n.apply(t,i||[])).next())}));var t,i,r,n}},{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){var t=this;return new Promise((function(i,r){if(t.resolve)return r("last read not complete yet");t.resolve=function(e){delete t.resolve,delete t.need,i(e)},t.demand(e,!0)}))}},{key:"readU32",value:function(){return this.read(Ki)}},{key:"readU16",value:function(){return this.read(qi)}},{key:"readU8",value:function(){return this.read(Qi)}},{key:"close",value:function(){this.g&&this.g.return()}},{key:"flush",value:function(){if(this.buffer&&this.need){var e=null,t=this.buffer.subarray(this.consumed),i=0,r=function(e){return t.length<(i=e)};if("number"==typeof this.need){if(r(this.need))return;e=t.subarray(0,i)}else if(this.need instanceof ArrayBuffer){if(r(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}else if(this.need===Ki){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===qi){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===Qi){if(r(1))return;e=t[0]}else if(Yi.has(this.need.constructor)){if(r(this.need.length<<Yi.get(this.need.constructor)))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"));return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}}},{key:"write",value:function(e){e instanceof ArrayBuffer?this.malloc(e.byteLength).set(new Uint8Array(e)):this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),(this.g||this.resolve)&&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,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{var r=new Uint8Array(i);r.set(this.buffer),this.buffer=r}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}])}();Ji.U32=Ki,Ji.U16=qi,Ji.U8=Qi;var Xi,$i="application/json, text/javascript",Zi="text/html",er=/^(?:text|application)\/xml/i,tr=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,ir=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,rr=/^\s*$/,nr={},ar={},sr="",or={type:"GET",beforeSend:lr,success:lr,error:lr,complete:lr,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:$i,xml:"application/xml, text/xml",html:Zi,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:lr,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function lr(){}function cr(e,t){"object"==m(e)&&(t=e,e=void 0);var i,r=mr({},t=t||{});for(i in or)void 0===r[i]&&(r[i]=or[i]);try{var n={},a=new Promise((function(e,t){n.resolve=e,n.reject=t}));a.resolve=n.resolve,a.reject=n.reject,r.promise=a}catch(e){r.promise={resolve:lr,reject:lr}}a=ir.exec(window.location.href.toLowerCase())||[];var s,o,l,c,u,d=(r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//"),r.url),h=(r.crossDomain||(r.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(r.url)&&RegExp.$2!==window.location.href),r.dataType);if("jsonp"===h)return/=\?/.test(r.url)||(a=(r.jsonp||"callback")+"=?",r.url=pr(r.url,a)),l=(s=r).jsonpCallback||"jsonp"+vr(),c=window.document.createElement("script"),u={abort:function(){l in window&&(window[l]=lr)}},a=window.document.getElementsByTagName("head")[0]||window.document.documentElement,c.onerror=function(e){e=e,window.clearTimeout(o),u.abort(),hr(e.type,u,e.type,s),f()},window[l]=function(e){window.clearTimeout(o),ur(e,u,s),f()},gr(s),c.src=s.url.replace(/=\?/,"="+l),c.src=pr(c.src,"_="+(new Date).getTime()),c.async=!0,s.scriptCharset&&(c.charset=s.scriptCharset),a.insertBefore(c,a.firstChild),0<s.timeout&&(o=window.setTimeout((function(){u.abort(),hr("timeout",u,"timeout",s),f()}),s.timeout)),s.promise.abort=function(){u.abort()},s.promise.xhr=u,s.promise;function f(){c.clearAttributes?c.clearAttributes():c.onload=c.onreadystatechange=c.onerror=null,c.parentNode&&c.parentNode.removeChild(c),c=null,delete window[l]}gr(r);var p=r.accepts[h]||r.accepts["*"],g={};/^([\w-]+:)\/\//.test(r.url)?RegExp.$1:window.location.protocol;var A,y=or.xhr();r.crossDomain||g["X-Requested-With"]||(g["X-Requested-With"]="XMLHttpRequest"),r.ifModified&&(nr[d]&&(g["If-Modified-Since"]=nr[d]),ar[d])&&(g["If-None-Match"]=ar[d]),p&&(-1<(g.Accept=p).indexOf(",")&&(p=p.split(",",2)[0]),y.overrideMimeType)&&y.overrideMimeType(p),p=!/^(?:GET|HEAD)$/.test(r.type.toUpperCase()),(r.data&&p&&!1!==r.contentType||t.contentType)&&(g["Content-Type"]=r.contentType),!1!==r.cache||p||(r.url=(t=/([?&])_=[^&]*/).test(d)?d.replace(t,"$1_="+vr()):d+(/\?/.test(d)?"&":"?")+"_="+vr()),r.headers=mr(g,r.headers||{}),y.onreadystatechange=function(){if(4===y.readyState){clearTimeout(A);var e,t=!1;if(200<=y.status&&y.status<300||304===y.status){sr=y.getAllResponseHeaders(),r.ifModified&&((i=fr("Last-Modified"))&&(nr[d]=i),i=fr("etag"))&&(ar[d]=i),h=h||(i=y.getResponseHeader("content-type"))&&(i===Zi?"html":i===$i?"json":er.test(i)&&"xml")||"text",e=y.responseText;try{"xml"===h?e=y.responseXML:"json"===h&&(e=rr.test(e)?null:JSON.parse(e))}catch(e){t=e}t?hr(t,"parseerror",y,r):ur(e,y,r)}else hr(null,"error",y,r)}var i},p=!("async"in r)||r.async;if(y.open(r.type,r.url,p,r.username,r.password),r.xhrFields)for(var v in r.xhrFields)y[v]=r.xhrFields[v];for(v in r.mimeType&&y.overrideMimeType&&y.overrideMimeType(r.mimeType),r.headers)void 0!==r.headers[v]&&y.setRequestHeader(v,r.headers[v]+"");return!1===function(e){var t=e.context;if(!1===e.beforeSend.call(t,y,e))return!1}(r)?(y.abort(),!1):(0<r.timeout&&(A=window.setTimeout((function(){y.onreadystatechange=lr,y.abort(),hr(null,"timeout",y,r)}),r.timeout)),y.send(r.data||null),r.promise.abort=function(){y.abort()},r.promise)}function ur(e,t,i){var r=i.context,n="success";i.success.call(r,e,n,t),i.promise.resolve(e,n,t),dr(n,t,i)}function dr(e,t,i){var r=i.context;i.complete.call(r,t,e)}function hr(e,t,i,r){var n=r.context;r.error.call(n,i,t,e),r.promise.reject(i,t,e),dr(t,i,r)}function fr(e){var t;if(!Xi){for(Xi={};t=tr.exec(sr);)Xi[t[1].toLowerCase()]=t[2];t=Xi[e.toLowerCase()]}return null===t?null:t}function pr(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function gr(e){var t,i;!Ar(e)||e.data instanceof FormData||!e.processData||(e.data=(t=e.data,(i=[]).add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},function e(t,i,r,n){var a=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(i);for(var s in i){var o=i[s];n&&(s=r?n:n+"["+(a?"":s)+"]"),!n&&a?t.add(o.name,o.value):(r?a:Ar)(o)?e(t,o,r,s):t.add(s,o)}}(i,t,void 0),i.join("&").replace("%20","+"))),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=pr(e.url,e.data))}function mr(e){for(var t=Array.prototype.slice.call(arguments,1),i=0,r=t.length;i<r;i++){var n,a=t[i]||{};for(n in a)a.hasOwnProperty(n)&&void 0!==a[n]&&(e[n]=a[n])}return e}function Ar(e){var t=m(e);return"function"==t||"object"==t&&!!e}function yr(e){return"function"==typeof e}function vr(){return(new Date).getTime()}function br(e){return parseInt(e)===e}function wr(e){if(br(e.length)){for(var t=0;t<e.length;t++)if(!br(e[t])||e[t]<0||255<e[t])return;return 1}}function kr(e,t){if(e.buffer&&"Uint8Array"===e.name)return t?e.slice?e.slice():Array.prototype.slice.call(e):e;if(Array.isArray(e)){if(wr(e))return new Uint8Array(e);throw new Error("Array contains invalid value: "+e)}if(br(e.length)&&wr(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Er(e){return new Uint8Array(e)}function Tr(e,t,i,r,n){null==r&&null==n||(e=e.slice?e.slice(r,n):Array.prototype.slice.call(e,r,n)),t.set(e,i)}cr.get=function(e,t,i,r){return yr(t)&&(r=r||i,i=t,t=void 0),cr({url:e,data:t,success:i,dataType:r})},cr.post=function(e,t,i,r){return yr(t)&&(r=r||i,i=t,t=void 0),cr({type:"POST",url:e,data:t,success:i,dataType:r})},cr.getJSON=function(e,t,i){return yr(t)&&(i=t,t=void 0),cr({url:e,data:t,success:i,dataType:"json"})},cr.ajaxSetup=function(e,t){return t?mr(mr(e,or),t):mr(or,e)};var Sr,_r={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i<e.length;){var r=e.charCodeAt(i++);37===r?(t.push(parseInt(e.substr(i,2),16)),i+=2):t.push(r)}return kr(t)},fromBytes:function(e){for(var t=[],i=0;i<e.length;){var r=e[i];r<128?(t.push(String.fromCharCode(r)),i++):191<r&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Cr=(Sr="0123456789abcdef",{toBytes:function(e){for(var t=[],i=0;i<e.length;i+=2)t.push(parseInt(e.substr(i,2),16));return t},fromBytes:function(e){for(var t=[],i=0;i<e.length;i++){var r=e[i];t.push(Sr[(240&r)>>4]+Sr[15&r])}return t.join("")}}),Rr={16:10,24:12,32:14},Dr=[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],xr=[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],Lr=[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],Ir=[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],Br=[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],Pr=[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],Mr=[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],Or=[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],Fr=[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],jr=[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],Ur=[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],Nr=[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],Gr=[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],zr=[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],Hr=[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 Wr(e){for(var t=[],i=0;i<e.length;i+=4)t.push(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]);return t}function Vr(e){if(!(this instanceof Vr))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:kr(e,!0)}),this._prepare()}function Kr(e){if(!(this instanceof Kr))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Vr(e)}function qr(e,t){if(!(this instanceof qr))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=Er(16);this._lastCipherblock=kr(t,!0),this._aes=new Vr(e)}function Qr(e,t,i){if(!(this instanceof Qr))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=Er(16);this.segmentSize=i=i||1,this._shiftRegister=kr(t,!0),this._aes=new Vr(e)}function Yr(e,t){if(!(this instanceof Yr))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=Er(16);this._lastPrecipher=kr(t,!0),this._lastPrecipherIndex=16,this._aes=new Vr(e)}function Jr(e){if(!(this instanceof Jr))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0!==e?e||1:e)?(this._counter=Er(16),this.setValue(e)):this.setBytes(e)}function Xr(e,t){if(!(this instanceof Xr))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Jr||(t=new Jr(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Vr(e)}Vr.prototype._prepare=function(){var e=Rr[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var i,r=4*(e+1),n=this.key.length/4,a=Wr(this.key);for(t=0;t<n;t++)this._Ke[i=t>>2][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var s,o=0,l=n;l<r;){if(s=a[n-1],a[0]^=xr[s>>16&255]<<24^xr[s>>8&255]<<16^xr[255&s]<<8^xr[s>>24&255]^Dr[o]<<24,o+=1,8!=n)for(t=1;t<n;t++)a[t]^=a[t-1];else{for(t=1;t<n/2;t++)a[t]^=a[t-1];for(s=a[n/2-1],a[n/2]^=xr[255&s]^xr[s>>8&255]<<8^xr[s>>16&255]<<16^xr[s>>24&255]<<24,t=n/2+1;t<n;t++)a[t]^=a[t-1]}for(t=0;t<n&&l<r;)this._Ke[c=l>>2][u=l%4]=a[t],this._Kd[e-c][u]=a[t++],l++}for(var c=1;c<e;c++)for(var u=0;u<4;u++)s=this._Kd[c][u],this._Kd[c][u]=Nr[s>>24&255]^Gr[s>>16&255]^zr[s>>8&255]^Hr[255&s]},Vr.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,i=[0,0,0,0],r=Wr(e),n=0;n<4;n++)r[n]^=this._Ke[0][n];for(var a=1;a<t;a++){for(n=0;n<4;n++)i[n]=Ir[r[n]>>24&255]^Br[r[(n+1)%4]>>16&255]^Pr[r[(n+2)%4]>>8&255]^Mr[255&r[(n+3)%4]]^this._Ke[a][n];r=i.slice()}var s,o=Er(16);for(n=0;n<4;n++)s=this._Ke[t][n],o[4*n]=255&(xr[r[n]>>24&255]^s>>24),o[4*n+1]=255&(xr[r[(n+1)%4]>>16&255]^s>>16),o[4*n+2]=255&(xr[r[(n+2)%4]>>8&255]^s>>8),o[4*n+3]=255&(xr[255&r[(n+3)%4]]^s);return o},Vr.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,i=[0,0,0,0],r=Wr(e),n=0;n<4;n++)r[n]^=this._Kd[0][n];for(var a=1;a<t;a++){for(n=0;n<4;n++)i[n]=Or[r[n]>>24&255]^Fr[r[(n+3)%4]>>16&255]^jr[r[(n+2)%4]>>8&255]^Ur[255&r[(n+1)%4]]^this._Kd[a][n];r=i.slice()}var s,o=Er(16);for(n=0;n<4;n++)s=this._Kd[t][n],o[4*n]=255&(Lr[r[n]>>24&255]^s>>24),o[4*n+1]=255&(Lr[r[(n+3)%4]>>16&255]^s>>16),o[4*n+2]=255&(Lr[r[(n+2)%4]>>8&255]^s>>8),o[4*n+3]=255&(Lr[255&r[(n+1)%4]]^s);return o},Kr.prototype.encrypt=function(e){if((e=kr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Er(e.length),i=Er(16),r=0;r<e.length;r+=16)Tr(e,i,0,r,r+16),Tr(i=this._aes.encrypt(i),t,r);return t},Kr.prototype.decrypt=function(e){if((e=kr(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=Er(e.length),i=Er(16),r=0;r<e.length;r+=16)Tr(e,i,0,r,r+16),Tr(i=this._aes.decrypt(i),t,r);return t},qr.prototype.encrypt=function(e){if((e=kr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Er(e.length),i=Er(16),r=0;r<e.length;r+=16){Tr(e,i,0,r,r+16);for(var n=0;n<16;n++)i[n]^=this._lastCipherblock[n];this._lastCipherblock=this._aes.encrypt(i),Tr(this._lastCipherblock,t,r)}return t},qr.prototype.decrypt=function(e){if((e=kr(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=Er(e.length),i=Er(16),r=0;r<e.length;r+=16){Tr(e,i,0,r,r+16);i=this._aes.decrypt(i);for(var n=0;n<16;n++)t[r+n]=i[n]^this._lastCipherblock[n];Tr(e,this._lastCipherblock,0,r,r+16)}return t},Qr.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t=kr(e,!0),i=0;i<t.length;i+=this.segmentSize){for(var r=this._aes.encrypt(this._shiftRegister),n=0;n<this.segmentSize;n++)t[i+n]^=r[n];Tr(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Tr(t,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return t},Qr.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t=kr(e,!0),i=0;i<t.length;i+=this.segmentSize){for(var r=this._aes.encrypt(this._shiftRegister),n=0;n<this.segmentSize;n++)t[i+n]^=r[n];Tr(this._shiftRegister,this._shiftRegister,0,this.segmentSize),Tr(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return t},Yr.prototype.decrypt=Yr.prototype.encrypt=function(e){for(var t=kr(e,!0),i=0;i<t.length;i++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[i]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},Jr.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");if(e>Number.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;0<=t;--t)this._counter[t]=e%256,e=parseInt(e/256)},Jr.prototype.setBytes=function(e){if(16!=(e=kr(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Jr.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}},Xr.prototype.decrypt=Xr.prototype.encrypt=function(e){for(var t=kr(e,!0),i=0;i<t.length;i++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[i]^=this._remainingCounter[this._remainingCounterIndex++];return t};var $r={AES:Vr,Counter:Jr,ModeOfOperation:{ecb:Kr,cbc:qr,cfb:Qr,ofb:Yr,ctr:Xr},utils:{hex:Cr,utf8:_r},padding:{pkcs7:{pad:function(e){var t=16-(e=kr(e,!0)).length%16,i=Er(e.length+t);Tr(e,i);for(var r=e.length;r<i.length;r++)i[r]=t;return i},strip:function(e){if((e=kr(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(16<t)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,r=0;r<t;r++)if(e[i+r]!==t)throw new Error("PKCS#7 invalid padding byte");var n=Er(i);return Tr(e,n,0,0,i),n}}},_arrayTest:{coerceArray:kr,createArray:Er,copyArray:Tr}},Zr=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.input=new Ji(i.demux()),e.debug.log("FlvDemux","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this.input=null,this.player.debug.log("FlvDemux","destroy")}},{key:"dispatch",value:function(e){this.input?this.input.write(e):this.player&&this.player.debug.warn("FlvDemux","dispatch() this.input is null")}},{key:"demux",value:c().mark((function e(){var t,i,r,n,a,s,o,l,u,d,h,f,p;return c().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,9;case 2:t=new ArrayBuffer(4),i=new Uint8Array(t),r=new Uint32Array(t),n=this.player;case 3:if(this.input){e.next=5;break}return e.abrupt("return");case 5:return i[3]=0,e.next=8,15;case 8:return a=e.sent,s=a[4],i[0]=a[7],i[1]=a[6],i[2]=a[5],o=r[0],i[0]=a[10],i[1]=a[9],i[2]=a[8],i[3]=a[11],l=r[0],e.next=15,o;case 15:if(u=e.sent.slice(),n){e.next=18;break}return e.abrupt("return");case 18:e.t0=s,e.next=8===e.t0?21:9===e.t0?23:25;break;case 21:return n._opt.hasAudio&&(n.updateStats({abps:u.byteLength}),0<u.byteLength)&&this._doDecode(u,1,l),e.abrupt("break",26);case 23:return n._opt.hasVideo&&(n.updateStats({vbps:u.byteLength,dts:l}),d=u[0]>>4&15,h=1==d,1!=d&&2!=d&&n.debug.warn("FlvDemux","frameType is ".concat(d," is not keyFrame or interFrame")),h&&this.calcIframeIntervalTimestamp(l),0<u.byteLength&&(r[0]=u[4],r[1]=u[3],r[2]=u[2],r[3]=0,f=r[0],n._times.demuxStart||(n._times.demuxStart=We()),p=u,n._opt.isCrypto&&(n._opt.cryptoKey&&0<n._opt.cryptoKey.byteLength&&n._opt.cryptoIV&&0<n._opt.cryptoIV.byteLength?p=function(e,t,i){t=new Uint8Array(t),i=new Uint8Array(i);for(var r,n=e.byteLength,a=5;a<n;){if(r=(r=e.slice(a,a+4))[3]|r[2]<<8|r[1]<<16|r[0]<<24,r>n)break;var s=e[a+4];if(1==(s&=31)||5==s){var o=e.slice(a+4+2,a+4+r),l=new $r.ModeOfOperation.ctr(t,new $r.Counter(i));s=l.decrypt(o),l=null,e.set(s,a+4+2)}a=a+4+r}return e}(u,n._opt.cryptoKey,n._opt.cryptoIV):n.debug.error("FlvDemux","cryptoKey.length is ".concat(n._opt.cryptoKey&&n._opt.cryptoKey.byteLength," or cryptoIV.length is ").concat(n._opt.cryptoIV&&n._opt.cryptoIV.byteLength," null"))),this._doDecode(p,2,l,h,f))),e.abrupt("break",26);case 25:n.debug.log("FlvDemux","demux() type is "+s);case 26:e.next=3;break;case 28: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?this.input.buffer.byteLength:e}}])}(Wi),en=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),e.debug.log("M7sDemux","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(t,"destroy",this,3)([]),this.player.debug.log("M7sDemux","destroy")}},{key:"dispatch",value:function(e){var t=this.player,i=new DataView(e),r=i.getUint8(0),n=i.getUint32(1,!1);switch(r){case 1:if(t._opt.hasAudio){var a=new Uint8Array(e,5);t.updateStats({abps:a.byteLength}),0<a.byteLength&&this._doDecode(a,r,n)}break;case 2:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=We()),5<i.byteLength){var s=new Uint8Array(e,5),o=i.getUint8(5)>>4==1,l=n;this.player._opt.useMSE&&dt(this.player.mseDecoder.firstRenderTime)&&(l=n-this.player.mseDecoder.firstRenderTime),t.updateStats({vbps:s.byteLength,dts:l}),0<s.byteLength&&(o&&this.calcIframeIntervalTimestamp(n),this._doDecode(s,r,n,o))}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}])}(Wi),tn=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),e.debug.log("WebTransportDemux","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.player.debug.log("WebTransportDemux","destroy"),f(t,"destroy",this,3)([])}}])}(Zr),rn=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.name="NakedFlowDemux",i.lastBuf=null,i.vps=null,i.sps=null,i.pps=null,i.streamVideoType=null,i.streamAudioType=null,i.tempNaluBufferList=new Uint8Array(0),i.localDts=0,i.isSendSeqHeader=!1,i.isSendAACSeqHeader=!1,e.debug.log(i.name,"init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){f(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.name,"destroy")}},{key:"dispatch",value:function(e){this.player,e=new Uint8Array(e),this.extractNALu$2(e)}},{key:"addNaluToBuffer",value:function(e){var t=e.byteLength+this.tempNaluBufferList.byteLength;t=new Uint8Array(t);t.set(this.tempNaluBufferList,0),t.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=t}},{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()}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,i,r=0,n=e.byteLength,a=0,s=[];r<n;)switch(t=e[r++],a){case 0:0===t&&(a=1);break;case 1:a=0===t?2:0;break;case 2:case 3:a=0===t?3:(1===t&&r<n&&(e[r],i&&s.push(e.subarray(i,r-a-1)),i=r),0)}return i&&s.push(e.subarray(i,n)),s}},{key:"extractNALu$2",value:function(e){var t=null;if(e&&!(e.byteLength<1)){this.lastBuf?((t=new Uint8Array(e.byteLength+this.lastBuf.length)).set(this.lastBuf),t.set(new Uint8Array(e),this.lastBuf.length)):t=new Uint8Array(e);for(var i=0,r=-1,n=-2,a=new Array,s=0;s<t.length;s+=2){var o=t[s],l=t[s+1];0==r&&0==o&&0==l?a.push(s-1):1==l&&0==o&&0==r&&0==n&&a.push(s-2),n=o,r=l}if(1<a.length)for(var c=0;c<a.length-1;++c){var u=t.subarray(a[c],a[c+1]+1);this.handleNALu(u),i=a[c+1]}else i=a[0];if(0!=i&&i<t.length)this.lastBuf=t.subarray(i);else{this.lastBuf||(this.lastBuf=t);var d=new Uint8Array(this.lastBuf.length+e.byteLength);d.set(this.lastBuf),d.set(new Uint8Array(e),this.lastBuf.length),this.lastBuf=d}}}},{key:"handleNALu",value:function(e){e.byteLength<4?this.player.debug.warn(this.name,"handleNALu nalu byteLength is ".concat(e.byteLength," <= 4")):(e=e.slice(4),this.handleVideoNalu(e))}},{key:"handleVideoNalu",value:function(e){var t=this,i=new Uint8Array(e);if(this.streamVideoType||(this.streamVideoType=function(e){var t=null,i=31&e[0];return(t=7!=i&&8!=i?t:Y)||32!=(i=(126&e[0])>>1)&&33!=i&&34!=i?t:J}(i)),this.streamVideoType===Y){var r=this.handleAddNaluStartCode(i),n=this.extractNALu(r);if(0===n.length)this.player.debug.warn(this.name,"handleVideoNalu","naluList.length === 0");else{var a=[];if(n.forEach((function(e){var i=Ii(e);8===i||7===i?t.handleVideoH264Nalu(e):Pi(i)&&a.push(e)})),1===a.length)this.handleVideoH264Nalu(a[0]);else{var s=function(e){if(0===e.length)return!1;for(var t=Ii(e[0]),i=1;i<e.length;i++)if(t!==Ii(e[i]))return!1;return!0}(a);if(s){var o=Ii(a[0]),l=5===o;this.handleVideoH264NaluList(a,l,o)}else a.forEach((function(e){t.handleVideoH264Nalu(e)}))}}}else this.streamVideoType===J?34===Fi(i)?this.extractH265PPS(i):this.handleVideoH265Nalu(i):this.player.debug.error(this.name," this.streamVideoType is null")}},{key:"extractH264PPS",value:function(e){var t=this;e=this.handleAddNaluStartCode(e),this.extractNALu(e).forEach((function(e){Bi(Ii(e))?t.extractH264SEI(e):t.handleVideoH264Nalu(e)}))}},{key:"extractH265PPS",value:function(e){var t=this;e=this.handleAddNaluStartCode(e),this.extractNALu(e).forEach((function(e){39===Fi(e)?t.extractH265SEI(e):t.handleVideoH265Nalu(e)}))}},{key:"extractH264SEI",value:function(e){var t=this;e=this.handleAddNaluStartCode(e),this.extractNALu(e).forEach((function(e){t.handleVideoH264Nalu(e)}))}},{key:"extractH265SEI",value:function(e){var t=this;e=this.handleAddNaluStartCode(e),this.extractNALu(e).forEach((function(e){t.handleVideoH265Nalu(e)}))}},{key:"handleAddNaluStartCode",value:function(e){var t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}},{key:"handleAudioAACNalu",value:function(e){if(e&&!(e.byteLength<1)){this.streamAudioType||(this.streamAudioType=X.AAC);var t=new Uint8Array(e),i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){var r=(192&i[2])>>6,n=(60&i[2])>>2,a=(1&i[2])<<2|(192&i[3])>>6,s=new Uint8Array([175,0,r<<3|(14&n)>>1,(1&n)<<7|a<<3]);this.isSendAACSeqHeader=!0,this._doDecode(s,1,0,!1,0)}var o=this.getNaluAudioDts(),l=new Uint8Array(t.length+2);l.set([175,1],0),l.set(t,2),this._doDecode(l,1,o,!1,0)}}},{key:"handleAudioG711ANalu",value:function(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=X.ALAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([114],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}},{key:"handleAudioG711UNalu",value:function(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=X.MULAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([130],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}},{key:"handleVideoH264Nalu",value:function(e){var t,i,r,n=Ii(e);switch(n){case 7:this.sps=e;break;case 8:this.pps=e}if(this.isSendSeqHeader)if(Pi(n)){this.player._times.demuxStart||(this.player._times.demuxStart=We());var a=5===n,s=this.getNaluDts(),o=(t=e,(i=[])[0]=a?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=t.byteLength>>24&255,i[6]=t.byteLength>>16&255,i[7]=t.byteLength>>8&255,i[8]=255&t.byteLength,(r=new Uint8Array(i.length+t.byteLength)).set(i,0),r.set(t,i.length),r);this.player.updateStats({vbps:o.byteLength,dts:s}),a&&this.calcIframeIntervalTimestamp(s),this._doDecode(o,2,s,a,0)}else this.player.debug.warn(this.name,"handleVideoH264Nalu is avc seq head nalType is "+n);else if(this.sps&&this.pps){this.isSendSeqHeader=!0;var l=function(e){var t=e,i=t.sps,r=t.pps,n=8+i.byteLength+1+2+r.byteLength,a=!1,s=(e=Ri.parseSPS$2(i),66!==i[3]&&77!==i[3]&&88!==i[3]&&(a=!0,n+=4),new Uint8Array(n)),o=(s[0]=1,s[1]=i[1],s[2]=i[2],s[3]=i[3],s[4]=255,s[5]=225,i.byteLength),l=(s[6]=o>>>8,s[7]=255&o,8);s.set(i,8),s[l+=o]=1,o=r.byteLength,s[l+1]=o>>>8,s[l+2]=255&o,s.set(r,l+3),l+=3+o,a&&(s[l]=252|e.chroma_format_idc,s[l+1]=248|e.bit_depth_luma-8,s[l+2]=248|e.bit_depth_chroma-8,s[l+3]=0,l+=4),o=[23,0,0,0,0],e=new Uint8Array(o.length+s.byteLength);return e.set(o,0),e.set(s,o.length),e}({sps:this.sps,pps:this.pps});this._doDecode(l,2,0,!0,0)}}},{key:"handleVideoH264NaluList",value:function(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=We());var r=this.getNaluDts(),n=(e=e.reduce((function(e,t){e=Li(e),t=Li(t);var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i})),(a=[])[0]=t?23:39,a[1]=1,a[2]=0,a[3]=0,a[4]=0,(s=new Uint8Array(a.length+e.byteLength)).set(a,0),s.set(e,a.length),s);this.player.updateStats({vbps:n.byteLength,dts:r}),t&&this.calcIframeIntervalTimestamp(r),this._doDecode(n,2,r,t,0)}else this.player.debug.warn(this.name,"handleVideoH264NaluList isSendSeqHeader is false");var a,s}},{key:"handleVideoH265Nalu",value:function(e){var t,i,r=Fi(e);switch(r){case 32:this.vps=e;break;case 33:this.sps=e;break;case 34:this.pps=e}if(this.isSendSeqHeader){if(!(32<=r&&r<=40)){this.player._times.demuxStart||(this.player._times.demuxStart=We());var n=16<=r&&r<=21,a=this.getNaluDts(),s=(r=e,(t=[])[0]=n?28:44,t[1]=1,t[2]=0,t[3]=0,t[4]=0,t[5]=r.byteLength>>24&255,t[6]=r.byteLength>>16&255,t[7]=r.byteLength>>8&255,t[8]=255&r.byteLength,(i=new Uint8Array(t.length+r.byteLength)).set(t,0),i.set(r,t.length),i);this.player.updateStats({vbps:s.byteLength,dts:a}),n&&this.calcIframeIntervalTimestamp(a),this._doDecode(s,2,a,n,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;var o=function(e){var t=e,i=(e=t.vps,t.pps),r=t.sps,n={configurationVersion:1},a=function(e){return e=Mi(e),e=new Ci(e),e.readByte(),e.readByte(),e.readBits(4),e.readBits(2),e.readBits(6),{num_temporal_layers:e.readBits(3)+1,temporal_id_nested:e.readBool()}}(e),s=function(e){var t=Mi(e),i=new Ci(t);i.readByte(),i.readByte();i.readBits(4);for(var r=i.readBits(3),n=(e=(i.readBool(),i.readBits(2)),i.readBool()),a=i.readBits(5),s=i.readByte(),o=i.readByte(),l=i.readByte(),c=i.readByte(),u=i.readByte(),d=i.readByte(),h=i.readByte(),f=i.readByte(),p=i.readByte(),g=i.readByte(),m=i.readByte(),A=[],y=[],v=0;v<r;v++)A.push(i.readBool()),y.push(i.readBool());if(0<r)for(var b=r;b<8;b++)i.readBits(2);for(var w=0;w<r;w++)A[w]&&(i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte()),A[w]&&i.readByte();i.readUEG();for(var k,E=i.readUEG(),T=(3==E&&i.readBits(1),i.readUEG()),S=i.readUEG(),_=(i.readBool()&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readUEG()),C=i.readUEG(),R=i.readUEG(),D=i.readBool()?0:r;D<=r;D++)i.readUEG(),i.readUEG(),i.readUEG();if(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG(),i.readBool()&&i.readBool())for(var x=0;x<4;x++)for(var L=0;L<(3===x?2:6);L++)if(i.readBool()){var I=Math.min(64,1<<4+(x<<1));1<x&&i.readSEG();for(var B=0;B<I;B++)i.readSEG()}else i.readUEG();i.readBool(),i.readBool(),i.readBool()&&(i.readByte(),i.readUEG(),i.readUEG(),i.readBool());for(var P=i.readUEG(),M=0,O=0;O<P;O++){var F=!1;if(F=0!==O?i.readBool():F){O===P&&i.readUEG(),i.readBool(),i.readUEG();for(var j=0,U=0;U<=M;U++){var N=i.readBool(),G=!1;N||(G=i.readBool()),(N||G)&&j++}M=j}else{var z=i.readUEG(),H=i.readUEG();M=z+H;for(var W=0;W<z;W++)i.readUEG(),i.readBool();for(var V=0;V<H;V++)i.readUEG(),i.readBool()}}if(i.readBool())for(var K=i.readUEG(),q=0;q<K;q++){for(var Q=0;Q<R+4;Q++)i.readBits(1);i.readBits(1)}var Y=0,J=1,X=1,$=!1,Z=1,ee=1;if(i.readBool(),i.readBool(),i.readBool()){if(i.readBool()&&(0<(k=i.readByte())&&k<16?(J=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][k-1],X=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][k-1]):255===k&&(J=i.readBits(16),X=i.readBits(16))),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(),i.readBool()&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()&&(Z=i.readBits(32),ee=i.readBits(32),i.readBool())&&(i.readUEG(),i.readBool())){var te,ie,re=!1;te=i.readBool(),ie=i.readBool(),(te||ie)&&((re=i.readBool())&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),re&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(var ne=0;ne<=r;ne++){var ae=i.readBool();$=ae;var se=!1,oe=!1;if((se=ae?se:i.readBool())?i.readSEG():oe=i.readBool(),oe||(cpbcnt=i.readUEG()+1),te)for(var le=0;le<1;le++)i.readUEG(),i.readUEG(),re&&(i.readUEG(),i.readUEG());if(ie)for(var ce=0;ce<1;ce++)i.readUEG(),i.readUEG(),re&&(i.readUEG(),i.readUEG())}}i.readBool()&&(i.readBool(),i.readBool(),i.readBool(),Y=i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG())}i.readBool();var ue="hvc1.".concat(a,".1.L").concat(m,".B0"),de=T,he=S,fe=1;return 1!==J&&1!==X&&(fe=J/X),i.destroy(),i=null,{codec_mimetype:ue,level_string:(m/30).toFixed(1),profile_idc:a,bit_depth:_+8,ref_frames:1,chroma_format:E,chroma_format_string: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"}}(E),general_level_idc:m,general_profile_space:e,general_tier_flag:n,general_profile_idc:a,general_profile_compatibility_flags_1:s,general_profile_compatibility_flags_2:o,general_profile_compatibility_flags_3:l,general_profile_compatibility_flags_4:c,general_constraint_indicator_flags_1:u,general_constraint_indicator_flags_2:d,general_constraint_indicator_flags_3:h,general_constraint_indicator_flags_4:f,general_constraint_indicator_flags_5:p,general_constraint_indicator_flags_6:g,min_spatial_segmentation_idc:Y,constant_frame_rate:0,chroma_format_idc:E,bit_depth_luma_minus8:_,bit_depth_chroma_minus8:C,frame_rate:{fixed:$,fps:ee/Z,fps_den:Z,fps_num:ee},sar_ratio:{width:J,height:X},codec_size:{width:de,height:he},present_size:{width:de*fe,height:he}}}(r),o=function(e){e=Mi(e),e=new Ci(e),e.readByte(),e.readByte(),e.readUEG(),e.readUEG(),e.readBool(),e.readBool(),e.readBits(3),e.readBool(),e.readBool(),e.readUEG(),e.readUEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool()&&e.readUEG(),e.readSEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool(),e.readBool();var t=e.readBool(),i=e.readBool(),r=1;return i&&t?r=0:i?r=3:t&&(r=2),{parallelismType:r}}(i);n=Object.assign(n,a,s,o),a=23+(5+e.byteLength)+(5+r.byteLength)+(5+i.byteLength),(s=new Uint8Array(a))[0]=1,s[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,s[2]=n.general_profile_compatibility_flags_1||0,s[3]=n.general_profile_compatibility_flags_2||0,s[4]=n.general_profile_compatibility_flags_3||0,s[5]=n.general_profile_compatibility_flags_4||0,s[6]=n.general_constraint_indicator_flags_1||0,s[7]=n.general_constraint_indicator_flags_2||0,s[8]=n.general_constraint_indicator_flags_3||0,s[9]=n.general_constraint_indicator_flags_4||0,s[10]=n.general_constraint_indicator_flags_5||0,s[11]=n.general_constraint_indicator_flags_6||0,s[12]=60,s[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,s[14]=255&n.min_spatial_segmentation_idc,s[15]=252|3&n.parallelismType,s[16]=252|3&n.chroma_format_idc,s[17]=248|7&n.bit_depth_luma_minus8,s[18]=248|7&n.bit_depth_chroma_minus8,s[19]=0,s[20]=0,s[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,s[22]=3,s[23]=160,s[24]=0,s[25]=1,s[26]=(65280&e.byteLength)>>8,s[27]=(255&e.byteLength)>>0,s.set(e,28),s[23+(5+e.byteLength)+0]=161,s[23+(5+e.byteLength)+1]=0,s[23+(5+e.byteLength)+2]=1,s[23+(5+e.byteLength)+3]=(65280&r.byteLength)>>8,s[23+(5+e.byteLength)+4]=(255&r.byteLength)>>0,s.set(r,23+(5+e.byteLength)+5),s[23+(5+e.byteLength+5+r.byteLength)+0]=162,s[23+(5+e.byteLength+5+r.byteLength)+1]=0,s[23+(5+e.byteLength+5+r.byteLength)+2]=1,s[23+(5+e.byteLength+5+r.byteLength)+3]=(65280&i.byteLength)>>8,s[23+(5+e.byteLength+5+r.byteLength)+4]=(255&i.byteLength)>>0,s.set(i,23+(5+e.byteLength+5+r.byteLength)+5),o=[28,0,0,0,0];return(a=new Uint8Array(o.length+s.byteLength)).set(o,0),a.set(s,o.length),a}({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(o,2,0,!0,0)}}},{key:"getInputByteLength",value:function(){var e=0;return this.lastBuf?this.lastBuf.byteLength:e}}])}(Wi),nn=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt.demuxType))(t)}return y(e,null,[{key:"getLoaderFactory",value:function(e){return"m7s"===e?en:e===k?Zr:e===E?tn:e===T?rn:void 0}}])}(),an=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.hasInit=!1,i.isDecodeFirstIIframe=!1,i.isInitInfo=!1,i.prevTimestamp=null,i.decodeDiffTimestamp=null,i.prevDts=null,i.decoder=null,i.isWidthOrHeightChanged=!1,i.initDecoder(),e.debug.log("Webcodecs","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.decoder&&("closed"!==this.decoder.state&&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("Webcodecs","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._times.videoStart||(this.player._times.videoStart=We(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender(),this.player.updateStats({dfps:!0,buf:this.player.demux&&this.player.demux.delay||0})}},{key:"handleError",value:function(e){this.player.debug.error("Webcodecs","VideoDecoder handleError",e)}},{key:"decodeVideo",value:function(e,t,i,r){if(this.hasInit)if(this.isDecodeFirstIIframe||i||this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false and isIframe is false"),!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){var n=15&e[0],a={};7==n?a=xi(e.slice(5)):12==n&&(a=Oi(e));var s=this.player.video.videoInfo;s&&s.width&&s.height&&a&&a.codecWidth&&a.codecHeight&&(a.codecWidth!==s.width||a.codecHeight!==s.height)&&(this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, old width is ".concat(videoWidth,", old height is ").concat(videoHeight,", new width is ").concat(a.codecWidth,", new height is ").concat(a.codecHeight,", and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emit(N.error,H.wcsWidthOrHeightChange),this.player.emit(H.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, and return");else if(Bt(e))this.player.debug.warn("Webcodecs","decodeVideo and payload is video sequence header so drop this frame");else if(e.byteLength<12)this.player.debug.warn("Webcodecs","decodeVideo and payload is too small , payload length is "+e.byteLength);else{var o=!1,l=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=l,o=!0);var c=l-this.prevTimestamp,u=(c=(((this.decodeDiffTimestamp=c)<5||500<c)&&!o&&this.player.debug.warn("Webcodecs","decodeVideo diff time is ",c),e.slice(5)),new EncodedVideoChunk({data:c,timestamp:t,type:i?"key":"delta"}));this.player.emit(N.timeUpdate,t),this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===b&&this.player.recorder.handleAddNaluTrack(c,i,t,r);try{if(this.isDecodeStateClosed())return void this.player.debug.warn("Webcodecs","VideoDecoder isDecodeStateClosed true");this.decoder.decode(u)}catch(e){this.player.debug.error("Webcodecs","VideoDecoder",e);var d=e.toString();-1===d.indexOf("A key frame is required after configure() or flush()")&&-1===d.indexOf("Cannot call 'decode' on a closed codec")||this.player.emit(H.webcodecsDecodeError)}this.prevTimestamp=(new Date).getTime()}}else this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false");else if(i&&0===e[1]){var h=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:h}),12!=h||"chrome"===(c=$e()).type.toLowerCase()&&107<=c.version){this.player._times.decodeStart||(this.player._times.decodeStart=We());var f=null,p=e.slice(5);7==h?f=function(e){for(var t=e.subarray(1,4),i="avc1.",r=0;r<3;r++){var n=t[r].toString(16);n.length<2&&(n="0"+n),i+=n}return{codec:i,description:e}}(p):12==h&&((u=p).subarray(1,4),f={codec:"hev1.1.6.L120.90",description:u}),this.player.recorder&&this.player._opt.recordType===b&&this.player.recorder.initMetaData(e,h),this.player.debug.log("Webcodecs","decodeVideo and webcodecs configure"),this.decoder.configure(f),this.hasInit=!0}else{var g=$e();this.player.debug.warn("Webcodecs","WebcodecsDecoder not support hevc decode",g.type,g.version),this.emit(H.webcodecsH265NotSupport)}}}},{key:"getDecodeDiffTimes",value:function(){return this.decodeDiffTimestamp}},{key:"isDecodeStateClosed",value:function(){return"closed"===this.decoder.state}}])}(e),sn={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"加载",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活"},on=Object.keys(sn).reduce((function(e,t){return e[t]='\n <i class="jessibuca-icon jessibuca-icon-'.concat(t,'"></i>\n ').concat(sn[t]?'<span class="icon-title-tips"><span class="icon-title">'.concat(sn[t],"</span></span>"):"","\n"),e}),{});function ln(e,t){var i=!1;return e.forEach((function(e){i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function cn(e,t,i){var r=0<arguments.length&&void 0!==e?e:[],n=1<arguments.length&&void 0!==t?t:[],a=2<arguments.length?i:void 0,s=r.length,o=n.length,l=Math.max(s,o),c=2e3,u=Math.ceil(l/c),d=0,h=0;!function e(){for(var t="",i="",o=0;o<c;o++){var l=r[h],f=(l&&(t+='\n <div class="jessibuca-playback-time-minute-one'.concat(l.hasRecord?" active":"").concat(l.isStart?" start":"",'" data-has-record="').concat(l.hasRecord,'"\n data-time="').concat(l.timestamp,'" data-type="').concat(l.dataType,'">\n <span class="jessibuca-playback-time-title-tips ').concat(h>s-60?"jessibuca-playback-time-title-tips-left":"",'"><span class="jessibuca-playback-time-title">').concat(l.title,"</span></span>\n </div>\n ")),n[h]);f&&(i+='\n <div class="jessibuca-playback-time-hour" data-hour="'.concat(f.hour,'" data-min="').concat(f.min,'" data-second="').concat(f.second,'"><span class="jessibuca-playback-time-hour-text">').concat(f.title,"</span></div>\n ")),h+=1}t&&a.$playbackTimeListOne.insertAdjacentHTML("beforeend",t),i&&a.$playbackTimeListSecond.insertAdjacentHTML("beforeend",i),(d+=1)<u&&(a.rafId=window.requestAnimationFrame(e))}()}function un(e,t){cn(function(e){for(var t,i,r,n=0<arguments.length&&void 0!==e?e:[],a=[],s=(n[0]||{}).startTimestamp,o=0;o<1440;o++){var l=o%60==0,c=!1;s&&(c=ln(n,(t=s,i=o,r=void 0,r=Math.floor(i/60)%60,i=Math.floor(i%60),new Date(t).setHours(r,i,0,0)))),a.push({title:function(e,t){var i,r="";return-1<e&&(i=Math.floor(e/60)%60,e%=60,e=Math.round(e),r=i<10?"0"+i+":":i+":",e<10&&(r+="0"),r+=e,ct(t)||(t<10&&(t="0"+t),r+=":"+t)),r}(o),timestamp:o,dataType:"min",hasRecord:c,isStart:l})}return a}(e),function(){for(var e=[],t=0;t<24;t++){var i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}var dn=function(e,t){var i=e["events"]["proxy"],r=document.createElement("object");r.setAttribute("aria-hidden","true"),r.setAttribute("tabindex",-1),r.type="text/html",r.data="about:blank",Ke(r,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});var n=e.width,a=e.height,s=at((function(){e.width===n&&e.height===a||(n=e.width,a=e.height,e.emit(N.resize),u())}),500),o=(i(r,"load",(function(){i(r.contentDocument.defaultView,"resize",(function(){s()}))})),e.$container.appendChild(r),e.on(N.destroy,(function(){e.$container.removeChild(r)})),e.on(N.volumechange,(function(){var i,r,n;0===(i=e.volume)?(Ke(t.$volumeOn,"display","none"),Ke(t.$volumeOff,"display","flex"),Ke(t.$volumeHandle,"top","48px")):t.$volumeHandle&&t.$volumePanel&&(r=qe(t.$volumePanel,"height")||60,n=qe(t.$volumeHandle,"height"),Ke(t.$volumeHandle,"top",r-(r-n)*i-n+"px"),Ke(t.$volumeOn,"display","flex"),Ke(t.$volumeOff,"display","none")),t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*i))})),e.on(N.loading,(function(i){Ke(t.$loading,"display",i?"flex":"none"),(Mt(e._opt.backgroundLoadingShow)&&Pt(i)||Mt(i))&&Ke(t.$poster,"display","none"),i&&Ke(t.$playBig,"display","none"),Xe()||i||(t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",Ke(t.$loadingBg,"display","none"))})),function(t){e.fullscreen&&kt(t)!==e.$container||l()}),l=function(i){i=ut(i)?i:e.fullscreen,Ke(t.$fullscreenExit,"display",i?"flex":"none"),Ke(t.$fullscreen,"display",i?"none":"flex")},c=function(){return e._opt.playType===v&&e._opt.playbackConfig.showControl},u=function(i){Xe()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((function(){if(e.fullscreen){var r=c()?48:38,n=e.height/2-e.width+r/2,a=e.height/2-r/2;t.$controls.style.transform="translateX(".concat(-n,"px) translateY(-").concat(a,"px) rotate(-90deg)")}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)";i&&i()}),10)};try{Ue.on("change",o),e.events.destroys.push((function(){Ue.off("change",o)}))}catch(e){}e.on(N.webFullscreen,(function(e){Xe()&&(l(e),u((function(){h()})))})),e.on(N.recording,(function(){e.playing&&(Ke(t.$record,"display",e.recording?"none":"flex"),Ke(t.$recordStop,"display",e.recording?"flex":"none"),e._opt.hasControl||e._opt.isShowRecordingUI)&&Ke(t.$recording,"display",e.recording?"flex":"none")})),e.on(N.recordingTimestamp,(function(e){t.$recordingTime&&(t.$recordingTime.innerHTML=gt(e))})),e.on(N.zooming,(function(){e.playing&&(Ke(t.$zoom,"display",e.zooming?"none":"flex"),Ke(t.$zoomStop,"display",e.zooming?"flex":"none"),e._opt.hasControl||e._opt.isShowZoomingUI)&&Ke(t.$zoomControls,"display",e.zooming?"flex":"none")})),e.on(N.playing,(function(e){d(e)}));var d=function(i){Ke(t.$play,"display",i?"none":"flex"),Ke(t.$playBig,"display",i?"none":"block"),Ke(t.$pause,"display",i?"flex":"none"),Ke(t.$screenshot,"display",i?"flex":"none"),Ke(t.$record,"display",i?"flex":"none"),Ke(t.$qualityMenu,"display",i?"flex":"none"),Ke(t.$volume,"display",i?"flex":"none"),Ke(t.$ptz,"display",i?"flex":"none"),Ke(t.$zoom,"display",i?"flex":"none"),Ke(t.$scaleMenu,"display",i?"flex":"none"),Ke(t.$faceDetect,"display",i?"flex":"none"),Ke(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&Ke(t.$speedMenu,"display",i?"flex":"none"),l(),t.extendBtnList.forEach((function(e){e.$iconWrap&&Ke(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&Ke(e.$activeIconWrap,"display","none")})),e._opt.showPerformance?Ke(t.$performanceActive,"display",i?"flex":"none"):Ke(t.$performance,"display",i?"flex":"none"),Ke(t.$poster,"display","none"),Ke(t.$ptzActive,"display","none"),Ke(t.$recordStop,"display","none"),Ke(t.$zoomStop,"display","none"),Ke(t.$faceDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML="0 KB/s"),Ke(t.$zoomControls,"display","none"),Ke(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jessibuca-ptz-controls-show")),h()},h=(e.on(N.playbackPause,(function(e){d(!e)})),e.on(N.kBps,(function(i){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"],i=(e=parseFloat(e),Math.floor(Math.log(e)/Math.log(1024))),r=e/Math.pow(1024,i);return(r=r.toFixed(2))+(t[i]||t[0])}(i),t.kbpsShow=i,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=i),h())})),function(){if(c()){var i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;Xe()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}});if(c()){var f=function(){if(c()){var i,r,n=0,a=e.playback&&e.playback.playingTimestamp;a&&(i=(a=new Date(a)).getHours(),r=a.getMinutes(),a=a.getSeconds(),e.playback.is60Min?n=60*i+r:e.playback.is30Min?n=2*(60*i+r)+parseInt(a/30,10):e.playback.is10Min?n=6*(60*i+r)+parseInt(a/10,10):e.playback.is5Min?n=12*(60*i+r)+parseInt(a/5,10):e.playback.is1Min&&(n=60*(60*i+r)+parseInt(a,10)),t.$playbackCurrentTime.style.left=n+"px")}},p=function(e){t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===oe&&t.$playbackNarrow.classList.add("disabled"),e===ce&&t.$playbackExpand.classList.add("disabled")},g=function(){var e=t.$playbackCurrentTime.style.left,i=(e=parseInt(e,10),t.controlsPlaybackTimeInner.width);e=0<e-i/2?parseInt(e-i/2,10):0;t.$playbackTimeInner.scrollLeft=e};e._opt.showBandwidth&&(t.$controlsLeft.style.width="90px"),e.on(N.playbackTime,(function(e){t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=tt(e,"{h}:{i}:{s}")),f()})),e.on(N.playbackPrecision,(function(e,i){t.$playbackTimeScroll.classList.remove(ue.oneHour,ue.halfHour,ue.fiveMin,ue.tenMin),t.$playbackTimeScroll.classList.add(ue[e]),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="",e){case oe:un(i,t);break;case le:n=t,cn(function(e){for(var t=0<arguments.length&&void 0!==e?e:[],i=[],r=(t[0]||{}).startTimestamp,n=0;n<1440;n++){var a=60*n,s=a%1800==0,o=!1;r&&(o=ln(t,At(r,a))),i.push({title:mt(a),timestamp:a,dataType:"second",hasRecord:o,isStart:s});var l=60*n+30;s=l%1800==0,r&&(o=ln(t,At(r,l))),i.push({title:mt(l),timestamp:l,dataType:"second",hasRecord:o,isStart:s})}return i}(i),function(){for(var e=[],t=0;t<24;t++){var i=t+":00",r=t+":30";t<10&&(i="0"+i,r="0"+r),e.push({title:i,hour:t,min:0,second:0}),e.push({title:r,hour:t,min:30,second:0})}return e}(),n);break;case"tenMin":n=t,cn(function(e){for(var t=0<arguments.length&&void 0!==e?e:[],i=[],r=(t[0]||{}).startTimestamp,n=0;n<144;n++)for(var a=0;a<60;a++){var s=10*a+600*n,o=s%600==0,l=!1;r&&(l=ln(t,At(r,s))),i.push({title:mt(s),timestamp:s,dataType:"second",isStart:o,hasRecord:l})}return i}(i),function(){for(var e=[],t=0;t<24;t++){var i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(var r=1;r<6;r++){var n=r+"0";e.push({title:i.replace(":00",":"+n),hour:t,min:10*r,second:0})}}return e}(),n);break;case ce:r=t,cn(function(e){for(var t=0<arguments.length&&void 0!==e?e:[],i=[],r=(t[0]||{}).startTimestamp,n=0;n<288;n++)for(var a=0;a<60;a++){var s=5*a+300*n,o=s%300==0,l=!1;r&&(l=ln(t,At(r,s))),i.push({title:mt(s),timestamp:s,dataType:"second",isStart:o,hasRecord:l})}return i}(i),function(){for(var e=[],t=0;t<24;t++){var i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(var r=1;r<6;r++){var n=r+"0",a=r+"5";e.push({title:i.replace(":00",":"+n),hour:t,min:10*r,second:0}),e.push({title:i.replace(":00",":"+a),hour:t,min:10*r+5,second:0})}}return e}(),r)}var r,n;f(),p(e),g()}),16)})),e.on(N.resize,(function(){h()})),h()}if(e._opt.operateBtns.quality&&0<e._opt.qualityConfig.length){e.on(N.streamQualityChange,(function(e){m(e)}));var m=function(e){t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((function(t){var i=t.dataset.quality;t.classList.remove("jessibuca-quality-menu-item-active"),i===e&&t.classList.add("jessibuca-quality-menu-item-active")}))},A=e._opt.qualityConfig||[],y="";A.forEach((function(e){y+='\n <div class="jessibuca-quality-menu-item" data-quality="'.concat(e,'">').concat(e,"</div>\n ")})),y&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",y),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jessibuca-quality-menu-item")}),setTimeout((function(){var t=A[0];e.streamQuality=t}),0)),e.streamQuality&&m(e.streamQuality)}if(e._opt.operateBtns.scale&&0<e._opt.scaleConfig.length){e.on(N.viewResizeChange,(function(e){b(e)}));var b=function(i){var r=e._opt.scaleConfig[i];t.$scaleText.innerText=r,t.$scaleMenuItems.forEach((function(e){var t=e.dataset.scale;e.classList.remove("jessibuca-scale-menu-item-active"),rt(t)===rt(i)&&e.classList.add("jessibuca-scale-menu-item-active")}))},w=e._opt.scaleConfig||[],k="";w.forEach((function(e,t){k+='\n <div class="jessibuca-scale-menu-item" data-scale="'.concat(t,'">').concat(e,"</div>\n ")})),k&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",k),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jessibuca-scale-menu-item")})),b(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&0<e._opt.playbackConfig.rateConfig.length){e.on(N.playbackRateChange,(function(e){E(e)}));var E=function(i){var r=e._opt.playbackConfig.rateConfig.find((function(e){return rt(e.value)===rt(i)}));r&&(t.$speedText.innerText=r.label,t.$speedMenuItems.forEach((function(e){var t=e.dataset.speed;e.classList.remove("jessibuca-speed-menu-item-active"),rt(t)===rt(i)&&e.classList.add("jessibuca-speed-menu-item-active")})))};w=e._opt.playbackConfig.rateConfig;var T="";w.forEach((function(e,t){T+='\n <div class="jessibuca-speed-menu-item" data-speed="'.concat(e.value,'">').concat(e.label,"</div>\n ")})),T&&(t.$speedMenuList.insertAdjacentHTML("beforeend",T),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jessibuca-speed-menu-item")}));var C=e.playback?e.playback.playbackRate:1;E(C)}e.on(N.stats,(function(){var i,r,n,a,s,o,l,c,u,d,h,f,p,g,m,A,y=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e._opt.showPerformance?(Ke(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="",i=e.video&&e.video.videoInfo||{},r=e.audio&&e.audio.audioInfo||{},n=e._times||{},a=e.getRenderType(),s=e.getCanvasRenderType(),o=e.getDecodeType(),l=e.getDemuxType(),c=e.getStreamType(),u=e.getAudioEngineType(),f=e.getRecordingDuration(),p=e.getRecordingByteLength(),d=e.isAudioPlaybackRateSpeed(),h=e.videoIframeIntervalTs,f=gt(f),p=null==(g=p)||""==g?"0 Bytes":(m=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"),A=0,g=parseFloat(g),A=Math.floor(Math.log(g)/Math.log(1024)),(g/Math.pow(1024,A)).toFixed(2)+m[A]),g=e.isPlayback()?"录播":"直播",m=y.isDropping,A=e.control?e.control.kbpsShow:"0 KB/s",g='\n <div class="jessibuca-performance-item">\n <span>版本 "2023-8-4"</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>播放模式 '.concat(g,"</span>\n </div>\n ").concat(e.isPlayback()?'\n <div class="jessibuca-performance-item">\n <span>播放倍率 '.concat(e.playback.rate,'倍</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>播放模式 ').concat(e.playback.isUseFpsRender?"固定FPS":"动态FPS","</span>\n </div>\n ").concat(e.playback.isUseFpsRender?'\n <div class="jessibuca-performance-item">\n <span>固定FPS '.concat(e.video.getStreamFps(),"</span>\n </div>\n "):"","\n "):"",'\n <div class="jessibuca-performance-item">\n <span>解封装模式 ').concat(S[l],'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>解码模式 ').concat(o,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>渲染组件 ').concat(a,"</span>\n </div>\n ").concat(a===_?'\n <div class="jessibuca-performance-item">\n <span>渲染引擎 '.concat(s,"</span>\n </div>\n "):"",'\n <div class="jessibuca-performance-item">\n <span>网络请求组件 ').concat(c,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频格式 ').concat(i.encType||"-",'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频(宽x高) ').concat(i.width||"-","x").concat(i.height||"-","</span>\n </div>\n ").concat(e.isPlayer()?'\n <div class="jessibuca-performance-item">\n <span>视频GOP(ms) '.concat(h||"-","</span>\n </div>\n "):"",'\n <div class="jessibuca-performance-item">\n <span>音频格式 ').concat(X[r.encType]||"-",'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>音频引擎 ').concat(u||"-",'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>音频通道 ').concat(r.channels||"-",'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>音频采样率 ').concat(r.sampleRate||"-","</span>\n </div>\n ").concat(e.isPlayer()?'\n <div class="jessibuca-performance-item">\n <span>播放器初始化(ms) '.concat(n.playTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>开始请求地址(ms) ').concat(n.streamTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>请求响应(ms) ').concat(n.streamResponseTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>解封装(ms) ').concat(n.demuxTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>解码(ms) ').concat(n.decodeTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>页面开始渲染(ms) ').concat(n.videoTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>初始化到页面渲染(ms) ').concat(n.allTimestamp,"</span>\n </div>\n ").concat(e.recording?'\n <div class="jessibuca-performance-item">\n <span>视频录制时间 '.concat(f,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频录制大小 ').concat(p,"</span>\n </div>\n "):"","\n "):"",'\n <div class="jessibuca-performance-item">\n <span>音频码率(bit) ').concat(y.abps,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频码率(bit) ').concat(y.vbps,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频帧率(fps) ').concat(y.fps,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频峰值帧率(fps) ').concat(y.maxFps,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>解码帧率(fps) ').concat(y.dfps,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>音频缓冲帧 ').concat(y.audioBuffer,"</span>\n </div>\n ").concat(e.isPlayer()?'\n <div class="jessibuca-performance-item">\n <span>视频待解码帧 '.concat(y.demuxBuffer,"</span>\n </div>\n "):'\n <div class="jessibuca-performance-item">\n <span>缓存时长(ms) '.concat(y.playbackCacheDataDuration,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频待渲染帧 ').concat(y.playbackVideoBuffer,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>视频待解码帧 ').concat(y.demuxBuffer,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>音频待解码帧 ').concat(y.audioDemuxBuffer,"</span>\n </div>\n "),'\n <div class="jessibuca-performance-item">\n <span>待解封装数据(byte) ').concat(y.flvBuffer,"</span>\n </div>\n ").concat(e._opt.useMSE?'\n <div class="jessibuca-performance-item">\n <span>MSE缓冲时长(ms) '.concat(y.mseDelay,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>MSE解码间隔(ms) ').concat(y.mseDecodeDiffTimes,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>MSE解码时间(ms) ').concat(y.mseTs,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>MSE播放模式 ').concat(1<y.mseDecodePlaybackRate?"加速":"正常","</span>\n </div>\n "):"","\n ").concat(e._opt.useWCS?'\n <div class="jessibuca-performance-item">\n <span>WCS解码间隔(ms) '.concat(y.wcsDecodeDiffTimes,"</span>\n </div>\n "):"","\n ").concat(e._opt.isHls?'<div class="jessibuca-performance-item">\n <span>HLS缓冲时长(ms) '.concat(y.hlsDelay,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>HLS播放模式 ').concat(1<y.hlsDecodePlaybackRate?"加速":"正常","</span>\n </div>\n "):"","\n ").concat(e.isPlayer()?'\n <div class="jessibuca-performance-item">\n <span>网络延迟(ms) '.concat(y.netBuf,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>缓冲时长(ms) ').concat(y.buf,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>最新缓冲时长(ms) ').concat(y.pushLatestDelay,"</span>\n </div>\n "):"",'\n <div class="jessibuca-performance-item">\n <span>视频显示时间(ms) ').concat(y.ts,"</span>\n </div>\n ").concat(e._opt.hasAudio&&e.isAudioNotMute()?'\n <div class="jessibuca-performance-item">\n <span>音频显示时间(ms) '.concat(y.audioTs,"</span>\n </div>\n ").concat(e._opt.hasVideo?'\n <div class="jessibuca-performance-item">\n <span>音视频同步时间戳(ms) '.concat(y.ts-y.audioTs,"</span>\n </div>\n "):"",'\n <div class="jessibuca-performance-item">\n <span>音频播放模式 ').concat(d?"加速":"正常","</span>\n </div>\n "):"",'\n <div class="jessibuca-performance-item">\n <span>视频解码时间(ms) ').concat(y.dts,"</span>\n </div>\n ").concat(e.isPlayer()?'\n <div class="jessibuca-performance-item">\n <span>解码前-解码后延迟(ms) '.concat(y.delayTs,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>总延迟(网络+解码)(ms) ').concat(y.totalDelayTs,"</span>\n </div>\n "):"","\n ").concat(e.isPlayer()&&y.isStreamTsMoreThanLocal?'<div class="jessibuca-performance-item">\n <span>是否超过一倍率推流 是</span>\n </div>\n ':"","\n ").concat(e.isPlayer()?'\n <div class="jessibuca-performance-item">\n <span>是否在丢帧 '.concat(m,"</span>\n </div>\n "):"",'\n <div class="jessibuca-performance-item">\n <span>网速 ').concat(A,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>播放时长(s) ').concat(gt(y.pTs),'</span>\n </div>\n <div class="jessibuca-performance-item-block"></div>\n '),t.$performancePanel.insertAdjacentHTML("beforeend",g)):(t.$performancePanel.innerHTML="",Ke(t.$performancePanel,"display","none"))})),e.on(N.togglePerformancePanel,(function(e){Ke(t.$performance,"display",e?"none":"flex"),Ke(t.$performanceActive,"display",e?"flex":"none")})),e.on(N.faceDetectActive,(function(e){Ke(t.$faceDetect,"display",e?"none":"flex"),Ke(t.$faceDetectActive,"display",e?"flex":"none")}))};function hn(e,t){var i,r;t=(t=void 0===t?{}:t).insertAt;e&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(r=document.createElement("style")).type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)))}function fn(e,t){t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function pn(e,t,i){e.style[t]=i}function gn(e,t){return e.composedPath&&-1<e.composedPath().indexOf(t)}function mn(e){var t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}hn('@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}}.jessibuca-container .jessibuca-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jessibuca-container .jessibuca-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}.jessibuca-container .jessibuca-ptz-controls.jessibuca-ptz-controls-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-up{transform:rotate(-90deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-left{transform:rotate(180deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-down{transform:rotate(90deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-left-up{transform:rotate(-135deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-right-up{transform:rotate(-45deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-left-down{transform:rotate(135deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-right-down{transform:rotate(45deg)}.jessibuca-container .jessibuca-ptz-bg-active.jessibuca-ptz-bg-active-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-left{left:33px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-up{top:33px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-right{left:73px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-down{top:73px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-left-up{top:39px;left:39px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-left-down{left:39px;top:67px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-right-up{top:39px;left:67px}.jessibuca-container .jessibuca-ptz-control.jessibuca-ptz-control-right-down{top:67px;left:67px}.jessibuca-container .jessibuca-ptz-expand{position:absolute;bottom:-35px;left:30px;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAbUExURfj4+MPDw0xMTL+/v7a2tllZWf///6Kiop2dneUx6hEAAAAJdFJOU/S/gLiFhP6oDXUvvN4AAABFSURBVBjTY2gxFIQDYQ8G9yAlOFAtYTBVQgLBDELIXEXsXGUjFK4CEx24ygwMDGwJQMIIG5duzsDifVxhhRawaMGOGikAaV8xR2nKvxYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAbUExURfv7+97e3pmZmdra2tPT06CgoP///8TExPr6+nJoZMwAAAAJdFJOU/S/gLiRhP4N82k6GisAAABKSURBVBjTYygxFIQDYXcGlyAlOFB1YTBVQgLBDELIXEXsXGUjFK5GEwpXgSZc5Y6OjrYMIGGEjUs7e7F4EM37uMIKLWDRgh01UgDd+j8/TlJ9rwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-narrow{position:absolute;bottom:-35px;right:30px;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAYUExURcPDw0xMTPf398DAwLa2tllZWaKiop2dnf9mW3QAAAAIdFJOU7+A9LiFhKgNukfbiwAAADVJREFUGNNjKDFggANmdwa3QEE4EE1hMBVEAsEMjMhcgcHDFVaCAkNs3MHoZrSARQt21EgBADICHEtvGJahAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jessibuca-container .jessibuca-ptz-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAASUExURZmZmd7e3vr6+tvb29PT08TExE/cQyMAAAAGdFJOU4C/9LiRDTYjZTIAAAAySURBVBjTYwgxFIQDYVcGFwYk4MJggMxlZhBA5jIOHi6zEhQYYOMORjejBSxasKNGCgAGLwiBDR4u8gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jessibuca-container .jessibuca-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jessibuca-container .jessibuca-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jessibuca-container .jessibuca-loading-bg{display:none;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}.jessibuca-container .jessibuca-loading-bg img{width:100%;height:100%}.jessibuca-container .jessibuca-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}.jessibuca-container .jessibuca-play-big{position:absolute;display:none;height:100%;width:100%;background:rgba(0,0,0,.4)}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jessibuca-container .jessibuca-recording{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:95px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-recording .jessibuca-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jessibuca-container .jessibuca-recording .jessibuca-recording-time{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-recording .jessibuca-icon-recordStop{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-zoom-controls{display:none;position:absolute;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:150px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-narrow{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-expand,.jessibuca-container .jessibuca-zoom-controls .jessibuca-zoom-stop2{width:16px;height:16px;cursor:pointer}.jessibuca-container .jessibuca-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}.jessibuca-container .jessibuca-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jessibuca-container .jessibuca-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;user-select:none;transition:width .5s ease-in}.jessibuca-container .jessibuca-controls .jessibuca-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jessibuca-container .jessibuca-controls .jessibuca-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-face,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-face-active,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-fullscreen,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-fullscreen-exit,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-microphone-close,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-pause,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-performance,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-performance-active,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-play,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-ptz,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-ptz-active,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-quality-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-record,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-record-stop,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-scale-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-screenshot,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-speed-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-template-menu,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-volume,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-zoom,.jessibuca-container .jessibuca-controls .jessibuca-controls-item.jessibuca-zoom-stop{display:none}.jessibuca-container .jessibuca-controls .jessibuca-controls-item-html{position:relative;display:none;justify-content:center}.jessibuca-container .jessibuca-controls .jessibuca-icon-audio,.jessibuca-container .jessibuca-controls .jessibuca-icon-mute{z-index:1}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom{display:flex;justify-content:space-between;height:100%}.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-left,.jessibuca-container .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-right{display:flex;align-items:center}.jessibuca-container.jessibuca-controls-show .jessibuca-controls{opacity:1;visibility:visible}.jessibuca-container.jessibuca-controls-show-auto-hide .jessibuca-controls{opacity:.8;visibility:visible;display:none}.jessibuca-container.jessibuca-hide-cursor *{cursor:none!important}.jessibuca-container .jessibuca-icon-loading{width:50px;height:50px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;animation:rotation 1s linear infinite}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-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%}.jessibuca-container .jessibuca-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwAyqXf5Hu1TZxDRmrxFjN7ZJa7NAAABXElEQVRIx92VS5KFIAxFgfALoLL/1XaVKPBCQteb9KAzM3Ik3FyiUv8rQqo0MsrL0VQmfJDWa1/5OPn1x1hxFWNMsv3ZsN/vJZy6ZVzoJWam/rcemA+pXwQWoLQXSZN8fAiaDy1dxKMlkvZsdiaIuC3pWPmgKccAIDToYk5x6ykahpF209B3i2sBtAic6wlHRRhHQJhrOghQOAeWyTaRAM1h9ELcq9AuInYVqMXzMBqwO2QC3IU7y5X0+MLYKa44nSFQlR5foxvxYVlN+3CIfbhvhUcKGHE42NX6G7O+do0rYHYbVGTuAz+BCjcHMn9zh/M8stsySp3CoAn8PHFFHJjPl2qa3jiYrBXY7tzIGRwi6mg+nbgQs++8t+tQDnyDNrEQev2fVJt3hIoE8dl1AYXWHrkzvkScJRdHizsiAASNtEk7S/NtXUbs70RSXxKgviPKFz99bVIB9SfxA8uZLAsxki39AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTMzMzMzMzM3NzczMzM7Ozs3NzczMzMzMzMzMzMzMzMzMzMzMzH6OaiEAAAAMdFJOUwBv7U2hEB4zt9NZixFhg1cAAAF+SURBVDjLY2CgF+CacwYKXFHEWXtg4mcOLUCWKDqDAKeRxJnBIhounWDaASFRAzJiO5CR5QNkHUHYoAPkioKZ7CAZAZgEB5AzHcpmBLKPwyRszpw5gWzsSRgbaNIEFIfAXAxkJiBcsgeh7MyZg0hu50RYcuaMAqqnTsMlNiAHgw7c9jNnCpAl9sCtPHMISEQJgoAwxPUGUAmgL9h1IEHYAPYJ1L2g0OGEhi3QfTHwQAFJMCECPQhFggUqAfRCDkIC5DwnSPwJoNhxKICBgS0NBEDuXAN3Ptx5EOADVgiRcEBOGIhIOHPmGJIEIyJMkeMJ7I2jiPhASkw9CJN9kKKZgfsM3G6QZoS79iClH+YzCPsyQL5EVnVmMpgVDQ7kwzAJcEDNNgsNXwINfAOEZ0FASQeWsA8jeQoVwLVUwoVUULUwrISJJ6xB1cJgDcpshxoDGLhgEQYDbIaCUqUMkPhAziRIGRUkcRJbFl6DS4LrDGoyR9HSgFWC3bORnFIEAI39IME59Pz6AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTM3NzczMzMzMzMzMzMzMzMvLy8vLy8zMzMzMzMzMzMzMzMzMzMzMzMzMzAmiiJAAAAAOdFJOUwAqre7XQBoOxWGeiHNRIXj5WAAAAcNJREFUOMu1VLtKQ0EQ3Ygx5FEIPhpFVLAIaNAUPkACWliGYGEpMWKjIKktJGBjIWIhiAgSRGwESWkhwcpGEAUtRJCYmBjFzDc4szv7uCpYOcXd2T07u2fOzF4h/jLf01H/xdzP9a4koFWi2W/rs8A26UXWwNiEu+5PWADyDnDorMOrPSwo7x186DjYJm/GAM84q+9JzkUKMRnQtkv2Y+j3MtCM/pTeFcHJO/s3nguJCM/QG7MMKaRggBSN99NyJ97ypoEPmSVAjsZ1gE8NyB0hgBcaw4Ywq9AEUKUxgEenGUi5EXTJjgIqdGlnBqCxkFb0FS2o42cXSOFEHPfM69yhzLKQIbEepieIbVgDNSEWXSDiAKsGwKNadA0L7lGUz/LmBia2uaXKk+c80p48iro6nE+IMxdY31sGcq4kPlMQK16NN5S1iJQ6EZNKIKmGKZS8bCUqp9jEw0J7VVtaPInFJdGU8NLObGMhT11MITJua9DT6ONuJWlGNdBGIg0R9271fFp1j0oFx0+vj1nJER3SDl4zIYGYs1h0Q4JJA5z43RCLDKi8cvYZntNy/Er1KpSch7j0uH+X1VKUfv1J+I1a/2xf3OKDpNnEfRYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA5UExURUdwTP///////////////////////////////////////////////////////////////////////308lk0AAAASdFJOUwBFnl8nDsur9hnq2jeLum17VecmAZgAAAGgSURBVEjH1VbZdsUgCIz7boz//7Fto3FBzLk9fSpvUUdgGDDH8WfjV6JKqZC8+eR0kLmZVky8H/cxA7PpBSJoRsyy3XliM24UP8/y1iQW1tljUIl479mQvlv5utptAzE8NMTC5kPkCdZV3VAA4OpFfHGdKoJhCTixJ0NPe7pki9eo3hbGtbLkOwXSqY6ueQgI6PXxN11dASWAEwL6DRQ4LIlLABgEUGIg3UWJycyAvl89DBRHyOxIG+emeLgMNxNRYQLUCJnLWj9lzzqKzsJY7fbloVDjoJw4AUrOYZH2HZXRgKYGSJ8DSkgGdl3YhlThhkoZC8pFGWt1CWzVH0rMsa10jTTNhWMvAAlKf4CUoDT40hFACgF8K5jzAdR4cxVmtX9LZWmgLngTFIMNb5EZQNAWVcgUIHmPoOhkesbPCY+bOs+XAeEedfp5xjxSsXBY8qcJsiKtlZIbHhe+RWQbaUqBylmGK8Lld1sQQuEHbdAbxHFhTqhprK8IccLAFRnrJLGXLkjdnqLTgMrir53xF2OMcLFq4Rf/B0RjQvin9gVLNDmYNA/hrAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jessibuca-container .jessibuca-menu-icon-text,.jessibuca-container .jessibuca-quality-icon-text,.jessibuca-container .jessibuca-scale-icon-text,.jessibuca-container .jessibuca-speed-icon-text{font-size:14px;width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jessibuca-container .jessibuca-speed{font-size:14px;color:#fff}.jessibuca-container .jessibuca-menu-list,.jessibuca-container .jessibuca-quality-menu-list,.jessibuca-container .jessibuca-scale-menu-list,.jessibuca-container .jessibuca-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}.jessibuca-container .jessibuca-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-menu-list.jessibuca-speed-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-quality-menu-list.jessibuca-speed-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-scale-menu-list.jessibuca-speed-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-quality-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-scale-menu-shown,.jessibuca-container .jessibuca-speed-menu-list.jessibuca-speed-menu-shown{visibility:visible;opacity:1}.jessibuca-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}.jessibuca-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container .jessibuca-quality-menu{padding:8px 0}.jessibuca-container .jessibuca-menu-item,.jessibuca-container .jessibuca-quality-menu-item,.jessibuca-container .jessibuca-scale-menu-item,.jessibuca-container .jessibuca-speed-menu-item{box-sizing:border-box;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}.jessibuca-container .jessibuca-menu-item:hover,.jessibuca-container .jessibuca-quality-menu-item:hover,.jessibuca-container .jessibuca-scale-menu-item:hover,.jessibuca-container .jessibuca-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-menu-item:focus,.jessibuca-container .jessibuca-quality-menu-item:focus,.jessibuca-container .jessibuca-scale-menu-item:focus,.jessibuca-container .jessibuca-speed-menu-item:focus{outline:none}.jessibuca-container .jessibuca-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-menu-item.jessibuca-speed-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-quality-menu-item.jessibuca-speed-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-scale-menu-item.jessibuca-speed-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-quality-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-scale-menu-item-active,.jessibuca-container .jessibuca-speed-menu-item.jessibuca-speed-menu-item-active{color:#2298fc}.jessibuca-container .jessibuca-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}.jessibuca-container .jessibuca-volume-panel-wrap.jessibuca-volume-panel-wrap-show{visibility:visible;opacity:1}.jessibuca-container .jessibuca-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jessibuca-container .jessibuca-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jessibuca-container .jessibuca-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:before{bottom:-54px;background:#fff}.jessibuca-container .jessibuca-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jessibuca-container .jessibuca-volume-panel-handle:after,.jessibuca-container .jessibuca-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-controls{width:100vh}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading{flex-direction:row}.jessibuca-container.jessibuca-fullscreen-web .jessibuca-loading-text{transform:rotate(270deg)}.jessibuca-container .jessibuca-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}.jessibuca-container .jessibuca-contextmenus .jessibuca-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)}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu a{color:#fff;text-decoration:none}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu span{display:inline-block;padding:0 7px}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu span.art-current,.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu span:hover{color:var(--theme)}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jessibuca-container .jessibuca-contextmenus .jessibuca-contextmenu:last-child{border-bottom:none}.jessibuca-container.jessibuca-contextmenus-show .jessibuca-contextmenus{display:flex}.jessibuca-container-playback .jessibuca-controls{height:48px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-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;user-select:none}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.one-hour{width:1440px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.half-hour{width:2880px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.ten-min{width:8640px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.five-min{width:17280px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-scroll.one-min{width:86400px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-day{height:100%;overflow:hidden}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-one-wrap{height:8px;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-wrap{height:25px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-controls-playback-btns{display:flex;align-items:center}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one.active,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one.active{background-color:orange;cursor:pointer}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one.start,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one.start{background-color:#999}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-one:hover .jessibuca-playback-time-title-tips,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-second-one:hover .jessibuca-playback-time-title-tips{visibility:visible;opacity:1}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-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}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-title-tips.jessibuca-playback-time-title-tips-left{transform:translateX(-100%)}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-title-tips .jessibuca-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour:first-child,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute:first-child{border-left:0}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour:first-child .jessibuca-playback-time-hour-text,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute:first-child .jessibuca-playback-time-hour-text{left:0}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour:after,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-hour-text,.jessibuca-container-playback .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-center .jessibuca-playback-time-minute-text{position:absolute;left:-13px}.jessibuca-container-playback .jessibuca-playback-expand.disabled .jessibuca-icon-expand,.jessibuca-container-playback .jessibuca-playback-narrow.disabled .jessibuca-icon-narrow{cursor:no-drop}.jessibuca-container-playback.jessibuca-fullscreen-web .jessibuca-controls .jessibuca-controls-bottom .jessibuca-controls-playback-time-inner{overflow-y:auto}.jessibuca-zoom-control{cursor:grab}.jessibuca-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}.jessibuca-performance-panel .jessibuca-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jessibuca-performance-panel .jessibuca-performance-item-block{height:10px}');var An=function(){function e(t){var i=this;A(this,e),this.player=t,this.extendBtnList=[],a=this,(n=t)._opt.hasControl&&n._opt.controlAutoHide?n.$container.classList.add("jessibuca-controls-show-auto-hide"):n.$container.classList.add("jessibuca-controls-show"),s=n._opt,o=s.operateBtns,l='\n <div class="jessibuca-controls-center">\n <div class="jessibuca-controls-playback-time">\n <div class="jessibuca-controls-playback-time-inner">\n <div class="jessibuca-controls-playback-time-scroll">\n <div class="jessibuca-controls-playback-time-list">\n <div class="jessibuca-playback-time-day">\n <div class="jessibuca-playback-time-one-wrap"></div>\n <div class="jessibuca-playback-time-second-wrap"></div>\n </div>\n </div>\n <div class="jessibuca-controls-playback-current-time">\n <div class="jessibuca-controls-playback-current-time-text">00:00:00</div>\n </div>\n </div>\n </div>\n </div>\n <div class="jessibuca-controls-playback-btns">\n <div class="jessibuca-controls-item jessibuca-playback-narrow">'.concat(on.narrow,'</div>\n <div class="jessibuca-controls-item jessibuca-playback-expand">').concat(on.expand,"</div>\n </div>\n </div>\n "),n.$container.insertAdjacentHTML("beforeend","\n ".concat(s.background?'<div class="jessibuca-poster" style="background-image: url('.concat(s.background,')"></div>'):"",'\n <div class="jessibuca-loading-bg">\n <img class="jessibuca-loading-bg-image" src="" alt="">\n </div>\n ').concat(s.loadingIcon?'\n <div class="jessibuca-loading">\n '.concat(on.loading,"\n ").concat(s.loadingText?'<div class="jessibuca-loading-text">'.concat(s.loadingText,"</div>"):"","\n </div>\n "):"","\n ").concat(s.hasControl&&o.play?'<div class="jessibuca-play-big"></div>':"","\n ").concat(s.hasControl&&o.ptz?'\n <div class="jessibuca-ptz-controls">\n <div class="jessibuca-ptz-bg-active"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-up" data-arrow="up"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-right" data-arrow="right"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-down" data-arrow="down"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-left" data-arrow="left"></div>\n '.concat(s.ptzMoreArrow?'\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-left-up" data-arrow="left-up"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-right-up" data-arrow="right-up"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-left-down" data-arrow="left-down"></div>\n <div class="jessibuca-ptz-arrow jessibuca-ptz-arrow-right-down" data-arrow="right-down"></div>\n ':"",'\n <div class="jessibuca-ptz-control"></div>\n ').concat(s.ptzZoomShow?'\n <div class="jessibuca-ptz-expand"></div>\n <div class="jessibuca-ptz-narrow"></div>\n ':"","\n\n ").concat(s.ptzApertureShow?'\n <div class="jessibuca-ptz-aperture-far"></div>\n <div class="jessibuca-ptz-aperture-near"></div>\n ':"","\n ").concat(s.ptzFocusShow?'\n <div class="jessibuca-ptz-focus-far"></div>\n <div class="jessibuca-ptz-focus-near"></div>\n ':"","\n </div>\n "):"","\n ").concat(s.hasVideo?'\n <div class="jessibuca-zoom-controls">\n <div class="jessibuca-zoom-narrow">'.concat(on.narrow,'</div>\n <div class="jessibuca-zoom-tips">电子放大</div>\n <div class="jessibuca-zoom-expand">').concat(on.expand,'</div>\n <div class="jessibuca-zoom-stop2">').concat(on.zoomStop,'</div>\n </div>\n <div class="jessibuca-recording">\n <div class="jessibuca-recording-red-point"></div>\n <div class="jessibuca-recording-time">00:00:00</div>\n <div class="jessibuca-icon-recordStop jessibuca-recording-stop">').concat(on.recordStop,"</div>\n </div>\n "):"","\n\n ").concat(s.hasControl?'\n <div class="jessibuca-controls">\n <div class="jessibuca-controls-bottom">\n <div class="jessibuca-controls-left">\n '.concat(s.showBandwidth?'<div class="jessibuca-controls-item jessibuca-speed"></div>':"",'\n <div class="jessibuca-controls-item-html">').concat(s.controlHtml,"</div>\n </div>\n ").concat(s.playType===v&&s.playbackConfig.showControl?l:"",'\n\n <div class="jessibuca-controls-right">\n ').concat(s.playType===v&&s.playbackConfig.showRateBtn?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-speed-menu">\n <div class="jessibuca-speed-icon-text"></div>\n <div class="jessibuca-speed-menu-list"></div>\n </div>\n </div>\n ':"","\n ").concat(o.close?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-close">'.concat(on.close,"</div></div>"):"","\n ").concat(o.performance?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-performance">'.concat(on.performance,'</div><div class="jessibuca-controls-item jessibuca-performance-active">').concat(on.performanceActive,"</div></div>"):"","\n ").concat(o.aiFace?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-face">'.concat(on.face,'</div><div class="jessibuca-controls-item jessibuca-face-active">').concat(on.faceActive,"</div></div>"):"","\n ").concat(o.quality?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-quality-menu">\n <div class="jessibuca-quality-icon-text"></div>\n <div class="jessibuca-quality-menu-list"></div>\n </div>\n </div>\n ':"","\n ").concat(o.scale?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-scale-menu">\n <div class="jessibuca-scale-icon-text"></div>\n <div class="jessibuca-scale-menu-list"></div>\n </div>\n </div>\n ':"","\n ").concat(o.audio?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-volume">\n '.concat(on.audio,"\n ").concat(on.mute,'\n <div class="jessibuca-volume-panel-wrap">\n <div class="jessibuca-volume-panel">\n <div class="jessibuca-volume-panel-handle"></div>\n </div>\n <div class="jessibuca-volume-panel-text"></div>\n </div>\n </div>\n </div>\n '):"","\n ").concat(o.play?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-play">'.concat(on.play,'</div><div class="jessibuca-controls-item jessibuca-pause">').concat(on.pause,"</div></div>"):"","\n ").concat(o.screenshot?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-screenshot">'.concat(on.screenshot,"</div></div>"):"","\n ").concat(o.record?' <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-record">'.concat(on.record,'</div><div class="jessibuca-controls-item jessibuca-record-stop">').concat(on.recordStop,"</div></div>"):"","\n ").concat(o.ptz?' <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-ptz">'.concat(on.ptz,'</div><div class="jessibuca-controls-item jessibuca-ptz-active">').concat(on.ptzActive,"</div></div>"):"","\n ").concat(o.zoom?' <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-zoom">'.concat(on.zoom,'</div><div class="jessibuca-controls-item jessibuca-zoom-stop">').concat(on.zoomStop,"</div></div>"):"","\n ").concat(o.fullscreen?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-fullscreen">'.concat(on.fullscreen,'</div><div class="jessibuca-controls-item jessibuca-fullscreen-exit">').concat(on.fullscreenExit,"</div></div>"):"","\n </div>\n </div>\n </div>\n "):"",'\n <div class="jessibuca-performance-panel"></div>\n <div class="jessibuca-contextmenus"></div>\n ')),Object.defineProperty(a,"$poster",{value:n.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(a,"$loadingBg",{value:n.$container.querySelector(".jessibuca-loading-bg")}),Object.defineProperty(a,"$loadingBgImage",{value:n.$container.querySelector(".jessibuca-loading-bg-image")}),Object.defineProperty(a,"$loading",{value:n.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(a,"$play",{value:n.$container.querySelector(".jessibuca-play")}),Object.defineProperty(a,"$playBig",{value:n.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(a,"$recording",{value:n.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(a,"$recordingTime",{value:n.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(a,"$recordingStop",{value:n.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(a,"$pause",{value:n.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(a,"$controls",{value:n.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(a,"$controlsInner",{value:n.$container.querySelector(".jessibuca-controls-bottom")}),Object.defineProperty(a,"$controlsLeft",{value:n.$container.querySelector(".jessibuca-controls-left")}),Object.defineProperty(a,"$controlsRight",{value:n.$container.querySelector(".jessibuca-controls-right")}),Object.defineProperty(a,"$volume",{value:n.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(a,"$volumePanelWrap",{value:n.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(a,"$volumePanelText",{value:n.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(a,"$volumePanel",{value:n.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(a,"$volumeHandle",{value:n.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(a,"$volumeOn",{value:n.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(a,"$volumeOff",{value:n.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(a,"$fullscreen",{value:n.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(a,"$fullscreenExit",{value:n.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(a,"$record",{value:n.$container.querySelector(".jessibuca-record")}),Object.defineProperty(a,"$recordStop",{value:n.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(a,"$screenshot",{value:n.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(a,"$speed",{value:n.$container.querySelector(".jessibuca-speed")}),Object.defineProperty(a,"$controlHtml",{value:n.$container.querySelector(".jessibuca-controls-item-html")}),Object.defineProperty(a,"$playbackTime",{value:n.$container.querySelector(".jessibuca-controls-playback-time")}),Object.defineProperty(a,"$playbackTimeInner",{value:n.$container.querySelector(".jessibuca-controls-playback-time-inner")}),Object.defineProperty(a,"$playbackTimeScroll",{value:n.$container.querySelector(".jessibuca-controls-playback-time-scroll")}),Object.defineProperty(a,"$playbackTimeList",{value:n.$container.querySelector(".jessibuca-controls-playback-time-list")}),Object.defineProperty(a,"$playbackTimeListOne",{value:n.$container.querySelector(".jessibuca-playback-time-one-wrap")}),Object.defineProperty(a,"$playbackTimeListSecond",{value:n.$container.querySelector(".jessibuca-playback-time-second-wrap")}),Object.defineProperty(a,"$playbackCurrentTime",{value:n.$container.querySelector(".jessibuca-controls-playback-current-time")}),Object.defineProperty(a,"$playbackCurrentTimeText",{value:n.$container.querySelector(".jessibuca-controls-playback-current-time-text")}),Object.defineProperty(a,"$controlsPlaybackBtns",{value:n.$container.querySelector(".jessibuca-controls-playback-btns")}),Object.defineProperty(a,"$playbackNarrow",{value:n.$container.querySelector(".jessibuca-playback-narrow")}),Object.defineProperty(a,"$playbackExpand",{value:n.$container.querySelector(".jessibuca-playback-expand")}),Object.defineProperty(a,"$ptz",{value:n.$container.querySelector(".jessibuca-ptz")}),Object.defineProperty(a,"$ptzActive",{value:n.$container.querySelector(".jessibuca-ptz-active")}),Object.defineProperty(a,"$ptzControl",{value:n.$container.querySelector(".jessibuca-ptz-controls")}),Object.defineProperty(a,"$ptzBgActive",{value:n.$container.querySelector(".jessibuca-ptz-bg-active")}),Object.defineProperty(a,"$ptzControlCircular",{value:n.$container.querySelector(".jessibuca-ptz-control")}),Object.defineProperty(a,"$ptzArrows",{value:n.$container.querySelectorAll(".jessibuca-ptz-arrow")}),Object.defineProperty(a,"$ptzExpand",{value:n.$container.querySelector(".jessibuca-ptz-expand")}),Object.defineProperty(a,"$ptzNarrow",{value:n.$container.querySelector(".jessibuca-ptz-narrow")}),Object.defineProperty(a,"$ptzApertureFar",{value:n.$container.querySelector(".jessibuca-ptz-aperture-far")}),Object.defineProperty(a,"$ptzApertureNear",{value:n.$container.querySelector(".jessibuca-ptz-aperture-near")}),Object.defineProperty(a,"$ptzFocusFar",{value:n.$container.querySelector(".jessibuca-ptz-focus-far")}),Object.defineProperty(a,"$ptzFocusNear",{value:n.$container.querySelector(".jessibuca-ptz-focus-near")}),Object.defineProperty(a,"$qualityText",{value:n.$container.querySelector(".jessibuca-quality-icon-text")}),Object.defineProperty(a,"$qualityMenu",{value:n.$container.querySelector(".jessibuca-quality-menu")}),Object.defineProperty(a,"$qualityMenuList",{value:n.$container.querySelector(".jessibuca-quality-menu-list")}),Object.defineProperty(a,"$scaleText",{value:n.$container.querySelector(".jessibuca-scale-icon-text")}),Object.defineProperty(a,"$scaleMenu",{value:n.$container.querySelector(".jessibuca-scale-menu")}),Object.defineProperty(a,"$scaleMenuList",{value:n.$container.querySelector(".jessibuca-scale-menu-list")}),Object.defineProperty(a,"$zoom",{value:n.$container.querySelector(".jessibuca-zoom")}),Object.defineProperty(a,"$zoomStop",{value:n.$container.querySelector(".jessibuca-zoom-stop")}),Object.defineProperty(a,"$zoomNarrow",{value:n.$container.querySelector(".jessibuca-zoom-narrow")}),Object.defineProperty(a,"$zoomExpand",{value:n.$container.querySelector(".jessibuca-zoom-expand")}),Object.defineProperty(a,"$zoomStop2",{value:n.$container.querySelector(".jessibuca-zoom-stop2")}),Object.defineProperty(a,"$close",{value:n.$container.querySelector(".jessibuca-close")}),Object.defineProperty(a,"$zoomControls",{value:n.$container.querySelector(".jessibuca-zoom-controls")}),Object.defineProperty(a,"$performancePanel",{value:n.$container.querySelector(".jessibuca-performance-panel")}),Object.defineProperty(a,"$performance",{value:n.$container.querySelector(".jessibuca-performance")}),Object.defineProperty(a,"$performanceActive",{value:n.$container.querySelector(".jessibuca-performance-active")}),Object.defineProperty(a,"$faceDetect",{value:n.$container.querySelector(".jessibuca-face")}),Object.defineProperty(a,"$faceDetectActive",{value:n.$container.querySelector(".jessibuca-face-active")}),Object.defineProperty(a,"$contextmenus",{value:n.$container.querySelector(".jessibuca-contextmenus")}),Object.defineProperty(a,"$speedText",{value:n.$container.querySelector(".jessibuca-speed-icon-text")}),Object.defineProperty(a,"$speedMenu",{value:n.$container.querySelector(".jessibuca-speed-menu")}),Object.defineProperty(a,"$speedMenuList",{value:n.$container.querySelector(".jessibuca-speed-menu-list")}),0<t._opt.extendOperateBtns.length&&t._opt.extendOperateBtns.forEach((function(e){i.addExtendBtn(e)})),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}}}),dn(t,this);var r,n,a,s,o,l,c=function(e){var t=d.$volumePanel.getBoundingClientRect(),i=t.bottom,r=t.height,n=d.$volumeHandle.getBoundingClientRect()["height"];return Ve(i-e.y-n/2,0,r-n/2)/(r-n)},u=t,d=this,h=u["events"]["proxy"],f=u._opt,p=f.operateBtns;if(h(window,["click","contextmenu"],(function(e){-1<e.composedPath().indexOf(u.$container)?d.isFocus=!0:d.isFocus=!1})),h(window,"orientationchange",(function(){setTimeout((function(){u.resize()}),300)})),h(d.$controls,"click",(function(e){e.stopPropagation()})),p.play&&(h(d.$pause,"click",(function(e){f.playType===v&&f.playbackConfig.uiUsePlaybackPause?u.playbackPause=!0:Et(p.pauseFn)?p.pauseFn():u.pause()})),h(d.$play,"click",(function(e){f.playType===v&&u.playbackPause?u.playbackPause=!1:Et(p.playFn)?p.playFn():(u.play(),u.resumeAudioAfterPause())}))),h(d.$playBig,"click",(function(e){f.playType===v&&u.playbackPause?u.playbackPause=!1:Et(p.playFn)?p.playFn():(u.play(),u.resumeAudioAfterPause())})),p.screenshot&&h(d.$screenshot,"click",(function(e){e.stopPropagation(),Et(p.screenshotFn)?p.screenshotFn():u.video.screenshot()})),p.audio&&(h(d.$volume,"mouseover",(function(){d.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")})),h(d.$volume,"mouseout",(function(){d.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")})),h(d.$volumeOn,"click",(function(e){e.stopPropagation(),Ke(d.$volumeOn,"display","none"),Ke(d.$volumeOff,"display","block"),e=u.volume,u.volume=0,u._lastVolume=e})),h(d.$volumeOff,"click",(function(e){e.stopPropagation(),Ke(d.$volumeOn,"display","block"),Ke(d.$volumeOff,"display","none"),u.volume=u.lastVolume||.5})),h(d.$volumePanel,"click",(function(e){e.stopPropagation(),u.volume=c(e)})),h(d.$volumeHandle,"mousedown",(function(){d.isVolumeDroging=!0})),h(d.$volumeHandle,"mousemove",(function(e){d.isVolumeDroging&&(u.volume=c(e))})),h(document,"mouseup",(function(){d.isVolumeDroging&&(d.isVolumeDroging=!1)}))),p.record&&(h(d.$record,"click",(function(e){e.stopPropagation(),Et(p.recordFn)?p.recordFn():u.recording=!0})),h(d.$recordStop,"click",(function(e){e.stopPropagation(),Et(p.recordStopFn)?p.recordStopFn():u.recording=!1}))),h(d.$recordingStop,"click",(function(e){e.stopPropagation(),Et(p.recordStopFn)?p.recordStopFn():u.recording=!1})),p.fullscreen&&(h(d.$fullscreen,"click",(function(e){e.stopPropagation(),Et(p.fullscreenFn)?p.fullscreenFn():u.fullscreen=!0})),h(d.$fullscreenExit,"click",(function(e){e.stopPropagation(),Et(p.fullscreenExitFn)?p.fullscreenExitFn():u.fullscreen=!1}))),p.ptz&&(h(d.$ptz,"click",(function(e){e.stopPropagation(),Ke(d.$ptzActive,"display","flex"),Ke(d.$ptz,"display","none"),d.$ptzControl.classList.add("jessibuca-ptz-controls-show")})),h(d.$ptzActive,"click",(function(e){e.stopPropagation(),Ke(d.$ptz,"display","flex"),Ke(d.$ptzActive,"display","none"),d.$ptzControl.classList.remove("jessibuca-ptz-controls-show")})),d.$ptzArrows.forEach((function(e){if(f.ptzClickType===x)h(e,"click",(function(e){e.stopPropagation(),e=e.currentTarget.dataset.arrow,d.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),d.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),d.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),u.emit(N.ptz,e),setTimeout((function(){d.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),he.forEach((function(e){d.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),d.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)})),u.emit(N.ptz,fe)}),1e3*f.ptzStopEmitDelay)}));else if("mouseDownAndUp"===f.ptzClickType){var t=!1;h(e,"mousedown",(function(e){e.stopPropagation(),t=!0,e=e.currentTarget.dataset.arrow,d.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),d.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),d.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),u.emit(N.ptz,e)}));var i=function(){t=!1,d.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),he.forEach((function(e){d.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),d.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)})),u.emit(N.ptz,fe)};h(e,"mouseup",(function(e){e.stopPropagation(),t&&i()})),h(window,"mouseup",(function(e){e.stopPropagation(),t&&i()}))}})),f.ptzZoomShow&&(h(d.$ptzExpand,"click",(function(e){e.stopPropagation(),u.emit(N.ptz,"zoomExpand"),setTimeout((function(){u.emit(N.ptz,fe)}),1e3*f.ptzStopEmitDelay)})),h(d.$ptzNarrow,"click",(function(e){e.stopPropagation(),u.emit(N.ptz,"zoomNarrow"),setTimeout((function(){u.emit(N.ptz,fe)}),1e3*f.ptzStopEmitDelay)}))),f.ptzApertureShow&&(h(d.$ptzApertureFar,"click",(function(e){e.stopPropagation(),u.emit(N.ptz,"apertureFar"),setTimeout((function(){u.emit(N.ptz,pe)}),1e3*f.ptzStopEmitDelay)})),h(d.$ptzApertureNear,"click",(function(e){e.stopPropagation(),u.emit(N.ptz,"apertureNear"),setTimeout((function(){u.emit(N.ptz,pe)}),1e3*f.ptzStopEmitDelay)}))),f.ptzFocusShow)&&(h(d.$ptzFocusFar,"click",(function(e){e.stopPropagation(),u.emit(N.ptz,"focusFar"),setTimeout((function(){u.emit(N.ptz,pe)}),1e3*f.ptzStopEmitDelay)})),h(d.$ptzFocusNear,"click",(function(e){e.stopPropagation(),u.emit(N.ptz,"focusNear"),setTimeout((function(){u.emit(N.ptz,pe)}),1e3*f.ptzStopEmitDelay)}))),p.performance&&(h(d.$performance,"click",(function(e){e.stopPropagation(),u.togglePerformancePanel(!0)})),h(d.$performanceActive,"click",(function(e){e.stopPropagation(),u.togglePerformancePanel(!1)}))),p.aiFace&&(h(d.$faceDetect,"click",(function(e){e.stopPropagation(),u.faceDetect(!0)})),h(d.$faceDetectActive,"click",(function(e){e.stopPropagation(),u.faceDetect(!1)}))),u._opt.hasControl&&u._opt.controlAutoHide){h(u.$container,"mouseover",(function(){u.fullscreen||(Ke(d.$controls,"display","block"),m())})),h(u.$container,"mousemove",(function(){u.$container&&d.$controls&&(u.fullscreen,"none"===d.$controls.style.display)&&(Ke(d.$controls,"display","block"),m())})),h(u.$container,"mouseout",(function(){y(),Ke(d.$controls,"display","none")}));var g=null,m=function(){y(),g=setTimeout((function(){Ke(d.$controls,"display","none")}),5e3)},y=function(){g&&(clearTimeout(g),g=null)}}if(u._opt.playType===v&&(h(d.$playbackNarrow,"click",(function(e){e.stopPropagation(),u.playback&&u.playback.narrowPrecision()})),h(d.$playbackExpand,"click",(function(e){e.stopPropagation(),u.playback&&u.playback.expandPrecision()})),h(d.$playbackTimeList,"click",(function(e){e=kt(e),e.matches("div.jessibuca-playback-time-minute-one")&&u.playback&&u.playback.seek(e.dataset)})),u._opt.playbackConfig.showRateBtn&&(h(d.$speedMenu,"mouseover",(function(){d.$speedMenuList.classList.add("jessibuca-speed-menu-shown")})),h(d.$speedMenu,"mouseout",(function(){d.$speedMenuList.classList.remove("jessibuca-speed-menu-shown")})),h(d.$speedMenuList,"click",(function(e){var t=kt(e);if(t.matches("div.jessibuca-speed-menu-item")){var i=t.dataset;u.emit(N.playbackPreRateChange,i.speed)}}))),u._opt.playbackConfig.supportWheel)&&h(d.$playbackTimeInner,"wheel",(function(e){e.preventDefault(),0<(e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3)?u.playback&&u.playback.expandPrecision():u.playback&&u.playback.narrowPrecision()})),p.quality&&(h(d.$qualityMenu,"mouseover",(function(){d.$qualityMenuList.classList.add("jessibuca-quality-menu-shown")})),h(d.$qualityMenu,"mouseout",(function(){d.$qualityMenuList.classList.remove("jessibuca-quality-menu-shown")})),h(d.$qualityMenuList,"click",(function(e){var t=kt(e);if(t.matches("div.jessibuca-quality-menu-item")){var i=t.dataset;u.streamQuality=i.quality}}))),p.scale&&(h(d.$scaleMenu,"mouseover",(function(){d.$scaleMenuList.classList.add("jessibuca-scale-menu-shown")})),h(d.$scaleMenu,"mouseout",(function(){d.$scaleMenuList.classList.remove("jessibuca-scale-menu-shown")})),h(d.$scaleMenuList,"click",(function(e){var t=kt(e);if(t.matches("div.jessibuca-scale-menu-item")){var i=t.dataset;u.setScaleMode(i.scale)}}))),p.zoom&&(h(d.$zoom,"click",(function(e){e.stopPropagation(),u.zooming=!0})),h(d.$zoomStop,"click",(function(e){e.stopPropagation(),u.zooming=!1}))),h(d.$zoomExpand,"click",(function(e){e.stopPropagation(),u.zoom&&u.zoom.expandPrecision()})),h(d.$zoomNarrow,"click",(function(e){e.stopPropagation(),u.zoom&&u.zoom.narrowPrecision()})),h(d.$zoomStop2,"click",(function(e){e.stopPropagation(),u.zooming=!1})),p.close&&h(d.$close,"click",(function(e){e.stopPropagation(),u.doDestroy()})),t._opt.hotKey){var b=function(e,t){T[e]?T[e].push(t):T[e]=[t]},w=t,k=this,E=w["events"]["proxy"],T={};b(27,(function(){w.fullscreen&&(w.fullscreen=!1)})),b(38,(function(){w.volume+=.05})),b(40,(function(){w.volume-=.05})),E(window,"keydown",(function(e){if(k.isFocus){var t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){var r=T[e.keyCode];r&&(e.preventDefault(),r.forEach((function(e){return e()})))}}}))}this.btnIndex=0,this.kbpsShow="0 KB/s",this.initLoadingBackground(),this.player.debug.log("Control","init")}return y(e,[{key:"destroy",value:function(){var e;this.$performancePanel&&(this.$performancePanel.innerHTML="",mn(this.$performancePanel)||(e=this.player.$container.querySelector(".jessibuca-performance-panel"))&&this.player.$container.removeChild(e)),this.$poster&&!mn(this.$poster)&&(e=this.player.$container.querySelector(".jessibuca-poster"))&&this.player.$container.removeChild(e),this.$loading&&!mn(this.$loading)&&(e=this.player.$container.querySelector(".jessibuca-loading"))&&this.player.$container.removeChild(e),this.$loadingBg&&!mn(this.$loadingBg)&&(e=this.player.$container.querySelector(".jessibuca-loading-bg"))&&this.player.$container.removeChild(e),this.$controls&&!mn(this.$controls)&&(e=this.player.$container.querySelector(".jessibuca-controls"))&&this.player.$container.removeChild(e),this.$playBig&&!mn(this.$playBig)&&(e=this.player.$container.querySelector(".jessibuca-play-big"))&&this.player.$container.removeChild(e),this.$recording&&!mn(this.$recording)&&(e=this.player.$container.querySelector(".jessibuca-recording"))&&this.player.$container.removeChild(e),this.$ptzControl&&!mn(this.$ptzControl)&&(e=this.player.$container.querySelector(".jessibuca-ptz-controls"))&&this.player.$container.removeChild(e),this.$zoomControls&&!mn(this.$zoomControls)&&(e=this.player.$container.querySelector(".jessibuca-zoom-controls"))&&this.player.$container.removeChild(e),this.$contextmenus&&(this.$contextmenus.innerHTML="",mn(this.$contextmenus)||(e=this.player.$container.querySelector(".jessibuca-contextmenus"))&&this.player.$container.removeChild(e)),this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container.classList.remove("jessibuca-controls-show-auto-hide"),this.player.$container.classList.remove("jessibuca-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,i=e.height,r=t/i,n=e.video.$videoElement.width/e.video.$videoElement.height;if(r>n){var a=(t-i*n)/2;e.$container.style.padding="0 ".concat(a,"px")}else{var s=(i-t/n)/2;e.$container.style.padding=s+"px 0"}}},{key:"initLoadingBackground",value:function(){var e=this.player;if(e._opt.loadingBackground&&e._opt.heartTimeoutReplayUseLastFrameShow){var t=e.height,i=e._opt,r=(i.hasControl&&!i.controlAutoHide&&(t-=i.playType===v?48:38),this.$loadingBgImage.width=e.width,this.$loadingBgImage.height=t,i.rotate);270!==r&&90!==r||(control.$loadingBgImage.width=t,control.$loadingBgImage.height=e.width),this.$loadingBgImage.src=e._opt.loadingBackground;var n="contain",a=(i.isResize||(n="fill"),i.isFullResize&&(n="none"),"");"none"===i.mirrorRotate&&r&&(a+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?a+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(a+=" rotateX(180deg)"),this.$loadingBgImage.style.transform=a,this.$loadingBgImage.style.objectFit=n,pn(this.$loadingBg,"display","block")}}},{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=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=xt(xe);if(t=Object.assign({},i,t),this._validateExtendBtn(t)){var r=t.name||"",n=this.$controlsRight,a=t.activeIcon&&t.activeClick,s='\n <div class="jessibuca-controls-item-wrap">\n '.concat(t.icon?'<div class="jessibuca-controls-item jessibuca-control-extend-'.concat(r,'">\n <i class="jessibuca-icon jessibuca-icon-extend-').concat(r,'"></i>\n ').concat(t.iconTitle?'\n <span class="icon-title-tips"><span class="icon-title">'.concat(t.iconTitle,"</span></span>\n "):"","\n </div>"):"","\n ").concat(t.activeIcon?'<div class="jessibuca-controls-item jessibuca-control-extend-'.concat(r,'-active">\n <i class="jessibuca-icon jessibuca-icon-extend-').concat(r,'-active"></i>\n ').concat(t.activeIconTitle?'\n <span class="icon-title-tips"><span class="icon-title">'.concat(t.activeIconTitle,"</span></span>\n "):"","\n </div>"):"","\n </div>\n "),o=Array.from(n.children)[t.index],l=(o?o.insertAdjacentHTML("beforebegin",s):fn(n,s),t.icon?n.querySelector(".jessibuca-icon-extend-"+r):null),c=t.icon?n.querySelector(".jessibuca-control-extend-"+r):null,u=t.activeIcon?n.querySelector(".jessibuca-icon-extend-".concat(r,"-active")):null,d=t.activeIcon?n.querySelector(".jessibuca-control-extend-".concat(r,"-active")):null,h=this.player["events"].proxy;t.icon&&(pn(l,"background","url(".concat(t.icon,") no-repeat center")),pn(l,"background-size","100% 100%"),pn(c,"display","none"),t.iconHover)&&(h(l,"mouseover",(function(){pn(l,"background","url(".concat(t.iconHover,") no-repeat center")),pn(l,"background-size","100% 100%")})),h(l,"mouseout",(function(){pn(l,"background","url(".concat(t.icon,") no-repeat center")),pn(l,"background-size","100% 100%")}))),t.activeIcon&&(pn(u,"background","url(".concat(t.activeIcon,") no-repeat center")),pn(u,"background-size","100% 100%"),pn(d,"display","none"),t.activeIconHover)&&(h(u,"mouseover",(function(){pn(u,"background","url(".concat(t.activeIconHover,") no-repeat center")),pn(u,"background-size","100% 100%")})),h(u,"mouseout",(function(){pn(u,"background","url(".concat(t.activeIcon,") no-repeat center")),pn(u,"background-size","100% 100%")}))),t.click&&l&&h(l,"click",(function(i){i.preventDefault(),a&&(pn(c,"display","none"),pn(d,"display","flex")),t.click.call(e.player,e,i)})),t.activeClick&&u&&h(u,"click",(function(i){i.preventDefault(),pn(c,"display","flex"),pn(d,"display","none"),t.activeClick.call(e.player,e,i)})),this.extendBtnList.push({name:r,$iconWrap:c,$activeIconWrap:d})}}}])}();hn(".jessibuca-container{position:relative;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");var yn=function(){function e(){A(this,e)}return y(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:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.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]),i.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]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}},{key:"box",value:function(e){for(var t=8,i=null,r=Array.prototype.slice.call(arguments,1),n=r.length,a=0;a<n;a++)t+=r[a].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);for(var s=8,o=0;o<n;o++)i.set(r[o],s),s+=r[o].byteLength;return i}},{key:"generateInitSegment",value:function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),r=(t=e.moov(t),new Uint8Array(i.byteLength+t.byteLength));return r.set(i,0),r.set(t,i.byteLength),r}},{key:"moov",value:function(t){var i=e.mvhd(t.timescale,t.duration),r=e.trak(t);t=e.mvex(t);return e.box(e.types.moov,i,r,t)}},{key:"mvhd",value:function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,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 i=t.id,r=t.duration,n=t.presentWidth;t=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,t>>>8&255,255&t,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 i=t.timescale;t=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t,85,196,0,0]))}},{key:"hdlr",value:function(t){return t="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,t)}},{key:"minf",value:function(t){var i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD);return e.box(e.types.minf,i,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?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:"mp4a",value:function(t){var i=t.channelCount,r=t.audioSampleRate;i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types.mp4a,i,e.esds(t))}},{key:"esds",value:function(t){t=t.config||[];var i=t.length;i=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(t).concat([6,1,2]));return e.box(e.types.esds,i)}},{key:"avc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=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,r>>>8&255,255&r,t>>>8&255,255&t,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,r,e.box(e.types.avcC,i))}},{key:"hvc1",value:function(t){var i=t.avcc,r=t.codecWidth;t=t.codecHeight,r=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,r>>>8&255,255&r,t>>>8&255,255&t,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,r,e.box(e.types.hvcC,i))}},{key:"mvex",value:function(t){return e.box(e.types.mvex,e.trex(t))}},{key:"trex",value:function(t){return t=t.id,t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]),e.box(e.types.trex,t)}},{key:"moof",value:function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))}},{key:"mfhd",value:function(t){return t=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e.box(e.types.mfhd,t)}},{key:"traf",value:function(t,i){var r=t.id,n=(r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),i=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),e.sdtp(t));t=e.trun(t,n.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,n)}},{key:"sdtp",value:function(t){var i=new Uint8Array(5);t=t.flags;return i[4]=t.isLeading<<6|t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy,e.box(e.types.sdtp,i)}},{key:"trun",value:function(t,i){var r=new Uint8Array(28),n=(i=(r.set([0,0,15,1,0,0,0,1,(i+=36)>>>24&255,i>>>16&255,i>>>8&255,255&i],0),t.duration),t.size),a=t.flags;t=t.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.isNonSync,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t],12),e.box(e.types.trun,r)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();yn.init();var vn=function(t){function i(e){var t;A(this,i),t=p(this,i),t.player=e,t.isAvc=!0,t.mediaSource=new window.MediaSource,t.sourceBuffer=null,t.hasInit=!1,t.isInitInfo=!1,t.cacheTrack={},t.timeInit=!1,t.sequenceNumber=0,t.dropping=!1,t.firstRenderTime=null,t.$videoElement=null,t.mediaSourceAppendBufferFull=!1,t.mediaSourceAppendBufferError=!1,t.isDecodeFirstIIframe=!1,t.prevTimestamp=null,t.decodeDiffTimestamp=null,t.prevDts=null,t.prevPayloadBufferSize=0,t.isWidthOrHeightChanged=!1,t.prevTs=null,t.mediaSourceObjectURL=window.URL.createObjectURL(t.mediaSource),t.eventListenList=[],e._opt.mseUseCanvasRender?(t.$videoElement=document.createElement("video"),t.$videoElement.src=t.mediaSourceObjectURL,t.initVideoEvents()):(t.player.video.$videoElement.src=t.mediaSourceObjectURL,t.$videoElement=t.player.video.$videoElement);var r=e["events"].proxy,n=r(t.mediaSource,"sourceopen",(function(){t.player&&t.player.emit(N.mseSourceOpen)})),a=r(t.mediaSource,"sourceclose",(function(){t.player&&t.player.emit(N.mseSourceClose)})),s=r(t.mediaSource,"sourceended",(function(){t.player&&t.player.emit(N.mseSourceended)}));if(t.eventListenList.push(n,a,s),t.player.isPlayer){var o=r(t.$videoElement,be,(function(i){if(t._handleUpdatePlaybackRate(),e._opt.mseUseCanvasRender)if(t.player.checkIsInRender())t.player.handleRender();else{var r=parseInt(i.timeStamp,10);t.player.debug.warn("MediaSource","mseUseCanvasRender is true and $videoElement ts is ".concat(r,", but not in render"))}else t.player.handleRender()})),l=r(t.$videoElement,we,(function(){e.debug.log("MediaSource","video playback Rate change",t.$videoElement&&t.$videoElement.playbackRate)}));t.eventListenList.push(o,l)}return e.debug.log("MediaSource","init"),t}return g(i,t),y(i,[{key:"destroy",value:function(){this.stop(),this.eventListenList.length&&(this.eventListenList.forEach((function(e){return e()})),this.eventListenList=[]),this.mediaSource=null,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack={},this.timeInit=!1,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.isDecodeFirstIIframe=!1,this.prevTimestamp=null,this.prevDts=null,this.prevPayloadBufferSize=0,this.prevTs=null,this.firstRenderTime=null,this.isWidthOrHeightChanged=!1,this.dropping=!1,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.off(),this.player.debug.log("MediaSource","destroy")}},{key:"state",get:function(){return this.mediaSource&&this.mediaSource.readyState}},{key:"isStateOpen",get:function(){return"open"===this.state}},{key:"isStateClosed",get:function(){return"closed"===this.state}},{key:"isStateEnded",get:function(){return"ended"===this.state}},{key:"duration",get:function(){return this.mediaSource&&this.mediaSource.duration||-1},set:function(e){this.mediaSource.duration=e}},{key:"initVideoEvents",value:function(){var e=this,t=this.player.events["proxy"],i=t(this.$videoElement,ye,(function(){e.player.debug.log("MediaSource","video canplay"),e.$videoElement.play().then((function(){e.player.debug.log("MediaSource","video play")})).catch((function(t){e.player.debug.warn("MediaSource","video play error ",t),e.player.emit(H.mediaSourceUseCanvasRenderPlayFailed),e.player.emit(N.error,H.mediaSourceUseCanvasRenderPlayFailed)}))})),r=t(this.$videoElement,ve,(function(){e.player.debug.log("MediaSource","video waiting")}));t=t(this.$videoElement,be,(function(t){t=parseInt(t.timeStamp,10),e.player.emit(N.videoTimeUpdate,t),e.$videoElement.paused&&(e.player.debug.warn("MediaSource","video is paused and next try to replay"),e.$videoElement.play().then((function(){e.player.debug.log("MediaSource","video is paused and replay success")})).catch((function(t){e.player.debug.warn("MediaSource","video is paused and replay error ",t)})))}));this.eventListenList.push(i,r,t)}},{key:"decodeVideo",value:function(e,t,i,r){var n=this.player;if(n)if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){var a=15&e[0],s={};7==a?s=xi(e.slice(5)):12==a&&(s=Oi(e));var o=this.player.video.videoInfo;o&&o.width&&o.height&&s&&s.codecWidth&&s.codecHeight&&(s.codecWidth!==o.width||s.codecHeight!==o.height)&&(this.player.debug.warn("MediaSource","\n 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(s.codecWidth,", new height is ").concat(s.codecHeight,",\n and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emit(N.error,H.mseWidthOrHeightChange),this.player.emit(H.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("MediaSource","decodeVideo: video width or height is changed, and return");else if(Bt(e))this.player.debug.warn("MediaSource","decodeVideo and payload is video sequence header so drop this frame");else if(e.byteLength<12)this.player.debug.warn("MediaSource","decodeVideo and payload is too small , payload length is "+e.byteLength);else{null===this.firstRenderTime&&(this.firstRenderTime=t);var l=t-this.firstRenderTime;if(l<0&&(this.player.debug.error("MediaSource","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 ")+this.player._opt.mseCorrectTimeDuration),l=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))this.player.debug.error("MediaSource","decodeVideo is max diff , ts is ".concat(t," and prevTs is ").concat(this.prevTs,", diff is ")+(this.prevTs-t)),this.emit(H.mediaSourceTsIsMaxDiff);else{if(null!==this.prevDts&&l<=this.prevDts){if(this.player.debug.error("MediaSource","\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,"\n and mseCorrectTimeDuration is ").concat(this.player._opt.mseCorrectTimeDuration,",\n and prevPayloadBufferSize is ").concat(this.prevPayloadBufferSize," and payload size is ")+e.byteLength),l===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debug.error("MediaSource","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.error("MediaSource","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(H.mediaSourceTsIsMaxDiff)}this._decodeVideo(e,l,i,r,t),this.prevDts=l,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t,this.player.getRenderType()===C&&this.player.video&&this.player.video.doAddContentToWatermark()}}}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false");else if(i&&0===e[1]){var c=15&e[0];n.video.updateVideoInfo({encTypeCode:c}),12!=c||function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(se))||e}()?(n._times.decodeStart||(n._times.decodeStart=We()),this.hasInit=this._decodeConfigurationRecord(e,t,i,c)):this.emit(H.mediaSourceH265NotSupport)}else this.player.debug.error("MediaSource","decodeVideo has not init , isIframe is ".concat(i," , payload is ")+e[1])}},{key:"_checkTsIsMaxDiff",value:function(e){return 0<this.prevTs&&e<this.prevTs&&36e5<this.prevTs-e}},{key:"_decodeConfigurationRecord",value:function(e,t,i,r){var n=e.slice(5),a={};return 7===r?a=xi(n):12===r&&(a=Oi(e)),this.player.recorder&&this.player._opt.recordType===b&&this.player.recorder.initMetaData(e,r),0===a.codecWidth&&0===a.codecHeight?(this.player.debug.error("MediaSource","_decodeConfigurationRecord",a),this.emit(H.mediaSourceDecoderConfigurationError),!1):(e={id:1,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:a.codecWidth,codecHeight:a.codecHeight,videoType:a.videoType},e=yn.generateInitSegment(e),this.isAvc=7===r,this.appendBuffer(e.buffer),this.sequenceNumber=0,this.cacheTrack={},!(this.timeInit=!1))}},{key:"_decodeVideo",value:function(e,t,i,r,n){var a=this.player,s=e.slice(5),o=s.byteLength,l=(new Date).getTime(),c=!1;this.prevTimestamp||(this.prevTimestamp=l,c=!0);e=l-this.prevTimestamp,((this.decodeDiffTimestamp=e)<5||500<e)&&!c&&a.debug.warn("MediaSource","_decodeVideo now time is ".concat(l," and prev time is ").concat(this.prevTimestamp,", diff time is ").concat(e," ms")),e=this.$videoElement;var u,d,h=a._opt.videoBufferDelay+a._opt.videoBuffer;1<e.buffered.length&&(this.removeBuffer(e.buffered.start(0),e.buffered.end(0)),this.timeInit=!1),this.dropping&&this.cacheTrack.id&&t-this.cacheTrack.dts>h?(a.debug.warn("MediaSource","dropping time is ",t-this.cacheTrack.dts),this.dropping=!1,this.cacheTrack={}):this.cacheTrack.id&&t>=this.cacheTrack.dts?(h=8+this.cacheTrack.size,(u=new Uint8Array(h))[0]=h>>>24&255,u[1]=h>>>16&255,u[2]=h>>>8&255,u[3]=255&h,u.set(yn.types.mdat,4),u.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===b&&this.player.recorder.handleAddFmp4Track(this.cacheTrack),h=yn.moof(this.cacheTrack,this.cacheTrack.dts),(d=new Uint8Array(h.byteLength+u.byteLength)).set(h,0),d.set(u,h.byteLength),this.appendBuffer(d.buffer),a.emit(N.timeUpdate,n),a.updateStats({fps:!0,ts:n,mseTs:t,buf:a.demux&&a.demux.delay||0}),a._times.videoStart||(a._times.videoStart=We(),a.handlePlayToRenderTimes())):(a.debug.log("MediaSource","timeInit set false , cacheTrack = {} now dts is ".concat(t,", and ts is ").concat(n," cacheTrack dts is ")+(this.cacheTrack&&this.cacheTrack.dts)),this.timeInit=!1,this.cacheTrack={}),this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=o,this.cacheTrack.dts=t,this.cacheTrack.cts=r,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=s,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==e.buffered.length||(a.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,e.currentTime=e.buffered.end(0)),!this.isInitInfo&&0<e.videoWidth&&0<e.videoHeight&&(a.debug.log("MediaSource","updateVideoInfo: ".concat(e.videoWidth,",")+e.videoHeight),a.video.updateVideoInfo({width:e.videoWidth,height:e.videoHeight}),a.video.initCanvasViewSize(),this.isInitInfo=!0),a._opt.mseUseCanvasRender&&a.video.render({$video:e,ts:t}),this.prevTimestamp=(new Date).getTime()}},{key:"appendBuffer",value:function(e){var t=this,i=this.player,r=i.debug,n=i.events.proxy;if(null===this.sourceBuffer){var a=this.isAvc?ae:se;try{this.sourceBuffer=this.mediaSource.addSourceBuffer(a)}catch(e){r.warn("MediaSource","this.mediaSource.addSourceBuffer()",e.code,e),this.player.emit(N.mseAddSourceBufferError,e)}a=n(this.sourceBuffer,"error",(function(e){t.player.emit(N.mseSourceBufferError,e)})),n=n(this.sourceBuffer,"updateend",(function(){})),this.eventListenList.push(a,n)}if(this.mediaSourceAppendBufferFull)r.error("MediaSource","this.mediaSourceAppendBufferFull is true");else if(this.mediaSourceAppendBufferError)r.error("MediaSource","this.mediaSourceAppendBufferError is true");else if(!1===this.sourceBuffer.updating&&this.isStateOpen)try{this.sourceBuffer.appendBuffer(e)}catch(e){r.warn("MediaSource","this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.emit(H.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(H.mediaSourceAppendBufferError)):(r.error("MediaSource","appendBuffer error",e),this.player.emit(N.mseSourceBufferError,e))}else this.isStateClosed?this.player.emit(H.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emit(H.mseSourceBufferError,"mediaSource is end"):Pt(this.sourceBuffer.updating)&&this.player.emit(N.mseSourceBufferBusy)}},{key:"getSourceBufferUpdating",value:function(){return this.sourceBuffer&&this.sourceBuffer.updating}},{key:"stop",value:function(){this.abortSourceBuffer(),this.endOfStream(),this.removeSourceBuffer()}},{key:"dropSourceBuffer",value:function(e){var t=this.$videoElement;this.dropping=e,0<t.buffered.length&&1<t.buffered.end(0)-t.currentTime&&(this.player.debug.warn("MediaSource","dropSourceBuffer","$video.buffered.end(0) is ".concat(t.buffered.end(0)," - $video.currentTime ")+t.currentTime),t.currentTime=t.buffered.end(0))}},{key:"checkSourceBufferDelay",value:function(){var e=this.$videoElement,t=0;return(t=0<e.buffered.length?e.buffered.end(e.buffered.length-1)-e.currentTime:t)<0&&(this.player.debug.warn("MediaSource","checkSourceBufferDelay end(0) is ".concat(e.buffered.end(0)," - currentTime is ").concat(e.currentTime," and result < 0 and result is ")+t),t=0),t}},{key:"getDecodeDiffTimes",value:function(){return this.decodeDiffTimestamp}},{key:"removeBuffer",value:function(e,t){if(this.isStateOpen&&!1===this.sourceBuffer.updating)try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn("MediaSource","removeBuffer() error",e)}else this.player.debug.warn("MediaSource","removeBuffer() this.isStateOpen is",this.isStateOpen,"this.sourceBuffer.updating",this.sourceBuffer.updating)}},{key:"endOfStream",value:function(){if(this.isStateOpen&&this.$videoElement&&1<=this.$videoElement.readyState)try{this.mediaSource.endOfStream()}catch(e){this.player.debug.warn("MediaSource","endOfStream() error",e)}}},{key:"abortSourceBuffer",value:function(){this.isStateOpen&&this.sourceBuffer&&(this.sourceBuffer.abort(),this.sourceBuffer=null)}},{key:"removeSourceBuffer",value:function(){if(!this.isStateClosed&&this.mediaSource&&this.sourceBuffer)try{this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.warn("MediaSource","removeSourceBuffer() error",e)}}},{key:"_handleUpdatePlaybackRate",value:function(){if(this.$videoElement){var e=this.$videoElement,t=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3,i=e.buffered,r=(i=(i.length&&i.start(0),i.length?i.end(i.length-1):0),e.currentTime),n=i-r;t=Math.max(5,3+t),t=(t<n?(this.player.debug.warn("MediaSource","handleUpdatePlaybackRate and buffered is ".concat(i," and current is ").concat(r," , delay buffer is more than ").concat(t," is ").concat(n," and new time is ")+i),e.currentTime=i,r=e.currentTime):n<0&&(this.player.debug.warn("MediaSource","handleUpdatePlaybackRate and delay buffer is ".concat(i," - current is ").concat(r," = ").concat(n," < 0 and check video is paused : ").concat(e.paused," ")),e.paused)&&e.play(),this._getPlaybackRate(i-r));e.playbackRate!==t&&(this.player.debug.warn("MediaSource","handleUpdatePlaybackRate and buffered is ".concat(i," and current time is ").concat(r," and delay is ").concat(i-r," set playbackRate is ").concat(t," ")),e.playbackRate=t)}}},{key:"getDecodePlaybackRate",value:function(){var e=0,t=this.$videoElement;return t?t.playbackRate:e}},{key:"_getPlaybackRate",value:function(e){var t=this.$videoElement,i=this.player._opt.videoBuffer,r=i+this.player._opt.videoBufferDelay;return e*=1e3,1===t.playbackRate?r<e?1.2:1:e<=i?1:t.playbackRate}}])}(e),bn=function(){return"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")},wn=function(){function t(e){var i=this;A(this,t),this.player=e,this.enabled=!1,bn()?(this.player.debug.log("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=function(){null!==i._wakeLock&&"visible"===document.visibilityState&&i.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%"}),this.noSleepVideo.addEventListener("timeupdate",(function(){4<i.noSleepVideo.currentTime&&(i.noSleepVideo.currentTime=1)})))}return y(t,[{key:"destroy",value:function(){this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}},{key:"_addSourceToVideo",value:function(e,t,i){var r=document.createElement("source");r.src=i,r.type="video/"+t,e.appendChild(r)}},{key:"isEnabled",get:function(){return this.enabled}},{key:"enable",value:function(){var e=this,t=this.player.debug;return bn()?navigator.wakeLock.request("screen").then((function(i){e._wakeLock=i,e.enabled=!0,t.log("wakeLock","Wake Lock active."),e._wakeLock.addEventListener("release",(function(){t.log("wakeLock","Wake Lock released.")}))})).catch((function(i){throw e.enabled=!1,t.error("wakeLock",i.name+", "+i.message),i})):(document.querySelector("body").append(this.noSleepVideo),this.noSleepVideo.play().then((function(t){return e.enabled=!0,t})).catch((function(t){throw e.enabled=!1,t})))}},{key:"disable",value:function(){var t=this.player.debug;if(bn())this._wakeLock&&this._wakeLock.release(),this._wakeLock=null;else{this.noSleepVideo.pause();try{this.noSleepVideo.parentNode&&(this.noSleepVideo.parentNode.removeChild(this.noSleepVideo),this.noSleepVideo=null)}catch(e){t.warn("NoSleep","Failed to remove noSleepVideo element.")}}this.enabled=!1}}])}(),kn=(Cr=je((function(e,t){"undefined"!=typeof window&&(e.exports=function(){return t={"./node_modules/eventemitter3/index.js":function(e,t,i){var r=Object.prototype.hasOwnProperty,n="~";function a(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");return i=new s(i,r||e,a),r=n?n+t:t,e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],i]:e._events[r].push(i):(e._events[r]=i,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function c(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(n=!1)),c.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},c.prototype.listeners=function(e){e=n?n+e:e;var t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,r=t.length,a=new Array(r);i<r;i++)a[i]=t[i].fn;return a},c.prototype.listenerCount=function(e){return e=n?n+e:e,e=this._events[e],e?e.fn?1:e.length:0},c.prototype.emit=function(e,t,i,r,a,s){var o=n?n+e:e;if(!this._events[o])return!1;var l,c=this._events[o],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,a),!0;case 6:return c.fn.call(c.context,t,i,r,a,s),!0}for(f=1,l=new Array(u-1);f<u;f++)l[f-1]=arguments[f];c.fn.apply(c.context,l)}else for(var d,h=c.length,f=0;f<h;f++)switch(c[f].once&&this.removeListener(e,c[f].fn,void 0,!0),u){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,t);break;case 3:c[f].fn.call(c[f].context,t,i);break;case 4:c[f].fn.call(c[f].context,t,i,r);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[f].fn.apply(c[f].context,l)}return!0},c.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},c.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},c.prototype.removeListener=function(e,t,i,r){if(e=n?n+e:e,this._events[e])if(t){var a=this._events[e];if(a.fn)a.fn!==t||r&&!a.once||i&&a.context!==i||l(this,e);else{for(var s=0,o=[],c=a.length;s<c;s++)(a[s].fn!==t||r&&!a[s].once||i&&a[s].context!==i)&&o.push(a[s]);o.length?this._events[e]=1===o.length?o[0]:o:l(this,e)}}else l(this,e);return this},c.prototype.removeAllListeners=function(e){return e?(e=n?n+e:e,this._events[e]&&l(this,e)):(this._events=new a,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=n,e.exports=c.EventEmitter=c},"./node_modules/url-toolkit/src/url-toolkit.js":function(e,t,i){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,n=/^([^\/?#]*)([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=o.parseURL(e);if(r)return r.path=o.normalizePath(r.path),o.buildURLFromParts(r);throw new Error("Error trying to parse base URL.")}if(r=o.parseURL(t),!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=o.normalizePath(r.path),o.buildURLFromParts(r)):t;if(t=o.parseURL(e),!t)throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=n.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var a;e={scheme:t.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};return r.netLoc||(e.netLoc=t.netLoc,"/"===r.path[0])||(r.path?(a=(a=t.path).substring(0,a.lastIndexOf("/")+1)+r.path,e.path=o.normalizePath(a)):(e.path=t.path,r.params||(e.params=t.params,r.query)||(e.query=t.query))),null===e.path&&(e.path=i.alwaysNormalize?o.normalizePath(r.path):r.path),o.buildURLFromParts(e)},parseURL:function(e){return e=r.exec(e),e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(s,"")).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},"./node_modules/webworkify-webpack/index.js":function(e,t,i){function r(e){var t={};function i(r){var n;return(t[r]||(n=t[r]={i:r,l:!1,exports:{}},e[r].call(n.exports,n,n.exports,i),n.l=!0,n)).exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var r=i(i.s=ENTRY_MODULE);return r.default||r}var n="[\\.|\\-|\\+|\\w|/|@]+",a="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function s(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}e.exports=function(e,t){var o={main:i.m},l=(t=t||{}).all?{main:Object.keys(o.main)}:function(t){for(var r={main:[e]},o={main:[]},l={main:{}};function(e){return Object.keys(e).reduce((function(t,i){return t||0<e[i].length}),!1)}(r);)for(var c=Object.keys(r),u=0;u<c.length;u++){var d=c[u],h=r[d].pop();if(l[d]=l[d]||{},!l[d][h]&&t[d][h]){l[d][h]=!0,o[d]=o[d]||[],o[d].push(h);for(var f=function(e,t,r){var o={},l=(o[r]=[],t.toString());if(t=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)){t=t[1];for(var c,u=new RegExp("(\\\\n|\\W)"+s(t)+a,"g");c=u.exec(l);)"dll-reference"!==c[3]&&o[r].push(c[3]);for(u=new RegExp("\\("+s(t)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+a,"g");c=u.exec(l);)e[c[2]]||(o[r].push(c[1]),e[c[2]]=i(c[1]).m),o[c[2]]=o[c[2]]||[],o[c[2]].push(c[4]);for(var d,h=Object.keys(o),f=0;f<h.length;f++)for(var p=0;p<o[h[f]].length;p++)d=o[h[f]][p],isNaN(+d)||(o[h[f]][p]=+o[h[f]][p])}return o}(t,t[d][h],d),p=Object.keys(f),g=0;g<p.length;g++)r[p[g]]=r[p[g]]||[],r[p[g]]=r[p[g]].concat(f[p[g]])}}return o}(o),c="",u=(Object.keys(l).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;l[e][t];)t++;l[e].push(t),o[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",c=c+"var "+e+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+l[e].map((function(t){return JSON.stringify(t)+": "+o[e][t].toString()})).join(",")+"});\n"})),c=c+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+l.main.map((function(e){return JSON.stringify(e)+": "+o.main[e].toString()})).join(",")+"}))(self);",new window.Blob([c],{type:"text/javascript"}));return t.bare||(t=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),(u=new window.Worker(t)).objectURL=t),u}},"./src/config.ts":function(e,t,i){i.r(t),i.d(t,"hlsDefaultConfig",(function(){return w})),i.d(t,"mergeConfig",(function(){return k})),i.d(t,"enableStreamingMode",(function(){return E}));t=i("./src/controller/abr-controller.ts");var r=i("./src/controller/audio-stream-controller.ts"),n=i("./src/controller/audio-track-controller.ts"),a=i("./src/controller/subtitle-stream-controller.ts"),s=i("./src/controller/subtitle-track-controller.ts"),o=i("./src/controller/buffer-controller.ts"),l=i("./src/controller/timeline-controller.ts"),c=i("./src/controller/cap-level-controller.ts"),u=i("./src/controller/fps-controller.ts"),d=i("./src/controller/eme-controller.ts"),h=i("./src/controller/cmcd-controller.ts"),f=i("./src/utils/xhr-loader.ts"),p=i("./src/utils/fetch-loader.ts"),g=i("./src/utils/cues.ts"),m=i("./src/utils/mediakeys-helper.ts"),A=i("./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function v(e,t){var i,r=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)),r}function b(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?v(Object(i),!0).forEach((function(t){var r,n;r=e,n=i[t=t],t in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var w=b(b({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:f.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:t.default,bufferController:o.default,capLevelController:c.default,fpsController:u.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:m.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:g.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:a.SubtitleStreamController,subtitleTrackController:s.default,timelineController:l.TimelineController,audioStreamController:r.default,audioTrackController:n.default,emeController:d.default,cmcdController:h.default});function k(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"');return y({},e,t)}function E(e){var t=e.loader;t!==p.default&&t!==f.default?(A.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Object(p.fetchSupported)()&&(e.loader=p.default,e.progressive=!0,e.enableSoftwareAES=!0,A.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":function(e,t,i){i.r(t);var r=i("./src/polyfills/number.ts"),n=i("./src/utils/ewma-bandwidth-estimator.ts"),a=i("./src/events.ts"),s=i("./src/utils/buffer-helper.ts"),o=i("./src/errors.ts"),l=i("./src/types/loader.ts"),c=i("./src/utils/logger.ts");function u(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,e=(this.hls=e).config,this.bwEstimator=new n.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}(i=d.prototype).registerListeners=function(){var e=this.hls;e.on(a.Events.FRAG_LOADING,this.onFragLoading,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e.off(a.Events.FRAG_LOADING,this.onFragLoading,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.ERROR,this.onError,this)},i.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},i.onFragLoading=function(e,t){var i=t.frag;i.type!==l.PlaylistLevelType.MAIN||this.timer||(this.fragCurrent=i,this.partCurrent=null!=(i=t.part)?i:null,this.timer=self.setInterval(this.onCheck,100))},i.onLevelLoaded=function(e,t){var i=this.hls.config;t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)},i._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,n=i.autoLevelEnabled,o=i.config,l=i.media;if(e&&l){var u=(t||e).stats,d=(t||e).duration;if(u.aborted)c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;else if(n&&!l.paused&&l.playbackRate&&l.readyState){n=performance.now()-u.loading.start;var h=Math.abs(l.playbackRate);if(!(n<=500*d/h)){var f=i.levels,p=i.minAutoLevel,g=f[e.level],m=(g=u.total||Math.max(u.loaded,Math.round(d*g.maxBitrate/8)),Math.max(1,u.bwEstimate?u.bwEstimate/8:1e3*u.loaded/n)),A=(g=(g-u.loaded)/m,l.currentTime),y=(s.BufferHelper.bufferInfo(l,A,o.maxBufferHole).end-A)/h;if(!(2*d/h<=y||g<=y)){for(var v=Number.POSITIVE_INFINITY,b=e.level-1;p<b&&!((v=d*f[b].maxBitrate/(6.4*m))<y);b--);g<=v||(l=this.bwEstimator.getEstimate(),c.logger.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+b+"\n Current BW estimate: "+(Object(r.isFiniteNumber)(l)?(l/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+g.toFixed(3)+" s\n Estimated load time for the next fragment: "+v.toFixed(3)+" s\n Time to underbuffer: "+y.toFixed(3)+" s"),i.nextLoadLevel=b,this.bwEstimator.sample(n,u.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),i.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:u}))}}}}},i.onFragLoaded=function(e,t){var i,n,s,o,c=t.frag;t=t.part;c.type===l.PlaylistLevelType.MAIN&&Object(r.isFiniteNumber)(c.sn)&&(i=(t||c).stats,s=(t||c).duration,this.clearTimer(),this.lastLoadedFragLevel=c.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate&&(n=((o=this.hls.levels[c.level]).loaded?o.loaded.bytes:0)+i.loaded,s=(o.loaded?o.loaded.duration:0)+s,o.loaded={bytes:n,duration:s},o.realBitrate=Math.round(8*n/s)),c.bitrateTest)&&(o={stats:i,frag:c,part:t,id:c.type},this.onFragBuffered(a.Events.FRAG_BUFFERED,o),c.bitrateTest=!1)},i.onFragBuffered=function(e,t){var i,r=t.frag;t=t.part,t=(t||r).stats;t.aborted||r.type!==l.PlaylistLevelType.MAIN||"initSegment"===r.sn||(i=t.parsing.end-t.loading.start,this.bwEstimator.sample(i,t.loaded),t.bwEstimate=this.bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=i/1e3:this.bitrateTestDelay=0)},i.onError=function(e,t){switch(t.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},i.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},i.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,i=this.hls,r=i.maxAutoLevel,n=i.config,a=i.minAutoLevel,o=(i=i.media,t=t?t.duration:e?e.duration:0,e=i?i.currentTime:0,i&&0!==i.playbackRate?Math.abs(i.playbackRate):1),l=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate;i=(s.BufferHelper.bufferInfo(i,e,n.maxBufferHole).end-e)/o,e=this.findBestLevel(l,a,r,i,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(0<=e)return e;c.logger.trace((i?"rebuffering expected":"buffer is empty")+", finding optimal quality level");o=t?Math.min(t,n.maxStarvationDelay):n.maxStarvationDelay;var u,d=n.abrBandWidthFactor,h=n.abrBandWidthUpFactor;return i||(u=this.bitrateTestDelay)&&(o=(t?Math.min(t,n.maxLoadingDelay):n.maxLoadingDelay)-u,c.logger.trace("bitrate test took "+Math.round(1e3*u)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*o)+" ms"),d=h=1),e=this.findBestLevel(l,a,r,i+o,d,h),Math.max(e,0)},i.findBestLevel=function(e,t,i,r,n,a){for(var s,o=this.fragCurrent,l=this.partCurrent,u=this.lastLoadedFragLevel,d=this.hls.levels,h=d[u],f=!(null==h||null==(s=h.details)||!s.live),p=null==h?void 0:h.codecSet,g=l?l.duration:o?o.duration:0,m=i;t<=m;m--){var A=d[m];if(A&&(!p||A.codecSet===p)){A=A.details,A=(l?null==A?void 0:A.partTarget:null==A?void 0:A.averagetargetduration)||g;var y,v=d[m].maxBitrate,b=v*A/(y=m<=u?n*e:a*e);if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(y)+"/"+v+"/"+A+"/"+r+"/"+b),v<y&&(!b||f&&!this.bitrateTestDelay||b<r))return m}}return-1},u(d.prototype,[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;return-1===e||t&&t.canEstimate()?(t=this.getNextABRAutoLevel(),-1!==e?Math.min(e,t):t):e},set:function(e){this._nextAutoLevel=e}}]),t.default=d},"./src/controller/audio-stream-controller.ts":function(e,t,i){i.r(t);var r=i("./src/polyfills/number.ts"),n=i("./src/controller/base-stream-controller.ts"),a=i("./src/events.ts"),s=i("./src/utils/buffer-helper.ts"),o=i("./src/controller/fragment-tracker.ts"),l=i("./src/types/level.ts"),c=i("./src/types/loader.ts"),u=i("./src/loader/fragment.ts"),d=i("./src/demux/chunk-cache.ts"),h=i("./src/demux/transmuxer-interface.ts"),f=i("./src/types/transmuxer.ts"),p=i("./src/controller/fragment-finders.ts"),g=i("./src/utils/discontinuities.ts"),m=i("./src/errors.ts"),A=i("./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}b=n.default,i=b,(w=k).prototype=Object.create(i.prototype),v(w.prototype.constructor=w,i),(w=k.prototype).onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},w._registerListeners=function(){var e=this.hls;e.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(a.Events.ERROR,this.onError,this),e.on(a.Events.BUFFER_RESET,this.onBufferReset,this),e.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w._unregisterListeners=function(){var e=this.hls;e.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(a.Events.ERROR,this.onError,this),e.off(a.Events.BUFFER_RESET,this.onBufferReset,this),e.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},w.onInitPtsFound=function(e,t){var i=t.frag,r=t.id;t=t.initPTS;"main"===r&&(r=i.cc,this.initPTS[i.cc]=t,this.log("InitPTS for cc: "+r+" found from main: "+t),this.videoTrackCC=r,this.state===n.State.WAITING_INIT_PTS)&&this.tick()},w.startLoad=function(e){var t;this.levels?(t=this.lastCurrentTime,this.stopLoad(),this.setInterval(100),(this.fragLoadError=0)<t&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=n.State.IDLE):(this.loadedmetadata=!1,this.state=n.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this.startPosition=e,this.state=n.State.STOPPED)},w.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_TRACK:var e=this.levels,t=this.trackId;t=null==e||null==(e=e[t])?void 0:e.details;if(t){if(this.waitForCdnTuneIn(t))break;this.state=n.State.WAITING_INIT_PTS}break;case n.State.FRAG_LOADING_WAITING_RETRY:e=performance.now(),t=this.retryDate,(!t||t<=e||null!=(t=this.media)&&t.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=n.State.IDLE);break;case n.State.WAITING_INIT_PTS:var i,r;e=this.waitingData;e?(t=e.frag,i=e.part,r=e.cache,e=e.complete,void 0!==this.initPTS[t.cc]?(this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.FRAG_LOADING,i={frag:t,part:i,payload:r.flush(),networkDetails:null},this._handleFragmentLoadProgress(i),e&&b.prototype._handleFragmentLoadComplete.call(this,i)):this.videoTrackCC!==this.waitingVideoCC?(A.logger.log("Waiting fragment cc ("+t.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment()):(r=this.getLoadPosition(),e=s.BufferHelper.bufferInfo(this.mediaBuffer,r,this.config.maxBufferHole),Object(p.fragmentWithinToleranceTest)(e.end,this.config.maxFragLookUpTolerance,t)<0&&(A.logger.log("Waiting fragment cc ("+t.cc+") @ "+t.start+" cancelled because another fragment at "+e.end+" is needed"),this.clearWaitingFragment()))):this.state=n.State.IDLE}this.onTickEnd()},w.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.IDLE)},w.onTickEnd=function(){var e,t=this.media;t&&t.readyState&&(e=(this.mediaBuffer||t).buffered,!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime)},w.doTickIdle=function(){var e,t,i=this.hls,r=this.levels,s=this.media,o=this.trackId,l=i.config;r&&r[o]&&(s||!this.startFragRequested&&l.startFragPrefetch)&&(!(l=r[o].details)||l.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(l)?this.state=n.State.WAITING_TRACK:(this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer||this.media,u.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO)),null!==(r=this.getFwdBufferInfo(this.mediaBuffer||this.media,c.PlaylistLevelType.AUDIO))&&(o=r.len,e=this.getMaxBufferLength(),t=this.audioSwitch,e<=o&&!t||(!t&&this._streamEnded(r,l)?(i.trigger(a.Events.BUFFER_EOS,{type:"audio"}),this.state=n.State.ENDED):(e=l.fragments[0].start,o=r.end,t&&(o=i=this.getLoadPosition(),l.PTSKnown)&&i<e&&(r.end>e||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=e+.05),(t=this.getNextFragment(o,l))?"identity"!==(null==(i=t.decryptdata)?void 0:i.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,l,o):this.loadKey(t,l):this.bufferFlushed=!0)))))},w.getMaxBufferLength=function(){var e=b.prototype.getMaxBufferLength.call(this),t=this.getFwdBufferInfo(this.videoBuffer||this.media,c.PlaylistLevelType.MAIN);return null===t?e:Math.max(e,t.len)},w.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},w.onAudioTracksUpdated=function(e,t){t=t.audioTracks,this.resetTransmuxer(),this.levels=t.map((function(e){return new l.Level(e)}))},w.onAudioTrackSwitching=function(e,t){var i=!!t.url;this.trackId=t.id,t=this.fragCurrent;null!=t&&t.loader&&t.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=n.State.IDLE):this.state=n.State.STOPPED,this.tick()},w.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},w.onLevelLoaded=function(e,t){this.mainDetails=t.details},w.onAudioTrackLoaded=function(e,t){var i=this.levels,r=t.details;t=t.id;if(i){this.log("Track "+t+" loaded ["+r.startSN+","+r.endSN+"],duration:"+r.totalduration);i=i[t];var a=0;if(r.live||null!=(s=i.details)&&s.live){var s=this.mainDetails;if(r.fragments[0]||(r.deltaUpdateFailed=!0),r.deltaUpdateFailed||!s)return;a=!i.details&&r.hasProgramDateTime&&s.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(r,s),r.fragments[0].start):this.alignPlaylists(r,i.details)}i.details=r,this.levelLastLoaded=t,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(i.details,a),this.state!==n.State.WAITING_TRACK||this.waitForCdnTuneIn(r)||(this.state=n.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)},w._handleFragmentLoadProgress=function(e){var t,i,r,a,s=e.frag,o=e.part,l=(e=e.payload,this.config),u=this.trackId,p=this.levels;p?(p=p[u],console.assert(p,"Audio track is defined on fragment load progress"),t=p.details,console.assert(t,"Audio track details are defined on fragment load progress"),l=l.defaultAudioCodec||p.audioCodec||"mp4a.40.2",p=(p=this.transmuxer)||(this.transmuxer=new h.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this))),i=this.initPTS[s.cc],r=null==(r=s.initSegment)?void 0:r.data,void 0!==i?(a=o?o.index:-1,a=new f.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,e.byteLength,a,-1!==a),p.push(e,r,l,"",s,o,t.totalduration,!1,a,i)):(A.logger.log("Unknown video PTS for cc "+s.cc+", waiting for video PTS before demuxing audio frag "+s.sn+" of ["+t.startSN+" ,"+t.endSN+"],track "+u),(this.waitingData=this.waitingData||{frag:s,part:o,cache:new d.default,complete:!1}).cache.push(new Uint8Array(e)),this.waitingVideoCC=this.videoTrackCC,this.state=n.State.WAITING_INIT_PTS)):this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+s.sn+" of level "+s.level+" will not be buffered")},w._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:b.prototype._handleFragmentLoadComplete.call(this,e)},w.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},w.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},w.onFragBuffered=function(e,t){var i=t.frag;t=t.part;i.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(t?" p: "+t.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch)&&(this.audioSwitch=!1,this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.fragBufferedComplete(i,t)))},w.onError=function(e,t){switch(t.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,t);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==n.State.ERROR&&this.state!==n.State.STOPPED&&(this.state=t.fatal?n.State.ERROR:n.State.IDLE,this.warn(t.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"audio"!==t.parent||this.state!==n.State.PARSING&&this.state!==n.State.PARSED||(i=!0,(i=(r=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO))&&.5<r.len?!this.reduceMaxBufferLength(r.len):i)&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,b.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState())}},w.onBufferFlushed=function(e,t){t.type===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},w._handleTransmuxComplete=function(e){var t,i,r,s,o,l,c,d=this.hls,h=e.remuxResult,f=(e=e.chunkMeta,this.getCurrentContext(e));f?(t=f.frag,f=f.part,i=h.audio,r=h.text,s=h.id3,h=h.initSegment,this.fragContextChanged(t)||(this.state=n.State.PARSING,this.audioSwitch&&i&&this.completeAudioSwitch(),null!=h&&h.tracks&&(this._bufferInitSegment(h.tracks,t,e),d.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:"audio",tracks:h.tracks})),i&&(h=i.startPTS,l=i.endPTS,c=i.startDTS,o=i.endDTS,f&&(f.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:h,endPTS:l,startDTS:c,endDTS:o}),t.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,h,l,c,o),this.bufferFragmentData(i,t,f,e)),null!=s&&null!=(h=s.samples)&&h.length&&(l=y({frag:t,id:"audio"},s),d.trigger(a.Events.FRAG_PARSING_METADATA,l)),r&&(c=y({frag:t,id:"audio"},r),d.trigger(a.Events.FRAG_PARSING_USERDATA,c)))):(this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(e.level))},w._bufferInitSegment=function(e,t,i){var r;this.state===n.State.PARSING&&(e.video&&delete e.video,r=e.audio)&&(r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e),null!=(e=r.initSegment)&&e.byteLength&&(r={type:"audio",frag:t,part:null,chunkMeta:i,parent:t.type,data:e},this.hls.trigger(a.Events.BUFFER_APPENDING,r)),this.tick())},w.loadFragment=function(e,t,i){var a=this.fragmentTracker.getState(e);this.fragCurrent=e,!this.audioSwitch&&a!==o.FragmentState.NOT_LOADED&&a!==o.FragmentState.PARTIAL||("initSegment"===e.sn?this._loadInitSegment(e):t.live&&!Object(r.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=n.State.WAITING_INIT_PTS):(this.startFragRequested=!0,b.prototype.loadFragment.call(this,e,t,i)))},w.completeAudioSwitch=function(){var e=this.hls,t=this.media,i=this.trackId;t&&(this.log("Switching audio track : flushing all audio"),b.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:i})};var b,w;i=k;function k(e,t){return(e=b.call(this,e,t,"[audio-stream-controller]")||this).videoBuffer=null,e.videoTrackCC=-1,e.waitingVideoCC=-1,e.audioSwitch=!1,e.trackId=-1,e.waitingData=null,e.mainDetails=null,e.bufferFlushed=!1,e._registerListeners(),e}t.default=i},"./src/controller/audio-track-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts"),n=i("./src/errors.ts"),a=i("./src/controller/base-playlist-controller.ts"),s=i("./src/types/loader.ts");function o(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}c=a.default,i=c,(a=u).prototype=Object.create(i.prototype),l(a.prototype.constructor=a,i),(a=u.prototype).registerListeners=function(){var e=this.hls;e.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(r.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var e=this.hls;e.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(r.Events.ERROR,this.onError,this)},a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,c.prototype.destroy.call(this)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},a.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},a.onAudioTrackLoaded=function(e,t){var i,r=t.id,n=t.details,a=this.tracksInGroup[r];a?(i=a.details,a.details=t.details,this.log("audioTrack "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,i))):this.warn("Invalid audio track id "+r)},a.onLevelLoading=function(e,t){this.switchLevel(t.level)},a.onLevelSwitching=function(e,t){this.switchLevel(t.level)},a.switchLevel=function(e){var t,i;e=this.hls.levels[e];null!=e&&e.audioGroupIds&&(t=e.audioGroupIds[e.urlId],this.groupId!==t)&&(this.groupId=t,e=this.tracks.filter((function(e){return!t||e.groupId===t})),this.selectDefaultTrack&&!e.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),i={audioTracks:this.tracksInGroup=e},this.log("Updating audio tracks, "+e.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(r.Events.AUDIO_TRACKS_UPDATED,i),this.selectInitialTrack())},a.onError=function(e,t){c.prototype.onError.call(this,e,t),!t.fatal&&t.context&&t.context.type===s.PlaylistContextType.AUDIO_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},a.setAudioTrack=function(e){var t,i,n,a,s,o,l=this.tracksInGroup;e<0||e>=l.length?this.warn("Invalid id passed to audio-track controller"):(this.clearTimer(),t=l[this.trackId],this.log("Now switching to audio-track index "+e),i=(l=l[e]).id,n=void 0===(n=l.groupId)?"":n,a=l.name,s=l.type,o=l.url,this.trackId=e,this.trackName=a,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:i,groupId:n,name:a,type:s,url:o}),l.details&&!l.details.live||(e=this.switchParams(l.url,null==t?void 0:t.details),this.loadPlaylist(e)))},a.selectInitialTrack=function(){var e=this.tracksInGroup;console.assert(e.length,"Initial audio track should be selected when tracks are known"),e=this.trackName,e=this.findTrackId(e)||this.findTrackId();-1!==e?this.setAudioTrack(e):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},a.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1},a.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,n=t.groupId;t=t.url;if(e)try{t=e.addDirectives(t)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("loading audio-track playlist for id: "+i),this.clearTimer(),this.hls.trigger(r.Events.AUDIO_TRACK_LOADING,{url:t,id:i,groupId:n,deliveryDirectives:e||null})}},o(u.prototype,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}]);var c;i=u;function u(e){return(e=c.call(this,e,"[audio-track-controller]")||this).tracks=[],e.groupId=null,e.tracksInGroup=[],e.trackId=-1,e.trackName="",e.selectDefaultTrack=!0,e.registerListeners(),e}t.default=i},"./src/controller/base-playlist-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return l}));var r=i("./src/polyfills/number.ts"),n=i("./src/types/level.ts"),a=i("./src/controller/level-helper.ts"),s=i("./src/utils/logger.ts"),o=i("./src/errors.ts"),l=((t=c.prototype).destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.onError=function(e,t){t.fatal&&t.type===o.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},t.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},t.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var i=null==t?void 0:t.renditionReports;if(i)for(var a=0;a<i.length;a++){var s=i[a],o=""+s.URI;if(o===e.substr(-o.length)){var l;o=parseInt(s["LAST-MSN"]),s=parseInt(s["LAST-PART"]);if(t&&this.hls.config.lowLatencyMode&&(l=Math.min(t.age-t.partTarget,t.targetduration),void 0!==s)&&l>t.partTarget&&(s+=1),Object(r.isFiniteNumber)(o))return new n.HlsUrlParameters(o,Object(r.isFiniteNumber)(s)?s:void 0,n.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,i){var r=this,n=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(n.advancedDateTime=Date.now()-o,n.live||null!=i&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+e+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),i&&0<n.fragments.length&&Object(a.mergeDetails)(i,n),this.canLoad&&n.live){o=void 0;var l,c=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var u=this.hls.config.lowLatencyMode,d=n.lastPartSn,h=n.endSN,f=n.lastPartIndex,p=d===h;d=(-1!==f?(o=p?h+1:d,c=p?u?0:f:f+1):o=h+1,n.age),f=d+n.ageHeader,h=Math.min(f-n.partTarget,1.5*n.targetduration);if(0<h&&(i&&h>i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+h+" with playlist age: "+n.age),h=0):(o+=f=Math.floor(h/n.targetduration),void 0!==c&&(c+=Math.round(h%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+h+" skip sn "+f+" to part "+c)),n.tuneInGoal=h),l=this.getDeliveryDirectives(n,t.deliveryDirectives,o,c),u||!p)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(n,t.deliveryDirectives,o,c);i=Object(a.computeReloadInterval)(n,s),void 0!==o&&n.canBlockReload&&(i-=n.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(i)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(l)}),i)}}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,i,r){var a=Object(n.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,a=n.HlsSkip.No),new n.HlsUrlParameters(i,r,a)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,n=this.retryCount<r.levelLoadingMaxRetry;return n?(this.retryCount++,-1<e.details.indexOf("LoadTimeOut")&&null!=(t=e.context)&&t.deliveryDirectives?(this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist()):(t=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout),this.timer=self.setTimeout((function(){return i.loadPlaylist()}),t),this.warn("retry playlist loading #"+this.retryCount+" in "+t+' ms after "'+e.details+'"'))):(this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0),n},c);function c(e,t){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=s.logger.log.bind(s.logger,t+":"),this.warn=s.logger.warn.bind(s.logger,t+":"),this.hls=e}},"./src/controller/base-stream-controller.ts":function(e,t,i){i.r(t),i.d(t,"State",(function(){return w})),i.d(t,"default",(function(){return k}));var r=i("./src/polyfills/number.ts"),n=(t=i("./src/task-loop.ts"),i("./src/controller/fragment-tracker.ts")),a=i("./src/utils/buffer-helper.ts"),s=i("./src/utils/logger.ts"),o=i("./src/events.ts"),l=i("./src/errors.ts"),c=i("./src/types/transmuxer.ts"),u=i("./src/utils/mp4-tools.ts"),d=i("./src/utils/discontinuities.ts"),h=i("./src/controller/fragment-finders.ts"),f=i("./src/controller/level-helper.ts"),p=i("./src/loader/fragment-loader.ts"),g=i("./src/crypt/decrypter.ts"),m=i("./src/utils/time-ranges.ts"),A=i("./src/types/loader.ts");function y(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var b,w={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},k=(b=t.default,i=b,(t=E).prototype=Object.create(i.prototype),v(t.prototype.constructor=t,i),(t=E.prototype).doTick=function(){this.onTickEnd()},t.onTickEnd=function(){},t.startLoad=function(e){},t.stopLoad=function(){this.fragmentLoader.abort();var e=this.fragCurrent;e&&this.fragmentTracker.removeFragment(e),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=w.STOPPED},t._streamEnded=function(e,t){var i=this.fragCurrent,r=this.fragmentTracker;return!(!(!t.live&&i&&i.sn>=t.endSN)||e.nextStart)&&(null!=(e=t.partList)&&e.length?(t=e[e.length-1],a.BufferHelper.isBuffered(this.media,t.start+t.duration/2)):(e=r.getState(i))===n.FragmentState.PARTIAL||e===n.FragmentState.OK)},t.onMediaAttached=function(e,t){t=this.media=this.mediaBuffer=t.media,this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended),t=this.config,this.levels&&t.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(t.startPosition)},t.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},t.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,i=this.media,n=this.mediaBuffer,s=this.state,o=i?i.currentTime:0;n=a.BufferHelper.bufferInfo(n||i,o,e.maxBufferHole);this.log("media seeking to "+(Object(r.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+s),s===w.ENDED?this.resetLoadingState():t&&!n.len&&(s=e.maxFragLookUpTolerance,e=t.start-s,s=o>t.start+t.duration+s,o<e||s)&&(s&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.resetLoadingState()),i&&(this.lastCurrentTime=o),this.loadedmetadata||n.len||(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()},t.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},t.onKeyLoaded=function(e,t){var i;this.state===w.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels&&(this.state=w.IDLE,i=this.levels[t.frag.level].details)&&this.loadFragment(t.frag,i,t.frag.start)},t.onHandlerDestroying=function(){this.stopLoad(),b.prototype.onHandlerDestroying.call(this)},t.onHandlerDestroyed=function(){this.state=w.STOPPED,this.hls.off(o.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,b.prototype.onHandlerDestroyed.call(this)},t.loadKey=function(e,t){this.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=w.KEY_LOADING,this.fragCurrent=e,this.hls.trigger(o.Events.KEY_LOADING,{frag:e})},t.loadFragment=function(e,t,i){this._loadFragForPlayback(e,t,i)},t._loadFragForPlayback=function(e,t,i){var r=this;this._doFragLoad(e,t,i,(function(t){r.fragContextChanged(e)?(r.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),r.fragmentTracker.removeFragment(e)):(e.stats.chunkCount++,r._handleFragmentLoadProgress(t))})).then((function(t){if(t){r.fragLoadError=0;var i=r.state;if(!r.fragContextChanged(e))return"payload"in t&&(r.log("Loaded fragment "+e.sn+" of level "+e.level),r.hls.trigger(o.Events.FRAG_LOADED,t),r.state===w.BACKTRACKING)?(r.fragmentTracker.backtrack(e,t),void r.resetFragmentLoading(e)):void r._handleFragmentLoadComplete(t);i!==w.FRAG_LOADING&&i!==w.BACKTRACKING&&(r.fragCurrent||i!==w.PARSING)||(r.fragmentTracker.removeFragment(e),r.state=w.IDLE)}})).catch((function(t){r.warn(t),r.resetFragmentLoading(e)}))},t.flushMainBuffer=function(e,t,i){void 0===i&&(i=null),e-t&&(e={startOffset:e,endOffset:t,type:i},this.fragLoadError=0,this.hls.trigger(o.Events.BUFFER_FLUSHING,e))},t._loadInitSegment=function(e){var t=this;this._doFragLoad(e).then((function(i){if(i&&!t.fragContextChanged(e)&&t.levels)return i;throw new Error("init load aborted")})).then((function(i){var r,n=t.hls,a=i.payload,s=e.decryptdata;return a&&0<a.byteLength&&s&&s.key&&s.iv&&"AES-128"===s.method?(r=self.performance.now(),t.decrypter.webCryptoDecrypt(new Uint8Array(a),s.key.buffer,s.iv.buffer).then((function(t){var a=self.performance.now();return n.trigger(o.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:r,tdecrypt:a}}),i.payload=t,i}))):i})).then((function(i){var r=t.fragCurrent,n=t.hls,a=t.levels;if(!a)throw new Error("init load aborted, missing levels");a=a[e.level].details,console.assert(a,"Level details are defined when init segment is loaded"),a=e.stats,t.state=w.IDLE,t.fragLoadError=0,e.data=new Uint8Array(i.payload),a.parsing.start=a.buffering.start=self.performance.now(),a.parsing.end=a.buffering.end=self.performance.now(),i.frag===r&&n.trigger(o.Events.FRAG_BUFFERED,{stats:a,frag:r,part:null,id:e.type}),t.tick()})).catch((function(i){t.warn(i),t.resetFragmentLoading(e)}))},t.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},t.fragBufferedComplete=function(e,t){var i=this.mediaBuffer||this.media;this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level+" "+m.default.toString(a.BufferHelper.getBuffered(i))),this.state=w.IDLE,this.tick()},t._handleFragmentLoadComplete=function(e){var t,i,r=this.transmuxer;r&&(i=e.frag,t=e.part,e=!(e=e.partsLoaded)||0===e.length||e.some((function(e){return!e})),i=new c.ChunkMetadata(i.level,i.sn,i.stats.chunkCount+1,0,t?t.index:-1,!e),r.flush(i))},t._handleFragmentLoadProgress=function(e){},t._doFragLoad=function(e,t,i,n){var a=this;if(void 0===i&&(i=null),!this.levels)throw new Error("frag load aborted, missing levels");if(i=Math.max(e.start,i||0),this.config.lowLatencyMode&&t){var s=t.partList;if(s&&n){i>e.end&&t.fragmentHint&&(e=t.fragmentHint);var l,c=this.getNextPart(s,e,i);if(-1<c)return l=s[c],this.log("Loading part sn: "+e.sn+" p: "+l.index+" cc: "+e.cc+" of playlist ["+t.startSN+"-"+t.endSN+"] parts [0-"+c+"-"+(s.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),this.nextLoadPosition=l.start+l.duration,this.state=w.FRAG_LOADING,this.hls.trigger(o.Events.FRAG_LOADING,{frag:e,part:s[c],targetBufferTime:i}),this.doFragPartsLoad(e,s,c,n).catch((function(e){return a.handleFragLoadError(e)}));if(!e.url||this.loadedEndOfParts(s,i))return Promise.resolve(null)}}return this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(t?"of ["+t.startSN+"-"+t.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(i.toFixed(3))),Object(r.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=w.FRAG_LOADING,this.hls.trigger(o.Events.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragmentLoader.load(e,n).catch((function(e){return a.handleFragLoadError(e)}))},t.doFragPartsLoad=function(e,t,i,r){var n=this;return new Promise((function(a,s){var l=[];!function i(c){var u=t[c];n.fragmentLoader.loadPart(e,u,r).then((function(r){var s=(l[u.index]=r).part;n.hls.trigger(o.Events.FRAG_LOADED,r),r=t[c+1];if(!r||r.fragment!==e)return a({frag:e,part:s,partsLoaded:l});i(c+1)})).catch(s)}(i)}))},t.handleFragLoadError=function(e){return e=e.data,e&&e.details===l.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(o.Events.ERROR,e),null},t._handleTransmuxerFlush=function(e){var t,i,r,n=this.getCurrentContext(e);n&&this.state===w.PARSING?(t=n.frag,i=n.part,n=n.level,r=self.performance.now(),t.stats.parsing.end=r,i&&(i.stats.parsing.end=r),this.updateLevelTiming(t,i,n,e.partial)):this.fragCurrent||(this.state=w.IDLE)},t.getCurrentContext=function(e){var t,i=this.levels,r=e.level,n=e.sn;e=e.part;return i&&i[r]?(i=i[r],(t=(e=-1<e?Object(f.getPartWith)(i,n,e):null)?e.fragment:Object(f.getFragmentWithSN)(i,n,this.fragCurrent))?{frag:t,part:e,level:i}:null):(this.warn("Levels object was unset while buffering fragment "+n+" of level "+r+". The current chunk will not be buffered."),null)},t.bufferFragmentData=function(e,t,i,r){var n,a,s;e&&this.state===w.PARSING&&(s=e.data1,n=e.data2,a=(a=s)&&n?Object(u.appendUint8Array)(s,n):a)&&a.length&&(s={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:a},this.hls.trigger(o.Events.BUFFER_APPENDING,s),e.dropped)&&e.independent&&!i&&this.flushBufferGap(t)},t.flushBufferGap=function(e){var t,i,r=this.media;r&&(a.BufferHelper.isBuffered(r,r.currentTime)?(t=r.currentTime,r=a.BufferHelper.bufferInfo(r,t,0),i=e.duration,i=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),r=Math.max(Math.min(e.start-i,r.end-i),t+i),e.start-r>i&&this.flushMainBuffer(r,e.start)):this.flushMainBuffer(0,e.start))},t.getFwdBufferInfo=function(e,t){var i=this.config,n=this.getLoadPosition();if(!Object(r.isFiniteNumber)(n))return null;var s=a.BufferHelper.bufferInfo(e,n,i.maxBufferHole);return 0===s.len&&void 0!==s.nextStart&&(t=this.fragmentTracker.getBufferedFrag(n,t),t&&s.nextStart<t.end)?a.BufferHelper.bufferInfo(e,n,Math.max(s.nextStart,i.maxBufferHole)):s},t.getMaxBufferLength=function(e){var t=this.config;e=e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength;return Math.min(e,t.maxMaxBufferLength)},t.reduceMaxBufferLength=function(e){var t=this.config;e=e||t.maxBufferLength;return t.maxMaxBufferLength>=e&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},t.getNextFragment=function(e,t){var i=t.fragments,r=i.length;if(!r)return null;var n,a=this.config,s=i[0].start;if(t.live){var o=a.initialLiveManifestSize;if(r<o)return this.warn("Not enough fragments to start playback (have: "+r+", need: "+o+")"),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(n=this.getInitialLiveFragment(t,i),this.startPosition=n?this.hls.liveSyncPosition||n.start:e)}else e<=s&&(n=i[0]);return n||(r=a.lowLatencyMode?t.partEnd:t.fragmentEnd,n=this.getFragmentAtPosition(e,r,t)),null==(o=n)||!o.initSegment||null!=(s=n)&&s.initSegment.data||this.bitrateTest?n:n.initSegment},t.getNextPart=function(e,t,i){for(var r=-1,n=!1,a=!0,s=0,o=e.length;s<o;s++){var l=e[s];a=a&&!l.independent;if(-1<r&&i<l.start)break;var c=l.loaded;!c&&(n||l.independent||a)&&l.fragment===t&&(r=s),n=c}return r},t.loadedEndOfParts=function(e,t){return e=e[e.length-1],e&&t>e.start&&e.loaded},t.getInitialLiveFragment=function(e,t){var i,r=this.fragPrevious,n=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=Object(h.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),n||((i=r.sn+1)>=e.startSN&&i<=e.endSN&&(i=t[i-e.startSN],r.cc===i.cc)&&this.log("Live playlist, switching playlist, load frag with next SN: "+(n=i).sn),n)||(n=Object(h.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+n.sn)):null!==(i=this.hls.liveSyncPosition)&&(n=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),n},t.getFragmentAtPosition=function(e,t,i){var r,a=this.config,s=this.fragPrevious,o=i.fragments,l=i.endSN,c=i.fragmentHint,u=a.maxFragLookUpTolerance;a=!!(a.lowLatencyMode&&i.partList&&c);if(a&&c&&!this.bitrateTest&&(o=o.concat(c),l=c.sn),r=e<t?(c=t-u<e?0:u,Object(h.findFragmentByPTS)(s,o,e,c)):o[o.length-1])if(t=r.sn-i.startSN,u=s&&r.level===s.level,e=o[1+t],this.fragmentTracker.getState(r)===n.FragmentState.BACKTRACKED){r=null;for(var d=t;o[d]&&this.fragmentTracker.getState(o[d])===n.FragmentState.BACKTRACKED;)r=s?o[d--]:o[--d];r=r||e}else s&&r.sn===s.sn&&!a&&u&&(r=r.sn<l&&this.fragmentTracker.getState(e)!==n.FragmentState.OK?(this.log("SN "+r.sn+" just loaded, load next one: "+e.sn),e):null);return r},t.synchronizeToLiveEdge=function(e){var t,i,r,n,a=this.config,s=this.media;s&&(t=this.hls.liveSyncPosition,i=s.currentTime,n=e.fragments[0].start,r=e.edge,n=i>=n-a.maxFragLookUpTolerance&&i<=r,null!==t)&&s.duration>t&&(i<t||!n)&&(a=void 0!==a.liveMaxLatencyDuration?a.liveMaxLatencyDuration:a.liveMaxLatencyDurationCount*e.targetduration,!n&&s.readyState<4||i<r-a)&&(this.loadedmetadata||(this.nextLoadPosition=t),s.readyState)&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+r+", reset currentTime to : "+t.toFixed(3)),s.currentTime=t)},t.alignPlaylists=function(e,t){var i,n,a,s=this.levels,o=this.levelLastLoaded,l=this.fragPrevious;s=null!==o?s[o]:null,o=e.fragments.length;return o?(i=e.fragments[0].start,a=!t,n=e.alignedSliding&&Object(r.isFiniteNumber)(i),a||!n&&!i?(Object(d.alignStream)(l,s,e),a=e.fragments[0].start,this.log("Live playlist sliding: "+a.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" prev-sn: "+(l?l.sn:"na")+" fragments: "+o),a):i):(this.warn("No fragments in live playlist"),0)},t.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},t.setStartPosition=function(e,t){var i,n=this.startPosition;-1!==(n=n<t?-1:n)&&-1!==this.lastCurrentTime||(i=e.startTimeOffset,Object(r.isFiniteNumber)(i)?(n=t+i,i<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log("Start time offset "+i+" found in playlist, adjust startPosition to "+n),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n),this.nextLoadPosition=n},t.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},t.handleFragLoadAborted=function(e,t){this.transmuxer&&"initSegment"!==e.sn&&e.stats.aborted&&(this.warn("Fragment "+e.sn+(t?" part"+t.index:"")+" of level "+e.level+" was aborted"),this.resetFragmentLoading(e))},t.resetFragmentLoading=function(e){this.fragCurrent&&this.fragContextChanged(e)||(this.state=w.IDLE)},t.onFragmentOrKeyLoadError=function(e,t){var i,r;t.fatal||(i=t.frag)&&i.type===e&&(r=this.fragCurrent,console.assert(r&&i.sn===r.sn&&i.level===r.level&&i.urlId===r.urlId,"Frag load error must match current frag to retry"),r=this.config,this.fragLoadError+1<=r.fragLoadingMaxRetry?this.resetLiveStartWhenNotLoaded(i.level)||(r=Math.min(Math.pow(2,this.fragLoadError)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout),this.warn("Fragment "+i.sn+" of "+e+" "+i.level+" failed to load, retrying in "+r+"ms"),this.retryDate=self.performance.now()+r,this.fragLoadError++,this.state=w.FRAG_LOADING_WAITING_RETRY):t.levelRetry?(e===A.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=w.IDLE):(s.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=w.ERROR))},t.afterBufferFlushed=function(e,t,i){e&&(e=a.BufferHelper.getBuffered(e),this.fragmentTracker.detectEvictedFragments(t,e,i),this.state===w.ENDED)&&this.resetLoadingState()},t.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=w.IDLE},t.resetLiveStartWhenNotLoaded=function(e){if(!this.loadedmetadata){if(this.startFragRequested=!1,e=this.levels?this.levels[e].details:null,null!=e&&e.live)return this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},t.updateLevelTiming=function(e,t,i,r){var n=this,a=i.details;console.assert(!!a,"level.details must be defined"),Object.keys(e.elementaryStreams).reduce((function(t,s){var l,c=e.elementaryStreams[s];return c?(l=c.endPTS-c.startPTS)<=0?(n.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+l+") resetting transmuxer to fallback to playlist timing"),n.resetTransmuxer(),t||!1):(l=r?0:Object(f.updateFragPTSDTS)(a,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS),n.hls.trigger(o.Events.LEVEL_PTS_UPDATED,{details:a,level:i,drift:l,type:s,frag:e,start:c.startPTS,end:c.endPTS}),!0):t}),!1)?(this.state=w.PARSED,this.hls.trigger(o.Events.FRAG_PARSED,{frag:e,part:t})):this.resetLoadingState()},t.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},y(E.prototype,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}]),E);function E(e,t,i){var r;return(r=b.call(this)||this).hls=void 0,r.fragPrevious=null,r.fragCurrent=null,r.fragmentTracker=void 0,r.transmuxer=null,r._state=w.STOPPED,r.media=void 0,r.mediaBuffer=void 0,r.config=void 0,r.bitrateTest=!1,r.lastCurrentTime=0,r.nextLoadPosition=0,r.startPosition=0,r.loadedmetadata=!1,r.fragLoadError=0,r.retryDate=0,r.levels=null,r.fragmentLoader=void 0,r.levelLastLoaded=null,r.startFragRequested=!1,r.decrypter=void 0,r.initPTS=[],r.onvseeking=null,r.onvended=null,r.logPrefix="",r.log=void 0,r.warn=void 0,r.logPrefix=i,r.log=s.logger.log.bind(s.logger,i+":"),r.warn=s.logger.warn.bind(s.logger,i+":"),r.hls=e,r.fragmentLoader=new p.default(e.config),r.fragmentTracker=t,r.config=e.config,r.decrypter=new g.default(e,e.config),e.on(o.Events.KEY_LOADED,r.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}},"./src/controller/buffer-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return h}));var r=i("./src/polyfills/number.ts"),n=i("./src/events.ts"),a=i("./src/utils/logger.ts"),s=i("./src/errors.ts"),o=i("./src/utils/buffer-helper.ts"),l=(t=i("./src/utils/mediasource-helper.ts"),i("./src/loader/fragment.ts")),c=i("./src/controller/buffer-operation-queue.ts"),u=Object(t.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,h=((i=f.prototype).hasSourceTypes=function(){return 0<this.getSourceBufferTypes().length||0<Object.keys(this.pendingTracks).length},i.destroy=function(){this.unregisterListeners(),this.details=null},i.registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.BUFFER_RESET,this.onBufferReset,this),e.on(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(n.Events.BUFFER_EOS,this.onBufferEos,this),e.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(n.Events.FRAG_PARSED,this.onFragParsed,this),e.on(n.Events.FRAG_CHANGED,this.onFragChanged,this)},i.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.BUFFER_RESET,this.onBufferReset,this),e.off(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(n.Events.BUFFER_EOS,this.onBufferEos,this),e.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(n.Events.FRAG_PARSED,this.onFragParsed,this),e.off(n.Events.FRAG_CHANGED,this.onFragChanged,this)},i._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},i.onManifestParsed=function(e,t){var i=2;(!t.audio||t.video)&&t.altAudio||(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,a.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},i.onMediaAttaching=function(e,t){var i;t=this.media=t.media;t&&u&&((i=this.mediaSource=new u).addEventListener("sourceopen",this._onMediaSourceOpen),i.addEventListener("sourceended",this._onMediaSourceEnded),i.addEventListener("sourceclose",this._onMediaSourceClose),t.src=self.URL.createObjectURL(i),this._objectUrl=t.src)},i.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,i=this._objectUrl;if(t){if(a.logger.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){a.logger.warn("[buffer-controller]: onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(i&&self.URL.revokeObjectURL(i),e.src===i?(e.removeAttribute("src"),e.load()):a.logger.warn("[buffer-controller]: media.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(n.Events.MEDIA_DETACHED,void 0)},i.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach((function(t){var i=e.sourceBuffer[t];try{i&&(e.removeBufferListeners(t),e.mediaSource&&e.mediaSource.removeSourceBuffer(i),e.sourceBuffer[t]=void 0)}catch(i){a.logger.warn("[buffer-controller]: Failed to reset the "+t+" buffer",i)}})),this._initSourceBuffer()},i.onBufferCodecs=function(e,t){var i=this,r=this.getSourceBufferTypes().length;Object.keys(t).forEach((function(e){var n,a,s,o;r?(n=i.tracks[e])&&"function"==typeof n.buffer.changeType&&(a=(o=t[e]).codec,s=o.levelCodec,o=o.container,(n.levelCodec||n.codec).replace(d,"$1")!==(s||a).replace(d,"$1"))&&i.appendChangeType(e,o+";codecs="+(s||a)):i.pendingTracks[e]=t[e]})),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},i.appendChangeType=function(e,t){var i=this,r=this.operationQueue;r.append({execute:function(){var n=i.sourceBuffer[e];n&&(a.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),n.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",t)}},e)},i.onBufferAppending=function(e,t){var i=this,r=this.hls,l=this.operationQueue,c=this.tracks,u=t.data,d=t.type,h=t.frag,f=t.part,p=t.chunkMeta,g=p.buffering[d],m=(t=self.performance.now(),g.start=t,h.stats.buffering),A=f?f.stats.buffering:null,y=(t=(0===m.start&&(m.start=t),A&&0===A.start&&(A.start=t),c.audio),"audio"===d&&1===p.id&&"audio/mpeg"===(null==t?void 0:t.container));l.append({execute:function(){var e,t;g.executeStart=self.performance.now(),y&&(e=i.sourceBuffer[d])&&(t=h.start-e.timestampOffset,.1<=Math.abs(t))&&(a.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+t+") sn: "+h.sn+")"),e.timestampOffset=h.start),i.appendExecutor(u,d)},onStart:function(){},onComplete:function(){var e,t=self.performance.now(),r=(g.executeEnd=g.end=t,0===m.first&&(m.first=t),A&&0===A.first&&(A.first=t),i.sourceBuffer),a={};for(e in r)a[e]=o.BufferHelper.getBuffered(r[e]);i.appendError=0,i.hls.trigger(n.Events.BUFFER_APPENDED,{type:d,frag:h,part:f,chunkMeta:p,parent:h.type,timeRanges:a})},onError:function(e){a.logger.error("[buffer-controller]: Error encountered while trying to append to the "+d+" SourceBuffer",e);var t={type:s.ErrorTypes.MEDIA_ERROR,parent:h.type,details:s.ErrorDetails.BUFFER_APPEND_ERROR,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=s.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,t.details=s.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(a.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),r.trigger(n.Events.ERROR,t)}},d)},i.onBufferFlushing=function(e,t){function i(e){return{execute:r.removeExecutor.bind(r,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(n.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){a.logger.warn("[buffer-controller]: Failed to remove from "+e+" SourceBuffer",t)}}}var r=this,s=this.operationQueue;t.type?s.append(i(t.type),t.type):this.getSourceBufferTypes().forEach((function(e){s.append(i(e),e)}))},i.onFragParsed=function(e,t){var i=this,r=t.frag,s=t.part,o=(t=[],(s||r).elementaryStreams);o[l.ElementaryStreamTypes.AUDIOVIDEO]?t.push("audiovideo"):(o[l.ElementaryStreamTypes.AUDIO]&&t.push("audio"),o[l.ElementaryStreamTypes.VIDEO]&&t.push("video")),0===t.length&&a.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var e=self.performance.now();r.stats.buffering.end=e,s&&(s.stats.buffering.end=e),e=(s||r).stats;i.hls.trigger(n.Events.FRAG_BUFFERED,{frag:r,part:s,stats:e,id:r.type})}),t)},i.onFragChanged=function(e,t){this.flushBackBuffer()},i.onBufferEos=function(e,t){var i=this;this.getSourceBufferTypes().reduce((function(e,r){var n=i.sourceBuffer[r];return t.type&&t.type!==r||n&&!n.ended&&(n.ended=!0,a.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),e&&!(n&&!n.ended)}),!0)&&this.blockBuffers((function(){var e=i.mediaSource;e&&"open"===e.readyState&&e.endOfStream()}))},i.onLevelUpdated=function(e,t){t=t.details,t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},i.flushBackBuffer=function(){var e,t,i,a,s=this.hls,l=this.details,c=this.media,u=this.sourceBuffer;c&&null!==l&&(e=this.getSourceBufferTypes()).length&&(i=l.live&&null!==s.config.liveBackBufferLength?s.config.liveBackBufferLength:s.config.backBufferLength,!Object(r.isFiniteNumber)(i)||i<0||(c=c.currentTime,t=l.levelTargetDuration,i=Math.max(i,t),a=Math.floor(c/t)*t-i,e.forEach((function(e){var t=u[e];t&&0<(t=o.BufferHelper.getBuffered(t)).length&&a>t.start(0)&&(s.trigger(n.Events.BACK_BUFFER_REACHED,{bufferEnd:a}),l.live&&s.trigger(n.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a}),s.trigger(n.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:e}))}))))},i.updateMediaElementDuration=function(){var e,t,i,n,s,o;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,s=this.media,i=this.mediaSource,n=e.fragments[0].start+e.totalduration,s=s.duration,o=Object(r.isFiniteNumber)(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(a.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(o<n&&s<n||!Object(r.isFiniteNumber)(s))&&(a.logger.log("[buffer-controller]: Updating Media Source duration to "+n.toFixed(3)),i.duration=n))},i.updateSeekableRange=function(e){var t=this.mediaSource,i=e.fragments;i.length&&e.live&&null!=t&&t.setLiveSeekableRange&&(i=Math.max(0,i[0].start),e=Math.max(i,i+e.totalduration),t.setLiveSeekableRange(i,e))},i.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;(r&&!e||2===r)&&(this.createSourceBuffers(i),this.pendingTracks={},0===(e=this.getSourceBufferTypes()).length?this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"}):e.forEach((function(e){t.executeNext(e)})))},i.createSourceBuffers=function(e){var t=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var r,o=0;for(r in e)if(!t[r]){var l=e[r];if(!l)throw Error("source buffer exists for track "+r+", however track does not");var c=l.levelCodec||l.codec,u=l.container+";codecs="+c;a.logger.log("[buffer-controller]: creating sourceBuffer("+u+")");try{var d=t[r]=i.addSourceBuffer(u),h=r;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[r]={buffer:d,codec:c,container:l.container,levelCodec:l.levelCodec,id:l.id},o++}catch(e){a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:u})}}o&&this.hls.trigger(n.Events.BUFFER_CREATED,{tracks:this.tracks})},i._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},i._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},i._onSBUpdateError=function(e,t){a.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1}),e=this.operationQueue.current(e),e&&e.onError(t)},i.removeExecutor=function(e,t,i){var n=this.media,s=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[e];n&&s&&l?(n=Object(r.isFiniteNumber)(n.duration)?n.duration:1/0,s=Object(r.isFiniteNumber)(s.duration)?s.duration:1/0,(t=Math.max(0,t))<(i=Math.min(i,n,s))?(a.logger.log("[buffer-controller]: Removing ["+t+","+i+"] from the "+e+" SourceBuffer"),console.assert(!l.updating,e+" sourceBuffer must not be updating"),l.remove(t,i)):o.shiftAndExecuteNext(e)):(a.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),o.shiftAndExecuteNext(e))},i.appendExecutor=function(e,t){var i=this.operationQueue,r=this.sourceBuffer[t];r?(r.ended=!1,console.assert(!r.updating,t+" sourceBuffer must not be updating"),r.appendBuffer(e)):(a.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),i.shiftAndExecuteNext(t))},i.blockBuffers=function(e,t){var i,r,n=this;(t=void 0===t?this.getSourceBufferTypes():t).length?(i=this.operationQueue,r=t.map((function(e){return i.appendBlocker(e)})),Promise.all(r).then((function(){e(),t.forEach((function(e){var t=n.sourceBuffer[e];t&&t.updating||i.shiftAndExecuteNext(e)}))}))):(a.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(e))},i.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},i.addBufferListener=function(e,t,i){var r=this.sourceBuffer[e];r&&(i=i.bind(this,e),this.listeners[e].push({event:t,listener:i}),r.addEventListener(t,i))},i.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))},f);function f(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var e=t.hls,i=t.media,r=t.mediaSource;a.logger.log("[buffer-controller]: Media source opened"),i&&(t.updateMediaElementDuration(),e.trigger(n.Events.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){a.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){a.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}},"./src/controller/buffer-operation-queue.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return n}));var r=i("./src/utils/logger.ts"),n=((t=a.prototype).append=function(e,t){var i=this.queues[t];i.push(e),1===i.length&&this.buffers[t]&&this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,i=new Promise((function(e){t=e})),r={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,e),i},t.executeNext=function(e){var t=this.buffers,i=this.queues,n=t[e];i=i[e];if(i.length){var a=i[0];try{a.execute()}catch(t){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(t),n&&n.updating||(i.shift(),this.executeNext(e))}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},a);function a(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}},"./src/controller/cap-level-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts");function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i=s.prototype).setStreamController=function(e){this.streamController=e},i.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},i.registerListeners=function(){var e=this.hls;e.on(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.unregisterListener=function(){var e=this.hls;e.off(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},i.onFpsDropLevelCapping=function(e,t){s.isLevelAllowed(t.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(t.droppedLevel)},i.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null},i.onManifestParsed=function(e,t){var i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()},i.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},i.onMediaDetaching=function(){this.stopCapping()},i.detectPlayerSize=function(){var e,t;this.media&&0<this.mediaHeight&&0<this.mediaWidth&&(e=this.hls.levels).length&&((t=this.hls).autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping)},i.getMaxLevel=function(e){var t=this,i=this.hls.levels;return i.length?(i=i.filter((function(i,r){return s.isLevelAllowed(r,t.restrictedLevels)&&r<=e})),this.clientRect=null,s.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)):-1},i.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){var e,t,i;return this.clientRect||(t={width:0,height:0},(e=this.media)&&(i=e.getBoundingClientRect(),t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)),this.clientRect=t)},s.isLevelAllowed=function(e,t){return-1===(t=void 0===t?[]:t).indexOf(e)},s.getMaxLevelByMediaSize=function(e,t,i){if(!e||!e.length)return-1;for(var r,n=e.length-1,a=0;a<e.length;a+=1){var s=e[a];if((s.width>=t||s.height>=i)&&(!(r=e[a+1])||s.width!==r.width||s.height!==r.height)){n=a;break}}return n},i=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],n((a=s).prototype,[{key:"mediaWidth",get:function(){return this.getDimensions().width*s.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*s.contentScaleFactor}}]),n(a,i);var a=s;function s(e){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}t.default=a},"./src/controller/cmcd-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return h}));var r=i("./src/events.ts"),n=i("./src/types/cmcd.ts"),a=i("./src/utils/buffer-helper.ts"),s=i("./src/utils/logger.ts");function o(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,i){t&&o(e.prototype,t),i&&o(e,i)}function c(e,t){var i,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e){var t;if(e)return"string"==typeof e?u(e,void 0):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,void 0):void 0}(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),i=0,function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}(t=f.prototype).registerListeners=function(){var e=this.hls;e.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(r.Events.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(r.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},t.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var i;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer},t.createData=function(){var e;return{v:n.CMCDVersion,sf:n.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(e,t){d(t=void 0===t?{}:t,this.createData());var i=t.ot===n.CMCDObjectType.INIT||t.ot===n.CMCDObjectType.VIDEO||t.ot===n.CMCDObjectType.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering),this.useHeaders?(i=f.toHeaders(t),Object.keys(i).length&&(e.headers||(e.headers={}),d(e.headers,i))):(i=f.toQuery(t))&&(e.url=f.appendQueryToUri(e.url,i))},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?n.CMCDObjectType.TIMED_TEXT:"initSegment"===e.sn?n.CMCDObjectType.INIT:"audio"===t?n.CMCDObjectType.AUDIO:"main"===t?this.hls.audioTracks.length?n.CMCDObjectType.VIDEO:n.CMCDObjectType.MUXED:void 0},t.getTopBandwidth=function(e){for(var t=0,i=this.hls,r=c(e===n.CMCDObjectType.AUDIO?i.audioTracks:(e=-1<(e=i.maxAutoLevel)?e+1:i.levels.length,i.levels.slice(0,e)));!(a=r()).done;){var a=a.value;a.bitrate>t&&(t=a.bitrate)}return 0<t?t:NaN},t.getBufferLength=function(e){var t=this.hls.media;e=e===n.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return e&&t?1e3*a.BufferHelper.bufferInfo(e,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return(e=r.prototype).destroy=function(){this.loader.destroy()},e.abort=function(){this.loader.abort()},e.load=function(e,i,r){t(e),this.loader.load(e,i,r)},l(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r;function r(e){this.loader=void 0,this.loader=new i(e)}},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return(e=r.prototype).destroy=function(){this.loader.destroy()},e.abort=function(){this.loader.abort()},e.load=function(e,i,r){t(e),this.loader.load(e,i,r)},l(r,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),r;function r(e){this.loader=void 0,this.loader=new i(e)}},f.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.substr(t.lastIndexOf("/")+1)},f.serialize=function(e){for(var t=[],i=function(e){return Math.round(e)},r=function(e){return 100*i(e/100)},n={br:i,d:i,bl:r,dl:r,mtp:r,nor:function(e){return encodeURIComponent(e)},rtp:r,tb:i},a=c(Object.keys(e||{}).sort());!(l=a()).done;){var s,o,l=l.value,u=e[l];s=u,Number.isNaN(s)||null==s||""===s||!1===s||"v"===l&&1===u||"pr"==l&&1===u||(s=m(u=(s=n[l])?s(u):u),o=void 0,o="ot"===l||"sf"===l||"st"===l?l+"="+u:"boolean"==s?l:"number"==s?l+"="+u:l+"="+JSON.stringify(u),t.push(o))}return t.join(",")},f.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],r=[{},{},{},{}],n={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},a=0,s=Object.keys(e);a<s.length;a++){var o=s[a];r[null!=n[o]?n[o]:1][o]=e[o]}for(var l=0;l<r.length;l++){var c=f.serialize(r[l]);c&&(t["CMCD-"+i[l]]=c)}return t},f.toQuery=function(e){return"CMCD="+encodeURIComponent(f.serialize(e))},f.appendQueryToUri=function(e,t){var i;return t?(i=e.includes("?")?"&":"?",e+i+t):e};var h=f;function f(e){var t=this,i=(e=(this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(e){try{t.apply(e,{ot:n.CMCDObjectType.MANIFEST,su:!t.initialized})}catch(e){s.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var i=e.frag,r=t.hls.levels[i.level],a=t.getObjectType(i),o={d:1e3*i.duration,ot:a};a!==n.CMCDObjectType.VIDEO&&a!==n.CMCDObjectType.AUDIO&&a!=n.CMCDObjectType.MUXED||(o.br=r.bitrate/1e3,o.tb=t.getTopBandwidth(a)/1e3,o.bl=t.getBufferLength(a)),t.apply(e,o)}catch(e){s.logger.warn("Could not generate segment CMCD data.",e)}},this.hls=e,this.config=e.config),e.cmcd);null!=i&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||f.uuid(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.registerListeners())}},"./src/controller/eme-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts"),n=i("./src/errors.ts"),a=i("./src/utils/logger.ts"),s=i("./src/utils/mediakeys-helper.ts");function o(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=e,this._config=e.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}(i=l.prototype).destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},i._registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i._unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},i.getLicenseServerUrl=function(e){if(e===s.KeySystems.WIDEVINE&&this._widevineLicenseUrl)return this._widevineLicenseUrl;throw new Error('no license server URL configured for key-system "'+e+'"')},i._attemptKeySystemAccess=function(e,t,i){var r=this;t=function(e,t,r){if(e===s.KeySystems.WIDEVINE)return n=i,a=r,o={audioCapabilities:[],videoCapabilities:[]},t.forEach((function(e){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:a.audioRobustness||""})})),n.forEach((function(e){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:a.videoRobustness||""})})),[o];var n,a,o;throw new Error("Unknown key-system: "+e)}(e,t,this._drmSystemOptions),a.logger.log("Requesting encrypted media key-system access"),t=this.requestMediaKeySystemAccess(e,t);this.mediaKeysPromise=t.then((function(t){return r._onMediaKeySystemAccessObtained(e,t)})),t.catch((function(t){a.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},i._onMediaKeySystemAccessObtained=function(e,t){var i=this,r=(a.logger.log('Access for key-system "'+e+'" obtained'),{mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e}),n=(this._mediaKeysList.push(r),Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return r.mediaKeys=t,a.logger.log('Media-keys created for key-system "'+e+'"'),i._onMediaKeysCreated(),t})));return n.catch((function(e){a.logger.error("Failed to create media-keys:",e)})),n},i._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},i._onNewMediaKeySession=function(e){var t=this;a.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(i){t._onKeySessionMessage(e,i.message)}),!1)},i._onKeySessionMessage=function(e,t){a.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){a.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),e.update(t)}))},i.onMediaEncrypted=function(e){var t,i=this;a.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),this.mediaKeysPromise?this.mediaKeysPromise.then(t=function(t){i._media&&(i._attemptSetMediaKeys(t),i._generateRequestWithPreferredKeySession(e.initDataType,e.initData))}).catch(t):(a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0}))},i._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");var t;this._hasSetMediaKeys||((t=this._mediaKeysList[0])&&t.mediaKeys?(a.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0):(a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0})))},i._generateRequestWithPreferredKeySession=function(e,t){var i,s=this,o=this._mediaKeysList[0];o?o.mediaKeysSessionInitialized?a.logger.warn("Key-Session already initialized but requested again"):(i=o.mediaKeysSession)?t?(a.logger.log('Generating key-session request for "'+e+'" init data type'),o.mediaKeysSessionInitialized=!0,i.generateRequest(e,t).then((function(){a.logger.debug("Key-session generation succeeded")})).catch((function(e){a.logger.error("Error generating key-session request:",e),s.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))):(a.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0})):(a.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0})):(a.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0}))},i._createLicenseXhr=function(e,t,i){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,e,t,i),t=this._licenseXhrSetup;if(t)try{t.call(this.hls,r,e),t=void 0}catch(e){a.logger.error(e)}try{r.readyState||r.open("POST",e,!0),t&&t.call(this.hls,r,e)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return r},i._onLicenseRequestReadyStageChange=function(e,t,i,s){if(4===e.readyState)if(200===e.status){this._requestLicenseFailureCount=0,a.logger.log("License request succeeded");var o=e.response,l=this._licenseResponseCallback;if(l)try{o=l.call(this.hls,e,t)}catch(e){a.logger.error(e)}s(o)}else a.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,3<this._requestLicenseFailureCount?this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0}):(l=3-this._requestLicenseFailureCount+1,a.logger.warn("Retrying license request, "+l+" attempts left"),this._requestLicense(i,s))},i._generateLicenseRequestChallenge=function(e,t){if(e.mediaKeySystemDomain===s.KeySystems.WIDEVINE)return t;throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},i._requestLicense=function(e,t){a.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(i)try{var s=this.getLicenseServerUrl(i.mediaKeySystemDomain),o=this._createLicenseXhr(s,e,t),l=(a.logger.log("Sending license request to URL: "+s),this._generateLicenseRequestChallenge(i,e));o.send(l)}catch(e){a.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}else a.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0})},i.onMediaAttached=function(e,t){this._emeEnabled&&(t=t.media,(this._media=t).addEventListener("encrypted",this._onMediaEncrypted))},i.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map((function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch((function(){}))}))).then((function(){return e.setMediaKeys(null)})).catch((function(){})))},i.onManifestParsed=function(e,t){var i;this._emeEnabled&&(i=t.levels.map((function(e){return e.audioCodec})).filter((function(e){return!!e})),t=t.levels.map((function(e){return e.videoCodec})).filter((function(e){return!!e})),this._attemptKeySystemAccess(s.KeySystems.WIDEVINE,i,t))},o(l.prototype,[{key:"requestMediaKeySystemAccess",get:function(){if(this._requestMediaKeySystemAccess)return this._requestMediaKeySystemAccess;throw new Error("No requestMediaKeySystemAccess function configured")}}]),t.default=l},"./src/controller/fps-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts"),n=i("./src/utils/logger.ts");function a(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}(i=a.prototype).setStreamController=function(e){this.streamController=e},i.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},i.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching)},i.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},i.onMediaAttaching=function(e,t){var i=this.hls.config;i.capLevelOnFPSDrop&&(t=t.media instanceof self.HTMLVideoElement?t.media:null,(this.media=t)&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod))},i.checkFPS=function(e,t,i){var a,s,o,l,c=performance.now();t&&(this.lastTime&&(l=c-this.lastTime,a=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,l=1e3*a/l,(o=this.hls).trigger(r.Events.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:i}),0<l)&&a>o.config.fpsDroppedMonitoringThreshold*s&&(l=o.currentLevel,n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),0<l)&&(-1===o.autoLevelCapping||o.autoLevelCapping>=l)&&(o.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:--l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch()),this.lastTime=c,this.lastDroppedFrames=i,this.lastDecodedFrames=t)},i.checkFPSInterval=function(){var e,t=this.media;t&&(this.isVideoPlaybackQualityAvailable?(e=t.getVideoPlaybackQuality(),this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)):this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount))},t.default=a},"./src/controller/fragment-finders.ts":function(e,t,i){i.r(t),i.d(t,"findFragmentByPDT",(function(){return a})),i.d(t,"findFragmentByPTS",(function(){return s})),i.d(t,"fragmentWithinToleranceTest",(function(){return o})),i.d(t,"pdtWithinToleranceTest",(function(){return l})),i.d(t,"findFragWithCC",(function(){return c}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/binary-search.ts");function a(e,t,i){if(null!==t&&Array.isArray(e)&&e.length&&Object(r.isFiniteNumber)(t)&&!(t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))){i=i||0;for(var n=0;n<e.length;++n){var a=e[n];if(l(t,i,a))return a}}return null}function s(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var a=null;return e?a=t[e.sn-t[0].sn+1]||null:0===i&&0===t[0].start&&(a=t[0]),(!a||0!==o(i,r,a))&&n.default.search(t,o.bind(null,i,r))||a}function o(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=0),t=Math.min(t,i.duration+(i.deltaPTS||0)),i.start+i.duration-t<=e?1:i.start-t>e&&i.start?-1:0}function l(e,t,i){return t=1e3*Math.min(t,i.duration+(i.deltaPTS||0)),(i.endProgramDateTime||0)-t>e}function c(e,t){return n.default.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}},"./src/controller/fragment-tracker.ts":function(e,t,i){i.r(t),i.d(t,"FragmentState",(function(){return r})),i.d(t,"FragmentTracker",(function(){return s}));var r,n=i("./src/events.ts"),a=i("./src/types/loader.ts"),s=((t=r=r||{}).NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK",(i=o.prototype)._registerListeners=function(){var e=this.hls;e.on(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(n.Events.FRAG_LOADED,this.onFragLoaded,this)},i._unregisterListeners=function(){var e=this.hls;e.off(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(n.Events.FRAG_LOADED,this.onFragLoaded,this)},i.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},i.getAppendedFrag=function(e,t){if(t===a.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var n=r.length;n--;){var s=r[n],o=s?s.end:i.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return 9<n&&(this.activeParts=r.slice(n-9)),s}else if(i.start<=e&&void 0!==i.appendedPTS&&e<=i.appendedPTS)return i}return this.getBufferedFrag(e,t)},i.getBufferedFrag=function(e,t){for(var i=this.fragments,r=Object.keys(i),n=r.length;n--;){var a=i[r[n]];if((null==a?void 0:a.body.type)===t&&a.buffered&&(a=a.body,a.start<=e&&e<=a.end))return a}return null},i.detectEvictedFragments=function(e,t,i){var r=this;Object.keys(this.fragments).forEach((function(n){var a=r.fragments[n];a&&(a.buffered?(n=a.range[e])&&n.time.some((function(e){return e=!r.isTimeBuffered(e.startPTS,e.endPTS,t),e&&r.removeFragment(a.body),e})):a.body.type===i&&r.removeFragment(a.body))}))},i.detectPartialFragments=function(e){var t,i=this,r=this.timeRanges,n=e.frag,a=e.part;r&&"initSegment"!==n.sn&&(e=c(n),t=this.fragments[e])&&(Object.keys(r).forEach((function(e){var s,o=n.elementaryStreams[e];o&&(s=r[e],o=null!==a||!0===o.partial,t.range[e]=i.getBufferedTimes(n,a,o,s))})),t.backtrack=t.loaded=null,Object.keys(t.range).length?t.buffered=!0:this.removeFragment(t.body))},i.fragBuffered=function(e){e=c(e),e=this.fragments[e],e&&(e.backtrack=e.loaded=null,e.buffered=!0)},i.getBufferedTimes=function(e,t,i,r){for(var n={time:[],partial:i},a=(t||e).start,s=(t||e).end,o=e.minEndPTS||s,l=e.maxStartPTS||a,c=0;c<r.length;c++){var u=r.start(c)-this.bufferPadding,d=r.end(c)+this.bufferPadding;if(u<=l&&o<=d){n.time.push({startPTS:Math.max(a,r.start(c)),endPTS:Math.min(s,r.end(c))});break}if(a<d&&u<s)n.partial=!0,n.time.push({startPTS:Math.max(a,r.start(c)),endPTS:Math.min(s,r.end(c))});else if(s<=u)break}return n},i.getPartialFragment=function(e){var t,i,r=null,n=0,a=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach((function(o){o=s[o],o&&l(o)&&(t=o.body.start-a,i=o.body.end+a,t<=e)&&e<=i&&(t=Math.min(e-t,i-e),n<=t)&&(r=o.body,n=t)})),r},i.getState=function(e){return e=c(e),e=this.fragments[e],e?e.buffered?l(e)?r.PARTIAL:r.OK:e.backtrack?r.BACKTRACKED:r.APPENDING:r.NOT_LOADED},i.backtrack=function(e,t){return e=c(e),e=this.fragments[e],!e||e.backtrack?null:(t=e.backtrack=t||e.loaded,e.loaded=null,t)},i.getBacktrackData=function(e){var t=c(e);t=this.fragments[t];if(t){var i;t=t.backtrack;if(null!=t&&null!=(i=t.payload)&&i.byteLength)return t;this.removeFragment(e)}return null},i.isTimeBuffered=function(e,t,i){for(var r,n,a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,r<=e&&t<=n)return!0;if(t<=r)return!1}return!1},i.onFragLoaded=function(e,t){var i=t.frag,r=t.part;"initSegment"===i.sn||i.bitrateTest||r||(r=c(i),this.fragments[r]={body:i,loaded:t,backtrack:null,buffered:!1,range:Object.create(null)})},i.onBufferAppended=function(e,t){var i=this,r=t.frag,n=t.part,s=t.timeRanges;r.type===a.PlaylistLevelType.MAIN&&(this.activeFragment=r,n?((t=this.activeParts)||(this.activeParts=t=[]),t.push(n)):this.activeParts=null),this.timeRanges=s,Object.keys(s).forEach((function(e){var t=s[e];if(i.detectEvictedFragments(e,t),!n)for(var a=0;a<t.length;a++)r.appendedPTS=Math.max(t.end(a),r.appendedPTS||0)}))},i.onFragBuffered=function(e,t){this.detectPartialFragments(t)},i.hasFragment=function(e){return e=c(e),!!this.fragments[e]},i.removeFragmentsInRange=function(e,t,i){var r=this;Object.keys(this.fragments).forEach((function(n){n=r.fragments[n];n&&n.buffered&&(n=n.body).type===i&&n.start<t&&n.end>e&&r.removeFragment(n)}))},i.removeFragment=function(e){var t=c(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},i.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},o);function o(e){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}function l(e){var t;return e.buffered&&(null!=(t=e.range.video)&&t.partial||null!=(t=e.range.audio)&&t.partial)}function c(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts":function(e,t,i){i.r(t),i.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return o})),i.d(t,"MAX_START_GAP_JUMP",(function(){return l})),i.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),i.d(t,"SKIP_BUFFER_RANGE_START",(function(){return u})),i.d(t,"default",(function(){return d}));var r=i("./src/utils/buffer-helper.ts"),n=i("./src/errors.ts"),a=i("./src/events.ts"),s=i("./src/utils/logger.ts"),o=250,l=2,c=.1,u=.05,d=((t=h.prototype).destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,i=this.media,n=this.stalled,a=i.currentTime,c=i.seeking,u=this.seeking&&!c,d=!this.seeking&&c;if(this.seeking=c,a===e){if((d||u)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&r.BufferHelper.getBuffered(i).length&&(e=r.BufferHelper.bufferInfo(i,a,0),d=0<e.len,u=e.nextStart||0,d||u)){if(c){d=e.len>l;var h=!u||l<u-a&&!this.fragmentTracker.getPartialFragment(a);if(d||h)return;this.moved=!1}if(!this.moved&&null!==this.stalled&&(d=Math.max(u,e.start||0)-a,h=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,u=null!=h&&null!=(u=h.details)&&u.live?2*h.details.targetduration:l,0<d&&d<=u))return void this._trySkipBufferHole(null);h=self.performance.now(),null!==n?(d=h-n,!c&&o<=d&&this._reportStall(e.len),u=r.BufferHelper.bufferInfo(i,a,t.maxBufferHole),this._tryFixBufferStall(u,d)):this.stalled=h}}else this.moved=!0,null!==n&&(this.stallReported&&(c=self.performance.now()-n,s.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(c)+"ms"),this.stallReported=!1),this.stalled=null,this.nudgeRetry=0)},t._tryFixBufferStall=function(e,t){var i=this.config,r=this.fragmentTracker,n=this.media.currentTime;r=r.getPartialFragment(n);r&&this._trySkipBufferHole(r)||e.len>i.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,i=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,i=this.hls,o=this.media,l=o.currentTime,d=0,h=r.BufferHelper.getBuffered(o),f=0;f<h.length;f++){var p=h.start(f);if(l+t.maxBufferHole>=d&&l<p)return p=Math.max(p+u,o.currentTime+c),s.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+p),this.moved=!0,this.stalled=null,o.currentTime=p,e&&i.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+p,frag:e}),p;d=h.end(f)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,i=this.media,r=i.currentTime,o=(this.nudgeRetry||0)+1;(this.nudgeRetry=o)<e.nudgeMaxRetry?(o=r+o*e.nudgeOffset,s.logger.warn("Nudging 'currentTime' from "+r+" to "+o),i.currentTime=o,t.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})):(s.logger.error("Playhead still not moving while enough data buffered @"+r+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0}))},h);function h(e,t,i,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}},"./src/controller/id3-track-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts"),n=i("./src/utils/texttrack-utils.ts"),a=i("./src/demux/id3.ts");function s(e){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=e,this._registerListeners()}(i=s.prototype).destroy=function(){this._unregisterListeners()},i._registerListeners=function(){var e=this.hls;e.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i._unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i.onMediaAttached=function(e,t){this.media=t.media},i.onMediaDetaching=function(){this.id3Track&&(Object(n.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},i.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var i=e[t];if("metadata"===i.kind&&"id3"===i.label)return Object(n.sendAddTrackEvent)(i,this.media),i}return this.media.addTextTrack("metadata","id3")}},i.onFragParsingMetadata=function(e,t){if(this.media){var i=t.frag,r=t.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var n=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<r.length;s++){var o=a.getID3Frames(r[s].data);if(o){var l=r[s].pts,c=s<r.length-1?r[s+1].pts:i.end;c-l<=0&&(c=l+.25);for(var u=0;u<o.length;u++){var d,h=o[u];a.isTimeStampFrame(h)||((d=new n(l,c,"")).value=h,this.id3Track.addCue(d))}}}}},i.onBufferFlushing=function(e,t){var i=t.startOffset,r=t.endOffset;t=t.type;t&&"audio"!==t||(t=this.id3Track)&&Object(n.removeCuesInRange)(t,i,r)},t.default=s},"./src/controller/latency-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return o}));var r=i("./src/errors.ts"),n=i("./src/events.ts"),a=i("./src/utils/logger.ts");function s(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t=l.prototype).destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},t.registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(n.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(n.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(n.Events.ERROR,this.onError)},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},t.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},t.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},t.onLevelUpdated=function(e,t){t=t.details,(this.levelDetails=t).advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},t.onError=function(e,t){t.details===r.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,a.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},t.timeupdate=function(){var e,t,i,r=this.media,n=this.levelDetails;r&&n&&(this.currentTime=r.currentTime,null!==(t=this.computeLatency()))&&(this._latency=t,i=(e=this.config).lowLatencyMode,e=e.maxLiveSyncPlaybackRate,i)&&1!==e&&null!==(i=this.targetLatency)&&(i=(t-=i)<Math.min(this.maxLatency,i+n.targetduration),n.live&&i&&.05<t&&1<this.forwardBufferLength?(n=Math.min(2,Math.max(1,e)),i=Math.round(2/(1+Math.exp(-.75*t-this.edgeStalled))*20)/20,r.playbackRate=Math.min(n,Math.max(1,i))):1!==r.playbackRate&&0!==r.playbackRate&&(r.playbackRate=1))},t.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},s(l.prototype,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e,t,i,r,n,a=this.levelDetails;return null===a?null:(e=a.holdBack,r=a.partHoldBack,a=a.targetduration,t=(n=this.config).liveSyncDuration,i=n.liveSyncDurationCount,n=n.lowLatencyMode&&r||e,(n=(r=this.hls.userConfig).liveSyncDuration||r.liveSyncDurationCount||0===n?void 0!==t?t:i*a:n)+Math.min(+this.stallCount,a))}},{key:"liveSyncPosition",get:function(){var e,t=this.estimateLiveEdge(),i=this.targetLatency,r=this.levelDetails;return null===t||null===i||null===r?null:(e=r.edge,t=t-i-this.edgeStalled,i=e-r.totalduration,e-=this.config.lowLatencyMode&&r.partTarget||r.targetduration,Math.min(Math.max(i,t),e))}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e,t=this.levelDetails;return null===t?0:(e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration),Math.max(t.age-e,0))}},{key:"forwardBufferLength",get:function(){var e,t=this.media,i=this.levelDetails;return t&&i?(e=t.buffered.length)?t.buffered.end(e-1):i.edge-this.currentTime:0}}]);var o=l;function l(e){var t=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}},"./src/controller/level-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return p}));var r=i("./src/types/level.ts"),n=i("./src/events.ts"),a=i("./src/errors.ts"),s=i("./src/utils/codecs.ts"),o=i("./src/controller/level-helper.ts"),l=(t=i("./src/controller/base-playlist-controller.ts"),i("./src/types/loader.ts"));function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function u(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h,f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=(h=t.default,i=h,(t=g).prototype=Object.create(i.prototype),d(t.prototype.constructor=t,i),(t=g.prototype)._registerListeners=function(){var e=this.hls;e.on(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(n.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(n.Events.ERROR,this.onError,this)},t._unregisterListeners=function(){var e=this.hls;e.off(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(n.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(n.Events.ERROR,this.onError,this)},t.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,h.prototype.destroy.call(this)},t.startLoad=function(){this._levels.forEach((function(e){e.loadError=0})),h.prototype.startLoad.call(this)},t.onManifestLoaded=function(e,t){var i,l,c=[],u=[],d=[],h={},p=!1,g=!1,m=!1;if(t.levels.forEach((function(e){var t=e.attrs,i=(p=p||!(!e.width||!e.height),g=g||!!e.videoCodec,m=m||!!e.audioCodec,f&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),e.bitrate+"-"+e.attrs.RESOLUTION+"-"+e.attrs.CODECS);(l=h[i])?l.url.push(e.url):(l=new r.Level(e),h[i]=l,c.push(l)),t&&(t.AUDIO&&Object(o.addGroupId)(l,"audio",t.AUDIO),t.SUBTITLES)&&Object(o.addGroupId)(l,"text",t.SUBTITLES)})),c=(c=(p||g)&&m?c.filter((function(e){var t=e.videoCodec,i=e.width;e=e.height;return!!t||!(!i||!e)})):c).filter((function(e){var t=e.audioCodec;e=e.videoCodec;return(!t||Object(s.isCodecSupportedInMp4)(t,"audio"))&&(!e||Object(s.isCodecSupportedInMp4)(e,"video"))})),t.audioTracks&&(u=t.audioTracks.filter((function(e){return!e.audioCodec||Object(s.isCodecSupportedInMp4)(e.audioCodec,"audio")})),Object(o.assignTrackIdsByGroup)(u)),t.subtitles&&(d=t.subtitles,Object(o.assignTrackIdsByGroup)(d)),0<c.length){i=c[0].bitrate,c.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=c;for(var A=0;A<c.length;A++)if(c[A].bitrate===i){this._firstLevel=A,this.log("manifest loaded, "+c.length+" level(s) found, first bitrate: "+i);break}var y=m&&!g;d={levels:c,audioTracks:u,subtitleTracks:d,firstLevel:this._firstLevel,stats:t.stats,audio:m,video:g,altAudio:!y&&u.some((function(e){return!!e.url}))};this.hls.trigger(n.Events.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,reason:"no level with compatible codecs found in manifest"})},t.onError=function(e,t){if(h.prototype.onError.call(this,e,t),!t.fatal){var i=t.context;e=this._levels[this.currentLevelIndex];if(i&&(i.type===l.PlaylistContextType.AUDIO_TRACK&&e.audioGroupIds&&i.groupId===e.audioGroupIds[e.urlId]||i.type===l.PlaylistContextType.SUBTITLE_TRACK&&e.textGroupIds&&i.groupId===e.textGroupIds[e.urlId]))this.redundantFailover(this.currentLevelIndex);else{var r,n,s=!1,o=!0;switch(t.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:t.frag&&(!(n=this._levels[t.frag.level])||(n.fragmentError++,n.fragmentError>this.hls.config.fragLoadingMaxRetry))&&(r=t.frag.level);break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(o=!1),r=i.level),s=!0;break;case a.ErrorDetails.REMUX_ALLOC_ERROR:r=t.level,s=!0}void 0!==r&&this.recoverLevel(t,r,s,o)}}},t.recoverLevel=function(e,t,i,r){var n=e.details,a=this._levels[t];if(a.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}r&&(1<(i=a.url.length)&&a.loadError<i?(e.levelRetry=!0,this.redundantFailover(t)):-1===this.manualLevelIndex&&(r=0===t?this._levels.length-1:t-1,this.currentLevelIndex!==r)&&0===this._levels[r].loadError&&(this.warn(n+": switch to "+r),e.levelRetry=!0,this.hls.nextAutoLevel=r))},t.redundantFailover=function(e){var t,i=this._levels[e],r=i.url.length;1<r&&(t=(i.urlId+1)%r,this.warn("Switching to redundant URL-id "+t),this._levels.forEach((function(e){e.urlId=t})),this.level=e)},t.onFragLoaded=function(e,t){t=t.frag;void 0!==t&&t.type===l.PlaylistLevelType.MAIN&&void 0!==(t=this._levels[t.level])&&(t.fragmentError=0,t.loadError=0)},t.onLevelLoaded=function(e,t){var i=t.level,r=t.details,n=this._levels[i];n?i===this.currentLevelIndex?(0===n.fragmentError&&(n.loadError=0,this.retryCount=0),this.playlistLoaded(i,t,n.details)):null!=(n=t.deliveryDirectives)&&n.skip&&(r.deltaUpdateFailed=!0):(this.warn("Invalid level index "+i),null!=(n=t.deliveryDirectives)&&n.skip&&(r.deltaUpdateFailed=!0))},t.onAudioTrackSwitched=function(e,t){var i=this.hls.levels[this.currentLevelIndex];if(i&&i.audioGroupIds){for(var r=-1,n=this.hls.audioTracks[t.id].groupId,a=0;a<i.audioGroupIds.length;a++)if(i.audioGroupIds[a]===n){r=a;break}r!==i.urlId&&(i.urlId=r,this.startLoad())}},t.loadPlaylist=function(e){var t=this.currentLevelIndex,i=this._levels[t];if(this.canLoad&&i&&0<i.url.length){var r=i.urlId;i=i.url[r];if(e)try{i=e.addDirectives(i)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Attempt loading level index "+t+(e?" at sn "+e.msn+" part "+e.part:"")+" with URL-id "+r+" "+i),this.clearTimer(),this.hls.trigger(n.Events.LEVEL_LOADING,{url:i,level:t,id:r,deliveryDirectives:e||null})}},t.removeLevel=function(e,t){function i(e,i){return i!==t}var r=this._levels.filter((function(r,n){return n!==e||1<r.url.length&&void 0!==t&&(r.url=r.url.filter(i),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(i)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(i)),!(r.urlId=0))})).map((function(e,t){var i=e.details;return null!=i&&i.fragments&&i.fragments.forEach((function(e){e.level=t})),e}));this._levels=r,this.hls.trigger(n.Events.LEVELS_UPDATED,{levels:r})},u(g.prototype,[{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&&(this.currentLevelIndex!==e||null==(i=t[e])||!i.details)){if(e<0||e>=t.length){var i=e<0;if(this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:i,reason:"invalid level idx"}),i)return;e=Math.min(e,t.length-1)}this.clearTimer();i=this.currentLevelIndex;var r=t[i];t=t[e],i=(this.log("switching to level "+e+" from "+i),c({},t,{level:this.currentLevelIndex=e,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId})),e=(delete i._urlId,this.hls.trigger(n.Events.LEVEL_SWITCHING,i),t.details);e&&!e.live||(i=this.switchParams(t.uri,null==r?void 0:r.details),this.loadPlaylist(i))}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){var e;return void 0===this._startLevel?void 0!==(e=this.hls.config.startLevel)?e:this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),g);function g(e){return(e=h.call(this,e,"[level-controller]")||this)._levels=[],e._firstLevel=-1,e._startLevel=void 0,e.currentLevelIndex=-1,e.manualLevelIndex=-1,e.onParsedComplete=void 0,e._registerListeners(),e}},"./src/controller/level-helper.ts":function(e,t,i){i.r(t),i.d(t,"addGroupId",(function(){return a})),i.d(t,"assignTrackIdsByGroup",(function(){return s})),i.d(t,"updatePTS",(function(){return o})),i.d(t,"updateFragPTSDTS",(function(){return c})),i.d(t,"mergeDetails",(function(){return u})),i.d(t,"mapPartIntersection",(function(){return d})),i.d(t,"mapFragmentIntersection",(function(){return h})),i.d(t,"adjustSliding",(function(){return f})),i.d(t,"addSliding",(function(){return p})),i.d(t,"computeReloadInterval",(function(){return g})),i.d(t,"getFragmentWithSN",(function(){return m})),i.d(t,"getPartWith",(function(){return A}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/logger.ts");function a(e,t,i){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(i);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(i)}}function s(e){var t={};e.forEach((function(e){var i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}function o(e,t,i){l(e[t],e[i])}function l(e,t){var i,n=t.startPTS;Object(r.isFiniteNumber)(n)?(i=0,(n=t.sn>e.sn?(i=n-e.start,e):(i=e.start-n,t)).duration!==i&&(n.duration=i)):t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function c(e,t,i,a,s,o){a-i<=0&&(n.logger.warn("Fragment should have a positive duration",t),a=i+t.duration,o=s+t.duration);var c=i,u=a,d=t.startPTS,h=t.endPTS,f=(Object(r.isFiniteNumber)(d)&&(f=Math.abs(d-i),Object(r.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(f,t.deltaPTS):t.deltaPTS=f,c=Math.max(i,d),i=Math.min(i,d),s=Math.min(s,t.startDTS),u=Math.min(a,h),a=Math.max(a,h),o=Math.max(o,t.endDTS)),t.duration=a-i,i-t.start);t.appendedPTS=a,t.start=t.startPTS=i,t.maxStartPTS=c,t.startDTS=s,t.endPTS=a,t.minEndPTS=u,t.endDTS=o;var p;d=t.sn;if(!e||d<e.startSN||d>e.endSN)return 0;h=d-e.startSN;var g=e.fragments;for(g[h]=t,p=h;0<p;p--)l(g[p],g[p-1]);for(p=h;p<g.length-1;p++)l(g[p],g[p+1]);return e.fragmentHint&&l(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,f}function u(e,t){for(var i=null,a=e.fragments,s=a.length-1;0<=s;s--){var o=a[s].initSegment;if(o){i=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,u=0;if(h(e,t,(function(e,n){e.relurl&&(u=e.cc-n.cc),Object(r.isFiniteNumber)(e.startPTS)&&Object(r.isFiniteNumber)(e.endPTS)&&(n.start=n.startPTS=e.startPTS,n.startDTS=e.startDTS,n.appendedPTS=e.appendedPTS,n.maxStartPTS=e.maxStartPTS,n.endPTS=e.endPTS,n.endDTS=e.endDTS,n.minEndPTS=e.minEndPTS,n.duration=e.endPTS-e.startPTS,n.duration&&(l=n),t.PTSKnown=t.alignedSliding=!0),n.elementaryStreams=e.elementaryStreams,n.loader=e.loader,n.stats=e.stats,n.urlId=e.urlId,e.initSegment&&(n.initSegment=e.initSegment,i=e.initSegment)})),i&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((function(e){var t;e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)})),t.skippedSegments&&(t.deltaUpdateFailed=t.fragments.some((function(e){return!e})),t.deltaUpdateFailed)){n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var p=t.skippedSegments;p--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}var g=t.fragments;if(u){n.logger.warn("discontinuity sliding from playlist, take drift into account");for(var m=0;m<g.length;m++)g[m].cc+=u}t.skippedSegments&&(t.startCC=t.fragments[0].cc),d(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),l?c(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS):f(e,t),g.length&&(t.totalduration=t.edge-g[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var A,y=t.advancedDateTime;t.advanced&&y?(A=t.edge,t.driftStart||(t.driftStartTime=y,t.driftStart=A),t.driftEndTime=y,t.driftEnd=A):(t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime)}function d(e,t,i){if(e&&t)for(var r=0,n=0,a=e.length;n<=a;n++){var s=e[n],o=t[n+r];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?i(s,o):r--}}function h(e,t,i){for(var r=t.skippedSegments,n=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(r?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,s=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=n;c<=a;c++){var u=l[s+c],d=o[c];r&&!d&&c<r&&(d=t.fragments[c]=u),u&&d&&i(u,d)}}function f(e,t){var i=t.startSN+t.skippedSegments-e.startSN;e=e.fragments;i<0||i>=e.length||p(t,e[i].start)}function p(e,t){if(t){for(var i=e.fragments,r=e.skippedSegments;r<i.length;r++)i[r].start+=t;e.fragmentHint&&(e.fragmentHint.start+=t)}}function g(e,t){var i,r=1e3*e.levelTargetDuration,n=r/2,a=e.age,s=0<a&&a<3*r,o=(t=t.loading.end-t.loading.start,e.availabilityDelay);return!1===e.updated?s?(i=333*e.misses,i=Math.max(Math.min(n,2*t),i),e.availabilityDelay=(e.availabilityDelay||0)+i):i=n:i=s?(o=Math.min(o||r/2,a),(e.availabilityDelay=o)+r-a):r-t,Math.round(i)}function m(e,t,i){var r;return e&&e.details?(e=e.details).fragments[t-e.startSN]||((r=e.fragmentHint)&&r.sn===t?r:t<e.startSN&&i&&i.sn===t?i:null):null}function A(e,t,i){if(e&&e.details){var r=e.details.partList;if(r)for(var n=r.length;n--;){var a=r[n];if(a.index===i&&a.fragment.sn===t)return a}}return null}},"./src/controller/stream-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return v}));var r=i("./src/polyfills/number.ts"),n=i("./src/controller/base-stream-controller.ts"),a=i("./src/is-supported.ts"),s=i("./src/events.ts"),o=i("./src/utils/buffer-helper.ts"),l=i("./src/controller/fragment-tracker.ts"),c=i("./src/types/loader.ts"),u=i("./src/loader/fragment.ts"),d=i("./src/demux/transmuxer-interface.ts"),h=i("./src/types/transmuxer.ts"),f=i("./src/controller/gap-controller.ts"),p=i("./src/errors.ts"),g=i("./src/utils/logger.ts");function m(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}y=n.default,t=y,(i=b).prototype=Object.create(t.prototype),A(i.prototype.constructor=i,t),(i=b.prototype)._registerListeners=function(){var e=this.hls;e.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(s.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(s.Events.ERROR,this.onError,this),e.on(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i._unregisterListeners=function(){var e=this.hls;e.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(s.Events.ERROR,this.onError,this),e.off(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},i.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},i.startLoad=function(e){var t,i,r;this.levels?(t=this.lastCurrentTime,i=this.hls,this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,this.startFragRequested||(-1===(r=i.startLevel)&&(i.config.testBandwidth?this.bitrateTest=!(r=0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1),0<t&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=n.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this._forceStartLoad=!0,this.state=n.State.STOPPED)},i.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},i.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_LEVEL:var e=this.levels,t=this.level;t=null==e||null==(e=e[t])?void 0:e.details;if(t&&(!t.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(t))break;this.state=n.State.IDLE}break;case n.State.FRAG_LOADING_WAITING_RETRY:e=self.performance.now(),t=this.retryDate,(!t||t<=e||null!=(t=this.media)&&t.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=n.State.IDLE)}this.onTickEnd()},i.onTickEnd=function(){y.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},i.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,i=this.levels,r=this.media,a=e.config,o=e.nextLoadLevel;null===t||!(r||!this.startFragRequested&&a.startFragPrefetch)||this.altAudio&&this.audioOnly||!i||!i[o]||(t=i[o],this.level=e.nextLoadLevel=o,!(a=t.details)||this.state===n.State.WAITING_LEVEL||a.live&&this.levelLastLoaded!==o?this.state=n.State.WAITING_LEVEL:null===(i=this.getFwdBufferInfo(this.mediaBuffer||r,c.PlaylistLevelType.MAIN))||i.len>=this.getMaxBufferLength(t.maxBitrate)||(this._streamEnded(i,a)?(e={},this.altAudio&&(e.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,e),this.state=n.State.ENDED):(o=i.end,t=this.getNextFragment(o,a),this.couldBacktrack&&!this.fragPrevious&&t&&"initSegment"!==t.sn&&1<(e=t.sn-a.startSN)&&(t=a.fragments[e-1],this.fragmentTracker.removeFragment(t)),t&&this.fragmentTracker.getState(t)===l.FragmentState.OK&&this.nextLoadPosition>o&&(i=this.audioOnly&&!this.altAudio?u.ElementaryStreamTypes.AUDIO:u.ElementaryStreamTypes.VIDEO,this.afterBufferFlushed(r,i,c.PlaylistLevelType.MAIN),t=this.getNextFragment(this.nextLoadPosition,a)),t&&("identity"!==(null==(e=(t=!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment).decryptdata)?void 0:e.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,a,o):this.loadKey(t,a)))))},i.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,r===l.FragmentState.BACKTRACKED){var n=this.fragmentTracker.getBacktrackData(e);if(n)return this._handleFragmentLoadProgress(n),void this._handleFragmentLoadComplete(n);r=l.FragmentState.NOT_LOADED}r===l.FragmentState.NOT_LOADED||r===l.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,e,t,i)):r===l.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null==(n=this.media)?void 0:n.buffered.length)&&this.fragmentTracker.removeAllFragments()},i.getAppendedFrag=function(e){return e=this.fragmentTracker.getAppendedFrag(e,c.PlaylistLevelType.MAIN),e&&"fragment"in e?e.fragment:e},i.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,c.PlaylistLevelType.MAIN)},i.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},i.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},i.nextLevelSwitch=function(){var e,t=this.levels,i=this.media;null!=i&&i.readyState&&((e=this.getAppendedFrag(i.currentTime))&&1<e.start&&this.flushMainBuffer(0,e.start-1),e=!i.paused&&t&&(e=t[this.hls.nextLoadLevel],t=this.fragLastKbps)&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*t)+1:0,t=this.getBufferedFrag(i.currentTime+e))&&(i=this.followingBufferedFrag(t))&&(this.abortCurrentFrag(),e=i.maxStartPTS||i.start,i=i.duration,t=Math.max(t.end,e+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,.5*i),.75*i)),this.flushMainBuffer(t,Number.POSITIVE_INFINITY))},i.abortCurrentFrag=function(){var e=this.fragCurrent;(this.fragCurrent=null)!=e&&e.loader&&e.loader.abort(),this.state===n.State.KEY_LOADING&&(this.state=n.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},i.flushMainBuffer=function(e,t){y.prototype.flushMainBuffer.call(this,e,t,this.altAudio?"video":null)},i.onMediaAttached=function(e,t){y.prototype.onMediaAttached.call(this,e,t),e=t.media,this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),e.addEventListener("playing",this.onvplaying),e.addEventListener("seeked",this.onvseeked),this.gapController=new f.default(this.config,e,this.fragmentTracker,this.hls)},i.onMediaDetaching=function(){var e=this.media;e&&(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),y.prototype.onMediaDetaching.call(this)},i.onMediaPlaying=function(){this.tick()},i.onMediaSeeked=function(){var e=this.media;e=e?e.currentTime:null;Object(r.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},i.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(s.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},i.onManifestParsed=function(e,t){var i,r=!1,n=!1;t.levels.forEach((function(e){(i=e.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(r=!0),-1!==i.indexOf("mp4a.40.5"))&&(n=!0)})),this.audioCodecSwitch=r&&n&&!Object(a.changeTypeSupported)(),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},i.onLevelLoading=function(e,t){var i=this.levels;i&&this.state===n.State.IDLE&&(!(i=i[t.level]).details||i.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(i.details))&&(this.state=n.State.WAITING_LEVEL)},i.onLevelLoaded=function(e,t){var i=this.levels,r=t.level,a=t.details,o=a.totalduration;if(i){if(this.log("Level "+r+" loaded ["+a.startSN+","+a.endSN+"], cc ["+a.startCC+", "+a.endCC+"] duration:"+o),o=this.fragCurrent,!o||this.state!==n.State.FRAG_LOADING&&this.state!==n.State.FRAG_LOADING_WAITING_RETRY||o.level!==t.level&&o.loader&&(this.state=n.State.IDLE,o.loader.abort()),t=i[r],o=0,a.live||null!=(i=t.details)&&i.live){if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed)return;o=this.alignPlaylists(a,t.details)}if(t.details=a,this.levelLastLoaded=r,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:a,level:r}),this.state===n.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=n.State.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,o),this.tick()}else this.warn("Levels were reset while loading level "+r)},i._handleFragmentLoadProgress=function(e){var t,i,r,n,a,s,o,l=e.frag,u=e.part,f=(e=e.payload,this.levels);f?(t=(f=f[l.level]).details)?(i=f.videoCodec,r=t.PTSKnown||!t.live,n=null==(n=l.initSegment)?void 0:n.data,f=this._getAudioCodec(f),a=this.transmuxer=this.transmuxer||new d.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),s=u?u.index:-1,s=new h.ChunkMetadata(l.level,l.sn,l.stats.chunkCount,e.byteLength,s,-1!==s),o=this.initPTS[l.cc],a.push(e,n,f,i,l,u,t.totalduration,r,s,o)):this.warn("Dropping fragment "+l.sn+" of level "+l.level+" after level details were reset"):this.warn("Levels were reset while fragment load was in progress. Fragment "+l.sn+" of level "+l.level+" will not be buffered")},i.onAudioTrackSwitching=function(e,t){var i=this.altAudio,r=!!t.url;t=t.id;r||(this.mediaBuffer!==this.media?(this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media,null!=(r=this.fragCurrent)&&r.loader&&(this.log("Switching to main audio track, cancel main fragment load"),r.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()):this.audioOnly&&this.resetTransmuxer(),r=this.hls,i&&r.trigger(s.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),r.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:t}))},i.onAudioTrackSwitched=function(e,t){var i;t=t.id,t=!!this.hls.audioTracks[t].url;t&&(i=this.videoBuffer)&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i),this.altAudio=t,this.tick()},i.onBufferCreated=function(e,t){var i,r=t.tracks,n=!1;for(i in r){var a,s,o=r[i];"main"===o.id?(s=o,"video"===(a=i)&&(o=r[i])&&(this.videoBuffer=o.buffer)):n=!0}n&&s?(this.log("Alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media},i.onFragBuffered=function(e,t){var i,r=t.frag;t=t.part;r&&r.type!==c.PlaylistLevelType.MAIN||(this.fragContextChanged(r)?(this.warn("Fragment "+r.sn+(t?" p: "+t.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),this.state===n.State.PARSED&&(this.state=n.State.IDLE)):(i=(t||r).stats,this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,t)))},i.onError=function(e,t){switch(t.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.MAIN,t);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==n.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=n.State.ERROR):t.levelRetry||this.state!==n.State.WAITING_LEVEL||(this.state=n.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"main"!==t.parent||this.state!==n.State.PARSING&&this.state!==n.State.PARSED||(i=!0,(i=(r=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN))&&.5<r.len?!this.reduceMaxBufferLength(r.len):i)&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState())}},i.checkBuffer=function(){var e,t=this.media,i=this.gapController;t&&i&&t.readyState&&(e=o.BufferHelper.getBuffered(t),!this.loadedmetadata&&e.length?(this.loadedmetadata=!0,this.seekToStartPos()):i.poll(this.lastCurrentTime),this.lastCurrentTime=t.currentTime)},i.onFragLoadEmergencyAborted=function(){this.state=n.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},i.onBufferFlushed=function(e,t){var i;t=t.type;(t!==u.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio)&&(i=(t===u.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media,this.afterBufferFlushed(i,t,c.PlaylistLevelType.MAIN))},i.onLevelsUpdated=function(e,t){this.levels=t.levels},i.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},i.seekToStartPos=function(){var e,t=this.media,i=t.currentTime,r=this.startPosition;0<=r&&i<r&&(t.seeking?g.logger.log("could not seek to "+r+", already seeking at "+i):(0<(e=((e=o.BufferHelper.getBuffered(t)).length?e.start(0):0)-r)&&(e<this.config.maxBufferHole||e<this.config.maxFragLookUpTolerance)&&(g.logger.log("adjusting start position by "+e+" to match buffer start"),this.startPosition=r+=e),this.log("seek to target start position "+r+" from current time "+i),t.currentTime=r))},i._getAudioCodec=function(e){return e=this.config.defaultAudioCodec||e.audioCodec,this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},i._loadBitrateTestFrag=function(e){var t=this;this._doFragLoad(e).then((function(i){var r,a=t.hls;!i||a.nextLoadLevel||t.fragContextChanged(e)||(t.fragLoadError=0,t.state=n.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1,(r=e.stats).parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),a.trigger(s.Events.FRAG_LOADED,i))}))},i._handleTransmuxComplete=function(e){var t="main",i=this.hls,a=e.remuxResult,o=(e=e.chunkMeta,this.getCurrentContext(e));if(o){var l=o.frag,c=o.part,d=(o=o.level,a.video),h=a.text,f=a.id3,p=a.initSegment,g=this.altAudio?void 0:a.audio;if(!this.fragContextChanged(l)){if(this.state=n.State.PARSING,p&&(p.tracks&&(this._bufferInitSegment(o,p.tracks,l,e),i.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:l,id:t,tracks:p.tracks})),m=p.initPTS,p=p.timescale,Object(r.isFiniteNumber)(m))&&(this.initPTS[l.cc]=m,i.trigger(s.Events.INIT_PTS_FOUND,{frag:l,id:t,initPTS:m,timescale:p})),d&&!1!==a.independent){if(o.details){var m=d.startPTS,A=(p=d.endPTS,o=d.startDTS,d.endDTS);if(c)c.elementaryStreams[d.type]={startPTS:m,endPTS:p,startDTS:o,endDTS:A};else if(d.firstKeyFrame&&d.independent&&(this.couldBacktrack=!0),d.dropped&&d.independent){if(this.getLoadPosition()+this.config.maxBufferHole<m)return void this.backtrack(l);l.setElementaryStreamInfo(d.type,l.start,p,l.start,A,!0)}l.setElementaryStreamInfo(d.type,m,p,o,A),this.bufferFragmentData(d,l,c,e)}}else if(!1===a.independent)return void this.backtrack(l);g&&(m=g.startPTS,p=g.endPTS,o=g.startDTS,A=g.endDTS,c&&(c.elementaryStreams[u.ElementaryStreamTypes.AUDIO]={startPTS:m,endPTS:p,startDTS:o,endDTS:A}),l.setElementaryStreamInfo(u.ElementaryStreamTypes.AUDIO,m,p,o,A),this.bufferFragmentData(g,l,c,e)),null!=f&&null!=(d=f.samples)&&d.length&&(a={frag:l,id:t,samples:f.samples},i.trigger(s.Events.FRAG_PARSING_METADATA,a)),h&&(m={frag:l,id:t,samples:h.samples},i.trigger(s.Events.FRAG_PARSING_USERDATA,m))}}else this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(e.level)},i._bufferInitSegment=function(e,t,i,r){var a,o,l,c,u,d=this;this.state===n.State.PARSING&&(this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio,a=t.audio,o=t.video,l=t.audiovideo,a&&(c=e.audioCodec,u=navigator.userAgent.toLowerCase(),this.audioCodecSwitch&&(c=c&&(-1!==c.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==a.metadata.channelCount)&&-1===u.indexOf("firefox")&&(c="mp4a.40.5"),-1!==u.indexOf("android")&&"audio/mpeg"!==a.container&&this.log("Android: force audio codec to "+(c="mp4a.40.2")),e.audioCodec&&e.audioCodec!==c&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+c+'"'),a.levelCodec=c,a.id="main",this.log("Init audio buffer, container:"+a.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(e.audioCodec||"")+"/"+a.codec+"]")),o&&(o.levelCodec=e.videoCodec,o.id="main",this.log("Init video buffer, container:"+o.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+o.codec+"]")),l&&this.log("Init audiovideo buffer, container:"+l.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+l.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var n=t[e].initSegment;null!=n&&n.byteLength&&d.hls.trigger(s.Events.BUFFER_APPENDING,{type:e,data:n,frag:i,part:null,chunkMeta:r,parent:i.type})})),this.tick())},i.backtrack=function(e){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(e);var t=this.fragmentTracker.backtrack(e);this.fragPrevious=null,this.nextLoadPosition=e.start,t?this.resetFragmentLoading(e):this.state=n.State.BACKTRACKING},i.checkFragmentChanged=function(){var e,t=this.media,i=null;t&&1<t.readyState&&!1===t.seeking&&(e=t.currentTime,o.BufferHelper.isBuffered(t,e)?i=this.getAppendedFrag(e):o.BufferHelper.isBuffered(t,e+.1)&&(i=this.getAppendedFrag(e+.1)),i)&&(t=this.fragPlaying,e=i.level,t&&i.sn===t.sn&&t.level===e&&i.urlId===t.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:i}),t&&t.level===e||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:e}),this.fragPlaying=i))},m(b.prototype,[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentLevel",get:function(){var e=this.media;return e&&(e=this.getAppendedFrag(e.currentTime),e)?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;return e?(e=this.getAppendedFrag(e.currentTime),this.followingBufferedFrag(e)):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]);var y,v=b;function b(e,t){return(e=y.call(this,e,t,"[stream-controller]")||this).audioCodecSwap=!1,e.gapController=null,e.level=-1,e._forceStartLoad=!1,e.altAudio=!1,e.audioOnly=!1,e.fragPlaying=null,e.onvplaying=null,e.onvseeked=null,e.fragLastKbps=0,e.stalled=!1,e.couldBacktrack=!1,e.audioCodecSwitch=!1,e.videoBuffer=null,e._registerListeners(),e}},"./src/controller/subtitle-stream-controller.ts":function(e,t,i){i.r(t),i.d(t,"SubtitleStreamController",(function(){return g}));var r=i("./src/events.ts"),n=i("./src/utils/buffer-helper.ts"),a=i("./src/controller/fragment-finders.ts"),s=i("./src/utils/discontinuities.ts"),o=i("./src/controller/level-helper.ts"),l=i("./src/controller/fragment-tracker.ts"),c=i("./src/controller/base-stream-controller.ts"),u=i("./src/types/loader.ts"),d=i("./src/types/level.ts");function h(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}p=c.default,t=p,(i=m).prototype=Object.create(t.prototype),f(i.prototype.constructor=i,t),(i=m.prototype).onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},i._registerListeners=function(){var e=this.hls;e.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(r.Events.ERROR,this.onError,this),e.on(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i._unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(r.Events.ERROR,this.onError,this),e.off(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},i.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(500),this.tick()},i.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},i.onLevelLoaded=function(e,t){this.mainDetails=t.details},i.onSubtitleFragProcessed=function(e,t){var i=t.frag;t=t.success;if(this.fragPrevious=i,this.state=c.State.IDLE,t){var r=this.tracksBuffered[this.currentTrackId];if(r){for(var n,a=i.start,s=0;s<r.length;s++)if(a>=r[s].start&&a<=r[s].end){n=r[s];break}t=i.start+i.duration,n?n.end=t:r.push(n={start:a,end:t}),this.fragmentTracker.fragBuffered(i)}}},i.onBufferFlushing=function(e,t){var i,r,n,a=t.startOffset,s=t.endOffset;0===a&&s!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(r=this.levels).length)&&r[i]&&r[i].details&&((n=s-r[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach((function(e){for(var t=0;t<e.length;)if(e[t].end<=n)e.shift();else{if(!(e[t].start<n))break;e[t].start=n,t++}})),this.fragmentTracker.removeFragmentsInRange(a,n,u.PlaylistLevelType.SUBTITLE)))},i.onError=function(e,t){t=t.frag;t&&t.type===u.PlaylistLevelType.SUBTITLE&&(null!=(t=this.fragCurrent)&&t.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE)},i.onSubtitleTracksUpdated=function(e,t){var i=this;t=t.subtitleTracks;this.tracksBuffered=[],this.levels=t.map((function(e){return new d.Level(e)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(e){i.tracksBuffered[e.id]=[]})),this.mediaBuffer=null},i.onSubtitleTrackSwitch=function(e,t){this.currentTrackId=t.id,this.levels.length&&-1!==this.currentTrackId?(null!=(t=this.levels[this.currentTrackId])&&t.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,t&&this.setInterval(500)):this.clearInterval()},i.onSubtitleTrackLoaded=function(e,t){var i=t.details,r=(t=t.id,this.currentTrackId),n=this.levels;if(n.length){var l=n[r];if(!(t>=n.length||t!==r)&&l){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!=(n=l.details)&&n.live){if(r=this.mainDetails,i.deltaUpdateFailed||!r)return;n=r.fragments[0],l.details?0===this.alignPlaylists(i,l.details)&&n&&Object(o.addSliding)(i,n.start):i.hasProgramDateTime&&r.hasProgramDateTime?Object(s.alignMediaPlaylistByPDT)(i,r):n&&Object(o.addSliding)(i,n.start)}l.details=i,this.levelLastLoaded=t,this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==c.State.IDLE||Object(a.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)}}},i._handleFragmentLoadComplete=function(e){var t,i=e.frag,n=(e=e.payload,i.decryptdata),a=this.hls;!this.fragContextChanged(i)&&e&&0<e.byteLength&&n&&n.key&&n.iv&&"AES-128"===n.method&&(t=performance.now(),this.decrypter.webCryptoDecrypt(new Uint8Array(e),n.key.buffer,n.iv.buffer).then((function(e){var n=performance.now();a.trigger(r.Events.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:t,tdecrypt:n}})})))},i.doTick=function(){var e,t,i,r,s,o,u,d;this.media?this.state===c.State.IDLE&&(o=this.currentTrackId,(e=this.levels).length)&&e[o]&&e[o].details&&(o=(e=e[o].details).targetduration,t=this.config,s=this.media,i=(s=n.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,s.currentTime-o,t.maxBufferHole)).end,s.len>this.getMaxBufferLength()+o||(console.assert(e,"Subtitle track details are defined on idle subtitle stream controller tick"),o=(s=e.fragments).length,d=e.edge,u=this.fragPrevious,i<d?(d=t.maxFragLookUpTolerance,!(r=Object(a.findFragmentByPTS)(u,s,i,d))&&u&&u.start<s[0].start&&(r=s[0])):r=s[o-1],null!=(t=r)&&t.encrypted?this.loadKey(r,e):r&&this.fragmentTracker.getState(r)===l.FragmentState.NOT_LOADED&&this.loadFragment(r,e,i))):this.state=c.State.IDLE},i.loadFragment=function(e,t,i){this.fragCurrent=e,p.prototype.loadFragment.call(this,e,t,i)},h(m.prototype,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]);var p,g=m;function m(e,t){return(e=p.call(this,e,t,"[subtitle-stream-controller]")||this).levels=[],e.currentTrackId=-1,e.tracksBuffered=[],e.mainDetails=null,e._registerListeners(),e}},"./src/controller/subtitle-track-controller.ts":function(e,t,i){i.r(t);var r=i("./src/events.ts"),n=i("./src/utils/texttrack-utils.ts"),a=i("./src/controller/base-playlist-controller.ts"),s=i("./src/types/loader.ts");function o(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}c=a.default,i=c,(a=u).prototype=Object.create(i.prototype),l(a.prototype.constructor=a,i),(a=u.prototype).destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,c.prototype.destroy.call(this)},a.registerListeners=function(){var e=this.hls;e.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(r.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var e=this.hls;e.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(r.Events.ERROR,this.onError,this)},a.onMediaAttached=function(e,t){this.media=t.media,this.media&&(-1<this.queuedDefaultTrack&&(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))},a.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),-1<this.trackId&&(this.queuedDefaultTrack=this.trackId),d(this.media.textTracks).forEach((function(e){Object(n.clearCurrentCues)(e)})),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},a.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},a.onSubtitleTrackLoaded=function(e,t){var i,r=t.id,n=t.details,a=this.trackId;a=this.tracksInGroup[a];a?(i=a.details,a.details=t.details,this.log("subtitle track "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,i))):this.warn("Invalid subtitle track id "+r)},a.onLevelLoading=function(e,t){this.switchLevel(t.level)},a.onLevelSwitching=function(e,t){this.switchLevel(t.level)},a.switchLevel=function(e){var t,i,n,a;e=this.hls.levels[e];null!=e&&e.textGroupIds&&(t=e.textGroupIds[e.urlId],this.groupId!==t)&&(e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,i=this.tracks.filter((function(e){return!t||e.groupId===t})),this.tracksInGroup=i,n=this.findTrackId(null==e?void 0:e.name)||this.findTrackId(),this.groupId=t,a={subtitleTracks:i},this.log("Updating subtitle tracks, "+i.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,a),-1!==n)&&this.setSubtitleTrack(n,e)},a.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;i<t.length;i++){var r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||e===r.name))return r.id}return-1},a.onError=function(e,t){c.prototype.onError.call(this,e,t),!t.fatal&&t.context&&t.context.type===s.PlaylistContextType.SUBTITLE_TRACK&&t.context.id===this.trackId&&t.context.groupId===this.groupId&&this.retryLoadingOrFail(t)},a.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,n=t.groupId;t=t.url;if(e)try{t=e.addDirectives(t)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(r.Events.SUBTITLE_TRACK_LOADING,{url:t,id:i,groupId:n,deliveryDirectives:e||null})}},a.toggleTrackModes=function(e){var t,i=this,r=this.media,n=this.subtitleDisplay,a=this.trackId;r&&(t=(r=d(r.textTracks)).filter((function(e){return e.groupId===i.groupId})),-1===e?[].slice.call(r).forEach((function(e){e.mode="disabled"})):(r=t[a])&&(r.mode="disabled"),a=t[e])&&(a.mode=n?"showing":"hidden")},a.setSubtitleTrack=function(e,t){var i,n,a,s,o,l=this.tracksInGroup;this.media?(this.trackId!==e&&this.toggleTrackModes(e),this.trackId===e&&(-1===e||null!=(i=l[e])&&i.details)||e<-1||e>=l.length||(this.clearTimer(),i=l[e],this.log("Switching to subtitle track "+e),this.trackId=e,i?(l=i.id,n=i.groupId,a=i.name,s=i.type,o=i.url,this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:l,groupId:void 0===n?"":n,name:a,type:s,url:o}),l=this.switchParams(i.url,null==t?void 0:t.details),this.loadPlaylist(l)):this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:e}))):this.queuedDefaultTrack=e},a.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=d(this.media.textTracks),i=0;i<t.length;i++)if("hidden"===t[i].mode)e=i;else if("showing"===t[i].mode){e=i;break}this.subtitleTrack!==e&&(this.subtitleTrack=e)}},o(u.prototype,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}]);var c;i=u;function u(e){var t;return(t=c.call(this,e,"[subtitle-track-controller]")||this).media=null,t.tracks=[],t.groupId=null,t.tracksInGroup=[],t.trackId=-1,t.selectDefaultTrack=!0,t.queuedDefaultTrack=-1,t.trackChangeListener=function(){return t.onTextTracksChanged()},t.asyncPollTrackChange=function(){return t.pollTrackChange(0)},t.useTextTrackPolling=!1,t.subtitlePollingInterval=-1,t.subtitleDisplay=!0,t.registerListeners(),t}function d(e){for(var t=[],i=0;i<e.length;i++){var r=e[i];"subtitles"===r.kind&&r.label&&t.push(e[i])}return t}t.default=i},"./src/controller/timeline-controller.ts":function(e,t,i){i.r(t),i.d(t,"TimelineController",(function(){return h}));var r=i("./src/polyfills/number.ts"),n=i("./src/events.ts"),a=i("./src/utils/cea-608-parser.ts"),s=i("./src/utils/output-filter.ts"),o=i("./src/utils/webvtt-parser.ts"),l=i("./src/utils/texttrack-utils.ts"),c=i("./src/utils/imsc1-ttml-parser.ts"),u=i("./src/types/loader.ts"),d=i("./src/utils/logger.ts"),h=((t=f.prototype).destroy=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(n.Events.FRAG_LOADING,this.onFragLoading,this),e.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(n.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(n.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(n.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(e,t,i,r,a){for(var s,o,l,c=!1,u=a.length;u--;){var d=a[u],h=(s=d[0],h=d[1],o=t,Math.min(h,i)-Math.max(s,o));if(0<=h&&(d[0]=Math.min(d[0],t),d[1]=Math.max(d[1],i),c=!0,.5<h/(i-t)))return}c||a.push([t,i]),this.config.renderTextTracksNatively?(l=this.captionsTracks[e],this.Cues.newCue(l,t,i,r)):(l=this.Cues.newCue(null,t,i,r),this.hls.trigger(n.Events.CUES_PARSED,{type:"captions",cues:l,track:e}))},t.onInitPtsFound=function(e,t){var i=this,r=t.frag,a=t.id,s=t.initPTS,o=(t=t.timescale,this.unparsedVttFrags);"main"===a&&(this.initPTS[r.cc]=s,this.timescale[r.cc]=t),o.length&&(this.unparsedVttFrags=[],o.forEach((function(e){i.onFragLoaded(n.Events.FRAG_LOADED,e)})))},t.getExistingTrack=function(e){var t=this.media;if(t)for(var i=0;i<t.textTracks.length;i++){var r=t.textTracks[i];if(r[e])return r}return null},t.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},t.createNativeTrack=function(e){var t,i,r,n,a;this.captionsTracks[e]||(n=this.captionsProperties,t=this.captionsTracks,i=this.media,r=(n=n[e]).label,n=n.languageCode,(a=this.getExistingTrack(e))?(t[e]=a,Object(l.clearCurrentCues)(t[e]),Object(l.sendAddTrackEvent)(t[e],i)):(a=this.createTextTrack("captions",r,n))&&(a[e]=!0,t[e]=a))},t.createNonNativeTrack=function(e){var t;this.nonNativeCaptionsTracks[e]||(t=this.captionsProperties[e])&&(t={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media},this.nonNativeCaptionsTracks[e]=t,this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[t]}))},t.createTextTrack=function(e,t,i){var r=this.media;if(r)return r.addTextTrack(e,t,i)},t.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},t.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){Object(l.clearCurrentCues)(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var i=0;i<t.length;i++)Object(l.clearCurrentCues)(t[i])}},t.onSubtitleTracksUpdated=function(e,t){var i,r=this,a=(t=(this.textTracks=[],t.subtitleTracks||[]),t.some((function(e){return e.textCodec===c.IMSC1_CODEC})));(this.config.enableWebVTT||a&&this.config.enableIMSC1)&&(a=this.tracks&&t&&this.tracks.length===t.length,this.tracks=t||[],this.config.renderTextTracksNatively?(i=this.media?this.media.textTracks:[],this.tracks.forEach((function(e,t){var n,a,s;if(t<i.length){for(var o=null,c=0;c<i.length;c++)if(a=i[c],s=e,a&&a.label===s.name&&!a.textTrack1&&!a.textTrack2){o=i[c];break}o&&(n=o)}n?Object(l.clearCurrentCues)(n):(n=r.createTextTrack("subtitles",e.name,e.lang))&&(n.mode="disabled"),n&&(n.groupId=e.groupId,r.textTracks.push(n))}))):!a&&this.tracks&&this.tracks.length&&(t=this.tracks.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}})),this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})))},t.onManifestLoaded=function(e,t){var i=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);t&&(t="textTrack"+t[1],t=i.captionsProperties[t])&&(t.label=e.name,e.lang&&(t.languageCode=e.lang),t.media=e)}))},t.onFragLoading=function(e,t){var i,r=this.cea608Parser1,n=this.cea608Parser2,a=this.lastSn,s=this.lastPartIndex;this.enabled&&r&&n&&t.frag.type===u.PlaylistLevelType.MAIN&&(i=t.frag.sn,t=null!=(t=null==t||null==(t=t.part)?void 0:t.index)?t:-1,i===a+1||i===a&&t===s+1||(r.reset(),n.reset()),this.lastSn=i,this.lastPartIndex=t)},t.onFragLoaded=function(e,t){var i,a,s=t.frag,o=t.payload,l=this.initPTS,d=this.unparsedVttFrags;s.type===u.PlaylistLevelType.SUBTITLE&&(o.byteLength?Object(r.isFiniteNumber)(l[s.cc])?(i=s.decryptdata,a="stats"in t,null!=i&&null!=i.key&&"AES-128"===i.method&&!a||(i=this.tracks[s.level],(a=this.vttCCs)[s.cc]||(a[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),i&&i.textCodec===c.IMSC1_CODEC?this._parseIMSC1(s,o):this._parseVTTs(s,o,a))):(d.push(t),l.length&&this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Missing initial subtitle PTS")})):this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")}))},t._parseIMSC1=function(e,t){var i=this,r=this.hls;Object(c.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(t){i._appendCues(t,e.level),r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){d.logger.log("Failed to parse IMSC1: "+t),r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))},t._parseVTTs=function(e,t,i){var r=this,a=this.hls;Object(o.parseWebVTT)(t,this.initPTS[e.cc],this.timescale[e.cc],i,e.cc,e.start,(function(t){r._appendCues(t,e.level),a.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(i){r._fallbackToIMSC1(e,t),d.logger.log("Failed to parse VTT cue: "+i),a.trigger(n.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})}))},t._fallbackToIMSC1=function(e,t){var i=this,r=this.tracks[e.level];r.textCodec||Object(c.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(){r.textCodec=c.IMSC1_CODEC,i._parseIMSC1(e,t)}),(function(){r.textCodec="wvtt"}))},t._appendCues=function(e,t){var i,r=this.hls;this.config.renderTextTracksNatively?"disabled"!==(i=this.textTracks[t]).mode&&e.forEach((function(e){return Object(l.addCueToTrack)(i,e)})):(t=this.tracks[t].default?"default":"subtitles"+t,r.trigger(n.Events.CUES_PARSED,{type:"subtitles",cues:e,track:t}))},t.onFragDecrypted=function(e,t){var i=t.frag;i.type===u.PlaylistLevelType.SUBTITLE&&(Object(r.isFiniteNumber)(this.initPTS[i.cc])?this.onFragLoaded(n.Events.FRAG_LOADED,t):this.unparsedVttFrags.push(t))},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&i&&r)for(var n=0;n<t.samples.length;n++){var a=t.samples[n].bytes;a&&(a=this.extractCea608Data(a),i.addData(t.samples[n].pts,a[0]),r.addData(t.samples[n].pts,a[1]))}},t.onBufferFlushing=function(e,t){var i,r,n=t.startOffset,a=t.endOffset,s=t.endOffsetSubtitles,o=(t=t.type,this.media);!o||o.currentTime<a||(t&&"video"!==t||(i=this.captionsTracks,Object.keys(i).forEach((function(e){return Object(l.removeCuesInRange)(i[e],n,a)}))),this.config.renderTextTracksNatively&&0===n&&void 0!==s&&(r=this.textTracks,Object.keys(r).forEach((function(e){return Object(l.removeCuesInRange)(r[e],n,s)}))))},t.extractCea608Data=function(e){for(var t=31&e[0],i=2,r=[[],[]],n=0;n<t;n++){var a=e[i++],s=127&e[i++],o=127&e[i++],l=3&a;0==s&&0==o||0==(4&a)||0!=l&&1!=l||(r[l].push(s),r[l].push(o))}return r},f);function f(e){var t,i,r,o;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.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.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}},this.config.enableCEA708Captions&&(t=new s.default(this,"textTrack1"),i=new s.default(this,"textTrack2"),r=new s.default(this,"textTrack3"),o=new s.default(this,"textTrack4"),this.cea608Parser1=new a.default(1,t,i),this.cea608Parser2=new a.default(3,r,o)),e.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(n.Events.FRAG_LOADING,this.onFragLoading,this),e.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(n.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(n.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(n.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}},"./src/crypt/aes-crypto.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return r})),n.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)};var r=n;function n(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}},"./src/crypt/aes-decryptor.ts":function(e,t,i){i.r(t),i.d(t,"removePadding",(function(){return n})),i.d(t,"default",(function(){return a}));var r=i("./src/utils/typed-array.ts");function n(e){var t=e.byteLength,i=t&&new DataView(e.buffer).getUint8(t-1);return i?Object(r.sliceUint8)(e,0,t-i):e}(t=s.prototype).uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),i=new Uint32Array(4),r=0;r<4;r++)i[r]=t.getUint32(4*r);return i},t.initTable=function(){var e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],a=i[2],s=i[3],o=(i=this.invSubMix,i[0]),l=i[1],c=i[2],u=i[3],d=new Uint32Array(256),h=0,f=0,p=0;for(p=0;p<256;p++)d[p]=p<128?p<<1:p<<1^283;for(p=0;p<256;p++){var g=f^f<<1^f<<2^f<<3^f<<4,m=(e[h]=g=g>>>8^255&g^99,d[t[g]=h]),A=d[m],y=d[A],v=257*d[g]^16843008*g;r[h]=v<<24|v>>>8,n[h]=v<<16|v>>>16,a[h]=v<<8|v>>>24,s[h]=v,o[g]=(v=16843009*y^65537*A^257*m^16843008*h)<<24|v>>>8,l[g]=v<<16|v>>>16,c[g]=v<<8|v>>>24,u[g]=v,h?(h=m^d[d[d[y^m]]],f^=d[d[f]]):h=f=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r<t.length&&i;)i=t[r]===this.key[r],r++;if(!i){this.key=t;var n=this.keySize=t.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);for(var a,s,o,l=this.ksRows=4*(n+6+1),c=this.keySchedule=new Uint32Array(l),u=this.invKeySchedule=new Uint32Array(l),d=this.sBox,h=this.rcon,f=(e=this.invSubMix,e[0]),p=e[1],g=e[2],m=e[3],A=0;A<l;A++)A<n?s=c[A]=t[A]:(o=s,A%n==0?(o=d[(o=o<<8|o>>>24)>>>24]<<24|d[o>>>16&255]<<16|d[o>>>8&255]<<8|d[255&o],o^=h[A/n|0]<<24):6<n&&A%n==4&&(o=d[o>>>24]<<24|d[o>>>16&255]<<16|d[o>>>8&255]<<8|d[255&o]),c[A]=s=(c[A-n]^o)>>>0);for(a=0;a<l;a++)A=l-a,o=3&a?c[A]:c[A-4],u[a]=a<4||A<=4?o:f[d[o>>>24]]^p[d[o>>>16&255]]^g[d[o>>>8&255]]^m[d[255&o]],u[a]=u[a]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,i){for(var r,n,a,s,o,l,c,u,d,h,f,p,g,m,A=this.keySize+6,y=this.invKeySchedule,v=this.invSBox,b=this.invSubMix,w=b[0],k=b[1],E=b[2],T=b[3],S=(b=this.uint8ArrayToUint32Array_(i),b[0]),_=b[1],C=b[2],R=b[3],D=new Int32Array(e),x=new Int32Array(D.length),L=this.networkToHostOrderSwap;t<D.length;){for(d=L(D[t]),h=L(D[t+1]),f=L(D[t+2]),p=L(D[t+3]),o=d^y[0],l=p^y[1],c=f^y[2],u=h^y[3],g=4,m=1;m<A;m++)r=w[o>>>24]^k[l>>16&255]^E[c>>8&255]^T[255&u]^y[g],n=w[l>>>24]^k[c>>16&255]^E[u>>8&255]^T[255&o]^y[g+1],a=w[c>>>24]^k[u>>16&255]^E[o>>8&255]^T[255&l]^y[g+2],s=w[u>>>24]^k[o>>16&255]^E[l>>8&255]^T[255&c]^y[g+3],o=r,l=n,c=a,u=s,g+=4;r=v[o>>>24]<<24^v[l>>16&255]<<16^v[c>>8&255]<<8^v[255&u]^y[g],n=v[l>>>24]<<24^v[c>>16&255]<<16^v[u>>8&255]<<8^v[255&o]^y[g+1],a=v[c>>>24]<<24^v[u>>16&255]<<16^v[o>>8&255]<<8^v[255&l]^y[g+2],s=v[u>>>24]<<24^v[o>>16&255]<<16^v[l>>8&255]<<8^v[255&c]^y[g+3],x[t]=L(r^S),x[t+1]=L(s^_),x[t+2]=L(a^C),x[t+3]=L(n^R),S=d,_=h,C=f,R=p,t+=4}return x.buffer};var a=s;function s(){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()}},"./src/crypt/decrypter.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return c}));var r=i("./src/crypt/aes-crypto.ts"),n=i("./src/crypt/fast-aes-key.ts"),a=i("./src/crypt/aes-decryptor.ts"),s=i("./src/utils/logger.ts"),o=i("./src/utils/mp4-tools.ts"),l=i("./src/utils/typed-array.ts"),c=((t=u.prototype).destroy=function(){this.observer=null},t.isSync=function(){return this.config.enableSoftwareAES},t.flush=function(){var e=this.currentResult;if(e)return e=new Uint8Array(e),this.reset(),this.removePKCS7Padding?Object(a.removePadding)(e):e;this.reset()},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,i,r){var n;this.config.enableSoftwareAES?(this.softwareDecrypt(new Uint8Array(e),t,i),(n=this.flush())&&r(n.buffer)):this.webCryptoDecrypt(new Uint8Array(e),t,i).then(r)},t.softwareDecrypt=function(e,t,i){var r=this.currentIV,n=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(e=Object(o.appendUint8Array)(s,e),this.remainderData=null),s=this.getValidChunk(e);return s.length?(r&&(i=r),e=this.softwareDecrypter,(e=e||(this.softwareDecrypter=new a.default)).expandKey(t),r=n,this.currentResult=e.decrypt(s.buffer,0,i),this.currentIV=Object(l.sliceUint8)(s,-16).buffer,r||null):null},t.webCryptoDecrypt=function(e,t,i){var a=this,s=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new n.default(s,t)),this.fastAesKey.expandKey().then((function(t){return s?new r.default(s,i).decrypt(e.buffer,t):Promise.reject(new Error("web crypto not initialized"))})).catch((function(r){return a.onWebCryptoError(r,e,t,i)}))},t.onWebCryptoError=function(e,t,i,r){return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",e),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(t,i,r)},t.getValidChunk=function(e){var t=e,i=e.length-e.length%16;return i!==e.length&&(t=Object(l.sliceUint8)(e,0,i),this.remainderData=Object(l.sliceUint8)(e,i)),t},t.logOnce=function(e){this.logEnabled&&(s.logger.log("[decrypter.ts]: "+e),this.logEnabled=!1)},u);function u(e,t,i){if(i=(void 0===i?{}:i).removePKCS7Padding,i=void 0===i||i,this.logEnabled=!0,this.observer=void 0,this.config=void 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.observer=e,this.config=t,this.removePKCS7Padding=i)try{var r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch(e){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}},"./src/crypt/fast-aes-key.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return r})),n.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])};var r=n;function n(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}},"./src/demux/aacdemuxer.ts":function(e,t,i){i.r(t);var r=i("./src/demux/base-audio-demuxer.ts"),n=i("./src/demux/adts.ts"),a=i("./src/utils/logger.ts"),s=i("./src/demux/id3.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l=r.default,i=l,(r=c).prototype=Object.create(i.prototype),o(r.prototype.constructor=r,i),(r=c.prototype).resetInitSegment=function(e,t,i){l.prototype.resetInitSegment.call(this,e,t,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}},c.probe=function(e){if(e)for(var t=(s.getID3Data(e,0)||[]).length,i=e.length;t<i;t++)if(n.probe(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},r.canParse=function(e,t){return n.canParse(e,t)},r.appendFrame=function(e,t,i){if(n.initTrackConfig(e,this.observer,t,i,e.manifestCodec),e=n.appendFrame(e,t,i,this.initPTS,this.frameIndex),e&&0===e.missing)return e};var l;i=c;function c(e,t){var i;return(i=l.call(this)||this).observer=void 0,i.config=void 0,i.observer=e,i.config=t,i}i.minProbeByteLength=9,t.default=i},"./src/demux/adts.ts":function(e,t,i){i.r(t),i.d(t,"getAudioConfig",(function(){return s})),i.d(t,"isHeaderPattern",(function(){return o})),i.d(t,"getHeaderLength",(function(){return l})),i.d(t,"getFullFrameLength",(function(){return c})),i.d(t,"canGetFrameLength",(function(){return u})),i.d(t,"isHeader",(function(){return d})),i.d(t,"canParse",(function(){return h})),i.d(t,"probe",(function(){return f})),i.d(t,"initTrackConfig",(function(){return p})),i.d(t,"getFrameDuration",(function(){return g})),i.d(t,"parseFrameHeader",(function(){return m})),i.d(t,"appendFrame",(function(){return A}));var r=i("./src/utils/logger.ts"),n=i("./src/errors.ts"),a=i("./src/events.ts");function s(e,t,i,s){var o,l,c=navigator.userAgent.toLowerCase(),u=s,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],h=1+((192&t[i+2])>>>6),f=(60&t[i+2])>>>2;if(!(d.length-1<f))return o=(1&t[i+2])<<2,o|=(192&t[i+3])>>>6,r.logger.log("manifest codec:"+s+", ADTS type:"+h+", samplingIndex:"+f),t=/firefox/i.test(c)?6<=f?(h=5,l=new Array(4),f-3):(h=2,l=new Array(2),f):-1!==c.indexOf("android")?(h=2,l=new Array(2),f):(h=5,l=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&6<=f?f-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(6<=f&&1==o||/vivaldi/i.test(c))||!s&&1==o)&&(h=2,l=new Array(2)),f)),l[0]=h<<3,l[0]|=(14&f)>>1,l[1]|=(1&f)<<7,l[1]|=o<<3,5===h&&(l[1]|=(14&t)>>1,l[2]=(1&t)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:d[f],channelCount:o,codec:"mp4a.40."+h,manifestCodec:u};e.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+f})}function o(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function c(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function u(e,t){return t+5<e.length}function d(e,t){return t+1<e.length&&o(e,t)}function h(e,t){return u(e,t)&&o(e,t)&&c(e,t)<=e.length-t}function f(e,t){var i,r;return!!d(e,t)&&!(t+(r=l(e,t))>=e.length||(i=c(e,t))<=r)&&((r=t+i)===e.length||d(e,r))}function p(e,t,i,n,a){e.samplerate||(t=s(t,i,n,a))&&(e.config=t.config,e.samplerate=t.samplerate,e.channelCount=t.channelCount,e.codec=t.codec,e.manifestCodec=t.manifestCodec,r.logger.log("parsed codec:"+e.codec+", rate:"+t.samplerate+", channels:"+t.channelCount))}function g(e){return 9216e4/e}function m(e,t,i,r,n){var a=l(e,t);e=c(e,t);if(0<(e-=a))return{headerLength:a,frameLength:e,stamp:i+r*n}}function A(e,t,i,r,n){var a,s,o;r=m(t,i,r,n,g(e.samplerate));if(r)return n=r.frameLength,s=r.headerLength,r=r.stamp,n=s+n,(o=Math.max(0,i+n-t.length))?(a=new Uint8Array(n-s)).set(t.subarray(i+s,t.length),0):a=t.subarray(i+s,i+n),t={unit:a,pts:r},o||e.samples.push(t),{sample:t,length:n,missing:o}}},"./src/demux/base-audio-demuxer.ts":function(e,t,i){i.r(t),i.d(t,"initPTSFn",(function(){return l}));var r=i("./src/polyfills/number.ts"),n=i("./src/demux/id3.ts"),a=i("./src/demux/dummy-demuxed-track.ts"),s=i("./src/utils/mp4-tools.ts"),o=i("./src/utils/typed-array.ts");(i=c.prototype).resetInitSegment=function(e,t,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},i.resetTimeStamp=function(){},i.resetContiguity=function(){},i.canParse=function(e,t){return!1},i.appendFrame=function(e,t,i){},i.demux=function(e,t){this.cachedData&&(e=Object(s.appendUint8Array)(this.cachedData,e),this.cachedData=null);var i,r,c,u=n.getID3Data(e,0),d=u?u.length:0,h=this._audioTrack,f=this._id3Track,p=u?n.getTimeStamp(u):void 0,g=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=l(p,t)),u&&0<u.length&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:u}),r=this.initPTS;d<g;)this.canParse(e,d)?(c=this.appendFrame(h,e,d))?(this.frameIndex++,r=c.sample.pts,i=d+=c.length):d=g:n.canParse(e,d)?(u=n.getID3Data(e,d),f.samples.push({pts:r,dts:r,data:u}),i=d+=u.length):d++,d===g&&i!==g&&(c=Object(o.sliceUint8)(e,i),this.cachedData?this.cachedData=Object(s.appendUint8Array)(this.cachedData,c):this.cachedData=c);return{audioTrack:h,avcTrack:Object(a.dummyTrack)(),id3Track:f,textTrack:Object(a.dummyTrack)()}},i.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},i.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(a.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(a.dummyTrack)()}},i.destroy=function(){};var l=function(e,t){return Object(r.isFiniteNumber)(e)?90*e:9e4*t};function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}t.default=c},"./src/demux/chunk-cache.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return r})),(i=n.prototype).push=function(e){this.chunks.push(e),this.dataLength+=e.length},i.flush=function(){var e=this.chunks,t=this.dataLength;return e.length?(e=1===e.length?e[0]:function(e){for(var i=new Uint8Array(t),r=0,n=0;n<e.length;n++){var a=e[n];i.set(a,r),r+=a.length}return i}(e),this.reset(),e):new Uint8Array(0)},i.reset=function(){this.chunks.length=0,this.dataLength=0};var r=n;function n(){this.chunks=[],this.dataLength=0}},"./src/demux/dummy-demuxed-track.ts":function(e,t,i){function r(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}i.r(t),i.d(t,"dummyTrack",(function(){return r}))},"./src/demux/exp-golomb.ts":function(e,t,i){i.r(t);var r=i("./src/utils/logger.ts");function n(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}(i=n.prototype).loadWord=function(){var e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4);t=Math.min(4,t);if(0===t)throw new Error("no bytes available");r.set(e.subarray(i,i+t)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*t,this.bytesAvailable-=t},i.skipBits=function(e){var t;this.bitsAvailable>e||(e=(e-=this.bitsAvailable)-((t=e>>3)>>3),this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},i.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;return 32<e&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,0<this.bitsAvailable?this.word<<=t:0<this.bytesAvailable&&this.loadWord(),0<(t=e-t)&&this.bitsAvailable?i<<t|this.readBits(t):i},i.skipLZ=function(){for(var e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},i.skipUEG=function(){this.skipBits(1+this.skipLZ())},i.skipEG=function(){this.skipBits(1+this.skipLZ())},i.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},i.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},i.readBoolean=function(){return 1===this.readBits(1)},i.readUByte=function(){return this.readBits(8)},i.readUShort=function(){return this.readBits(16)},i.readUInt=function(){return this.readBits(32)},i.skipScalingList=function(e){for(var t=8,i=8,r=0;r<e;r++)t=0===(i=0!==i?(t+this.readEG()+256)%256:i)?t:i},i.readSPS=function(){var e,t,i,r=0,n=0,a=0,s=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),d=this.skipBits.bind(this),h=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this),g=(o(),o());if(l(5),d(3),o(),f(),(100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g)&&(g=c(),3===g&&d(1),f(),f(),d(1),u()))for(t=3!==g?8:12,i=0;i<t;i++)u()&&p(i<6?16:64);if(f(),g=c(),0===g)c();else if(1===g)for(d(1),h(),h(),e=c(),i=0;i<e;i++)h();f(),d(1);g=c(),f=c(),l=l(1);var m=(0===l&&d(1),d(1),u()&&(r=c(),n=c(),a=c(),s=c()),[1,1]);if(u()&&u())switch(o()){case 1:m=[1,1];break;case 2:m=[12,11];break;case 3:m=[10,11];break;case 4:m=[16,11];break;case 5:m=[40,33];break;case 6:m=[24,11];break;case 7:m=[20,11];break;case 8:m=[32,11];break;case 9:m=[80,33];break;case 10:m=[18,11];break;case 11:m=[15,11];break;case 12:m=[64,33];break;case 13:m=[160,99];break;case 14:m=[4,3];break;case 15:m=[3,2];break;case 16:m=[2,1];break;case 255:m=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(g+1)-2*r-2*n),height:(2-l)*(f+1)*16-(l?2:4)*(a+s),pixelRatio:m}},i.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t.default=n},"./src/demux/id3.ts":function(e,t,i){i.r(t),i.d(t,"isHeader",(function(){return n})),i.d(t,"isFooter",(function(){return a})),i.d(t,"getID3Data",(function(){return s})),i.d(t,"canParse",(function(){return l})),i.d(t,"getTimeStamp",(function(){return c})),i.d(t,"isTimeStampFrame",(function(){return u})),i.d(t,"getID3Frames",(function(){return h})),i.d(t,"decodeFrame",(function(){return f})),i.d(t,"utf8ArrayToStr",(function(){return y})),i.d(t,"testables",(function(){return v}));var r,n=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},a=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},s=function(e,t){for(var i=t,r=0;n(e,t);)r=(r+=10)+o(e,t+6),a(e,t+10)&&(r+=10),t+=r;if(0<r)return e.subarray(i,i+r)},o=function(e,t){var i=0;i=(127&e[t])<<21;return(i=(i|=(127&e[t+1])<<14)|(127&e[t+2])<<7)|127&e[t+3]},l=function(e,t){return n(e,t)&&o(e,t+6)+10<=e.length-t},c=function(e){for(var t=h(e),i=0;i<t.length;i++){var r=t[i];if(u(r))return A(r)}},u=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},d=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=o(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},h=function(e){for(var t=0,i=[];n(e,t);){for(var r=o(e,t+6),s=(t+=10)+r;t+8<s;){var l=d(e.subarray(t)),c=f(l);c&&i.push(c),t+=l.size+10}a(e,t)&&(t+=10)}return i},f=function(e){return("PRIV"===e.type?p:"W"===e.type[0]?m:g)(e)},p=function(e){var t,i;if(!(e.size<2))return t=y(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1)),{key:e.type,info:t,data:i.buffer}},g=function(e){var t,i;if(!(e.size<2))return"TXXX"===e.type?(t=1,t+=(i=y(e.data.subarray(1),!0)).length+1,t=y(e.data.subarray(t)),{key:e.type,info:i,data:t}):(i=y(e.data.subarray(1)),{key:e.type,data:i})},m=function(e){var t,i;return"WXXX"===e.type?e.size<2?void 0:(t=1,t+=(i=y(e.data.subarray(1),!0)).length+1,t=y(e.data.subarray(t)),{key:e.type,info:i,data:t}):(i=y(e.data),{key:e.type,data:i})},A=function(e){var t;if(8===e.data.byteLength)return t=1&(e=new Uint8Array(e.data))[3],e=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7],e/=45,t&&(e+=47721858.84),Math.round(e)},y=function(e,t){var i,n;if(void 0===t&&(t=!1),r=r||void 0===self.TextDecoder?r:new self.TextDecoder("utf-8"),r)return i=r.decode(e),t?-1!==(n=i.indexOf("\0"))?i.substring(0,n):i:i.replace(/\0/g,"");for(var a,s,o,l=e.length,c="",u=0;u<l;){if(0===(a=e[u++])&&t)return c;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:s=e[u++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[u++],o=e[u++],c+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return c},v={decodeTextFrame:g}},"./src/demux/mp3demuxer.ts":function(e,t,i){i.r(t);var r=i("./src/demux/base-audio-demuxer.ts"),n=i("./src/demux/id3.ts"),a=i("./src/utils/logger.ts"),s=i("./src/demux/mpegaudio.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l=r.default,i=l,(r=c).prototype=Object.create(i.prototype),o(r.prototype.constructor=r,i),(r=c.prototype).resetInitSegment=function(e,t,i){l.prototype.resetInitSegment.call(this,e,t,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}},c.probe=function(e){if(e)for(var t=(n.getID3Data(e,0)||[]).length,i=e.length;t<i;t++)if(s.probe(e,t))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(e,t){return s.canParse(e,t)},r.appendFrame=function(e,t,i){if(null!==this.initPTS)return s.appendFrame(e,t,i,this.initPTS,this.frameIndex)};var l;i=c;function c(){return l.apply(this,arguments)||this}i.minProbeByteLength=4,t.default=i},"./src/demux/mp4demuxer.ts":function(e,t,i){i.r(t);var r=i("./src/utils/mp4-tools.ts"),n=i("./src/demux/dummy-demuxed-track.ts");(i=a.prototype).resetTimeStamp=function(){},i.resetInitSegment=function(){},i.resetContiguity=function(){},a.probe=function(e){return 0<Object(r.findBox)({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length},i.demux=function(e){var t=e,i=Object(n.dummyTrack)();return this.config.progressive?(this.remainderData&&(t=Object(r.appendUint8Array)(this.remainderData,e)),e=Object(r.segmentValidRange)(t),this.remainderData=e.remainder,i.samples=e.valid||new Uint8Array):i.samples=t,{audioTrack:Object(n.dummyTrack)(),avcTrack:i,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},i.flush=function(){var e=Object(n.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(n.dummyTrack)(),avcTrack:e,id3Track:Object(n.dummyTrack)(),textTrack:Object(n.dummyTrack)()}},i.demuxSampleAes=function(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},i.destroy=function(){},i=a;function a(e,t){this.remainderData=null,this.config=void 0,this.config=t}i.minProbeByteLength=1024,t.default=i},"./src/demux/mpegaudio.ts":function(e,t,i){i.r(t),i.d(t,"appendFrame",(function(){return l})),i.d(t,"parseHeader",(function(){return c})),i.d(t,"isHeaderPattern",(function(){return u})),i.d(t,"isHeader",(function(){return d})),i.d(t,"canParse",(function(){return h})),i.d(t,"probe",(function(){return f}));var r=null,n=[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],a=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],s=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o=[0,1,1,4];function l(e,t,i,r,n){if(!(i+24>t.length)){var a=c(t,i);if(a&&i+a.frameLength<=t.length)return r+=n*(9e4*a.samplesPerFrame/a.sampleRate),n={unit:t.subarray(i,i+a.frameLength),pts:r,dts:r},e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(n),{sample:n,length:a.frameLength,missing:0}}}function c(e,t){var i,l,c,u,d,h=e[t+1]>>3&3,f=e[t+1]>>1&3,p=e[t+2]>>4&15,g=e[t+2]>>2&3;if(1!=h&&0!=p&&15!=p&&3!=g)return d=e[t+2]>>1&1,i=e[t+3]>>6,p=1e3*n[14*(3==h?3-f:3==f?3:4)+p-1],g=a[3*(3==h?0:2==h?1:2)+g],l=3==i?1:2,u=8*(h=s[h][f])*(c=o[f]),h=Math.floor(h*p/g+d)*c,null===r&&(d=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),r=d?parseInt(d[1]):0),r&&r<=87&&2==f&&224e3<=p&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:g,channelCount:l,frameLength:h,samplesPerFrame:u}}function u(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function d(e,t){return t+1<e.length&&u(e,t)}function h(e,t){return u(e,t)&&4<=e.length-t}function f(e,t){var i;return!!(t+1<e.length&&u(e,t))&&(i=4,(t+=i=null!=(t=c(e,t))&&t.frameLength?t.frameLength:i)===e.length||d(e,t))}},"./src/demux/sample-aes.ts":function(e,t,i){i.r(t);var r=i("./src/crypt/decrypter.ts"),n=i("./src/demux/tsdemuxer.ts");function a(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new r.default(e,t,{removePKCS7Padding:!1})}(i=a.prototype).decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,t)},i.decryptAacSample=function(e,t,i,r){var n=e[t].unit,a=n.subarray(16,n.length-n.length%16),s=(a=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),this);this.decryptBuffer(a,(function(a){a=new Uint8Array(a),n.set(a,16),r||s.decryptAacSamples(e,t+1,i)}))},i.decryptAacSamples=function(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(e,t,i,r),!r)return}}},i.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i},i.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e},i.decryptAvcSample=function(e,t,i,r,a,s){var o=Object(n.discardEPB)(a.data),l=this.getAvcEncryptedData(o),c=this;this.decryptBuffer(l.buffer,(function(n){a.data=c.getAvcDecryptedUnit(o,n),s||c.decryptAvcSamples(e,t,i+1,r)}))},i.decryptAvcSamples=function(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();for(var n=e[t].units;!(i>=n.length);i++){var a=n[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,a,s),!s)return}}}},t.default=a},"./src/demux/transmuxer-interface.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return u}));var r=i("./node_modules/webworkify-webpack/index.js"),n=i("./src/events.ts"),a=i("./src/demux/transmuxer.ts"),s=i("./src/utils/logger.ts"),o=i("./src/errors.ts"),l=(t=i("./src/utils/mediasource-helper.ts"),i("./node_modules/eventemitter3/index.js")),c=Object(t.getMediaSource)()||{isTypeSupported:function(){return!1}},u=((i=d.prototype).destroy=function(){var e=this.worker;e?(e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null):(e=this.transmuxer)&&(e.destroy(),this.transmuxer=null),e=this.observer;e&&e.removeAllListeners(),this.observer=null},i.push=function(e,t,i,r,n,o,l,c,u,d){var h=this,f=(u.transmuxing.start=self.performance.now(),this.transmuxer),p=this.worker,g=(o||n).start,m=n.decryptdata,A=this.frag,y=!(A&&n.cc===A.cc),v=!(A&&u.level===A.level),b=A?u.sn-A.sn:-1,w=this.part?u.part-this.part.index:1,k=!v&&(1==b||0==b&&1==w),E=self.performance.now();(v||b||0===n.stats.parsing.start)&&(n.stats.parsing.start=E),!o||!w&&k||(o.stats.parsing.start=E),E=!(A&&(null==(b=n.initSegment)?void 0:b.url)===(null==(w=A.initSegment)?void 0:w.url)),b=new a.TransmuxState(y,k,c,v,g,E);k&&!y&&!E||(s.logger.log("[transmuxer-interface, "+n.type+"]: Starting new transmux session for sn: "+u.sn+" p: "+u.part+" level: "+u.level+" id: "+u.id+"\n discontinuity: "+y+"\n trackSwitch: "+v+"\n contiguous: "+k+"\n accurateTimeOffset: "+c+"\n timeOffset: "+g+"\n initSegmentChange: "+E),A=new a.TransmuxConfig(i,r,t,l,d),this.configureTransmuxer(A)),this.frag=n,this.part=o,p?p.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:u,state:b},e instanceof ArrayBuffer?[e]:[]):f&&(w=f.push(e,m,u,b),Object(a.isPromise)(w)?w.then((function(e){h.handleTransmuxComplete(e)})):this.handleTransmuxComplete(w))},i.flush=function(e){var t=this,i=(e.transmuxing.start=self.performance.now(),this.transmuxer),r=this.worker;r?r.postMessage({cmd:"flush",chunkMeta:e}):i&&(r=i.flush(e),Object(a.isPromise)(r)?r.then((function(i){t.handleFlushResult(i,e)})):this.handleFlushResult(r,e))},i.handleFlushResult=function(e,t){var i=this;e.forEach((function(e){i.handleTransmuxComplete(e)})),this.onFlush(t)},i.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},i.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},i.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},d);function d(e,t,i,u){function d(t,i){(i=i||{}).frag=f.frag,i.id=f.id,e.trigger(t,i)}var h,f=this,p=(i=(this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=e,this.id=t,this.onTransmuxComplete=i,this.onFlush=u,e.config),u=(this.observer=new l.EventEmitter,this.observer.on(n.Events.FRAG_DECRYPTED,d),this.observer.on(n.Events.ERROR,d),{mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')}),navigator.vendor);if(i.enableWorker&&"undefined"!=typeof Worker){s.logger.log("demuxing in webworker");try{h=this.worker=r("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(t){e.trigger(n.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(t.message+" ("+t.filename+":"+t.lineno+")")})},h.postMessage({cmd:"init",typeSupported:u,vendor:p,id:t,config:JSON.stringify(i)})}catch(e){s.logger.warn("Error in worker:",e),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new a.default(this.observer,u,i,p,t),this.worker=null}}else this.transmuxer=new a.default(this.observer,u,i,p,t)}},"./src/demux/transmuxer-worker.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return o}));var r=i("./src/demux/transmuxer.ts"),n=i("./src/events.ts"),a=i("./src/utils/logger.ts"),s=i("./node_modules/eventemitter3/index.js");function o(e){function t(t,i){e.postMessage({event:t,data:i})}var i=new s.EventEmitter;i.on(n.Events.FRAG_DECRYPTED,t),i.on(n.Events.ERROR,t),e.addEventListener("message",(function(n){var s=n.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);e.transmuxer=new r.default(i,s.typeSupported,o,s.vendor,s.id),Object(a.enableLogs)(o.debug),t("init",null);break;case"configure":e.transmuxer.configure(s.config);break;case"demux":o=e.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state),Object(r.isPromise)(o)?o.then((function(t){l(e,t)})):l(e,o);break;case"flush":var c=s.chunkMeta;o=e.transmuxer.flush(c);Object(r.isPromise)(o)?o.then((function(t){u(e,t,c)})):u(e,o,c)}}))}function l(e,t){var i,r,n;((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(n=t.remuxResult).audio,n=n.video,r&&c(i,r),n&&c(i,n),e.postMessage({event:"transmuxComplete",data:t},i))}function c(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function u(e,t,i){t.forEach((function(t){l(e,t)})),e.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return A})),i.d(t,"isPromise",(function(){return b})),i.d(t,"TransmuxConfig",(function(){return w})),i.d(t,"TransmuxState",(function(){return k}));var r,n=i("./src/events.ts"),a=i("./src/errors.ts"),s=i("./src/crypt/decrypter.ts"),o=(t=i("./src/demux/aacdemuxer.ts"),i("./src/demux/mp4demuxer.ts")),l=i("./src/demux/tsdemuxer.ts"),c=i("./src/demux/mp3demuxer.ts"),u=i("./src/remux/mp4-remuxer.ts"),d=i("./src/remux/passthrough-remuxer.ts"),h=i("./src/demux/chunk-cache.ts"),f=i("./src/utils/mp4-tools.ts"),p=i("./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(e){p.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var g=[{demux:l.default,remux:u.default},{demux:o.default,remux:d.default},{demux:t.default,remux:u.default},{demux:c.default,remux:u.default}],m=1024,A=(g.forEach((function(e){e=e.demux,m=Math.max(m,e.minProbeByteLength)})),(i=v.prototype).configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},i.push=function(e,t,i,n){var a=this,s=i.transmuxing,o=(e=(s.executeStart=r(),new Uint8Array(e)),this.cache),l=this.config,c=this.currentTransmuxState,u=this.transmuxConfig;n&&(this.currentTransmuxState=n),d=null,t=d=0<e.byteLength&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method?t:d;if(t&&"AES-128"===t.method){var d=this.getDecrypter();if(!l.enableSoftwareAES)return this.decryptionPromise=d.webCryptoDecrypt(e,t.key.buffer,t.iv.buffer).then((function(e){return e=a.push(e,null,i),a.decryptionPromise=null,e})),this.decryptionPromise;if(l=d.softwareDecrypt(e,t.key.buffer,t.iv.buffer),!l)return s.executeEnd=r(),y(i);e=new Uint8Array(l)}d=n||c,l=d.contiguous,n=d.discontinuity,c=d.trackSwitch;var h=d.accurateTimeOffset,p=d.timeOffset,g=(d=d.initSegmentChange,u.audioCodec),m=u.videoCodec,A=u.defaultInitPts,v=u.duration,b=u.initSegmentData;(n||c||d)&&this.resetInitSegment(b,g,m,v),(n||d)&&this.resetInitialTimestamp(A),l||this.resetContiguity(),this.needsProbing(e,n,c)&&(o.dataLength&&(b=o.flush(),e=Object(f.appendUint8Array)(b,e)),this.configureTransmuxer(e,u)),g=this.transmux(e,t,p,h,i),m=this.currentTransmuxState;return m.contiguous=!0,m.discontinuity=!1,m.trackSwitch=!1,s.executeEnd=r(),g},i.flush=function(e){var t,i=this,s=e.transmuxing,o=(s.executeStart=r(),this.decrypter),l=this.cache,c=this.currentTransmuxState,u=this.decryptionPromise;return u?u.then((function(){return i.flush(e)})):(t=[],u=c.timeOffset,o&&(c=o.flush())&&t.push(this.push(c,null,e)),o=l.dataLength,l.reset(),c=this.demuxer,l=this.remuxer,c&&l?b(l=c.flush(u))?l.then((function(r){return i.flushRemux(t,r,e),t})):(this.flushRemux(t,l,e),t):(m<=o&&this.observer.emit(n.Events.ERROR,n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),s.executeEnd=r(),[y(e)]))},i.flushRemux=function(e,t,i){var n=t.audioTrack,a=t.avcTrack,s=t.id3Track,o=(t=t.textTrack,this.currentTransmuxState),l=o.accurateTimeOffset;o=o.timeOffset,p.logger.log("[transmuxer.ts]: Flushed fragment "+i.sn+(-1<i.part?" p: "+i.part:"")+" of level "+i.level),n=this.remuxer.remux(n,a,s,t,o,l,!0,this.id);e.push({remuxResult:n,chunkMeta:i}),i.transmuxing.executeEnd=r()},i.resetInitialTimestamp=function(e){var t=this.demuxer,i=this.remuxer;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))},i.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},i.resetInitSegment=function(e,t,i,r){var n=this.demuxer,a=this.remuxer;n&&a&&(n.resetInitSegment(t,i,r),a.resetInitSegment(e,t,i))},i.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},i.transmux=function(e,t,i,r,n){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,n):this.transmuxUnencrypted(e,i,r,n)},i.transmuxUnencrypted=function(e,t,i,r){e=this.demuxer.demux(e,t,!1,!this.config.progressive);var n=e.audioTrack,a=e.avcTrack,s=e.id3Track;e=e.textTrack;return{remuxResult:this.remuxer.remux(n,a,s,e,t,i,!1,this.id),chunkMeta:r}},i.transmuxSampleAes=function(e,t,i,r,n){var a=this;return this.demuxer.demuxSampleAes(e,t,i).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,i,r,!1,a.id),chunkMeta:n}}))},i.configureTransmuxer=function(e,t){for(var i,r=this.config,n=this.observer,a=this.typeSupported,s=this.vendor,l=t.audioCodec,c=t.defaultInitPts,u=t.duration,h=t.initSegmentData,f=(t=t.videoCodec,0),m=g.length;f<m;f++)if(g[f].demux.probe(e)){i=g[f];break}i||(p.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),i={demux:o.default,remux:d.default});var A=this.demuxer,y=this.remuxer,v=i.remux,b=i.demux;y&&y instanceof v||(this.remuxer=new v(n,r,a,s)),A&&A instanceof b||(this.demuxer=new b(n,r,a),this.probe=b.probe),this.resetInitSegment(h,l,t,u),this.resetInitialTimestamp(c)},i.needsProbing=function(e,t,i){return!this.demuxer||!this.remuxer||t||i},i.getDecrypter=function(){return this.decrypter||(this.decrypter=new s.default(this.observer,this.config))},v),y=function(e){return{remuxResult:{},chunkMeta:e}};function v(e,t,i,r,n){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new h.default,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}function b(e){return"then"in e&&e.then instanceof Function}var w=function(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n},k=function(e,t,i,r,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}},"./src/demux/tsdemuxer.ts":function(e,t,i){i.r(t),i.d(t,"discardEPB",(function(){return y}));var r=i("./src/demux/adts.ts"),n=i("./src/demux/mpegaudio.ts"),a=i("./src/demux/exp-golomb.ts"),s=i("./src/demux/id3.ts"),o=i("./src/demux/sample-aes.ts"),l=i("./src/events.ts"),c=i("./src/utils/mp4-tools.ts"),u=i("./src/utils/logger.ts"),d=i("./src/errors.ts"),h={video:1,audio:2,id3:3,text:4};f.probe=function(e){return e=f.syncOffset(e),!(e<0||(e&&u.logger.warn("MPEG2-TS detected but first sync word found @ offset "+e+", junk ahead ?"),0))},f.syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),i=0;i<t;){if(71===e[i]&&71===e[i+188]&&71===e[i+376])return i;i++}return-1},f.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:h[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}},(i=f.prototype).resetInitSegment=function(e,t,i){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",i),this._audioTrack=f.createTrack("audio",i),this._id3Track=f.createTrack("id3",i),this._txtTrack=f.createTrack("text",i),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=t,this._duration=i},i.resetTimeStamp=function(){},i.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,i=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},i.demux=function(e,t,i,r){void 0===r&&(r=!1),(i=void 0!==i&&i)||(this.sampleAes=null);var n,a=this._avcTrack,s=this._audioTrack,o=this._id3Track,h=a.pid,p=a.pesData,m=s.pid,A=o.pid,y=s.pesData,v=o.pesData,b=!1,w=this.pmtParsed,k=this._pmtId,E=e.length;if(this.remainderData&&(E=(e=Object(c.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),E<188&&!r)return this.remainderData=e,{audioTrack:s,avcTrack:a,id3Track:o,textTrack:this._txtTrack};var T=Math.max(0,f.syncOffset(e));(E-=(E+T)%188)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,E,e.buffer.byteLength-E));for(var S,_=0,C=T;C<E;C+=188)if(71===e[C]){var R=!!(64&e[C+1]),D=((31&e[C+1])<<8)+e[C+2],x=void 0;if(1<(48&e[C+3])>>4){if((x=C+5+e[C+4])===C+188)continue}else x=C+4;switch(D){case h:R&&(p&&(n=g(p))&&this.parseAVCPES(n,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(x,C+188)),p.size+=C+188-x);break;case m:R&&(y&&(n=g(y))&&(s.isAAC?this.parseAACPES(n):this.parseMPEGPES(n)),y={data:[],size:0}),y&&(y.data.push(e.subarray(x,C+188)),y.size+=C+188-x);break;case A:R&&(v&&(n=g(v))&&this.parseID3PES(n),v={data:[],size:0}),v&&(v.data.push(e.subarray(x,C+188)),v.size+=C+188-x);break;case 0:R&&(x+=e[x]+1),k=this._pmtId=(31&(L=e)[(S=x)+10])<<8|L[S+11];break;case k:R&&(x+=e[x]+1);var L=function(e,t,i,r){var n={audio:-1,avc:-1,id3:-1,isAAC:!0},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var s=(31&e[t+1])<<8|e[t+2];switch(e[t]){case 207:if(!r){u.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===n.audio&&(n.audio=s);break;case 21:-1===n.id3&&(n.id3=s);break;case 219:if(!r){u.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===n.avc&&(n.avc=s);break;case 3:case 4:i?-1===n.audio&&(n.audio=s,n.isAAC=!1):u.logger.log("MPEG audio found, not supported in this browser");break;case 36:u.logger.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return n}(e,x,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,i);0<(h=L.avc)&&(a.pid=h),0<(m=L.audio)&&(s.pid=m,s.isAAC=L.isAAC),0<(A=L.id3)&&(o.pid=A),b&&!w&&(u.logger.log("reparse from beginning"),b=!1,C=T-188),w=this.pmtParsed=!0;break;case 17:case 8191:break;default:b=!0}}else _++;0<_&&this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+_+" TS packet/s that do not start with 0x47"}),a.pesData=p,s.pesData=y,o.pesData=v;var I={audioTrack:s,avcTrack:a,id3Track:o,textTrack:this._txtTrack};return r&&this.extractRemainingSamples(I),I},i.flush=function(){var e=this.remainderData;return this.remainderData=null,e=e?this.demux(e,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},i.extractRemainingSamples=function(e){var t,i=e.audioTrack,r=e.avcTrack,n=(e=e.id3Track,r.pesData),a=i.pesData,s=e.pesData;n&&(t=g(n))?(this.parseAVCPES(t,!0),r.pesData=null):r.pesData=n,a&&(t=g(a))?(i.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),i.pesData=null):(null!=a&&a.size&&u.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=a),s&&(t=g(s))?(this.parseID3PES(t),e.pesData=null):e.pesData=s},i.demuxSampleAes=function(e,t,i){return e=this.demux(e,i,!0,!this.config.progressive),i=this.sampleAes=new o.default(this.observer,this.config,t),this.decrypt(e,i)},i.decrypt=function(e,t){return new Promise((function(i){var r=e.audioTrack,n=e.avcTrack;r.samples&&r.isAAC?t.decryptAacSamples(r.samples,0,(function(){n.samples?t.decryptAvcSamples(n.samples,0,0,(function(){i(e)})):i(e)})):n.samples&&t.decryptAvcSamples(n.samples,0,0,(function(){i(e)}))}))},i.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},i.parseAVCPES=function(e,t){var i,r=this,n=this._avcTrack,o=this.parseAVCNALu(e.data),l=this.avcSample,c=!1;e.data=null,l&&o.length&&!n.audFound&&(m(l,n),l=this.avcSample=p(!1,e.pts,e.dts,"")),o.forEach((function(t){switch(t.type){case 1:i=!0,(l=l||(r.avcSample=p(!0,e.pts,e.dts,""))).frame=!0;var o=t.data;c&&4<o.length&&(2!==(o=new a.default(o).readSliceType())&&4!==o&&7!==o&&9!==o||(l.key=!0));break;case 5:i=!0,(l=l||(r.avcSample=p(!0,e.pts,e.dts,""))).key=!0,l.frame=!0;break;case 6:i=!0;var u=new a.default(y(t.data));u.readUByte();for(var d=0,h=0,f=!1,g=0;!f&&1<u.bytesAvailable;){for(d=0;d+=g=u.readUByte(),255===g;);for(h=0;h+=g=u.readUByte(),255===g;);if(4===d&&0!==u.bytesAvailable){if(f=!0,181===u.readUByte()&&49===u.readUShort()&&1195456820===u.readUInt()&&3===u.readUByte()){for(var v=u.readUByte(),b=31&v,w=[v,u.readUByte()],k=0;k<b;k++)w.push(u.readUByte()),w.push(u.readUByte()),w.push(u.readUByte());A(r._txtTrack.samples,{type:3,pts:e.pts,bytes:w})}}else if(5===d&&0!==u.bytesAvailable){if(f=!0,16<h){for(var E=[],T=0;T<16;T++)E.push(u.readUByte().toString(16)),3!==T&&5!==T&&7!==T&&9!==T||E.push("-");for(var S=h-16,_=new Uint8Array(S),C=0;C<S;C++)_[C]=u.readUByte();A(r._txtTrack.samples,{pts:e.pts,payloadType:d,uuid:E.join(""),userData:Object(s.utf8ArrayToStr)(_),userDataBytes:_})}}else if(h<u.bytesAvailable)for(var R=0;R<h;R++)u.readUByte()}break;case 7:if(c=i=!0,!n.sps){o=new a.default(t.data).readSPS(),n.width=o.width,n.height=o.height,n.pixelRatio=o.pixelRatio,n.sps=[t.data],n.duration=r._duration;for(var D=t.data.subarray(1,4),x="avc1.",L=0;L<3;L++){var I=D[L].toString(16);x+=I=I.length<2?"0"+I:I}n.codec=x}break;case 8:i=!0,n.pps||(n.pps=[t.data]);break;case 9:i=!1,n.audFound=!0,l&&m(l,n),l=r.avcSample=p(!1,e.pts,e.dts,"");break;case 12:i=!1;break;default:i=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&i&&l.units.push(t)})),t&&l&&(m(l,n),this.avcSample=null)},i.getLastNalUnit=function(){var e,t,i=this.avcSample;return null!=(e=i=i&&0!==i.units.length?i:(e=this._avcTrack.samples)[e.length-1])&&e.units?(e=i.units)[e.length-1]:t},i.parseAVCNALu=function(e){var t,i,r,n,a,s,o=e.byteLength,l=this._avcTrack,c=l.naluState||0,u=c,d=[],h=0,f=-1,p=0;for(-1===c&&(p=31&e[f=0],c=0,h=1);h<o;)t=e[h++],c=c?1!==c?t?1===t?(0<=f?(r={data:e.subarray(f,h-c-1),type:p},d.push(r)):(r=this.getLastNalUnit())&&(u&&h<=4-u&&r.state&&(r.data=r.data.subarray(0,r.data.byteLength-u)),0<(i=h-c-1))&&((n=new Uint8Array(r.data.byteLength+i)).set(r.data,0),n.set(e.subarray(0,i),r.data.byteLength),r.data=n,r.state=0),h<o?(p=31&e[f=h],0):-1):0:3:t?0:2:t?0:1;return 0<=f&&0<=c&&(a={data:e.subarray(f,o),type:p,state:c},d.push(a)),0===d.length&&(a=this.getLastNalUnit())&&((s=new Uint8Array(a.data.byteLength+e.byteLength)).set(a.data,0),s.set(e,a.data.byteLength),a.data=s),l.naluState=c,d},i.parseAACPES=function(e){var t,i,n,a,s=0,o=this._audioTrack,c=this.aacOverFlow,h=e.data;for(c&&(this.aacOverFlow=null,f=(a=c.sample.unit.byteLength)-(a=Math.min(c.missing,a)),c.sample.unit.set(h.subarray(0,a),f),o.samples.push(c.sample),s=c.missing),t=s,i=h.length;t<i-1&&!r.isHeader(h,t);t++);if(t===s||(a=t<i-1?(n="AAC PES did not start with ADTS header,offset:"+t,!1):(n="no ADTS header found in AAC PES",!0),u.logger.warn("parsing error:"+n),this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:a,reason:n}),!a)){if(r.initTrackConfig(o,this.observer,h,t,this.audioCodec),void 0!==e.pts)p=e.pts;else{if(!c)return void u.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var f=r.getFrameDuration(o.samplerate),p=c.sample.pts+f}for(var g=0;t<i;){if(r.isHeader(h,t)){if(t+5<i){var m=r.appendFrame(o,h,t,p,g);if(m){if(!m.missing){t+=m.length,g++;continue}this.aacOverFlow=m}}break}t++}}},i.parseMPEGPES=function(e){var t=e.data,i=t.length,r=0,a=0,s=e.pts;if(void 0!==s)for(;a<i;)if(n.isHeader(t,a)){var o=n.appendFrame(this._audioTrack,t,a,s,r);if(!o)break;a+=o.length,r++}else a++;else u.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},i.parseID3PES=function(e){void 0!==e.pts?this._id3Track.samples.push(e):u.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},i=f;function f(e,t,i){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.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=i}function p(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}function g(e){var t,i,r,n,a=0,s=e.data;if(!e||0===e.size)return null;for(;s[0].length<19&&1<s.length;){var o=new Uint8Array(s[0].length+s[1].length);o.set(s[0]),o.set(s[1],s[0].length),s[0]=o,s.splice(1,1)}if(1!==((t=s[0])[0]<<16)+(t[1]<<8)+t[2])return null;if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;var l=t[7],c=(192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?54e5<r-(n=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)&&(u.logger.warn(Math.round((r-n)/9e4)+"s delta between PTS and DTS, align them"),r=n):n=r),(l=t[8])+9);if(e.size<=c)return null;e.size-=c;for(var d=new Uint8Array(e.size),h=0,f=s.length;h<f;h++){var p=(t=s[h]).byteLength;if(c){if(p<c){c-=p;continue}t=t.subarray(c),p-=c,c=0}d.set(t,a),a+=p}return i&&(i-=l+3),{data:d,pts:r,dts:n,len:i}}function m(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var i=t.samples,r=i.length;if(!r)return t.dropped++;i=i[r-1],e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&u.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function A(e,t){var i=e.length;if(0<i){if(t.pts>=e[i-1].pts)e.push(t);else for(var r=i-1;0<=r;r--)if(t.pts<e[r].pts){e.splice(r,0,t);break}}else e.push(t)}function y(e){for(var t=e.byteLength,i=[],r=1;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return e;var n=t-i.length,a=new Uint8Array(n),s=0;for(r=0;r<n;s++,r++)s===i[0]&&(s++,i.shift()),a[r]=e[s];return a}i.minProbeByteLength=188,t.default=i},"./src/errors.ts":function(e,t,i){var r,n;i.r(t),i.d(t,"ErrorTypes",(function(){return r})),i.d(t,"ErrorDetails",(function(){return n})),(i=r=r||{}).NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",(t=n=n||{}).KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown"},"./src/events.ts":function(e,t,i){var r;i.r(t),i.d(t,"Events",(function(){return r})),(i=r=r||{}).MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached"},"./src/hls.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return y}));var r=i("./node_modules/url-toolkit/src/url-toolkit.js"),n=i("./src/loader/playlist-loader.ts"),a=i("./src/loader/key-loader.ts"),s=i("./src/controller/id3-track-controller.ts"),o=i("./src/controller/latency-controller.ts"),l=i("./src/controller/level-controller.ts"),c=i("./src/controller/fragment-tracker.ts"),u=i("./src/controller/stream-controller.ts"),d=i("./src/is-supported.ts"),h=i("./src/utils/logger.ts"),f=i("./src/config.ts"),p=i("./node_modules/eventemitter3/index.js"),g=i("./src/events.ts"),m=i("./src/errors.ts");function A(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}v.isSupported=function(){return Object(d.isSupported)()},(t=v.prototype).createController=function(e,t,i){return e?(t=t?new e(this,t):new e(this),i&&i.push(t),t):null},t.on=function(e,t,i){this._emitter.on(e,t,i=void 0===i?this:i)},t.once=function(e,t,i){this._emitter.once(e,t,i=void 0===i?this:i)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,i,r){this._emitter.off(e,t,i=void 0===i?this:i,r)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,i){return this._emitter.emit(e,t,i)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){h.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(g.Events.ERROR,{type:m.ErrorTypes.OTHER_ERROR,details:m.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){h.logger.log("destroy"),this.trigger(g.Events.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},t.attachMedia=function(e){h.logger.log("attachMedia"),this._media=e,this.trigger(g.Events.MEDIA_ATTACHING,{media:e})},t.detachMedia=function(){h.logger.log("detachMedia"),this.trigger(g.Events.MEDIA_DETACHING,void 0),this._media=null},t.loadSource=function(e){this.stopLoad();var t=this.media,i=this.url,n=this.url=r.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});h.logger.log("loadSource:"+n),t&&i&&i!==n&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(g.Events.MANIFEST_LOADING,{url:e})},t.startLoad=function(e){void 0===e&&(e=-1),h.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},t.stopLoad=function(){h.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},t.swapAudioCodec=function(){h.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){h.logger.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},t.removeLevel=function(e,t){this.levelController.removeLevel(e,t=void 0===t?0:t)},t=[{key:"version",get:function(){return"1.1.5"}},{key:"Events",get:function(){return g.Events}},{key:"ErrorTypes",get:function(){return m.ErrorTypes}},{key:"ErrorDetails",get:function(){return m.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig||f.hlsDefaultConfig},set:function(e){v.defaultConfig=e}}],A((i=v).prototype,[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){h.logger.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){h.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){h.logger.log("set loadLevel:"+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){h.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){h.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){e=!!e,e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(h.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{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)for(var i=e.length,r=0;r<i;r++)if(e[r].maxBitrate>t)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}]),A(i,t);var y=v;function v(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,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;var t=this.config=Object(f.mergeConfig)(v.DefaultConfig,e),i=(e=(this.userConfig=e,Object(h.enableLogs)(t.debug),this._autoLevelCapping=-1,t.progressive&&Object(f.enableStreamingMode)(t),t.abrController),t.bufferController),r=t.capLevelController,d=t.fpsController,g=(e=this.abrController=new e(this),i=this.bufferController=new i(this),r=this.capLevelController=new r(this),d=new d(this),new n.default(this)),m=new a.default(this),A=new s.default(this),y=this.levelController=new l.default(this),b=new c.FragmentTracker(this),w=this.streamController=new u.default(this,b);r.setStreamController(w),d.setStreamController(w),y=[y,w],this.networkControllers=y,w=[g,m,e,i,r,d,A,b];this.audioTrackController=this.createController(t.audioTrackController,null,y),this.createController(t.audioStreamController,b,y),this.subtitleTrackController=this.createController(t.subtitleTrackController,null,y),this.createController(t.subtitleStreamController,b,y),this.createController(t.timelineController,null,w),this.emeController=this.createController(t.emeController,null,w),this.cmcdController=this.createController(t.cmcdController,null,w),this.latencyController=this.createController(o.default,null,w),this.coreComponents=w}y.defaultConfig=void 0},"./src/is-supported.ts":function(e,t,i){i.r(t),i.d(t,"isSupported",(function(){return a})),i.d(t,"changeTypeSupported",(function(){return s}));var r=i("./src/utils/mediasource-helper.ts");function n(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e,t=Object(r.getMediaSource)();return!!t&&(e=n(),t=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),e=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove,!!t)&&!!e}function s(){var e=n();return"function"==typeof(null==e||null==(e=e.prototype)?void 0:e.changeType)}},"./src/loader/fragment-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return u})),i.d(t,"LoadError",(function(){return p}));var r=i("./src/polyfills/number.ts"),n=i("./src/errors.ts");function a(e){var t="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return s(e,arguments,l(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,e)})(e)}function s(e,t,i){return(s=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),1}catch(e){}}}()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t),t=new(Function.bind.apply(e,r));return i&&o(t,i.prototype),t}).apply(null,arguments)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=Math.pow(2,17),u=((t=d.prototype).destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t){var i=this,r=e.url;if(!r)return Promise.reject(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var u=i.loader=e.loader=new(s||o)(a),d=h(e),f={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=u.stats,u.load(d,f,{onSuccess:function(t,n,a,s){i.resetLoader(e,u),r({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,r,a){i.resetLoader(e,u),l(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:a}))},onAbort:function(t,r,a){i.resetLoader(e,u),l(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:a}))},onTimeout:function(t,r,a){i.resetLoader(e,u),l(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:a}))},onProgress:function(i,r,n,a){t&&t({frag:e,part:null,payload:n,networkDetails:a})}})}))},t.loadPart=function(e,t,i){var r=this,a=(this.abort(),this.config),s=a.fLoader,o=a.loader;return new Promise((function(l,u){r.loader&&r.loader.destroy();var d=r.loader=e.loader=new(s||o)(a),f=h(e,t),g={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=d.stats,d.load(f,g,{onSuccess:function(n,a,s,o){r.resetLoader(e,d),r.updateStatsFromPart(e,t),n={frag:e,part:t,payload:n.data,networkDetails:o},i(n),l(n)},onError:function(i,a,s){r.resetLoader(e,d),u(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:i,networkDetails:s}))},onAbort:function(i,a,s){e.stats.aborted=t.stats.aborted,r.resetLoader(e,d),u(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(i,a,s){r.resetLoader(e,d),u(new p({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,n=r.total;i.loaded+=r.loaded,n?(n=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/n),e)))*Math.round(i.loaded/t),i.total=i.loaded+n):i.total=Math.max(i.loaded,i.total),e=i.loading,t=r.loading;e.start?e.first+=t.first-t.start:(e.start=t.start,e.first=t.first),e.end=t.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},d);function d(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}function h(e,t){var i=(t=void 0===t?null:t)||e;e={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},t=i.byteRangeStartOffset,i=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&(e.rangeStart=t,e.rangeEnd=i),e}f=a(Error),i=f,(t=g).prototype=Object.create(i.prototype),o(t.prototype.constructor=t,i);var f,p=g;function g(e){for(var t,i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return(t=f.call.apply(f,[this].concat(r))||this).data=void 0,t.data=e,t}},"./src/loader/fragment.ts":function(e,t,i){i.r(t),i.d(t,"ElementaryStreamTypes",(function(){return r})),i.d(t,"BaseSegment",(function(){return g})),i.d(t,"Fragment",(function(){return m})),i.d(t,"Part",(function(){return A}));var r,n=i("./src/polyfills/number.ts"),a=i("./node_modules/url-toolkit/src/url-toolkit.js"),s=i("./src/utils/logger.ts"),o=i("./src/loader/level-key.ts"),l=i("./src/loader/load-stats.ts");function c(e,t){e.prototype=Object.create(t.prototype),u(e.prototype.constructor=e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t,i){t&&d(e.prototype,t),i&&d(e,i)}(t=r=r||{}).AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo",b.prototype.setByteRange=function(e,t){e=e.split("@",2);var i=[];1===e.length?i[0]=t?t.byteRangeEndOffset:0:i[0]=parseInt(e[1]),i[1]=parseInt(e[0])+i[0],this._byteRange=i},h(b,[{key:"byteRange",get:function(){return this._byteRange||[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(a.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]);var f,p,g=b,m=(c(v,p=g),(i=v.prototype).createInitializationVector=function(e){for(var t=new Uint8Array(16),i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t},i.setDecryptDataFromLevelKey=function(e,t){var i=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((i=o.LevelKey.fromURI(e.uri)).method=e.method,i.iv=this.createInitializationVector(t),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(e,t,i,r,n,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,n)):s[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null},h(v,[{key:"decryptdata",get:function(){var e;return this.levelkey||this._decryptdata?(!this._decryptdata&&this.levelkey&&("number"!=typeof(e=this.sn)&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&s.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)),this._decryptdata):null}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){var e;return null!==this.programDateTime&&Object(n.isFiniteNumber)(this.programDateTime)?(e=Object(n.isFiniteNumber)(this.duration)?this.duration:0,this.programDateTime+1e3*e):null}},{key:"encrypted",get:function(){var e;return!(null==(e=this.decryptdata)||!e.keyFormat||!this.decryptdata.uri)}}]),v),A=(c(y,f=g),h(y,[{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)}}]),y);function y(e,t,i,r,n){return(i=f.call(this,i)||this).fragOffset=0,i.duration=0,i.gap=!1,i.independent=!1,i.relurl=void 0,i.fragment=void 0,i.index=void 0,i.stats=new l.LoadStats,i.duration=e.decimalFloatingPoint("DURATION"),i.gap=e.bool("GAP"),i.independent=e.bool("INDEPENDENT"),i.relurl=e.enumeratedString("URI"),i.fragment=t,i.index=r,t=e.enumeratedString("BYTERANGE"),t&&i.setByteRange(t,n),n&&(i.fragOffset=n.fragOffset+n.duration),i}function v(e,t){return(t=p.call(this,t)||this)._decryptdata=null,t.rawProgramDateTime=null,t.programDateTime=null,t.tagList=[],t.duration=0,t.sn=0,t.levelkey=void 0,t.type=void 0,t.loader=null,t.level=-1,t.cc=0,t.startPTS=void 0,t.endPTS=void 0,t.appendedPTS=void 0,t.startDTS=void 0,t.endDTS=void 0,t.start=0,t.deltaPTS=void 0,t.maxStartPTS=void 0,t.minEndPTS=void 0,t.stats=new l.LoadStats,t.urlId=0,t.data=void 0,t.bitrateTest=!1,t.title=null,t.initSegment=null,t.type=e,t}function b(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null,t),this.baseurl=e}},"./src/loader/key-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return s}));var r=i("./src/events.ts"),n=i("./src/errors.ts"),a=i("./src/utils/logger.ts"),s=((t=o.prototype)._registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders)e=this.loaders[e],e&&e.destroy();this.loaders={}},t.onKeyLoading=function(e,t){t=t.frag;var i,n,s=t.type,o=this.loaders[s];t.decryptdata?(i=t.decryptdata.uri)!==this.decrypturl||null===this.decryptkey?(n=this.hls.config,o&&(a.logger.warn("abort previous key loader for type:"+s),o.abort()),i?(o=n.loader,s=t.loader=this.loaders[s]=new o(n),this.decrypturl=i,this.decryptkey=null,o={url:i,frag:t,responseType:"arraybuffer"},i={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:n.fragLoadingRetryDelay,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:0},n={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},s.load(o,i,n)):a.logger.warn("key uri is falsy")):this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:t})):a.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,i){i=i.frag,i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:i})):a.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){t=t.frag;var i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:t,response:e})},t.loadtimeout=function(e,t){t=t.frag;var i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:t})},o);function o(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}},"./src/loader/level-details.ts":function(e,t,i){i.r(t),i.d(t,"LevelDetails",(function(){return a}));var r=i("./src/polyfills/number.ts");function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}s.prototype.reloaded=function(e){var t,i;e?(t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex,this.updated=this.endSN!==e.endSN||!!i||!!t,this.advanced=this.endSN>e.endSN||0<t||0==t&&0<i,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay):(this.advanced=!0,this.updated=!0)},n(s.prototype,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(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 0<e?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}}]);var a=s;function s(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.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,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.fragments=[],this.url=e}},"./src/loader/level-key.ts":function(e,t,i){i.r(t),i.d(t,"LevelKey",(function(){return a}));var r=i("./node_modules/url-toolkit/src/url-toolkit.js");function n(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}s.fromURL=function(e,t){return new s(e,t)},s.fromURI=function(e){return new s(e)},n(s.prototype,[{key:"uri",get:function(){return this._uri}}]);var a=s;function s(e,t){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=t?Object(r.buildAbsoluteURL)(e,t,{alwaysNormalize:!0}):e}},"./src/loader/load-stats.ts":function(e,t,i){i.r(t),i.d(t,"LoadStats",(function(){return r}));var r=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return m}));var r=i("./src/polyfills/number.ts"),n=i("./node_modules/url-toolkit/src/url-toolkit.js"),a=i("./src/loader/fragment.ts"),s=i("./src/loader/level-details.ts"),o=i("./src/loader/level-key.ts"),l=i("./src/utils/attr-list.ts"),c=i("./src/utils/logger.ts"),u=i("./src/utils/codecs.ts"),d=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,h=/#EXT-X-MEDIA:(.*)/g,f=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),g=/\.(mp4|m4s|m4v|m4a)$/i,m=(A.findGroup=function(e,t){for(var i=0;i<e.length;i++){var r=e[i];if(r.id===t)return r}},A.convertAVC1ToAVCOTI=function(e){var t,i=e.split(".");return 2<i.length?(t=i.shift()+".",(t+=parseInt(i.shift()).toString(16))+("000"+parseInt(i.shift()).toString(16)).substr(-4)):e},A.resolve=function(e,t){return n.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(e,t){var i,r,n,a,s=[],o={},c=!1;for(d.lastIndex=0;null!=(i=d.exec(e));)i[1]?(n={attrs:r=new l.AttrList(i[1]),bitrate:r.decimalInteger("AVERAGE-BANDWIDTH")||r.decimalInteger("BANDWIDTH"),name:r.NAME,url:A.resolve(i[2],t)},(a=r.decimalResolution("RESOLUTION"))&&(n.width=a.width,n.height=a.height),function(e,t){["video","audio","text"].forEach((function(i){var r,n=e.filter((function(e){return Object(u.isCodecType)(e,i)}));n.length&&(r=n.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)})),t[i+"Codec"]=(0<r.length?r:n)[0],e=e.filter((function(e){return-1===n.indexOf(e)})))})),t.unknownCodecs=e}((r.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),n),n.videoCodec&&-1!==n.videoCodec.indexOf("avc1")&&(n.videoCodec=A.convertAVC1ToAVCOTI(n.videoCodec)),s.push(n)):i[3]&&(a=new l.AttrList(i[3]))["DATA-ID"]&&(c=!0,o[a["DATA-ID"]]=a);return{levels:s,sessionData:c?o:null}},A.parseMasterPlaylistMedia=function(e,t,i,r){void 0===r&&(r=[]);var n=[],a=0;for(h.lastIndex=0;null!==(o=h.exec(e));){var s,o=new l.AttrList(o[1]);o.TYPE===i&&(o={attrs:o,bitrate:0,id:a++,groupId:o["GROUP-ID"],instreamId:o["INSTREAM-ID"],name:o.NAME||o.LANGUAGE||"",type:i,default:o.bool("DEFAULT"),autoselect:o.bool("AUTOSELECT"),forced:o.bool("FORCED"),lang:o.LANGUAGE,url:o.URI?A.resolve(o.URI,t):""},r.length&&(y(o,s=A.findGroup(r,o.groupId)||r[0],"audioCodec"),y(o,s,"textCodec")),n.push(o))}return n},A.parseLevelPlaylist=function(e,t,i,u,d){var h,m,A,y=new s.LevelDetails(t),b=y.fragments,w=null,k=0,E=0,T=0,S=0,_=null,C=new a.Fragment(u,t),R=-1,D=!1;for(f.lastIndex=0,y.m3u8=e;null!==(h=f.exec(e));){D&&(D=!1,(C=new a.Fragment(u,t)).start=T,C.sn=k,C.cc=S,C.level=i,w)&&(C.initSegment=w,C.rawProgramDateTime=w.rawProgramDateTime);var x=h[1];if(x){C.duration=parseFloat(x);var L=(" "+h[2]).slice(1);C.title=L||null,C.tagList.push(L?["INF",x,L]:["INF",x])}else if(h[3])Object(r.isFiniteNumber)(C.duration)&&(C.start=T,A&&(C.levelkey=A),C.sn=k,C.level=i,C.cc=S,C.urlId=d,b.push(C),C.relurl=(" "+h[3]).slice(1),v(C,_),T+=(_=C).duration,k++,D=!(E=0));else if(h[4])L=(" "+h[4]).slice(1),_?C.setByteRange(L,_):C.setByteRange(L);else if(h[5])C.rawProgramDateTime=(" "+h[5]).slice(1),C.tagList.push(["PROGRAM-DATE-TIME",C.rawProgramDateTime]),-1===R&&(R=b.length);else if(h=h[0].match(p)){for(m=1;m<h.length&&void 0===h[m];m++);var I=(" "+h[m]).slice(1),B=(" "+h[m+1]).slice(1),P=h[m+2]?(" "+h[m+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":y.type=B.toUpperCase();break;case"MEDIA-SEQUENCE":k=y.startSN=parseInt(B);break;case"SKIP":var M=new l.AttrList(B),O=M.decimalInteger("SKIPPED-SEGMENTS");if(Object(r.isFiniteNumber)(O)){for(var F=y.skippedSegments=O;F--;)b.unshift(null);k+=O}O=M.enumeratedString("RECENTLY-REMOVED-DATERANGES"),O&&(y.recentlyRemovedDateranges=O.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(B);break;case"VERSION":y.version=parseInt(B);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(B||P)&&C.tagList.push(P?[B,P]:[B]);break;case"DIS":S++;case"GAP":C.tagList.push([I]);break;case"BITRATE":C.tagList.push([I,B]);break;case"DISCONTINUITY-SEQ":S=parseInt(B);break;case"KEY":M=new l.AttrList(B),O=M.enumeratedString("METHOD");var j=M.URI,U=M.hexadecimalInteger("IV"),N=M.enumeratedString("KEYFORMATVERSIONS"),G=M.enumeratedString("KEYID"),z=null!=(z=M.enumeratedString("KEYFORMAT"))?z:"identity";-1<["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(z)?c.logger.warn("Keyformat "+z+" is not supported from the manifest"):"identity"===z&&O&&(A=o.LevelKey.fromURL(t,j),j)&&0<=["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(O)&&(A.method=O,A.keyFormat=z,G&&(A.keyID=G),N&&(A.keyFormatVersions=N),A.iv=U);break;case"START":j=new l.AttrList(B).decimalFloatingPoint("TIME-OFFSET"),Object(r.isFiniteNumber)(j)&&(y.startTimeOffset=j);break;case"MAP":z=new l.AttrList(B),C.relurl=z.URI,z.BYTERANGE&&C.setByteRange(z.BYTERANGE),C.level=i,C.sn="initSegment",A&&(C.levelkey=A),C.initSegment=null,w=C,D=!0;break;case"SERVER-CONTROL":G=new l.AttrList(B),y.canBlockReload=G.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=G.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=0<y.canSkipUntil&&G.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=G.optionalFloat("PART-HOLD-BACK",0),y.holdBack=G.optionalFloat("HOLD-BACK",0);break;case"PART-INF":N=new l.AttrList(B),y.partTarget=N.decimalFloatingPoint("PART-TARGET");break;case"PART":U=(U=y.partList)||(y.partList=[]);var H=0<E?U[U.length-1]:void 0,W=E++;W=new a.Part(new l.AttrList(B),C,t,W,H);U.push(W),C.duration+=W.duration;break;case"PRELOAD-HINT":H=new l.AttrList(B),y.preloadHint=H;break;case"RENDITION-REPORT":W=new l.AttrList(B),y.renditionReports=y.renditionReports||[],y.renditionReports.push(W);break;default:c.logger.warn("line parsed but not handled: "+h)}}else c.logger.warn("No matches on slow regex match for level playlist!")}_&&!_.relurl?(b.pop(),T-=_.duration,y.partList&&(y.fragmentHint=_)):y.partList&&(v(C,_),C.cc=S,y.fragmentHint=C);var V=b.length,K=b[0],q=b[V-1];return 0<(T+=y.skippedSegments*y.targetduration)&&V&&q?(y.averagetargetduration=T/V,V=q.sn,y.endSN="initSegment"!==V?V:0,K&&(y.startCC=K.cc,K.initSegment||y.fragments.every((function(e){return e.relurl&&(e=e.relurl,g.test(null!=(e=null==(e=n.parseURL(e))?void 0:e.path)?e:""))}))&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(C=new a.Fragment(u,t)).relurl=q.relurl,C.level=i,C.sn="initSegment",K.initSegment=C,y.needSidxRanges=!0))):(y.endSN=0,y.startCC=0),y.fragmentHint&&(T+=y.fragmentHint.duration),y.totalduration=T,y.endCC=S,0<R&&function(e,t){for(var i=e[t],r=t;r--;){var n=e[r];if(!n)return;n.programDateTime=i.programDateTime-1e3*n.duration,i=n}}(b,R),y},A);function A(){}function y(e,t,i){t=t[i],t&&(e[i]=t)}function v(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(r.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(e,t,i){i.r(t);var r=i("./src/polyfills/number.ts"),n=i("./src/events.ts"),a=i("./src/errors.ts"),s=i("./src/utils/logger.ts"),o=i("./src/utils/mp4-tools.ts"),l=i("./src/loader/m3u8-parser.ts"),c=i("./src/types/loader.ts"),u=i("./src/utils/attr-list.ts");function d(e,t){return e=e.url,void 0!==e&&0!==e.indexOf("data:")?e:t.url}function h(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}(i=h.prototype).registerListeners=function(){var e=this.hls;e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},i.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},i.createInternalLoader=function(e){var t=this.hls.config,i=t.pLoader,r=t.loader;i=new(i||r)(t);return e.loader=i,this.loaders[e.type]=i},i.getInternalLoader=function(e){return this.loaders[e.type]},i.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},i.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},i.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},i.onManifestLoading=function(e,t){t=t.url,this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:t,deliveryDirectives:null})},i.onLevelLoading=function(e,t){var i=t.id,r=t.level,n=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:null,level:r,responseType:"text",type:c.PlaylistContextType.LEVEL,url:n,deliveryDirectives:t})},i.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,n=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:n,deliveryDirectives:t})},i.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,n=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:n,deliveryDirectives:t})},i.load=function(e){var t,i,r,n,a=this.hls.config;if(l=this.getInternalLoader(e)){var o=l.context;if(o&&o.url===e.url)return void s.logger.trace("[playlist-loader]: playlist request ongoing");s.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),l.abort()}switch(e.type){case c.PlaylistContextType.MANIFEST:t=a.manifestLoadingMaxRetry,i=a.manifestLoadingTimeOut,r=a.manifestLoadingRetryDelay,n=a.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:t=0,i=a.levelLoadingTimeOut;break;default:t=a.levelLoadingMaxRetry,i=a.levelLoadingTimeOut,r=a.levelLoadingRetryDelay,n=a.levelLoadingMaxRetryTimeout}var l=this.createInternalLoader(e),u=(o=(null!=(o=e.deliveryDirectives)&&o.part&&(e.type===c.PlaylistContextType.LEVEL&&null!==e.level?u=this.hls.levels[e.level].details:e.type===c.PlaylistContextType.AUDIO_TRACK&&null!==e.id?u=this.hls.audioTracks[e.id].details:e.type===c.PlaylistContextType.SUBTITLE_TRACK&&null!==e.id&&(u=this.hls.subtitleTracks[e.id].details),u)&&(o=u.partTarget,u=u.targetduration,o&&u&&(i=Math.min(1e3*Math.max(3*o,.8*u),i))),{timeout:i,maxRetry:t,retryDelay:r,maxRetryDelay:n,highWaterMark:0}),{onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)});l.load(e,o,u)},i.loadsuccess=function(e,t,i,r){var n;void 0===r&&(r=null),i.isSidxRequest?(this.handleSidxRequest(e,i),this.handlePlaylistLoaded(e,t,i,r)):(this.resetInternalLoader(i.type),0===(n=e.data).indexOf("#EXTM3U")?(t.parsing.start=performance.now(),0<n.indexOf("#EXTINF:")||0<n.indexOf("#EXT-X-TARGETDURATION:")?this.handleTrackOrLevelPlaylist(e,t,i,r):this.handleMasterPlaylist(e,t,i,r)):this.handleManifestParsingError(e,i,"no EXTM3U delimiter",r))},i.loaderror=function(e,t,i){this.handleNetworkError(t,i=void 0===i?null:i,!1,e)},i.loadtimeout=function(e,t,i){this.handleNetworkError(t,i=void 0===i?null:i,!0)},i.handleMasterPlaylist=function(e,t,i,r){var a,o,c=this.hls,h=e.data,f=d(e,i),p=l.default.parseMasterPlaylist(h,f),g=p.levels;p=p.sessionData;g.length?(a=g.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),o=g.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),a=l.default.parseMasterPlaylistMedia(h,f,"AUDIO",a),o=l.default.parseMasterPlaylistMedia(h,f,"SUBTITLES",o),h=l.default.parseMasterPlaylistMedia(h,f,"CLOSED-CAPTIONS"),a.length&&!a.some((function(e){return!e.url}))&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(s.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),a.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new u.AttrList({}),bitrate:0,url:""})),c.trigger(n.Events.MANIFEST_LOADED,{levels:g,audioTracks:a,subtitles:o,captions:h,url:f,stats:t,networkDetails:r,sessionData:p})):this.handleManifestParsingError(e,i,"no level found in manifest",r)},i.handleTrackOrLevelPlaylist=function(e,t,i,s){var o=this.hls,h=i.id,f=i.level,p=i.type,g=d(e,i),m=Object(r.isFiniteNumber)(h)?h:0,A=Object(r.isFiniteNumber)(f)?f:m,y=function(){switch(i.type){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}();A=l.default.parseLevelPlaylist(e.data,g,A,y,m);A.fragments.length?(p===c.PlaylistContextType.MANIFEST&&(y={attrs:new u.AttrList({}),bitrate:0,details:A,name:"",url:g},o.trigger(n.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:g,stats:t,networkDetails:s,sessionData:null})),t.parsing.end=performance.now(),A.needSidxRanges?(y=null==(m=A.fragments[0].initSegment)?void 0:m.url,this.load({url:y,isSidxRequest:!0,type:p,level:f,levelDetails:A,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})):(i.levelDetails=A,this.handlePlaylistLoaded(e,t,i,s))):o.trigger(n.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:"number"==typeof i.level?i.level:void 0})},i.handleSidxRequest=function(e,t){var i,r=Object(o.parseSegmentIndex)(new Uint8Array(e.data));r&&(e=r.references,i=t.levelDetails,e.forEach((function(e,t){e=e.info,t=i.fragments[t],0===t.byteRange.length&&t.setByteRange(String(1+e.end-e.start)+"@"+String(e.start)),t.initSegment&&t.initSegment.setByteRange(String(r.moovEndOffset)+"@0")})))},i.handleManifestParsingError=function(e,t,i,r){this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===c.PlaylistContextType.MANIFEST,url:e.url,reason:i,response:e,context:t,networkDetails:r})},i.handleNetworkError=function(e,t,i,r){s.logger.warn("[playlist-loader]: A network "+((i=void 0!==i&&i)?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var o=a.ErrorDetails.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case c.PlaylistContextType.MANIFEST:o=i?a.ErrorDetails.MANIFEST_LOAD_TIMEOUT:a.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:o=i?a.ErrorDetails.LEVEL_LOAD_TIMEOUT:a.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:o=i?a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:o=i?a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:a.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type),u={type:a.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:u,context:e,networkDetails:t},r&&(u.response=r),this.hls.trigger(n.Events.ERROR,u)},i.handlePlaylistLoaded=function(e,t,i,r){var a=i.type,s=i.level,o=i.id,l=i.groupId,u=i.loader,d=i.levelDetails,h=i.deliveryDirectives;if(null!=d&&d.targetduration){if(u)switch(d.live&&(u.getCacheAge&&(d.ageHeader=u.getCacheAge()||0),u.getCacheAge&&!isNaN(d.ageHeader)||(d.ageHeader=0)),a){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(n.Events.LEVEL_LOADED,{details:d,level:s||0,id:o||0,stats:t,networkDetails:r,deliveryDirectives:h});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(n.Events.AUDIO_TRACK_LOADED,{details:d,id:o||0,groupId:l||"",stats:t,networkDetails:r,deliveryDirectives:h});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED,{details:d,id:o||0,groupId:l||"",stats:t,networkDetails:r,deliveryDirectives:h})}}else this.handleManifestParsingError(e,i,"invalid target duration",r)},t.default=h},"./src/polyfills/number.ts":function(e,t,i){i.r(t),i.d(t,"isFiniteNumber",(function(){return r})),i.d(t,"MAX_SAFE_INTEGER",(function(){return n}));var r=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},n=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(e,t,i){function r(){}i.r(t),r.getSilentFrame=function(e,t){return"mp4a.40.2"===e?1===t?new Uint8Array([0,200,0,128,35,128]):2===t?new Uint8Array([33,0,73,144,2,25,0,35,128]):3===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]):4===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]):5===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]):6===t?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]):void 0:1===t?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]):2===t||3===t?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]):void 0},t.default=r},"./src/remux/mp4-generator.ts":function(e,t,i){i.r(t);var r=Math.pow(2,32)-1;n.init=function(){for(var e in n.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]})n.types.hasOwnProperty(e)&&(n.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=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]),r=(t=(n.HDLR_TYPES={video:t,audio:i},new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])),i=new Uint8Array([0,0,0,0,0,0,0,0]),i=(n.STTS=n.STSC=n.STCO=i,n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]),new Uint8Array([105,115,111,109])),new Uint8Array([97,118,99,49])),a=new Uint8Array([0,0,0,1]);n.FTYP=n.box(n.types.ftyp,i,a,i,r),n.DINF=n.box(n.types.dinf,n.box(n.types.dref,t))},n.box=function(e){for(var t=8,i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];for(var a=r.length,s=a;a--;)t+=r[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a<s;a++)o.set(r[a],t),t+=r[a].byteLength;return o},n.hdlr=function(e){return n.box(n.types.hdlr,n.HDLR_TYPES[e])},n.mdat=function(e){return n.box(n.types.mdat,e)},n.mdhd=function(e,t){t*=e;var i=Math.floor(t/(1+r));t=Math.floor(t%(1+r));return n.box(n.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,85,196,0,0]))},n.mdia=function(e){return n.box(n.types.mdia,n.mdhd(e.timescale,e.duration),n.hdlr(e.type),n.minf(e))},n.mfhd=function(e){return n.box(n.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},n.minf=function(e){return"audio"===e.type?n.box(n.types.minf,n.box(n.types.smhd,n.SMHD),n.DINF,n.stbl(e)):n.box(n.types.minf,n.box(n.types.vmhd,n.VMHD),n.DINF,n.stbl(e))},n.moof=function(e,t,i){return n.box(n.types.moof,n.mfhd(e),n.traf(i,t))},n.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=n.trak(e[t]);return n.box.apply(null,[n.types.moov,n.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(n.mvex(e)))},n.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=n.trex(e[t]);return n.box.apply(null,[n.types.mvex].concat(i))},n.mvhd=function(e,t){t*=e;var i=Math.floor(t/(1+r));t=Math.floor(t%(1+r)),e=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return n.box(n.types.mvhd,e)},n.sdtp=function(e){for(var t,i=e.samples||[],r=new Uint8Array(4+i.length),a=0;a<i.length;a++)t=i[a].flags,r[a+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return n.box(n.types.sdtp,r)},n.stbl=function(e){return n.box(n.types.stbl,n.stsd(e),n.box(n.types.stts,n.STTS),n.box(n.types.stsc,n.STSC),n.box(n.types.stsz,n.STSZ),n.box(n.types.stco,n.STCO))},n.avc1=function(e){for(var t,i,r=[],a=[],s=0;s<e.sps.length;s++)i=(t=e.sps[s]).byteLength,r.push(i>>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(s=0;s<e.pps.length;s++)i=(t=e.pps[s]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(t));var o=n.box(n.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(a))),l=e.width,c=e.height,u=e.pixelRatio[0],d=e.pixelRatio[1];return n.box(n.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]),o,n.box(n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),n.box(n.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))},n.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},n.mp4a=function(e){var t=e.samplerate;return n.box(n.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),n.box(n.types.esds,n.esds(e)))},n.mp3=function(e){var t=e.samplerate;return n.box(n.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]))},n.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?n.box(n.types.stsd,n.STSD,n.mp4a(e)):n.box(n.types.stsd,n.STSD,n.mp3(e)):n.box(n.types.stsd,n.STSD,n.avc1(e))},n.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,a=e.width,s=(e=e.height,Math.floor(i/(1+r)));i=Math.floor(i%(1+r));return n.box(n.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,e>>8&255,255&e,0,0]))},n.traf=function(e,t){var i=n.sdtp(e),a=e.id,s=Math.floor(t/(1+r));t=Math.floor(t%(1+r));return n.box(n.types.traf,n.box(n.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),n.box(n.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t])),n.trun(e,i.length+16+20+8+16+8+8),i)},n.trak=function(e){return e.duration=e.duration||4294967295,n.box(n.types.trak,n.tkhd(e),n.mdia(e))},n.trex=function(e){return e=e.id,n.box(n.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},n.trun=function(e,t){var i,r,a,s,o,l=e.samples||[],c=l.length,u=(e=12+16*c,new Uint8Array(e));for(u.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,(t+=8+e)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i<c;i++)r=(o=l[i]).duration,a=o.size,s=o.flags,o=o.cts,u.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*i);return n.box(n.types.trun,u)},n.initSegment=function(e){n.types||n.init();e=n.moov(e);var t=new Uint8Array(n.FTYP.byteLength+e.byteLength);return t.set(n.FTYP),t.set(e,n.FTYP.byteLength),t},i=n;function n(){}i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,t.default=i},"./src/remux/mp4-remuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return g})),i.d(t,"normalizePts",(function(){return A}));var r=i("./src/polyfills/number.ts"),n=i("./src/remux/aac-helper.ts"),a=i("./src/remux/mp4-generator.ts"),s=i("./src/events.ts"),o=i("./src/errors.ts"),l=i("./src/utils/logger.ts"),c=i("./src/types/loader.ts"),u=i("./src/utils/timescale-conversion.ts");function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}var h=null,f=null,p=!1,g=((t=m.prototype).destroy=function(){},t.resetTimeStamp=function(e){l.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){l.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){l.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1;e=e.reduce((function(e,i){var r=i.pts-e;return r<-4294967296?(t=!0,A(e,i.pts)):0<r?e:i.pts}),e[0].pts);return t&&l.logger.debug("PTS rollover detected"),e},t.remux=function(e,t,i,r,n,a,s,o){var u,d,h,f,p,g,m,y=n,v=n,b=-1<e.pid,w=-1<t.pid,k=t.samples.length,E=0<e.samples.length,T=1<k;return(b&&!E||w&&!T)&&!this.ISGenerated&&!s||(this.ISGenerated||(h=this.generateIS(e,t,n)),b=this.isVideoContiguous,s=-1,T&&(s=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples),!b)&&this.config.forceKeyFrameOnDiscontinuity&&(g=!0,0<s?(l.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+k+" video samples due to a missing keyframe"),m=this.getVideoStartPts(t.samples),t.samples=t.samples.slice(s),t.dropped+=s,v+=(t.samples[0].pts-m)/(t.timescale||9e4)):-1===s&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+k+" video samples"),g=!1)),this.ISGenerated&&(E&&T&&(m=this.getVideoStartPts(t.samples),k=(A(e.samples[0].pts,m)-m)/t.inputTimeScale,y+=Math.max(0,k),v+=Math.max(0,-k)),E?(e.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n)),d=this.remuxAudio(e,y,this.isAudioContiguous,a,w||T||o===c.PlaylistLevelType.AUDIO?v:void 0),T&&(m=d?d.endPTS-d.startPTS:0,t.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n)),u=this.remuxVideo(t,v,b,m))):T&&(u=this.remuxVideo(t,v,b,0)),u)&&(u.firstKeyFrame=s,u.independent=-1!==s)),{audio:d,video:u,initSegment:h,independent:g,text:f=this.ISGenerated&&(i.samples.length&&(p=this.remuxID3(i,n)),r.samples.length)?this.remuxText(r,n):f,id3:p}},t.generateIS=function(e,t,i){var n,s,o,l=e.samples,c=t.samples,u=this.typeSupported,d={},h=!Object(r.isFiniteNumber)(this._initPTS),f="audio/mp4";if(h&&(o=s=1/0),e.config&&l.length&&(e.timescale=e.samplerate,e.isAAC||(u.mpeg?(f="audio/mpeg",e.codec=""):u.mp3&&(e.codec="mp3")),d.audio={id:"audio",container:f,codec:e.codec,initSegment:!e.isAAC&&u.mpeg?new Uint8Array(0):a.default.initSegment([e]),metadata:{channelCount:e.channelCount}},h)&&(n=e.inputTimeScale,o=s=l[0].pts-Math.round(n*i)),t.sps&&t.pps&&c.length&&(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},h)&&(n=t.inputTimeScale,f=this.getVideoStartPts(c),u=Math.round(n*i),s=Math.min(s,A(c[0].dts,f)-u),o=Math.min(o,f-u)),Object.keys(d).length)return this.ISGenerated=!0,h&&(this._initPTS=o,this._initDTS=s),{tracks:d,initPTS:o,timescale:n}},t.remuxVideo=function(e,t,i,r){var n,c=e.inputTimeScale,f=e.samples,g=[],m=f.length,v=this._initPTS,b=this.nextAvcDts,w=8,k=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,T=0,S=!1;i&&null!==b||(b=t*c-(f[0].pts-A(f[0].dts,f[0].pts)));for(var _=0;_<m;_++){var C=f[_];C.pts=A(C.pts-v,b),C.dts=A(C.dts-v,b),C.dts>C.pts&&(T=Math.max(Math.min(T,C.pts-C.dts),-18e3)),C.dts<f[0<_?_-1:_].dts&&(S=!0)}S&&f.sort((function(e,t){var i=e.dts-t.dts;e=e.pts-t.pts;return i||e})),R=f[0].dts;t=f[f.length-1].dts;var R,D=Math.round((t-R)/(m-1));if(T<0){if(T<-2*D){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-D,!0)+" ms");for(var x=T,L=0;L<m;L++)f[L].dts=x=Math.max(x,f[L].pts-D),f[L].pts=Math.max(x,f[L].pts)}else{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(u.toMsFromMpegTsClock)(T,!0)+" ms to overcome this issue");for(var I=0;I<m;I++)f[I].dts=f[I].dts+T}R=f[0].dts}i&&((z=D<(i=R-b))||i<-1)&&(z?l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(i,!0)+" ms ("+i+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(-i,!0)+" ms ("+i+"dts) overlapping between fragments detected"),R=b,z=f[0].pts-i,f[0].dts=R,f[0].pts=z,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(z,!0)+"/"+Object(u.toMsFromMpegTsClock)(R,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(i,!0)+" ms")),p&&(R=Math.max(0,R));for(var B=0,P=0,M=0;M<m;M++){for(var O=f[M],F=O.units,j=F.length,U=0,N=0;N<j;N++)U+=F[N].data.length;P+=U,B+=j,O.length=U,O.dts=Math.max(O.dts,R),O.pts=Math.max(O.pts,O.dts,0),k=Math.min(O.pts,k),E=Math.max(O.pts,E)}t=f[m-1].dts;var G,z=P+4*B+8;try{G=new Uint8Array(z)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:z,reason:"fail allocating video mdat "+z})}var H=new DataView(G.buffer);H.setUint32(0,z),G.set(a.default.types.mdat,4);for(var W=0;W<m;W++){for(var V,K=f[W],q=K.units,Q=0,Y=0,J=q.length;Y<J;Y++){var X=q[Y],$=X.data;X=X.data.byteLength;H.setUint32(w,X),w+=4,G.set($,w),w+=X,Q+=4+X}W<m-1?n=f[W+1].dts-K.dts:(Z=this.config,V=K.dts-f[0<W?W-1:W].dts,Z.stretchShortVideoTrack&&null!==this.nextAudioPts&&Math.floor(Z.maxBufferHole*c)<(Z=(r?k+r*c:this.nextAudioPts)-K.pts)?((n=Z-V)<0&&(n=V),l.logger.log("[mp4-remuxer]: It is approximately "+Z/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=V);var Z=Math.round(K.pts-K.dts);g.push(new y(K.key,n,Q,Z))}return g.length&&h&&h<70&&((i=g[0].flags).dependsOn=2,i.isNonSync=0),console.assert(void 0!==n,"mp4SampleDuration must be computed"),this.nextAvcDts=b=t+n,this.isVideoContiguous=!0,z={data1:a.default.moof(e.sequenceNumber++,R,d({},e,{samples:g})),data2:G,startPTS:k/c,endPTS:(E+n)/c,startDTS:R/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:g.length,dropped:e.dropped},e.samples=[],e.dropped=0,console.assert(G.length,"MDAT length must not be zero"),z},t.remuxAudio=function(e,t,i,r,c){var u=e.inputTimeScale,h=u/(e.samplerate||u),f=e.isAAC?1024:1152,p=f*h,g=this._initPTS,m=!e.isAAC&&this.typeSupported.mpeg,v=[],b=e.samples,w=m?0:8,k=this.nextAudioPts||-1,E=t*u;if(this.isAudioContiguous=i=i||b.length&&0<k&&(r&&Math.abs(E-k)<9e3||Math.abs(A(b[0].pts-g,E)-k)<20*p),b.forEach((function(e){e.pts=A(e.pts-g,E)})),!i||k<0){if(!(b=b.filter((function(e){return 0<=e.pts}))).length)return;k=0===c?0:r?Math.max(0,E):b[0].pts}if(e.isAAC)for(var T=void 0!==c,S=this.config.maxAudioFramesDrift,_=0,C=k;_<b.length;_++){var R=b[_],D=R.pts,x=D-C,L=Math.abs(1e3*x/u);if(x<=-S*p&&T)0===_&&(l.logger.warn("Audio frame @ "+(D/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*x/u)+" ms."),this.nextAudioPts=k=C=D);else if(S*p<=x&&L<1e4&&T){var I=Math.round(x/p);(C=D-I*p)<0&&(I--,C+=p),0===_&&(this.nextAudioPts=k=C),l.logger.warn("[mp4-remuxer]: Injecting "+I+" audio frame @ "+(C/u).toFixed(3)+"s due to "+Math.round(1e3*x/u)+" ms gap.");for(var B=0;B<I;B++){var P=Math.max(C,0),M=n.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);M||(l.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),M=R.unit.subarray()),b.splice(_,0,{unit:M,pts:P}),C+=p,_++}}R.pts=C,C+=p}for(var O,F=null,j=null,U=0,N=b.length;N--;)U+=b[N].unit.byteLength;for(var G=0,z=b.length;G<z;G++){var H=b[G],W=H.unit;H=H.pts;if(null!==j)v[G-1].duration=Math.round((H-j)/h);else{if(F=H=i&&e.isAAC?k:H,!(0<U))return;U+=w;try{O=new Uint8Array(U)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:U,reason:"fail allocating audio mdat "+U})}m||(new DataView(O.buffer).setUint32(0,U),O.set(a.default.types.mdat,4))}O.set(W,w),W=W.byteLength,w+=W,v.push(new y(!0,f,W,0)),j=H}if(t=v.length,t)return this.nextAudioPts=k=j+h*v[v.length-1].duration,r={data1:m?new Uint8Array(0):a.default.moof(e.sequenceNumber++,F/h,d({},e,{samples:v})),data2:O,startPTS:r=F/u,endPTS:c=k/u,startDTS:r,endDTS:c,type:"audio",hasAudio:!0,hasVideo:!(e.samples=[]),nb:t},this.isAudioContiguous=!0,console.assert(O.length,"MDAT length must not be zero"),r},t.remuxEmptyAudio=function(e,t,i,r){var a=e.inputTimeScale,s=a/(e.samplerate||a),o=this.nextAudioPts,c=(null!==o?o:r.startDTS*a)+this._initDTS,u=(o=r.endDTS*a+this._initDTS,1024*s),d=Math.ceil((o-c)/u),h=n.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),h){for(var f=[],p=0;p<d;p++){var g=c+p*u;f.push({unit:h,pts:g,dts:g})}return e.samples=f,this.remuxAudio(e,t,i,!1)}l.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t.remuxID3=function(e,t){var i=e.samples.length;if(i){for(var r=e.inputTimeScale,n=this._initPTS,a=this._initDTS,s=0;s<i;s++){var o=e.samples[s];o.pts=A(o.pts-n,t*r)/r,o.dts=A(o.dts-a,t*r)/r}var l=e.samples;return e.samples=[],{samples:l}}},t.remuxText=function(e,t){var i=e.samples.length;if(i){for(var r=e.inputTimeScale,n=this._initPTS,a=0;a<i;a++){var s=e.samples[a];s.pts=A(s.pts-n,t*r)/r}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}},m);function m(e,t,i,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===h&&(e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),h=e?parseInt(e[1]):0),null===f&&(t=navigator.userAgent.match(/Safari\/(\d+)/i),f=t?parseInt(t[1]):0),p=!!h&&h<75||!!f&&f<600}function A(e,t){var i;if(null!==t)for(i=t<e?-8589934592:8589934592;4294967296<Math.abs(e-t);)e+=i;return e}var y=function(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags=new v(e)},v=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}},"./src/remux/passthrough-remuxer.ts":function(e,t,i){i.r(t);var r=i("./src/polyfills/number.ts"),n=i("./src/utils/mp4-tools.ts"),a=i("./src/loader/fragment.ts"),s=i("./src/utils/logger.ts");(i=l.prototype).destroy=function(){},i.resetTimeStamp=function(e){this.initPTS=e,this.lastEndDTS=null},i.resetNextTimestamp=function(){this.lastEndDTS=null},i.resetInitSegment=function(e,t,i){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e),this.emitInitSegment=!0},i.generateInitSegment=function(e){var t,i,r=this.audioCodec,o=this.videoCodec;e&&e.byteLength?(t=this.initData=Object(n.parseInitSegment)(e),r=r||c(t.audio,a.ElementaryStreamTypes.AUDIO),o=o||c(t.video,a.ElementaryStreamTypes.VIDEO),i={},t.audio&&t.video?i.audiovideo={container:"video/mp4",codec:r+","+o,initSegment:e,id:"main"}:t.audio?i.audio={container:"audio/mp4",codec:r,initSegment:e,id:"audio"}:t.video?i.video={container:"video/mp4",codec:o,initSegment:e,id:"main"}:s.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i):(this.initTracks=void 0,this.initData=void 0)},i.remux=function(e,t,i,a,l){var c,u,d,h=this.initPTS,f=this.lastEndDTS,p={audio:void 0,video:void 0,text:a,id3:i,initSegment:void 0};Object(r.isFiniteNumber)(f)||(f=this.lastEndDTS=l||0),l=t.samples;return l&&l.length&&(t={initPTS:void 0,timescale:1},(d=this.initData)&&d.length||(this.generateInitSegment(l),d=this.initData),d&&d.length?(this.emitInitSegment&&(t.tracks=this.initTracks,this.emitInitSegment=!1),Object(r.isFiniteNumber)(h)||(this.initPTS=t.initPTS=h=o(d,l,f)),c=(u=Object(n.getDuration)(l,d))+(f=f),Object(n.offsetStartDTS)(d,l,h),0<u?this.lastEndDTS=c:(s.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp()),h="",(u=!!d.audio)&&(h+="audio"),(d=!!d.video)&&(h+="video"),p.audio="audio"===(l={data1:l,startPTS:f,startDTS:f,endPTS:c,endDTS:c,type:h,hasAudio:u,hasVideo:d,nb:1,dropped:0}).type?l:void 0,p.video="audio"!==l.type?l:void 0,p.text=a,p.id3=i,p.initSegment=t):s.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment.")),p};var o=function(e,t,i){return Object(n.getStartDTS)(e,t)-i};function l(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}function c(e,t){return e=null==e?void 0:e.codec,e&&4<e.length?e:"hvc1"===e?"hvc1.1.c.L120.90":"av01"===e?"av01.0.04M.08":"avc1"===e||t===a.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}t.default=l},"./src/task-loop.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return r})),(i=n.prototype).destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},i.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},i.onHandlerDestroyed=function(){},i.hasInterval=function(){return!!this._tickInterval},i.hasNextTick=function(){return!!this._tickTimer},i.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},i.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),!(this._tickInterval=null))},i.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),!(this._tickTimer=null))},i.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),1<this._tickCallCount&&this.tickImmediate(),this._tickCallCount=0)},i.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},i.doTick=function(){};var r=n;function n(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}},"./src/types/cmcd.ts":function(e,t,i){i.r(t),i.d(t,"CMCDVersion",(function(){return s})),i.d(t,"CMCDObjectType",(function(){return r})),i.d(t,"CMCDStreamingFormat",(function(){return n})),i.d(t,"CMCDStreamType",(function(){return a}));var r,n,a,s=1;(i=r=r||{}).MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o",(t=n=n||{}).DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o",(i=a=a||{}).VOD="v",i.LIVE="l"},"./src/types/level.ts":function(e,t,i){function r(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var n;function a(e,t){var i=e.canSkipUntil,r=e.canSkipDateRanges;e=e.endSN;return i&&(void 0!==t?t-e:0)<i?r?n.v2:n.Yes:n.No}i.r(t),i.d(t,"HlsSkip",(function(){return n})),i.d(t,"getSkipValue",(function(){return a})),i.d(t,"HlsUrlParameters",(function(){return s})),i.d(t,"Level",(function(){return o})),(i=n=n||{}).No="",i.Yes="YES",i.v2="v2",c.prototype.addDirectives=function(e){return e=new self.URL(e),void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.toString()};var s=c,o=(r(l.prototype,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(e){e%=this.url.length,this._urlId!==e&&(this.details=void 0,this._urlId=e)}}]),l);function l(e){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[e.url],this.attrs=e.attrs,this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter((function(e){return e})).join(",").replace(/\.[^.,]+/g,"")}function c(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}},"./src/types/loader.ts":function(e,t,i){var r,n;i.r(t),i.d(t,"PlaylistContextType",(function(){return r})),i.d(t,"PlaylistLevelType",(function(){return n})),(i=r=r||{}).MANIFEST="manifest",i.LEVEL="level",i.AUDIO_TRACK="audioTrack",i.SUBTITLE_TRACK="subtitleTrack",(t=n=n||{}).MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle"},"./src/types/transmuxer.ts":function(e,t,i){i.r(t),i.d(t,"ChunkMetadata",(function(){return r}));var r=function(e,t,i,r,n,a){void 0===r&&(r=0),void 0===n&&(n=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=a}},"./src/utils/attr-list.ts":function(e,t,i){i.r(t),i.d(t,"AttrList",(function(){return a}));var r=/^(\d+)x(\d+)$/,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=((i=s.prototype).decimalInteger=function(e){return e=parseInt(this[e],10),e>Number.MAX_SAFE_INTEGER?1/0:e},i.hexadecimalInteger=function(e){if(this[e]){for(var t=(1&(t=(this[e]||"0x").slice(2)).length?"0":"")+t,i=new Uint8Array(t.length/2),r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(2*r,2*r+2),16);return i}return null},i.hexadecimalIntegerAsNumber=function(e){return e=parseInt(this[e],16),e>Number.MAX_SAFE_INTEGER?1/0:e},i.decimalFloatingPoint=function(e){return parseFloat(this[e])},i.optionalFloat=function(e,t){return e=this[e],e?parseFloat(e):t},i.enumeratedString=function(e){return this[e]},i.bool=function(e){return"YES"===this[e]},i.decimalResolution=function(e){if(e=r.exec(this[e]),null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},s.parseAttrList=function(e){var t,i={};for(n.lastIndex=0;null!==(t=n.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1]]=r}return i},s);function s(e){for(var t in e="string"==typeof e?s.parseAttrList(e):e)e.hasOwnProperty(t)&&(this[t]=e[t])}},"./src/utils/binary-search.ts":function(e,t,i){i.r(t),t.default={search:function(e,t){for(var i,r,n=0,a=e.length-1;n<=a;){var s=t(r=e[i=(n+a)/2|0]);if(0<s)n=1+i;else{if(!(s<0))return r;a=i-1}}return null}}},"./src/utils/buffer-helper.ts":function(e,t,i){i.r(t),i.d(t,"BufferHelper",(function(){return a}));var r=i("./src/utils/logger.ts"),n={length:0,start:function(){return 0},end:function(){return 0}},a=(s.isBuffered=function(e,t){try{if(e)for(var i=s.getBuffered(e),r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}catch(e){}return!1},s.bufferInfo=function(e,t,i){try{if(e){for(var r=s.getBuffered(e),n=[],a=0;a<r.length;a++)n.push({start:r.start(a),end:r.end(a)});return this.bufferedInfo(n,t,i)}}catch(e){}return{len:0,start:t,end:t,nextStart:void 0}},s.bufferedInfo=function(e,t,i){t=Math.max(0,t),e.sort((function(e,t){return e.start-t.start||t.end-e.end}));var r=[];if(i)for(var n=0;n<e.length;n++){var a,s=r.length;s&&(a=r[s-1].end,e[n].start-a<i)?e[n].end>a&&(r[s-1].end=e[n].end):r.push(e[n])}else r=e;for(var o,l=0,c=t,u=t,d=0;d<r.length;d++){var h=r[d].start,f=r[d].end;if(h<=t+i&&t<f)c=h,l=(u=f)-t;else if(t+i<h){o=h;break}}return{len:l,start:c||0,end:u||0,nextStart:o}},s.getBuffered=function(e){try{return e.buffered}catch(e){return r.logger.log("failed to get media.buffered",e),n}},s);function s(){}},"./src/utils/cea-608-parser.ts":function(e,t,i){function r(e){var t=e;return o.hasOwnProperty(e)&&(t=o[e]),String.fromCharCode(t)}function n(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i].toString(16));return t}i.r(t),i.d(t,"Row",(function(){return y})),i.d(t,"CaptionScreen",(function(){return v}));var a,s=i("./src/utils/logger.ts"),o={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},l=15,c=100,u={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},d={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},p=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],g=((i=a=a||{})[i.ERROR=0]="ERROR",i[i.TEXT=1]="TEXT",i[i.WARNING=2]="WARNING",i[i.INFO=2]="INFO",i[i.DEBUG=3]="DEBUG",i[i.DATA=3]="DATA",C.prototype.log=function(e,t){this.verboseLevel>=e&&s.logger.log(this.time+" ["+e+"] "+t)},C),m=((i=_.prototype).reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},i.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;i<t.length;i++){var r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}},i.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},i.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},i.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},i.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},_),A=((i=S.prototype).reset=function(){this.uchar=" ",this.penState.reset()},i.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},i.setPenState=function(e){this.penState.copy(e)},i.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},i.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},i.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},S),y=((i=T.prototype).equals=function(e){for(var t=!0,i=0;i<c;i++)if(!this.chars[i].equals(e.chars[i])){t=!1;break}return t},i.copy=function(e){for(var t=0;t<c;t++)this.chars[t].copy(e.chars[t])},i.isEmpty=function(){for(var e=!0,t=0;t<c;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},i.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(a.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>c&&(this.logger.log(a.DEBUG,"Too large cursor position "+this.pos),this.pos=c)},i.moveCursor=function(e){var t=this.pos+e;if(1<e)for(var i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)},i.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},i.insertChar=function(e){144<=e&&this.backSpace();var t=r(e);this.pos>=c?this.logger.log(a.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},i.clearFromPos=function(e){for(var t=e;t<c;t++)this.chars[t].reset()},i.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},i.clearToEndOfRow=function(){this.clearFromPos(this.pos)},i.getTextString=function(){for(var e=[],t=!0,i=0;i<c;i++){var r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},i.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},T),v=((i=E.prototype).reset=function(){for(var e=0;e<l;e++)this.rows[e].clear();this.currRow=14},i.equals=function(e){for(var t=!0,i=0;i<l;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t},i.copy=function(e){for(var t=0;t<l;t++)this.rows[t].copy(e.rows[t])},i.isEmpty=function(){for(var e=!0,t=0;t<l;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},i.backSpace=function(){this.rows[this.currRow].backSpace()},i.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},i.insertChar=function(e){this.rows[this.currRow].insertChar(e)},i.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},i.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},i.setCursor=function(e){this.logger.log(a.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},i.setPAC=function(e){this.logger.log(a.INFO,"pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var i=0;i<l;i++)this.rows[i].clear();var r=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var s=n.rows[r].cueStartTime,o=this.logger.time;if(s&&null!==o&&s<o)for(var c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(n.rows[r+c])}}this.currRow=t,s=this.rows[this.currRow],null!==e.indent&&(o=e.indent,o=Math.max(o-1,0),s.setCursor(e.indent),e.color=s.chars[o].penState.foreground),s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1},this.setPen(s)},i.setBkgData=function(e){this.logger.log(a.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},i.setRollUpRows=function(e){this.nrRollUpRows=e},i.rollUp=function(){var e;null!==this.nrRollUpRows?(this.logger.log(a.TEXT,this.getDisplayText()),e=this.currRow+1-this.nrRollUpRows,(e=this.rows.splice(e,1)[0]).clear(),this.rows.splice(this.currRow,0,e),this.logger.log(a.INFO,"Rolling up")):this.logger.log(a.DEBUG,"roll_up but nrRollUpRows not set yet")},i.getDisplayText=function(e){e=e||!1;for(var t=[],i="",r=0;r<l;r++){var n=this.rows[r].getTextString();n&&t.push(e?"Row "+(r+1)+": '"+n+"'":n.trim())}return 0<t.length?e?"["+t.join(" | ")+"]":t.join("\n"):i},i.getTextAndFormat=function(){return this.rows},E),b=((i=k.prototype).reset=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},i.getHandler=function(){return this.outputFilter},i.setHandler=function(e){this.outputFilter=e},i.setPAC=function(e){this.writeScreen.setPAC(e)},i.setBkgData=function(e){this.writeScreen.setBkgData(e)},i.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(a.INFO,"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)},i.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(a.INFO,i+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(a.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},i.ccRCL=function(){this.logger.log(a.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},i.ccBS=function(){this.logger.log(a.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory)&&this.outputDataUpdate()},i.ccAOF=function(){},i.ccAON=function(){},i.ccDER=function(){this.logger.log(a.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},i.ccRU=function(e){this.logger.log(a.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},i.ccFON=function(){this.logger.log(a.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},i.ccRDC=function(){this.logger.log(a.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},i.ccTR=function(){this.logger.log(a.INFO,"TR"),this.setMode("MODE_TEXT")},i.ccRTD=function(){this.logger.log(a.INFO,"RTD"),this.setMode("MODE_TEXT")},i.ccEDM=function(){this.logger.log(a.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},i.ccCR=function(){this.logger.log(a.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},i.ccENM=function(){this.logger.log(a.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},i.ccEOC=function(){var e;this.logger.log(a.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode&&(e=this.displayedMemory,this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(a.TEXT,"DISP: "+this.displayedMemory.getDisplayText())),this.outputDataUpdate(!0)},i.ccTO=function(e){this.logger.log(a.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},i.ccMIDROW=function(e){var t={flash:!1};t.underline=e%2==1,t.italics=46<=e,t.italics?t.foreground="white":(e=Math.floor(e/2)-16,t.foreground=["white","green","blue","cyan","red","yellow","magenta"][e]),this.logger.log(a.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},i.outputDataUpdate=function(e){void 0===e&&(e=!1);var 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))},i.cueSplitAtTime=function(e){!this.outputFilter||this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e)},k);function w(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new g;this.channels=[null,new b(e,t,r),new b(e+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}function k(e,t,i){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=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new v(i),this.nonDisplayedMemory=new v(i),this.lastOutputScreen=new v(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}function E(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<l;t++)this.rows.push(new y(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}function T(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<c;t++)this.chars.push(new A);this.logger=e,this.pos=0,this.currPenState=new m}function S(e,t,i,r,n,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new m(t,i,r,n,a)}function _(e,t,i,r,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=i||!1,this.background=r||"black",this.flash=n||!1}function C(){this.time=null,this.verboseLevel=a.ERROR}function R(e,t,i){i.a=e,i.b=t}function D(e,t,i){return i.a===e&&i.b===t}(i=w.prototype).getHandler=function(e){return this.channels[e].getHandler()},i.setHandler=function(e,t){this.channels[e].setHandler(t)},i.addData=function(e,t){var i,r=!1;this.logger.time=e;for(var s=0;s<t.length;s+=2){var o,l=127&t[s],c=127&t[s+1];0==l&&0==c||(this.logger.log(a.DATA,"["+n([t[s],t[s+1]])+"] -> ("+n([l,c])+")"),!(i=(i=(i=(i=this.parseCmd(l,c))||this.parseMidrow(l,c))||this.parsePAC(l,c))||this.parseBackgroundAttributes(l,c))&&(r=this.parseChars(l,c))&&((o=this.currentChannel)&&0<o?this.channels[o].insertChars(r):this.logger.log(a.WARNING,"No channel found yet. TEXT-MODE?")),i)||r||this.logger.log(a.WARNING,"Couldn't parse cleaned data "+n([l,c])+" orig: "+n([t[s],t[s+1]]))}},i.parseCmd=function(e,t){var i,r,s=this.cmdHistory;return((20===e||28===e||21===e||29===e)&&32<=t&&t<=47||(23===e||31===e)&&33<=t&&t<=35)&&(D(e,t,s)?(R(null,null,s),this.logger.log(a.DEBUG,"Repeated command ("+n([e,t])+") is dropped")):(r=this.channels[i=20===e||21===e||23===e?1:2],20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),R(e,t,s),this.currentChannel=i),!0)},i.parseMidrow=function(e,t){var i;return(17===e||25===e)&&32<=t&&t<=47&&((i=17===e?1:2)!==this.currentChannel?(this.logger.log(a.ERROR,"Mismatch channel in midrow parsing"),!1):!!(i=this.channels[i])&&(i.ccMIDROW(t),this.logger.log(a.DEBUG,"MIDROW ("+n([e,t])+")"),!0))},i.parsePAC=function(e,t){var i,r,n=this.cmdHistory;return((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127||(16===e||24===e)&&64<=t&&t<=95)&&(D(e,t,n)?(R(null,null,n),!0):!!(r=this.channels[i=e<=23?1:2])&&(r.setPAC(this.interpretPAC((64<=t&&t<=95?1==i?u:h:1==i?d:f)[e],t)),R(e,t,n),this.currentChannel=i,!0))},i.interpretPAC=function(e,t){return e={color:null,italics:!1,indent:null,underline:!1,row:e},t=95<t?t-96:t-64,e.underline=1==(1&t),t<=13?e.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(t/2)]:t<=15?(e.italics=!0,e.color="white"):e.indent=4*Math.floor((t-16)/2),e},i.parseChars=function(e,t){var i,s=null,o=null;return 17<=(o=25<=e?(i=2,e-8):(i=1,e))&&o<=19?(this.logger.log(a.INFO,"Special char '"+r(o=17===o?t+80:18===o?t+112:t+144)+"' in channel "+i),s=[o]):32<=e&&e<=127&&(s=0===t?[e]:[e,t]),s&&(i=n(s),this.logger.log(a.DEBUG,"Char codes = "+i.join(",")),R(e,t,this.cmdHistory)),s},i.parseBackgroundAttributes=function(e,t){var i,r;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(r={},16===e||24===e?(i=Math.floor((t-32)/2),r.background=p[i],t%2==1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),this.channels[e<=23?1:2].setBkgData(r),R(e,t,this.cmdHistory),!0)},i.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},i.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var i=this.channels[t];i&&i.cueSplitAtTime(e)}},t.default=w},"./src/utils/codecs.ts":function(e,t,i){i.r(t),i.d(t,"isCodecType",(function(){return n})),i.d(t,"isCodecSupportedInMp4",(function(){return a}));var r={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function n(e,t){return t=r[t],!!t&&!0===t[e.slice(0,4)]}function a(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}},"./src/utils/cues.ts":function(e,t,i){i.r(t);var r=i("./src/utils/vttparser.ts"),n=i("./src/utils/webvtt-parser.ts"),a=i("./src/utils/texttrack-utils.ts"),s=/\s/;t.default={newCue:function(e,t,i,o){for(var l,c,u,d,h=[],f=self.VTTCue||self.TextTrackCue,p=0;p<o.rows.length;p++)if(c=!0,u=0,d="",!(l=o.rows[p]).isEmpty()){for(var g=0;g<l.chars.length;g++)s.test(l.chars[g].uchar)&&c?u++:(d+=l.chars[g].uchar,c=!1);(l.cueStartTime=t)===i&&(i+=1e-4),16<=u?u--:u++;var m=Object(r.fixLineBreaks)(d.trim()),A=Object(n.generateCueId)(t,i,m);e&&e.cues&&e.cues.getCueById(A)||((m=new f(t,i,m)).id=A,m.line=p+1,m.align="left",m.position=10+Math.min(80,10*Math.floor(8*u/32)),h.push(m))}return e&&h.length&&(h.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:8<e.line&&8<t.line?t.line-e.line:e.line-t.line})),h.forEach((function(t){return Object(a.addCueToTrack)(e,t)}))),h}}},"./src/utils/discontinuities.ts":function(e,t,i){i.r(t),i.d(t,"findFirstFragWithCC",(function(){return s})),i.d(t,"shouldAlignOnDiscontinuities",(function(){return o})),i.d(t,"findDiscontinuousReferenceFrag",(function(){return l})),i.d(t,"adjustSlidingStart",(function(){return u})),i.d(t,"alignStream",(function(){return d})),i.d(t,"alignPDT",(function(){return h})),i.d(t,"alignFragmentByPDTDelta",(function(){return f})),i.d(t,"alignMediaPlaylistByPDT",(function(){return p}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/logger.ts"),a=i("./src/controller/level-helper.ts");function s(e,t){for(var i=null,r=0,n=e.length;r<n;r++){var a=e[r];if(a&&a.cc===t){i=a;break}}return i}function o(e,t,i){return!(!t.details||!(i.endCC>i.startCC||e&&e.cc<i.startCC))}function l(e,t){if(e=e.fragments,t=t.fragments,t.length&&e.length){if(e=s(e,t[0].cc),e&&(!e||e.startPTS))return e;n.logger.log("No frag in previous level to align on")}else n.logger.log("No fragments to align")}function c(e,t){e&&(t=e.start+t,e.start=e.startPTS=t,e.endPTS=t+e.duration)}function u(e,t){for(var i=t.fragments,r=0,n=i.length;r<n;r++)c(i[r],e);t.fragmentHint&&c(t.fragmentHint,e),t.alignedSliding=!0}function d(e,t,i){var s;t&&(o(e,t,e=i)&&(s=l(t.details,e))&&Object(r.isFiniteNumber)(s.start)&&(n.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),u(s.start,e)),!i.alignedSliding&&t.details&&h(i,t.details),i.alignedSliding||!t.details||i.skippedSegments||Object(a.adjustSliding)(t.details,i))}function h(e,t){var i,a;t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime&&(i=t.fragments[0].programDateTime,t=((a=e.fragments[0].programDateTime)-i)/1e3+t.fragments[0].start)&&Object(r.isFiniteNumber)(t)&&(n.logger.log("Adjusting PTS using programDateTime delta "+(a-i)+"ms, sliding:"+t.toFixed(3)+" "+e.url+" "),u(t,e))}function f(e,t){var i=e.programDateTime;i&&(e.start=e.startPTS=i=(i-t)/1e3,e.endPTS=i+e.duration)}function p(e,t){var i;t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime&&(i=t.fragments[0].programDateTime-1e3*t.fragments[0].start,e.fragments.forEach((function(e){f(e,i)})),e.fragmentHint&&f(e.fragmentHint,i),e.alignedSliding=!0)}},"./src/utils/ewma-bandwidth-estimator.ts":function(e,t,i){i.r(t);var r=i("./src/utils/ewma.ts");function n(e,t,i){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new r.default(e),this.fast_=new r.default(t)}(i=n.prototype).update=function(e,t){var i=this.slow_,n=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new r.default(e,i.getEstimate(),i.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new r.default(t,n.getEstimate(),n.getTotalWeight()))},i.sample=function(e,t){e=(e=Math.max(e,this.minDelayMs_))/1e3,t=8*t/e,this.fast_.sample(e,t),this.slow_.sample(e,t)},i.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},i.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},i.destroy=function(){},t.default=n},"./src/utils/ewma.ts":function(e,t,i){function r(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}i.r(t),(i=r.prototype).sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},i.getTotalWeight=function(){return this.totalWeight_},i.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},t.default=r},"./src/utils/fetch-loader.ts":function(e,t,i){i.r(t),i.d(t,"fetchSupported",(function(){return d}));var r=i("./src/polyfills/number.ts"),n=i("./src/loader/load-stats.ts"),a=i("./src/demux/chunk-cache.ts");function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return o(e,arguments,c(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),l(i,e)})(e)}function o(e,t,i){return(o=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),1}catch(e){}}}()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t),t=new(Function.bind.apply(e,r));return i&&l(t,i.prototype),t}).apply(null,arguments)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}function h(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||f,this.controller=new self.AbortController,this.stats=new n.LoadStats}function f(e,t){return new self.Request(e.url,t)}(i=h.prototype).destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},i.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},i.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},i.load=function(e,t,i){var n=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var s=function(e,t){return t={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(u({},e.headers))},e.rangeEnd&&t.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),t}(e,this.controller.signal),o=i.onProgress,l="arraybuffer"===e.responseType,c=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){n.abortInternal(),i.onTimeout(a,e,n.response)}),t.timeout),self.fetch(this.request).then((function(i){var s,c;if((n.response=n.loader=i).ok)return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(i.headers.get("Content-Length")||"0"),o&&Object(r.isFiniteNumber)(t.highWaterMark)?n.loadProgressively(i,a,e,t.highWaterMark,o):l?i.arrayBuffer():i.text();throw s=i.status,c=i.statusText,new A(c||"fetch, bad network response",s,i)})).then((function(s){var l=n.response,u=(self.clearTimeout(n.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first),a.loaded=a.total=s[c],{url:l.url,data:s});o&&!Object(r.isFiniteNumber)(t.highWaterMark)&&o(a,e,s,l),i.onSuccess(u,a,e,l)})).catch((function(t){var r;self.clearTimeout(n.requestTimeout),a.aborted||(r=t.code||0,i.onError({code:r,text:t.message},e,t.details))}))},i.getCacheAge=function(){var e,t=null;return this.response?(e=this.response.headers.get("age"))?parseFloat(e):null:t},i.loadProgressively=function(e,t,i,r,n){void 0===r&&(r=0);var s=new a.default,o=e.body.getReader();return function a(){return o.read().then((function(o){var l;return o.done?(s.dataLength&&n(t,i,s.flush(),e),Promise.resolve(new ArrayBuffer(0))):(l=(o=o.value).length,t.loaded+=l,l<r||s.dataLength?(s.push(o),s.dataLength>=r&&n(t,i,s.flush(),e)):n(t,i,o,e),a())})).catch((function(){return Promise.reject()}))}()},i=h,p=s(Error),m=p,(g=y).prototype=Object.create(m.prototype),l(g.prototype.constructor=g,m);var p,g,m,A=y;function y(e,t,i){return(e=p.call(this,e)||this).code=void 0,e.details=void 0,e.code=t,e.details=i,e}t.default=i},"./src/utils/imsc1-ttml-parser.ts":function(e,t,i){i.r(t),i.d(t,"IMSC1_CODEC",(function(){return u})),i.d(t,"parseIMSC1",(function(){return p}));var r=i("./src/utils/mp4-tools.ts"),n=i("./src/utils/vttparser.ts"),a=i("./src/utils/vttcue.ts"),s=i("./src/demux/id3.ts"),o=i("./src/utils/timescale-conversion.ts"),l=i("./src/utils/webvtt-parser.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,r=arguments[t];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}).apply(this,arguments)}var u="stpp.ttml.im1t",d=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,h=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,f={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(e,t,i,n,u){var d=Object(r.findBox)(new Uint8Array(e),["mdat"]);if(0!==d.length){d=d[0],d=Object(s.utf8ArrayToStr)(new Uint8Array(e,d.start,d.end-d.start)),t=Object(o.toTimescaleFromScale)(t,1,i);try{n(function(e,t){var i,r,n,s,o,u=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(u)return i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(i).reduce((function(e,t){return e[t]=u.getAttribute("ttp:"+t)||i[t],e}),{}),n="preserve"!==u.getAttribute("xml:space"),s=m(g(u,"styling","style")),o=m(g(u,"layout","region")),e=g(u,"body","[begin]"),[].map.call(e,(function(e){var i=function e(t,i){return[].slice.call(t.childNodes).reduce((function(t,r,n){return"br"===r.nodeName&&n?t+"\n":null!=(n=r.childNodes)&&n.length?e(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}(e,n);if(!i||!e.hasAttribute("begin"))return null;var u=v(e.getAttribute("begin"),r),d=v(e.getAttribute("dur"),r),h=v(e.getAttribute("end"),r);if(null===u)throw y(e);if(null===h){if(null===d)throw y(e);h=u+d}var p,g,m;d=new a.default(u-t,h-t,i),d.id=Object(l.generateCueId)(d.startTime,d.endTime,d.text),u=o[e.getAttribute("region")],h=s[e.getAttribute("style")],d.position=10,d.size=80,p=u,g=h,m="http://www.w3.org/ns/ttml#styling",i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(e,t){var i=A(g,m,t)||A(p,m,t);return i&&(e[t]=i),e}),{}),e=i.textAlign;return e&&((u=f[e])&&(d.lineAlign=u),d.align=e),c(d,i),d})).filter((function(e){return null!==e}));throw new Error("Invalid ttml")}(d,t))}catch(e){u(e)}}else u(new Error("Could not parse IMSC1 mdat"))}function g(e,t,i){return e=e.getElementsByTagName(t)[0],e?[].slice.call(e.querySelectorAll(i)):[]}function m(e){return e.reduce((function(e,t){var i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function A(e,t,i){return e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function y(e){return new Error("Could not parse ttml timestamp "+e)}function v(e,t){var i,r,a,s;return e?(null===(i=Object(n.parseTimeStamp)(e))&&(d.test(e)?(r=t,a=d.exec(e),s=(0|a[4])+(0|a[5])/r.subFrameRate,i=3600*(0|a[1])+60*(0|a[2])+(0|a[3])+s/r.frameRate):h.test(e)&&(i=function(t){var i=h.exec(e),r=Number(i[1]);switch(i[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/t.frameRate;case"t":return r/t.tickRate}return r}(t))),i):null}},"./src/utils/logger.ts":function(e,t,i){function r(){}i.r(t),i.d(t,"enableLogs",(function(){return s})),i.d(t,"logger",(function(){return o}));var n={trace:r,debug:r,log:r,warn:r,info:r,error:r},a=n;function s(e){if(self.console&&!0===e||"object"==m(e)){!function(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];i.forEach((function(t){var i;a[t]=e[t]?e[t].bind(e):(t=t,(i=self.console[t])?i.bind(self.console,"["+t+"] >"):r)}))}(e,"debug","log","info","warn","error");try{a.log()}catch(e){a=n}}else a=n}var o=n},"./src/utils/mediakeys-helper.ts":function(e,t,i){i.r(t),i.d(t,"KeySystems",(function(){return r})),i.d(t,"requestMediaKeySystemAccess",(function(){return n})),(i=r=r||{}).WIDEVINE="com.widevine.alpha",i.PLAYREADY="com.microsoft.playready";var r,n="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":function(e,t,i){function r(){return self.MediaSource||self.WebKitMediaSource}i.r(t),i.d(t,"getMediaSource",(function(){return r}))},"./src/utils/mp4-tools.ts":function(e,t,i){i.r(t),i.d(t,"bin2str",(function(){return o})),i.d(t,"readUint16",(function(){return l})),i.d(t,"readUint32",(function(){return c})),i.d(t,"writeUint32",(function(){return u})),i.d(t,"findBox",(function(){return d})),i.d(t,"parseSegmentIndex",(function(){return h})),i.d(t,"parseInitSegment",(function(){return f})),i.d(t,"getStartDTS",(function(){return p})),i.d(t,"getDuration",(function(){return g})),i.d(t,"computeRawDurationFromSamples",(function(){return m})),i.d(t,"offsetStartDTS",(function(){return A})),i.d(t,"segmentValidRange",(function(){return y})),i.d(t,"appendUint8Array",(function(){return v}));var r=i("./src/utils/typed-array.ts"),n=i("./src/loader/fragment.ts"),a=Math.pow(2,32)-1,s=[].push;function o(e){return String.fromCharCode.apply(null,e)}function l(e,t){return"data"in e&&(t+=e.start,e=e.data),e=e[t]<<8|e[t+1],e<0?65536+e:e}function c(e,t){return"data"in e&&(t+=e.start,e=e.data),e=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],e<0?4294967296+e:e}function u(e,t,i){"data"in e&&(t+=e.start,e=e.data),e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function d(e,t){var i,r,n=[];if(t.length)for(var a=("data"in e?(i=e.data,r=e.start,e.end):(r=0,(i=e).byteLength)),l=r;l<a;){var u,h=c(i,l);h=1<h?l+h:a;o(i.subarray(l+4,l+8))===t[0]&&(1===t.length?n.push({data:i,start:l+8,end:h}):(u=d({data:i,start:l+8,end:h},t.slice(1))).length&&s.apply(n,u)),l=h}return n}function h(e){var t=d(e,["moov"])[0];t=t?t.end:null,e=d(e,["sidx"]);if(!e||!e[0])return null;var i=[],r=e[0],n=(e=r.data[0],0===e?8:16),a=c(r,n),s=r.end+0,o=l(r,n=(n+=4)+(0===e?8:16)+2);n+=2;for(var u=0;u<o;u++){var h=n,f=c(r,h),p=(h+=4,2147483647&f);if(1==(2147483648&f)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;f=c(r,h),h+=4,i.push({referenceSize:p,subsegmentDuration:f,info:{duration:f/a,start:s,end:s+p-1}}),s+=p,n=h+=4}return{earliestPresentationTime:0,timescale:a,version:e,referencesCount:o,references:i,moovEndOffset:t}}function f(e){for(var t=[],i=d(e,["moov","trak"]),r=0;r<i.length;r++){var a,s,l,u=i[r],h=d(u,["tkhd"])[0];h&&(h=c(h,0===h.data[h.start]?12:20),a=d(u,["mdia","mdhd"])[0])&&(a=c(a,0===a.data[a.start]?12:20),s=d(u,["mdia","hdlr"])[0])&&(s=o(s.data.subarray(s.start+8,s.start+12)),s={soun:n.ElementaryStreamTypes.AUDIO,vide:n.ElementaryStreamTypes.VIDEO}[s])&&(l=void 0,(u=d(u,["mdia","minf","stbl","stsd"])[0])&&(l=o(u.data.subarray(u.start+12,u.start+16))),t[h]={timescale:a,type:s},t[s]={timescale:a,id:h,codec:l})}return d(e,["moov","mvex","trex"]).forEach((function(e){var i=c(e,4);i=t[i];i&&(i.default={duration:c(e,12),flags:c(e,20)})})),t}function p(e,t){return d(t,["moof","traf"]).reduce((function(t,i){var r=d(i,["tfdt"])[0],n=r.data[r.start];i=d(i,["tfhd"]).reduce((function(t,i){if(i=c(i,4),i=e[i],i){var a=c(r,4);a=(a=1===n?(a*=Math.pow(2,32))+c(r,8):a)/(i.timescale||9e4);if(isFinite(a)&&(null===t||a<t))return a}return t}),null);return null!==i&&isFinite(i)&&(null===t||i<t)?i:t}),null)||0}function g(e,t){for(var i=0,r=0,a=0,s=d(e,["moof","traf"]),o=0;o<s.length;o++){var l=s[o],u=d(l,["tfhd"])[0],f=t[c(u,4)];if(f){var p=f.default,g=c(u,0)|(null==p?void 0:p.flags),A=null==p?void 0:p.duration;8&g&&(A=c(u,2&g?12:8));for(var y=f.timescale||9e4,v=d(l,["trun"]),b=0;b<v.length;b++)!(i=m(v[b]))&&A&&(i=A*c(v[b],4)),f.type===n.ElementaryStreamTypes.VIDEO?r+=i/y:f.type===n.ElementaryStreamTypes.AUDIO&&(a+=i/y)}}return 0===r&&0===a&&(e=h(e),null!=e&&e.references)?e.references.reduce((function(e,t){return e+t.info.duration||0}),0):r||a}function m(e){var t=c(e,0),i=8;1&t&&(i+=4),4&t&&(i+=4);for(var r=0,n=c(e,4),a=0;a<n;a++)256&t&&(r+=c(e,i),i+=4),512&t&&(i+=4),1024&t&&(i+=4),2048&t&&(i+=4);return r}function A(e,t,i){d(t,["moof","traf"]).forEach((function(t){d(t,["tfhd"]).forEach((function(r){var n;r=c(r,4),r=e[r];r&&(n=r.timescale||9e4,d(t,["tfdt"]).forEach((function(e){var t=e.data[e.start],r=c(e,4);0===t?u(e,4,r-i*n):(r=(r=(r*=Math.pow(2,32))+c(e,8))-i*n,r=Math.max(r,0),t=Math.floor(r/(a+1)),r=Math.floor(r%(a+1)),u(e,4,t),u(e,8,r))})))}))}))}function y(e){var t={valid:null,remainder:null},i=d(e,["moof"]);return i&&(i.length<2?t.remainder=e:(i=i[i.length-1],t.valid=Object(r.sliceUint8)(e,0,i.start-8),t.remainder=Object(r.sliceUint8)(e,i.start-8))),t}function v(e,t){var i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}},"./src/utils/output-filter.ts":function(e,t,i){i.r(t),i.d(t,"default",(function(){return r})),(i=n.prototype).dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},i.newCue=function(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},i.reset=function(){this.cueRanges=[],this.startTime=null};var r=n;function n(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}},"./src/utils/texttrack-utils.ts":function(e,t,i){i.r(t),i.d(t,"sendAddTrackEvent",(function(){return n})),i.d(t,"addCueToTrack",(function(){return a})),i.d(t,"clearCurrentCues",(function(){return s})),i.d(t,"removeCuesInRange",(function(){return o})),i.d(t,"getCuesInRange",(function(){return l}));var r=i("./src/utils/logger.ts");function n(e,t){var i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function a(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(i){r.logger.debug("[texttrack-utils]: "+i);var n=new self.TextTrackCue(t.startTime,t.endTime,t.text);n.id=t.id,e.addCue(n)}"disabled"===i&&(e.mode=i)}function s(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)e.removeCue(e.cues[i]);"disabled"===t&&(e.mode=t)}function o(e,t,i){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&0<e.cues.length)for(var n=l(e.cues,t,i),a=0;a<n.length;a++)e.removeCue(n[a]);"disabled"===r&&(e.mode=r)}function l(e,t,i){var r=[],n=function(e,t){if(t<e[0].startTime)return 0;var i=e.length-1;if(t>e[i].endTime)return-1;for(var r=0,n=i;r<=n;){var a=Math.floor((n+r)/2);if(t<e[a].startTime)n=a-1;else{if(!(t>e[a].startTime&&r<i))return a;r=a+1}}return e[r].startTime-t<t-e[n].startTime?r:n}(e,t);if(-1<n)for(var a=n,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}},"./src/utils/time-ranges.ts":function(e,t,i){i.r(t),t.default={toString:function(e){for(var t="",i=e.length,r=0;r<i;r++)t+="["+e.start(r).toFixed(3)+","+e.end(r).toFixed(3)+"]";return t}}},"./src/utils/timescale-conversion.ts":function(e,t,i){function r(e,t,i,r){return e=e*t*(i=void 0===i?1:i),(r=void 0!==r&&r)?Math.round(e):e}function n(e,t,i,n){return r(e,t,1/(i=void 0===i?1:i),n=void 0!==n&&n)}function a(e,t){return r(e,1e3,1/9e4,t=void 0!==t&&t)}function s(e,t){return r(e,9e4,1/(t=void 0===t?1:t))}i.r(t),i.d(t,"toTimescaleFromBase",(function(){return r})),i.d(t,"toTimescaleFromScale",(function(){return n})),i.d(t,"toMsFromMpegTsClock",(function(){return a})),i.d(t,"toMpegTsClockFromTimescale",(function(){return s}))},"./src/utils/typed-array.ts":function(e,t,i){function r(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}i.r(t),i.d(t,"sliceUint8",(function(){return r}))},"./src/utils/vttcue.ts":function(e,t,i){function r(e,t){return"string"==typeof t&&!!Array.isArray(e)&&(t=t.toLowerCase(),!!~e.indexOf(t))&&t}function n(e){return r(l,e)}function a(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=1;n<arguments.length;n++){var a,s=arguments[n];for(a in s)e[a]=s[a]}return e}function s(e,t,i){var s=this,l={enumerable:!0},c=(s.hasBeenReset=!1,""),u=!1,d=e,h=t,f=i,p=null,g="",m=!0,A="auto",y="start",v=50,b="middle",w=50,k="middle";Object.defineProperty(s,"id",a({},l,{get:function(){return c},set:function(e){c=""+e}})),Object.defineProperty(s,"pauseOnExit",a({},l,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(s,"startTime",a({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"endTime",a({},l,{get:function(){return h},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"text",a({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(s,"region",a({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"vertical",a({},l,{get:function(){return g},set:function(e){if(e=r(o,e),!1===e)throw new SyntaxError("An invalid or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"snapToLines",a({},l,{get:function(){return m},set:function(e){m=!!e,this.hasBeenReset=!0}})),Object.defineProperty(s,"line",a({},l,{get:function(){return A},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");A=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"lineAlign",a({},l,{get:function(){return y},set:function(e){if(e=n(e),!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"position",a({},l,{get:function(){return v},set:function(e){if(e<0||100<e)throw new Error("Position must be between 0 and 100.");v=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",a({},l,{get:function(){return b},set:function(e){if(e=n(e),!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",a({},l,{get:function(){return w},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");w=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",a({},l,{get:function(){return k},set:function(e){if(e=n(e),!e)throw new SyntaxError("An invalid or illegal string was specified.");k=e,this.hasBeenReset=!0}})),s.displayState=void 0}var o,l;i.r(t),t.default="undefined"!=typeof self&&self.VTTCue?self.VTTCue:(o=["","lr","rl"],l=["start","middle","end","left","right"],s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s)},"./src/utils/vttparser.ts":function(e,t,i){i.r(t),i.d(t,"parseTimeStamp",(function(){return s})),i.d(t,"fixLineBreaks",(function(){return h})),i.d(t,"VTTParser",(function(){return f}));var r=i("./src/utils/vttcue.ts"),n=(a.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},a);function a(){}function s(e){function t(e,t,i,r){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(r||0)}return e=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/),e?59<parseFloat(e[2])?t(e[2],e[3],0,e[4]):t(e[1],e[2],e[3],e[4]):null}(t=l.prototype).set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}},t.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},t.percent=function(e,t){return!!(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)&&(t=parseFloat(t),0<=t&&t<=100))&&(this.set(e,t),!0)};var o=l;function l(){this.values=Object.create(null)}function c(e,t,i,r){var n,a,s=r?e.split(r):[e];for(n in s)"string"==typeof s[n]&&2===(a=s[n].split(i)).length&&t(a[0],a[1])}var u=new r.default(0,0,""),d="middle"===u.align?"middle":"center";function h(e){return e.replace(/<br(?: \/)?>/gi,"\n")}(i=p.prototype).parse=function(e){var t=this;function i(){for(var e=0,i=h(i=t.buffer);e<i.length&&"\r"!==i[e]&&"\n"!==i[e];)++e;var r=i.substr(0,e);return"\r"===i[e]&&++e,"\n"===i[e]&&++e,t.buffer=i.substr(e),r}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var n="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(n=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var l=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(l?l=!1:n=i(),t.state){case"HEADER":/:/.test(n)?c(n,(function(e,t){}),/:/):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new r.default(0,0,""),t.state="CUE",-1===n.indexOf("--\x3e")){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{!function(e,t,i){var r,n,a=e;function l(){var t=s(e);if(null===t)throw new Error("Malformed timestamp: "+a);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function h(){e=e.replace(/^\s+/,"")}if(h(),t.startTime=l(),h(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+a);e=e.substr(3),h(),t.endTime=l(),h(),r=e,t=t,n=new o,c(r,(function(e,t){var r;switch(e){case"region":for(var a=i.length-1;0<=a;a--)if(i[a].id===t){n.set(e,i[a].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),n.integer(e,r[0]),n.percent(e,r[0])&&n.set("snapToLines",!1),n.alt(e,r[0],["auto"]),2===r.length&&n.alt("lineAlign",r[1],["start",d,"end"]);break;case"position":r=t.split(","),n.percent(e,r[0]),2===r.length&&n.alt("positionAlign",r[1],["start",d,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",d,"end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical",""),"auto"===(r=n.get("line","auto"))&&-1===u.line&&(r=-1),t.line=r,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",d),"auto"===(r=n.get("position","auto"))&&50===u.position&&(r="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=r}(n,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var f=-1!==n.indexOf("--\x3e");if(!n||f&&(l=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=n;continue;case"BADCUE":n||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},i.flush=function(){var t=this;try{if(!t.cue&&"HEADER"!==t.state||(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state||"BADWEBVTT"===t.state)throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this};var f=p;function p(){this.state="INITIAL",this.buffer="",this.decoder=new n,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}},"./src/utils/webvtt-parser.ts":function(e,t,i){i.r(t),i.d(t,"generateCueId",(function(){return d})),i.d(t,"parseWebVTT",(function(){return h}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/vttparser.ts"),a=i("./src/demux/id3.ts"),s=i("./src/utils/timescale-conversion.ts"),o=i("./src/remux/mp4-remuxer.ts"),l=/\r\n|\n\r|\n|\r/g,c=function(e,t,i){return e.substr(i=void 0===i?0:i,t.length)===t},u=function(e){for(var t=5381,i=e.length;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()};function d(e,t,i){return u(e.toString())+u(t.toString())+u(i)}function h(e,t,i,u,h,f,p,g){var m,A=new n.VTTParser,y=(e=Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),[]),v=Object(s.toMpegTsClockFromTimescale)(t,i),b="00:00.000",w=0,k=0,E=!0,T=!1;A.oncue=function(e){var t=u[h],i=u.ccOffset,r=(w-v)/9e4;null!=t&&t.new&&(void 0!==k?i=u.ccOffset=t.start:function(e,t){var i,r=e[h],n=e[r.prevCC];if(!n||!n.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,r.new=!1;for(;null!=(i=n)&&i.new;)e.ccOffset+=r.start-n.start,r.new=!1,n=e[(r=n).prevCC];e.presentationOffset=t}(u,r)),r&&(i=r-u.presentationOffset),T&&(t=e.endTime-e.startTime,r=Object(o.normalizePts)(9e4*(e.startTime+i-k),9e4*f)/9e4,e.startTime=r,e.endTime=r+t),i=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(i)),e.id||(e.id=d(e.startTime,e.endTime,i)),0<e.endTime&&y.push(e)},A.onparsingerror=function(e){m=e},A.onflush=function(){m?g(m):p(y)},e.forEach((function(e){if(E){if(c(e,"X-TIMESTAMP-MAP=")){T=!(E=!1),e.substr(16).split(",").forEach((function(e){c(e,"LOCAL:")?b=e.substr(6):c(e,"MPEGTS:")&&(w=parseInt(e.substr(7)))}));try{k=function(e){var t=parseInt(e.substr(-3)),i=parseInt(e.substr(-6,2)),n=parseInt(e.substr(-9,2)),a=9<e.length?parseInt(e.substr(0,e.indexOf(":"))):0;if(Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(n)&&Object(r.isFiniteNumber)(a))return t+1e3*i+6e4*n+36e5*a;throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e)}(b)/1e3}catch(e){T=!1,m=e}return}""===e&&(E=!1)}A.parse(e+"\n")})),A.flush()}},"./src/utils/xhr-loader.ts":function(e,t,i){i.r(t);var r=i("./src/utils/logger.ts"),n=i("./src/loader/load-stats.ts"),a=/^age:\s*[\d.]+\s*$/m;function s(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}(i=s.prototype).destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},i.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState)&&(this.stats.aborted=!0,e.abort())},i.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},i.load=function(e,t,i){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=i,this.retryDelay=t.retryDelay,this.loadInternal()},i.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,r=this.stats;r=(r.loading.first=0,r.loaded=0,this.xhrSetup);try{if(r)try{r(i,t.url)}catch(e){i.open("GET",t.url,!0),r(i,t.url)}i.readyState||i.open("GET",t.url,!0);var n=this.context.headers;if(n)for(var a in n)i.setRequestHeader(a,n[a])}catch(e){return void this.callbacks.onError({code:i.status,text:e.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},i.readystatechange=function(){var e,t,i,n,a=this.context,s=this.loader,o=this.stats;a&&s&&(t=s.readyState,e=this.config,!o.aborted)&&2<=t&&(self.clearTimeout(this.requestTimeout),0===o.loading.first&&(o.loading.first=Math.max(self.performance.now(),o.loading.start)),4===t?(s.onreadystatechange=null,s.onprogress=null,200<=(t=s.status)&&t<300?(o.loading.end=Math.max(self.performance.now(),o.loading.first),n="arraybuffer"===a.responseType?(i=s.response).byteLength:(i=s.responseText).length,o.loaded=o.total=n,this.callbacks&&((n=this.callbacks.onProgress)&&n(o,a,i,s),this.callbacks)&&(n={url:s.responseURL,data:i},this.callbacks.onSuccess(n,o,a,s))):o.retry>=e.maxRetry||400<=t&&t<499?(r.logger.error(t+" while loading "+a.url),this.callbacks.onError({code:t,text:s.statusText},a,s)):(r.logger.warn(t+" while loading "+a.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,e.maxRetryDelay),o.retry++)):(self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout)))},i.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},i.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},i.getCacheAge=function(){var e,t=null;return this.loader&&a.test(this.loader.getAllResponseHeaders())?(e=this.loader.getResponseHeader("age"))?parseFloat(e):null:t},t.default=s}},i={},e.m=t,e.c=i,e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:r})},e.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==m(t)&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(r,n,function(e){return t[e]}.bind(null,n));return r},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.p="/dist/",e(e.s="./src/hls.ts").default;function e(r){var n;return(i[r]||(n=i[r]={i:r,l:!1,exports:{}},t[r].call(n.exports,n,n.exports,e),n.l=!0,n)).exports}var t,i}())})))&&Cr.__esModule&&Object.prototype.hasOwnProperty.call(Cr,"default")?Cr.default:Cr,En=function(e){function t(e){var i;return A(this,t),i=p(this,t),(i.player=e)._opt,i.canVideoPlay=!1,i.$videoElement=null,i.canvasRenderInterval=null,i.bandwidthEstimateInterval=null,i.fpsInterval=null,i.hlsFps=0,i.hlsPrevFrams=0,i.isInitInfo=!1,i.eventsDestroy=[],kn.isSupported()?(i.$videoElement=i.player.video.$videoElement,i.hls=new kn({}),i._initHls(),i._bindEvents()):function(){var e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}()?(i.$videoElement=i.player.video.$videoElement,i.canVideoPlay=!0):i.player.debug.error("HlsDecoder","init hls error ,not support "),i.player.debug.log("HlsDecoder","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((function(e){return e()})),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.$videoElement=null,this.hlsFps=0,this.player.debug.log("HlsDecoder","destroy")}},{key:"checkHlsBufferedDelay",value:function(){var e=this.$videoElement,t=0,i=e.buffered;i=i.length?i.end(i.length-1):0;return(t=i-e.currentTime)<0&&(this.player.debug.warn("HlsDecoder","checkHlsBufferedDelay result < 0",t,i,e.currentTime),t=0),t}},{key:"getFps",value:function(){return this.hlsFps}},{key:"_startCanvasRender",value:function(){var e=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:"_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(N.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(){var t=e.$videoElement.getVideoPlaybackQuality();e.hlsFps=t.totalVideoFrames-e.hlsPrevFrams,e.hlsPrevFrams=t.totalVideoFrames}),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,et()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}},{key:"_bindEvents",value:function(){var e=this,t=this.player,i=this.player.events["proxy"];this.hls;var r=i(this.$videoElement,be,(function(i){e.hls&&(i=parseInt(i.timeStamp,10),t.handleRender(),t.updateStats({ts:i,dts:i}),t.emit(N.videoTimeUpdate,i))}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(kn.Events.ERROR,(function(t,i){if(i.fatal)switch(i.type){case kn.ErrorTypes.NETWORK_ERROR:e.player.debug.error("HlsDecoder","fatal network error encountered, try to recover"),e.hls.startLoad();break;case kn.ErrorTypes.MEDIA_ERROR:e.player.debug.error("HlsDecoder","fatal media error encountered, try to recover"),e.hls.recoverMediaError()}})),this.hls.on(kn.Events.MEDIA_ATTACHING,(function(){})),this.hls.on(kn.Events.MEDIA_ATTACHED,(function(){})),this.hls.on(kn.Events.MEDIA_DETACHING,(function(){})),this.hls.on(kn.Events.MEDIA_DETACHED,(function(){})),this.hls.on(kn.Events.BUFFER_RESET,(function(){})),this.hls.on(kn.Events.BUFFER_CODECS,(function(){})),this.hls.on(kn.Events.BUFFER_CREATED,(function(){})),this.hls.on(kn.Events.BUFFER_APPENDING,(function(t,i){e.player.debug.log("HlsDecoder","BUFFER_APPENDING",i)})),this.hls.on(kn.Events.BUFFER_APPENDED,(function(){})),this.hls.on(kn.Events.BUFFER_EOS,(function(){})),this.hls.on(kn.Events.BUFFER_FLUSHING,(function(){})),this.hls.on(kn.Events.BUFFER_FLUSHED,(function(){})),this.hls.on(kn.Events.MANIFEST_LOADING,(function(){e.player.debug.log("HlsDecoder","MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(kn.Events.MANIFEST_LOADED,(function(t,i){e.player.debug.log("HlsDecoder","MANIFEST_LOADED playlist m3u8文件加载完成",i)})),this.hls.on(kn.Events.MANIFEST_PARSED,(function(){e.player.debug.log("HlsDecoder","MANIFEST_PARSED playlist m3u8解析完成"),t._times.demuxStart||(t._times.demuxStart=We())})),this.hls.on(kn.Events.LEVEL_LOADING,(function(){})),this.hls.on(kn.Events.LEVEL_LOADED,(function(e,t){})),this.hls.on(kn.Events.FRAG_LOADING,(function(){})),this.hls.on(kn.Events.FRAG_LOADED,(function(e,i){t._times.decodeStart||(t._times.decodeStart=We())})),this.hls.on(kn.Events.BUFFER_APPENDING,(function(){t._times.videoStart||(t._times.videoStart=We(),t.handlePlayToRenderTimes())})),this.hls.on(kn.Events.FRAG_DECRYPTED,(function(){})),this.hls.on(kn.Events.KEY_LOADING,(function(){})),this.hls.on(kn.Events.KEY_LOADING,(function(){})),this.hls.on(kn.Events.FPS_DROP,(function(e){})),this.hls.on(kn.Events.FPS_DROP_LEVEL_CAPPING,(function(e){})),this.hls.on(kn.Events.FRAG_PARSING_INIT_SEGMENT,(function(t,i){e.player.debug.log("HlsDecoder","FRAG_PARSING_INIT_SEGMENT",i);var r,n=!!(i&&i.tracks&&i.tracks.audio),a=!!(i&&i.tracks&&i.tracks.video);if(n&&i.tracks.audio){var s=i.tracks.audio,o=s.metadata&&s.metadata.channelCount?s.metadata.channelCount:0,l=s.codec;e.player.audio&&e.player.audio.updateAudioInfo({encType:l,channels:o,sampleRate:44100})}a&&i.tracks.video&&(i=(s=i.tracks.video).codec,r=s.metadata&&s.metadata.width?s.metadata.width:0,s=s.metadata&&s.metadata.height?s.metadata.height:0,e.player.video)&&e.player.video.updateVideoInfo({encTypeCode:-1!==i.indexOf("avc")?7:12,width:r,height:s})}))}},{key:"initVideoPlay",value:function(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),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"],i=t(this.$videoElement,ye,(function(){e.player.debug.log("HlsDecoder","video canplay"),e.$videoElement.play().then((function(){e.player.debug.log("HlsDecoder","video play"),e._startCanvasRender(),e.initRenderSize()})).catch((function(t){e.player.debug.warn("HlsDecoder","video play error ",t)}))})),r=t(this.$videoElement,ve,(function(){e.player.debug.log("HlsDecoder","video waiting")})),n=t(this.$videoElement,be,(function(t){t=parseInt(t.timeStamp,10),e.player.handleRender(),e.player.updateStats({ts:t}),e.player.emit(N.videoTimeUpdate,t),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)})))}));t=t(this.$videoElement,we,(function(){e.player.debug.log("HlsDecoder","video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate)}));this.eventsDestroy.push(i,r,n,t)}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){t.canVideoPlay?(t.initVideoPlay(e),i()):t.hls.on(kn.Events.MEDIA_ATTACHED,(function(){t.hls.loadSource(e),i()}))}))}},{key:"_handleUpdatePlaybackRate",value:function(){if(this.$videoElement){var e=this.$videoElement,t=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3,i=e.buffered,r=(i=(i.length&&i.start(0),i.length?i.end(i.length-1):0),e.currentTime),n=i-r;t=Math.max(5,3+t),t=(t<n?(this.player.debug.warn("HlsDecoder","handleUpdatePlaybackRate and delay buffer is more than ".concat(t," is ").concat(n," and new time is ").concat(i," ")),e.currentTime=i,r=e.currentTime):n<0&&this.player.debug.warn("HlsDecoder","handleUpdatePlaybackRate and delay buffer is less than 0 is ".concat(n," and new time is ")+i),this._getPlaybackRate(i-r));e.playbackRate!==t&&(e.playbackRate=t)}}},{key:"_getPlaybackRate",value:function(e){var t=this.$videoElement,i=this.player._opt.videoBuffer,r=i+this.player._opt.videoBufferDelay;return e*=1e3,1===t.playbackRate?r<e?1.2:1:e<=i?1:t.playbackRate}},{key:"getDecodePlaybackRate",value:function(){var e=0,t=this.$videoElement;return t?t.playbackRate:e}}])}(e),Tn=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.rtcPeerConnection=null,i.videoStream=null,i._initRtcPeerConnection(),i.player.debug.log("WebrtcDecoder","init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.rtcPeerConnection&&(this.rtcPeerConnection.close(),this.rtcPeerConnection=null),this.videoStream=null,this.player.video.$videoElement.srcObject=null,this.player.debug.log("WebrtcDecoder","destroy")}},{key:"_initRtcPeerConnection",value:function(){var e=this,t=new RTCPeerConnection,i=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=function(t){e.player.debug.log("WebrtcDecoder","onsignalingstatechange",t)},t.oniceconnectionstatechange=function(i){e.player.debug.log("WebrtcDecoder","oniceconnectionstatechange",t.iceConnectionState)},t.onicecandidate=function(t){e.player.debug.log("WebrtcDecoder","onicecandidate",t)},t.ontrack=function(t){var r=i.video.$videoElement;"video"===t.track.kind&&(t=t.streams[0],r.srcObject=t,e.videoStream=t)},t.onconnectionstatechange=function(e){switch(i.debug.log("WebrtcDecoder","sdp connect status "+t.connectionState),t.connectionState){case"connected":break;case"disconnected":i.emit(N.webrtcDisconnect);break;case"failed":i.emit(N.webrtcFailed);break;case"closed":i.emit(N.webrtcClosed)}},this.rtcPeerConnection=t}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){var n=t.rtcPeerConnection;n.createOffer().then((function(a){n.setLocalDescription(a),t.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp loadSource"),a=a.sdp,fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:a}).then((function(e){e.text().then((function(e){t.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp response"),n.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})),i()})).catch((function(e){t.player.debug.error("WebrtcDecoder","loadSource response.text() error",e),r(e)}))})).catch((function(e){t.player.debug.error("WebrtcDecoder","loadSource getWebRtcRemoteSdp response error",e),r(e)}))})).catch((function(e){t.player.debug.error("WebrtcDecoder","loadSource rtcPeerConnection.createOffer() error",e),r(e)}))}))}}])}(e),Sn=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.tagName="WebrtcForZLMDecoder",i.player=e,i.rtcPeerConnection=null,i.videoStream=null,i._initRtcPeerConnection(),i.player.debug.log(i.tagName,"init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.rtcPeerConnection&&(this.rtcPeerConnection.close(),this.rtcPeerConnection=null),this.videoStream&&(this.videoStream.getTracks().forEach((function(e){return e.stop()})),this.videoStream=null),this.videoStream=null,this.player.video.$videoElement.srcObject=null,this.player.debug.log(this.tagName,"destroy")}},{key:"_initRtcPeerConnection",value:function(){var e=this,t=new RTCPeerConnection,i=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=function(e){console.log("onsignalingstatechange",e)},t.oniceconnectionstatechange=function(e){console.log("oniceconnectionstatechange",t.iceConnectionState)},t.onicecandidate=function(e){console.log("onicecandidate",e)},t.ontrack=function(t){var r=i.video.$videoElement;console.log("ontrack",t),"video"===t.track.kind&&(t=t.streams[0],r.srcObject=t,e.videoStream=t)},this.rtcPeerConnection=t}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){var n=t.rtcPeerConnection;n.createOffer().then((function(a){n.setLocalDescription(a),t.player.debug.log(t.tagName,"getWebRtcRemoteSdp loadSource"),a=a.sdp,cr({url:e,type:"POST",data:a,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"}).then((function(e){if(t.player.debug.log(t.tagName,"getWebRtcRemoteSdp response"),e=e.data,0!==e.code)return r(e.msg);n.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e.sdp})),i()})).catch((function(e){t.player.debug.error(t.tagName,"loadSource getWebRtcRemoteSdp response error",e),r(e)}))})).catch((function(e){t.player.debug.error(t.tagName,"loadSource rtcPeerConnection.createOffer() error",e),r(e)}))}))}}])}(e),_n=function(e){function t(e,i){var r;return A(this,t),r=p(this,t),r.player=e,r.player.$container.classList.add("jessibuca-container-playback"),r._showPrecision=null,r._startTime=null,r._playStartTime=null,r._playingTimestamp=null,r._fps=parseInt(i.fps,10)||e._opt.playbackFps,r._isUseFpsRender=!!Pt(i.isUseFpsRender),r._rate=1,r._audioTimestamp=0,r._videoTimestamp=0,r._currentLocalTimestamp=0,r._localOneFrameTimestamp=i.localOneFrameTimestamp||40,r._localCalculateTimeInterval=null,r._isUseLocalCalculateTime=!!Pt(i.isUseLocalCalculateTime),r._isPlaybackPauseClearCache=!Mt(i.isPlaybackPauseClearCache),r._isCacheBeforeDecodeForFpsRender=!!Pt(i.isCacheBeforeDecodeForFpsRender),r._startfpsTime=null,r._startFpsTimestamp=null,r._checkStatsInterval=null,r._playbackTs=0,r._renderFps=0,r._isUseLocalCalculateTime?r._startLocalCalculateTime():r._listen(),r.playbackList=[],r._totalDuration=0,r.initPlaybackList(i.playList),r.player.on(N.playbackPause,(function(e){e?r.pause():r.resume()})),e.debug.log("Playback","init",{fps:r._fps,isUseFpsRender:r._isUseFpsRender,localOneFrameTimestamp:r._localOneFrameTimestamp,isUseLocalCalculateTime:r._isUseLocalCalculateTime,uiUsePlaybackPause:i.uiUsePlaybackPause,showControl:i.showControl}),r}return g(t,e),y(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._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container.classList.remove("jessibuca-container-playback"),this.off(),this.player.debug.log("Playback","destroy")}},{key:"_listen",value:function(){var e=this;this.player.on(N.stats,(function(t){t=t.ts,e._playStartTime||(e._playStartTime=t),t-=e._playStartTime,e.setPlayingTimestamp(t)}))}},{key:"pause",value:function(){this.clearStatsInterval()}},{key:"resume",value:function(){this.startCheckStatsInterval()}},{key:"updateStats",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(e=(this._startFpsTimestamp||(this._startFpsTimestamp=We()),dt(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1),We()),e-this._startFpsTimestamp);if(!(t<1e3)){var i=null;this._startfpsTime&&(i=this._playbackTs-this._startfpsTime),this.player.emit(N.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:t,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=e}}},{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),t-=e._playStartTime;e.setPlayingTimestamp(t)}),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){this.playbackList=e||[];var t=0;this.playbackList.forEach((function(e,i){10===yt(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=tt(e.startTimestamp)),10===yt(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=tt(e.endTimestamp)),e.duration=e.end-e.start,t+=e.duration})),this._totalDuration=t,this.player.debug.log("Playback",this.playbackList),0<this.playbackList.length&&this.setStartTime(this.playbackList[0].startTimestamp),this.setShowPrecision(oe)}},{key:"startTime",get:function(){return this._startTime||0}},{key:"setStartTime",value:function(e){this._startTime=e,this._playStartTime=null}},{key:"setRate",value:function(e){this._rate=e,this.player.emit(N.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===oe}},{key:"is30Min",get:function(){return this.showPrecision===le}},{key:"is10Min",get:function(){return"tenMin"===this.showPrecision}},{key:"is5Min",get:function(){return this.showPrecision===ce}},{key:"is1Min",get:function(){return this.showPrecision===ce}},{key:"isPlaybackPauseClearCache",get:function(){return this._isPlaybackPauseClearCache}},{key:"isCacheBeforeDecodeForFpsRender",get:function(){return this._isCacheBeforeDecodeForFpsRender}},{key:"setShowPrecision",value:function(e){this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(N.playbackPrecision,this._showPrecision,this.playbackList))}},{key:"setPlayingTimestamp",value:function(e){e=this.startTime+e;var t=(this._playingTimestamp=e,this.player.emit(N.playbackTime,e),new Date(e));this.player.emit(N.playbackTimestamp,{ts:e,hour:t.getHours(),min:t.getMinutes(),second:t.getSeconds()})}},{key:"playingTimestamp",get:function(){return this._playingTimestamp}},{key:"narrowPrecision",value:function(){var e=de.indexOf(this.showPrecision)-1;0<=e&&(e=de[e],this.setShowPrecision(e))}},{key:"expandPrecision",value:function(){var e=de.indexOf(this.showPrecision)+1;e<=de.length-1&&(e=de[e],this.setShowPrecision(e))}},{key:"seek",value:function(e){if(console.log(e),"true"===e.hasRecord){var t=e.time;"min"===e.type&&(t=60*e.time),this.player.emit(N.playbackSeek,function(e){var t={};return-1<e?{hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60}:t}(t))}}}])}(e),Cn=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e,i.bindEvents=[],i.isDragging=!1,i.currentZoom=1,i.prevVideoElementStyleTransform=null,i.prevVideoElementStyleScale=null,i.tempPosition={x:0,y:0},i.videoPosition={left:0,top:0};var r=i.player["events"].proxy;return i.player.on(N.zooming,(function(e){if(e){i.player.$container.classList.add("jessibuca-zoom-control"),i._bindEvents();var t=i.player.video.$videoElement.style.transform,r=i.player.video.$videoElement.style.left,n=i.player.video.$videoElement.style.top;r=parseFloat(r),n=parseFloat(n),r=(r&&(i.videoPosition.left=r),n&&(i.videoPosition.top=n),(i.prevVideoElementStyleTransform=t).match(/scale\([0-9., ]*\)/g));r&&r[0]&&(n=r[0].replace("scale(","").replace(")",""),i.prevVideoElementStyleScale=n.split(","))}else i.player.$container.classList.remove("jessibuca-zoom-control"),i._unbindEvents(),i._resetVideoPosition(),i.player.$container.style.cursor="auto",i.player.video.$videoElement.style.transform=i.prevVideoElementStyleTransform,i.prevVideoElementStyleTransform=null,i.prevVideoElementStyleScale=null})),r(window,"mouseup",(function(e){i.handleMouseUp(e)})),e.debug.log("zoom","init"),i}return g(t,e),y(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["events"]["proxy"],i=t(this.player.$container,"mousemove",(function(t){e.handleMouseMove(t)}));this.bindEvents.push(i),i=t(this.player.$container,"mousedown",(function(t){e.handleMouseDown(t)}));this.bindEvents.push(i)}},{key:"_unbindEvents",value:function(){this.bindEvents.forEach((function(e){e&&e()}))}},{key:"handleMouseMove",value:function(e){var t,i,r,n;e.stopPropagation(),this.isDragging&&this.player.zooming&&(t=Tt(e),e=t.posX,i=t.posY,r=this.tempPosition.x-e,n=this.tempPosition.y-i,this.videoPosition.left=this.videoPosition.left-r,this.videoPosition.top=this.videoPosition.top-n,this.tempPosition.x=e,this.tempPosition.y=i,this.updateVideoPosition())}},{key:"handleMouseDown",value:function(e){e.stopPropagation();var t=kt(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){var i=Tt(e),r=i.posX,n=i.posY;this.player.$container.style.cursor="grabbing",this.tempPosition.x=r,this.tempPosition.y=n,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}},{key:"handleMouseUp",value:function(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(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}},{key:"narrowPrecision",value:function(){this.currentZoom<=1||(--this.currentZoom,this.updateVideoElementScale())}},{key:"expandPrecision",value:function(){5<=this.currentZoom||(this.currentZoom+=1,this.updateVideoElementScale())}},{key:"updateVideoElementScale",value:function(){var e=this.player.video.$videoElement,t=e.style.transform,i=1,r=1;if(this.prevVideoElementStyleScale){var n=this.prevVideoElementStyleScale[0],a=(void 0!==n&&(i=n,r=n),this.prevVideoElementStyleScale[1]);void 0!==a&&(r=a)}r=rt(r);var s=.5*(i=rt(i))*(this.currentZoom-1)+i,o=.5*r*(this.currentZoom-1)+r,l=-1===t.indexOf("scale(")?t+" scale(".concat(s,",").concat(o,")"):t.replace(/scale\([0-9., ]*\)/,"scale(".concat(s,",").concat(o,")"));this.player.debug.log("zoom","updateVideoElementScale end is ".concat(s,", ").concat(o," style is ")+l),e.style.transform=l}}])}(e),Rn=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.faceDetector=null,i.objectDetector=null,i.initFaceDetector(),i.initObjectDetector(),i.player.debug.log("AiLoader","init"),i}return g(t,e),y(t,[{key:"initFaceDetector",value:function(){var e=this;if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){var t=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth});t.load().then((function(){e.player.debug.log("AiLoader","init face detector success"),e.faceDetector=t}))}}},{key:"initObjectDetector",value:function(){var e=this;if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){var t=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth});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){t&&0<t.length&&e.player.emit(N.aiObjectDetectorInfo,t)}))}))}}},{key:"destroy",value:function(){this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.off()}}])}(e),Dn=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.LOG_NAME="Contextmenu",i.menuList=[],i.$contextmenus=e.control.$contextmenus,Xe()?i.player.debug.warn(i.LOG_NAME,"not support mobile"):i.init(),e.debug.log(i.LOG_NAME,"init"),i}return g(t,e),y(t,[{key:"destroy",value:function(){this.menuList=[],this.player.debug.log(this.LOG_NAME,"destroy")}},{key:"isShow",get:function(){return this.player.$container.classList.contains("jessibuca-contextmenus-show")}},{key:"show",value:function(){this.player.$container.classList.add("jessibuca-contextmenus-show")}},{key:"hide",value:function(){this.player.$container.classList.remove("jessibuca-contextmenus-show")}},{key:"init",value:function(){var e=this,t=this.player["events"].proxy;0<this.player._opt.contextmenuBtns.length&&this.player._opt.contextmenuBtns.forEach((function(t){e.addMenuItem(t)})),t(this.player.$container,"contextmenu",(function(t){t.preventDefault(),e.show();var i=t.clientX,r=(t=t.clientY,e.player.$container.getBoundingClientRect()),n=r.height,a=r.width,s=r.left,o=r.top,l=e.$contextmenus.getBoundingClientRect(),c=l.height,u=l.width,d=i-s,h=t-o;s+a<i+u&&(d=a-u),o+n<t+c&&(h=n-c),Ke(e.$contextmenus,{left:d+"px",top:h+"px"})})),t(this.player.$container,"click",(function(t){gn(t,e.$contextmenus)||e.hide()})),this.player.on(N.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,t,i,r,n=this,a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=xt(Le);a=Object.assign({},s,a),this._validateMenuItem(a)&&(e=this.player,s=e.events.proxy,e.debug,i='\n <div class="jessibuca-contextmenu jessibuca-contextmenu-'.concat(t=nt(),'">\n ').concat(a.content,"\n </div>\n "),(r=Array.from(this.$contextmenus.children)[a.index])?r.insertAdjacentHTML("beforebegin",i):fn(this.$contextmenus,i),r=this.$contextmenus.querySelector(".jessibuca-contextmenu-"+t),a.click&&s(r,"click",(function(e){e.preventDefault(),a.click.call(n.player,n,e),n.hide()})),this.menuList.push({uuid:t,$menuItem:r}))}}])}(e),xn=function(e){function t(e,i){var r;A(this,t),r=p(this,t),r.$container=e;e=It();var n,a=(r._opt=Object.assign({},e,i),r.debug=new Oe(r),r._opt.forceNoOffscreen=!0,Xe()&&(r._opt.controlAutoHide=!1),r._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(r._opt.forceNoOffscreen=!0,r._opt.useOffscreen=!1):r._opt.useOffscreen=!0),(r._opt.isHls||r._opt.isWebrtc)&&(r._opt.useWCS=!1,r._opt.useMSE=!1,r._opt.isNakedFlow=!1),r._opt.isNakedFlow,r._opt.isHls||r._opt.isWebrtc||(r._opt.useWCS&&(r._opt.useWCS="VideoEncoder"in window,r._opt.useWCS||r.debug.warn("Player","useWCS is true, but not support so set useWCS false"),r._opt.useWCS)&&(r._opt.useOffscreen?r._opt.wcsUseVideoRender=!1:r._opt.wcsUseVideoRender&&(r._opt.wcsUseVideoRender=ot()&&lt(),r._opt.wcsUseVideoRender||r.debug.warn("Player","wcsUseVideoRender is true, but not support so set wcsUseVideoRender false"))),r._opt.useMSE&&(r._opt.useMSE=function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(ae))||e}(),r._opt.useMSE||r.debug.warn("Player","useMSE is true, but not support so set useMSE false"))),r._opt.useMSE?(r._opt.useWCS&&r.debug.warn("Player","useMSE is true and useWCS is true then useWCS set true->false"),r._opt.forceNoOffscreen||r.debug.warn("Player","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.useSIMD&&-1===r._opt.decoder.indexOf("-simd")||(r._opt.useSIMD=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])),r._opt.useSIMD)||r.debug.warn("Player","useSIMD is true, but not support so set useSIMD false"),r._opt.useSIMD?-1===r._opt.decoder.indexOf("-simd")&&(r._opt.decoder=r._opt.decoder.replace("decoder-pro","decoder-pro-simd")):-1!==r._opt.decoder.indexOf("-simd")&&(r._opt.decoder=r._opt.decoder.replace("decoder-pro-simd","decoder-pro")),Mt(r._opt.hasAudio)&&(r._opt.operateBtns.audio=!1),Mt(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("Player","_opt.qualityConfig is empty, so set operateBtns.quality false")),Pt(r._opt.useWebGPU)&&(r._opt.useWebGPU=function(){var e=!1;return"gpu"in navigator||e}(),Mt(r._opt.useWebGPU))&&r.debug.warn("Player","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._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,pTs:0,dts:0},r._allStatsData={},r._faceDetectActive=!1,r._objectDetectActive=!1,r._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},r._videoTimestamp=0,r._audioTimestamp=0,r._videoIframeIntervalTs=0,r._streamQuality=r._opt.defaultStreamQuality||"",r._visibility=!0,r._lastestVisibilityChangeTimestamp=null,r._tempWorkerStats=null,r._isPlayback()&&(r._opt.useMSE=!1,r._opt.useWCS=!1),Mt(r._opt.useMSE)&&Mt(r._opt.useWCS)&&Mt(r._opt.isWebrtc)&&Mt(r._opt.isHls)&&(r._opt.useWasm=!0),(r._opt.isHls||r._opt.isWebrtc)&&(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=it()&&ot()&&lt(),r._opt.wasmUseVideoRender||r.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")),r._opt.useSIMD?r.debug.log("Player","use simd wasm"):r.debug.log("Player","use wasm")),r._opt.useWasm&&(r._opt.useFaceDetector&&window.JessibucaProFaceDetector||r._opt.useObjectDetector&&window.JessibucaProObjectDetector)?(r.ai=new Rn(r),r._opt.useFaceDetector&&window.JessibucaProFaceDetector||(r._opt.operateBtns.aiFace=!1),r._opt.useObjectDetector&&window.JessibucaProObjectDetector||(r._opt.operateBtns.aiObject=!1)):(r._opt.operateBtns.aiObject=!1,r._opt.operateBtns.aiFace=!1),!r._opt.useFaceDetector||r._opt.useWasm&&window.JessibucaProFaceDetector||r.debug.warn("Player","use face detector, useWasm is ".concat(r._opt.useWasm," and window.JessibucaProFaceDetector is ")+!!window.JessibucaProFaceDetector),!r._opt.useObjectDetector||r._opt.useWasm&&window.JessibucaProObjectDetector||r.debug.warn("Player","use object detector, useWasm is ".concat(r._opt.useWasm," and window.JessibucaProObjectDetector is ")+!!window.JessibucaProObjectDetector),r._opt.useVideoRender&&(r._opt.useWasm&&!r._opt.useOffscreen?(r._opt.wasmUseVideoRender=it()&&ot()&&lt(),r._opt.wasmUseVideoRender||r.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")):r._opt.useWCS&&!r._opt.useOffscreen&&(r._opt.wcsUseVideoRender=ot()&&lt(),r._opt.wcsUseVideoRender||r.debug.warn("Player","use wcs video render, but not support so set wcsUseVideoRender false"))),r._opt.useCanvasRender&&(r._opt.useMSE&&(r._opt.mseUseCanvasRender=!0),r._opt.useWasm&&(r._opt.wasmUseVideoRender=!1),r._opt.useWCS&&(r._opt.wcsUseVideoRender=!1),r._opt.isHls)&&!et()&&(r._opt.hlsUseCanvasRender=!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._opt.isHls?r._opt.hlsUseCanvasRender?r._opt.useCanvasRender=!0:r._opt.useVideoRender=!0:r._opt.isWebrtc&&(r._opt.useVideoRender=!0),n=r,Object.defineProperty(n,"rect",{get:function(){var e=n.$container.getBoundingClientRect();return e.width=Math.max(e.width,n.$container.clientWidth),e.height=Math.max(e.height,n.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(n,e,{get:function(){return n.rect[e]}})})),r.events=new Ot(r),r._opt.hasVideo&&(r.video=new ii(r),r.recorder=new zi(r)),r._opt.isHls?(r.hlsDecoder=new En(r),r.loaded=!0):r._opt.isWebrtc?(r._opt.isWebrtcForZLM?r.webrtc=new Sn(r):r.webrtc=new Tn(r),r.loaded=!0):St(r._opt)?r.loaded=!0:r.decoderWorker=new Hi(r),r._opt.hasAudio&&(r.audio=new yi(r)),r.stream=null,r.demux=null,r._lastVolume=null,r._isInZoom=!1,r._playingStartTimestamp=null,r._opt.useWCS&&(r.webcodecsDecoder=new an(r),r._opt.hasAudio||(r.loaded=!0)),r._opt.useMSE&&(r.mseDecoder=new vn(r),r._opt.hasAudio||(r.loaded=!0)),r.control=new An(r),0<r._opt.contextmenuBtns.length&&(r.contextmenu=new Dn(r)),r._isPlayback()&&(r.playback=new _n(r,r._opt.playbackConfig)),r._opt.operateBtns.zoom&&(r.zoom=new Cn(r)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&(r.keepScreenOn=new wn(r)),r);try{var s=function(e){kt(e)===a.$container&&(a.emit(G.fullscreen,a.fullscreen),!a.fullscreen||a._opt.useMSE)&&a.resize()};Ue.on("change",s),a.events.destroys.push((function(){Ue.off("change",s)}))}catch(a){}if(a.on(N.decoderWorkerInit,(function(){a.debug.log("player","listen decoderWorkerInit and set loaded true"),a.loaded=!0})),a.on(N.play,(function(){a.loading=!1})),a.on(N.fullscreen,(function(e){if(e)try{Ue.request(a.$container).then((function(){})).catch((function(e){a.debug.error("player","fullscreen request error",e),Xe()&&a._opt.useWebFullScreen&&(a.webFullscreen=!0)}))}catch(e){Xe()&&a._opt.useWebFullScreen&&(a.webFullscreen=!0)}else try{Ue.exit().then((function(){a.webFullscreen&&(a.webFullscreen=!1)})).catch((function(e){a.debug.error("player","fullscreen exit error",e),a.webFullscreen&&(a.webFullscreen=!1)}))}catch(e){a.webFullscreen&&(a.webFullscreen=!1)}})),Xe()&&a.on(N.webFullscreen,(function(e){e?a.$container.classList.add("jessibuca-fullscreen-web"):a.$container.classList.remove("jessibuca-fullscreen-web"),a.emit(G.fullscreen,a.fullscreen)})),a.on(N.resize,(function(){a.video&&a.video.resize()})),a._opt.debug){var o=[N.timeUpdate];Object.keys(N).forEach((function(e){a.on(N[e],(function(t){o.includes(e)||a.debug.log("player events",N[e],t)}))})),Object.keys(H).forEach((function(e){a.on(H[e],(function(t){a.debug.log("player event error",H[e],t)}))}))}var l=r,c=l._opt,u=l.debug,d=l.events.proxy;if(c.supportDblclickFullscreen&&d(l.$container,"dblclick",(function(e){e=kt(e).nodeName.toLowerCase(),"canvas"!==e&&"video"!==e||(l.fullscreen=!l.fullscreen)})),d(document,"visibilitychange",(function(){l.visibility="visible"===document.visibilityState,u.log("visibilitychange",document.visibilityState),c.hiddenAutoPause&&(u.log("visibilitychange","hiddenAutoPause is true ",document.visibilityState,l._isPlayingBeforePageHidden),"visible"===document.visibilityState?l._isPlayingBeforePageHidden&&l.play():(l._isPlayingBeforePageHidden=l.playing,l.playing&&l.pause()))})),d(document,["click","contextmenu"],(function(e){gn(e,l.$container)?(l.isInput="INPUT"===e.target.tagName,l.isFocus=!0,l.emit(N.focus)):(l.isInput=!1,l.isFocus=!1,l.emit(N.blur))})),c.autoResize){var h=at((function(){l.resize()}),500);d(window,["resize","orientationchange"],(function(){h()})),screen&&screen.orientation&&screen.orientation.onchange&&d(screen.orientation,"change",(function(){h()}))}return r.singleWatermark=new Zt(r),r._opt.watermarkConfig&&r.updateWatermark(r._opt.watermarkConfig),r._opt.useWCS&&r.debug.log("Player","use WCS"),r._opt.useMSE&&r.debug.log("Player","use MSE"),r._opt.useOffscreen&&r.debug.log("Player","use offscreen"),r._opt.isHls&&r.debug.log("Player","use hls"),r._opt.isWebrtc&&r.debug.log("Player","use webrtc"),r._isPlayback()&&r.debug.log("Player","use playback"),r._opt.hasVideo&&(0===r.width&&r.debug.warn("Player","container width is 0, please check the container width"),0===r.height)&&r.debug.warn("Player","container height is 0, please check the container height"),r.debug.log("Player options",r._opt),r}return g(t,e),y(t,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,i){e._destroyed=!0,e.emit("destroy"),e.off(),e.clearCheckHeartTimeout(),e.clearCheckLoadingTimeout(),e.clearStatsInterval(),e.clearVisibilityHiddenTimeout(),e._loading=!1,e._playing=!1,e._playbackPause=!1,e._hasLoaded=!1,e._lastVolume=null,e._zooming=!1,e._faceDetectActive=!1,e._objectDetectActive=!1,e._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},e._opt=It(),e.events&&(e.events.destroy(),e.events=null),e.decoderWorker?e.decoderWorker.destroy().then((function(){e._destroy(),e.decoderWorker=null,t()})):(e._destroy(),t())}))}},{key:"_destroy",value:function(){this.singleWatermark&&(this.singleWatermark.destroy(),this.singleWatermark=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(this.stream.destroy(),this.stream=null),this.recorder&&(this.recorder.destroy(),this.recorder=null),this.control&&(this.control.destroy(),this.control=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.demux&&(this.demux.destroy(),this.demux=null),this.hlsDecoder&&(this.hlsDecoder.destroy(),this.hlsDecoder=null),this.playback&&(this.playback.destroy(),this.playback=null),this.zoom&&(this.zoom.destroy(),this.zoom=null),this.ai&&(this.ai.destroy(),this.ai=null),this.keepScreenOn&&(this.releaseWakeLock(),this.keepScreenOn.destroy(),this.keepScreenOn=null),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._streamQuality="",this._visibility=!0,this._isInZoom=!1,this._playingStartTimestamp=null,this._lastestVisibilityChangeTimestamp=null,this._videoIframeIntervalTs=null,this._tempWorkerStats=null,this.$container=null,this.debug.log("play","destroy end")}},{key:"fullscreen",get:function(){return Ue.isFullscreen||this.webFullscreen},set:function(e){var t=this;Xe()&&this._opt.useWebFullScreen?(this.emit(N.webFullscreen,e),setTimeout((function(){t.updateOption({rotate:e?270:0}),t.resize()}),10)):this.emit(N.fullscreen,e)}},{key:"webFullscreen",get:function(){return this.$container.classList.contains("jessibuca-fullscreen-web")},set:function(e){this.emit(N.webFullscreen,e)}},{key:"loaded",get:function(){return this._hasLoaded||this._opt.isHls||this._opt.isWebrtc||this._opt.useMSE&&!this._opt.hasAudio||this._opt.useWCS&&!this._opt.hasAudio},set:function(e){this._hasLoaded=e}},{key:"playing",get:function(){return this._playing},set:function(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(N.playing,e),this.emit(N.volumechange,this.volume),e?this.emit(N.play):this.emit(N.pause))}},{key:"volume",get:function(){return this.audio&&this.audio.volume||0},set:function(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume):this.debug.error("Player","set volume error, audio is null"))}},{key:"lastVolume",get:function(){return this._lastVolume}},{key:"loading",get:function(){return this._loading},set:function(e){this.loading!==e&&(this._loading=e,this.emit(N.loading,this._loading))}},{key:"zooming",get:function(){return this._zooming},set:function(e){this.zooming!==e&&(this.zoom||(this.zoom=new Cn(this)),this._zooming=e,this.emit(N.zooming,this.zooming))}},{key:"recording",get:function(){return!!this.recorder&&this.recorder.isRecording},set:function(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this._opt.useWasm)&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0}):this.recording&&(this._opt.useWasm&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder)&&this.recorder.stopRecordAndSave().then((function(){})).catch((function(e){}))}},{key:"audioTimestamp",get:function(){return this._audioTimestamp},set:function(e){null!==e&&(this._audioTimestamp=e)}},{key:"videoTimestamp",get:function(){return this._videoTimestamp},set:function(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(N.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}},{key:"streamQuality",get:function(){return this._streamQuality},set:function(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(N.streamQualityChange,e))}},{key:"isDebug",get:function(){return Pt(this._opt.debug)}},{key:"scaleType",get:function(){var e=this._opt,t=e.isResize,i=(e=e.isFullResize,0);return Mt(e)&&Mt(t)?i=0:Mt(e)&&Pt(t)?i=1:Pt(e)&&Pt(t)&&(i=2),i}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility!==e&&(this._visibility=e,this.emit(N.visibilityChange,e),this._lastestVisibilityChangeTimestamp=We(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}},{key:"playbackPause",get:function(){return this._playbackPause},set:function(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(N.playbackPause,e),this.emit(N.playbackPauseOrResume,e))}},{key:"videoIframeIntervalTs",get:function(){return this._videoIframeIntervalTs},set:function(e){this._videoIframeIntervalTs=e}},{key:"faceDetectActive",get:function(){return this._faceDetectActive},set:function(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(N.faceDetectActive,e))}},{key:"objectDetectActive",get:function(){return this._objectDetectActive},set:function(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(N.objectDetectActive,e))}},{key:"isUseWorkerDemuxAndDecode",get:function(){return this.stream&&this.stream.getStreamType()===a}},{key:"isDestroyed",value:function(){return this._destroyed}},{key:"updateOption",value:function(e){this._opt=Object.assign({},this._opt,e)}},{key:"init",value:function(){var e=this;return new Promise((function(t,i){e.video||e._opt.hasVideo&&(e.video=new ii(e)),e.audio||e._opt.hasAudio&&(e.audio=new yi(e)),e.stream||(e.stream=new Si(e)),e._opt.isHls?(e.hlsDecoder||(e.hlsDecoder=new En(e),e.loaded=!0),t()):e._opt.isWebrtc?(e.webrtc||(e._opt.isWebrtcForZLM?e.webrtc=new Sn(e):e.webrtc=new Tn(e),e.loaded=!0),t()):(e.demux||e._opt.hasVideo&&!e.isUseWorkerDemuxAndDecode&&(e.demux=new nn(e)),e._opt.useWCS&&!e.webcodecsDecoder&&(e.webcodecsDecoder=new an(e)),e._opt.useMSE&&!e.mseDecoder&&(e.mseDecoder=new vn(e)),e.decoderWorker?e.loaded?t():e.once(N.decoderWorkerInit,(function(){e.loaded=!0,t()})):St(e._opt)?t():(e.decoderWorker=new Hi(e),e.once(N.decoderWorkerInit,(function(){e.loaded=!0,t()}))))}))}},{key:"play",value:function(e,t){var i=this;return new Promise((function(r,n){if(!e&&!i._opt.url)return n("url is empty");i.loading=!0,i.playing=!1,i._times.playInitStart=We(),e=e||i._opt.url,i._opt.url=e,i.clearCheckHeartTimeout(),i.init().then((function(){i._times.playStart=We(),i._opt.isNotMute&&i.mute(!1),i.webcodecsDecoder&&i.webcodecsDecoder.once(H.webcodecsH265NotSupport,(function(){i.emit(H.webcodecsH265NotSupport),i._opt.autoWasm||i.emit(N.error,H.webcodecsH265NotSupport)})),i.mseDecoder&&(i.mseDecoder.once(H.mediaSourceH265NotSupport,(function(){i.emit(H.mediaSourceH265NotSupport),i._opt.autoWasm||i.emit(N.error,H.mediaSourceH265NotSupport)})),i.mseDecoder.once(H.mediaSourceFull,(function(){i.emit(H.mediaSourceFull)})),i.mseDecoder.once(H.mediaSourceAppendBufferError,(function(){i.emit(H.mediaSourceAppendBufferError)})),i.mseDecoder.once(H.mediaSourceBufferListLarge,(function(){i.emit(H.mediaSourceBufferListLarge)})),i.mseDecoder.once(H.mediaSourceAppendBufferEndTimeout,(function(){i.emit(H.mediaSourceAppendBufferEndTimeout)})),i.mseDecoder.once(H.mediaSourceDecoderConfigurationError,(function(){i.emit(H.mediaSourceDecoderConfigurationError)})),i.mseDecoder.once(H.mediaSourceTsIsMaxDiff,(function(){i.emit(H.mediaSourceTsIsMaxDiff)}))),i.enableWakeLock(),i.checkLoadingTimeout(),i.stream?(i.stream.once(H.fetchError,(function(e){i.emit(H.fetchError,e),n(e)})),i.stream.once(H.websocketError,(function(e){i.emit(H.websocketError,e),n(e)})),i.stream.once(N.streamEnd,(function(){n("stream end")})),i.stream.once(H.hlsError,(function(e){n(e)})),i.stream.once(H.webrtcError,(function(e){n(e)})),i.stream.once(N.streamSuccess,(function(){r(),i._times.streamResponse=We(),i.video&&i.video.play(),i.checkStatsInterval(),i.isPlayback()&&i.playback&&i.playback.startCheckStatsInterval()})),i.stream.fetchStream(e,t)):i.debug.warn("player","play() this.stream is null")})).catch((function(e){n(e)}))}))}},{key:"close",value:function(){var e=this;return new Promise((function(t,i){e._close().then((function(){e.video&&e.video.clearView(),t()})).catch((function(e){i(e)}))}))}},{key:"resumeAudioAfterPause",value:function(){this.lastVolume&&(this.volume=this.lastVolume)}},{key:"_close",value:function(){var e=this;return new Promise((function(t,i){e.stream&&(e.stream.destroy(),e.stream=null),e.demux&&(e.demux.destroy(),e.demux=null),e.decoderWorker&&(e.decoderWorker.destroy(),e.decoderWorker=null),e.webcodecsDecoder&&(e.webcodecsDecoder.destroy(),e.webcodecsDecoder=null),e.mseDecoder&&(e.mseDecoder.destroy(),e.mseDecoder=null),e.hlsDecoder&&(e.hlsDecoder.destroy(),e.hlsDecoder=null),e.webrtc&&(e.webrtc.destroy(),e.webrtc=null),e.audio&&(e.audio.destroy(),e.audio=null),e.clearCheckHeartTimeout(),e.clearCheckLoadingTimeout(),e.clearStatsInterval(),e.isPlayback()&&e.playback&&e.playback.clearStatsInterval(),e.loading=!1,e.recording=!1,e.zooming=!1,e.playing=!1,e.video&&(e.video.resetInit(),e.video.pause(!0)),e.releaseWakeLock(),e.resetStats(),e._audioTimestamp=0,e._videoTimestamp=0,e._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((function(){t()}),0)}))}},{key:"pause",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return new Promise((function(i,r){t?e.close().then((function(){i()})).catch((function(e){r(e)})):e._close().then((function(){i()})).catch((function(e){r(e)}))}))}},{key:"isAudioMute",value:function(){var e=!0;return this.audio?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 i=this;return new Promise((function(r,n){i.recorder||n("recorder is null"),i.recording?(i._opt.useWasm&&i.decoderWorker.updateWorkConfig({key:"isRecording",value:!0}),i.recorder.stopRecordAndSave(e,t).then((function(e){r(e)})).catch((function(e){n(e)}))):n("recorder is not recording")}))}},{key:"_hasControl",value:function(){var e=this,t=!1,i=!1;return Object.keys(this._opt.operateBtns).forEach((function(t){e._opt.operateBtns[t]&&-1===(""+t).indexOf("Fn")&&(i=!0)})),(this._opt.showBandwidth||i)&&(t=!0),!(!this._isPlayback()||!this._opt.playbackConfig.showControl)||t}},{key:"_isPlayback",value:function(){return this._opt.playType===v}},{key:"useWasmDecode",value:function(){return Mt(this._opt.useMSE)&&Mt(this._opt.useWCS)}},{key:"canVideoTrackWritter",value:function(){var e=this._opt;return Mt(e.isHls)&&Mt(e.isWebrtc)&&Mt(e.useMSE)&&(e.useWCS&&Mt(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}},{key:"checkHeart",value:function(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}},{key:"checkHeartTimeout",value:function(){var e=this;this._checkHeartTimeout=setTimeout((function(){Mt(e.playbackPause)&&e.playing?e.isDestroyed()?e.debug&&e.debug.warn("player","checkHeartTimeout but player is destroyed"):0!==e._stats.fps?e.debug&&e.debug.warn("player","checkHeartTimeout but fps is "+e._stats.fps):Mt(e.visibility)&&0!==e._stats.vbps?e.debug&&e.debug.warn("player","checkHeartTimeout but page is not visibility and vbps is "+e._stats.vbps):(e.debug.warn("player","checkHeartTimeout and\n pause and emit delayTimeout event and\n current vbps is ".concat(e._stats.vbps," and\n current fps is ").concat(e._stats.fps," and\n current visibility is ").concat(e.visibility," and")),e.emit(N.timeout,N.delayTimeout),e.emit(N.delayTimeout)):e.debug.warn("player","playbackPause is ".concat(e.playbackPause,", playing is ")+e.playing)}),1e3*this._opt.heartTimeout)}},{key:"checkStatsInterval",value:function(){var e=this;this._checkStatsInterval=setInterval((function(){e.updateStats()}),1e3)}},{key:"clearCheckHeartTimeout",value:function(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}},{key:"checkLoadingTimeout",value:function(){var e=this;this._checkLoadingTimeout=setTimeout((function(){e.playing?e.debug.warn("player","checkLoadingTimeout but loading is ".concat(e.loading," and playing is ")+e.playing):e.isDestroyed()?e.debug&&e.debug.warn("player","checkLoadingTimeout but player is destroyed"):(e.debug.warn("player","checkLoadingTimeout and pause and emit loadingTimeout event"),e.emit(N.timeout,N.loadingTimeout),e.emit(N.loadingTimeout))}),1e3*this._opt.loadingTimeout)}},{key:"clearCheckLoadingTimeout",value:function(){this._checkLoadingTimeout&&(this.debug.log("player","clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}},{key:"clearStatsInterval",value:function(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}},{key:"handleRender",value:function(){this.isDestroyed()?this.debug&&this.debug.warn("player","handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.emit(N.start),this.loading=!1),this.playing||(this.playing=!0),this.checkHeart())}},{key:"updateStats",value:function(e){e=e||{},this._startBpsTime||(this._startBpsTime=We()),dt(e.ts)&&(this._stats.ts=e.ts,null===this._playingStartTimestamp)&&0<e.ts&&(this._playingStartTimestamp=e.ts),dt(e.dts)&&(this._stats.dts=e.dts),dt(e.mseTs)&&(this._stats.mseTs=e.mseTs),dt(e.buf)&&(this._stats.buf=e.buf),dt(e.netBuf)&&(this._stats.netBuf=e.netBuf),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);var t=We();if(!(t-this._startBpsTime<1e3)){null!==this._playingStartTimestamp&&(this._stats.pTs+=1);var i=0,r=0,n=0,a=(this._opt.useMSE&&this.mseDecoder&&(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),r=this.mseDecoder.getDecodeDiffTimes(),n=this.mseDecoder.getDecodePlaybackRate()),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this._opt.isHls&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10),n=this.hlsDecoder.getDecodePlaybackRate()),0),s=0,o=0,l=!1,c=!1,u=0,d=(this.demux&&(l=this.demux.isDropping()),this._opt.useWasm?this._tempWorkerStats&&(s=this._tempWorkerStats.demuxBufferDelay,o=this._tempWorkerStats.audioDemuxBufferDelay,a=this._tempWorkerStats.flvBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,l=this._tempWorkerStats.isDropping,u=this._tempWorkerStats.pushLatestDelay,c=this._tempWorkerStats.isStreamTsMoreThanLocal):this.demux&&(a=this.demux.getInputByteLength(),u=this.demux.getPushLatestDelay(),c=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList)&&(s=this.demux.bufferList.length),0),h=(this.audio&&this.audio.bufferList&&(d=this.audio.bufferList.length),0),f=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(h=this.video.bufferList&&this.video.bufferList.length||0),e=this.video.getStreamFps();var p=0<e?1e3/e:0;f=parseInt(p*h+p*s,10)}e=this._stats.dts-this._stats.ts;var g=e+this._stats.netBuf;this._opt.isHls&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps),this._allStatsData=Object.assign(this._stats,{audioBuffer:d,audioTs:this.audioTimestamp,playbackVideoBuffer:h,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:f,demuxBuffer:s,pushLatestDelay:u,audioDemuxBuffer:o,flvBuffer:a,mseDelay:i,mseDecodeDiffTimes:r,mseDecodePlaybackRate:n,wcsDecodeDiffTimes:r,hlsDelay:i,hlsDecodePlaybackRate:n,delayTs:e,totalDelayTs:g,isDropping:l,isStreamTsMoreThanLocal:c}),this.emit(N.stats,this._allStatsData),1048576<this._allStatsData.flvBuffer&&this.emit(H.flvDemuxBufferSizeTooLarge,this._allStatsData.flvBuffer),this._opt.hasVideo&&this.emit(N.performance,function(e){var t=0;return 24<=e?t=2:15<=e&&(t=1),t}(this._stats.fps)),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t}}},{key:"resetStats",value:function(){this._startBpsTime=null,this._playingStartTimestamp=null,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},this._allStatsData={}}},{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(N.beforeDestroy)}},{key:"handlePlayToRenderTimes",value:function(){var e=this.getPlayToRenderTimes();this.emit(N.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,e.demuxTimestamp=e.demuxStart-e.streamResponse,e.decodeTimestamp=e.decodeStart-e.demuxStart,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}},{key:"getOption",value:function(){return this._opt}},{key:"isPlayer",value:function(){return this._opt.playType===s}},{key:"isPlayback",value:function(){return this._opt.playType===v}},{key:"isDemuxSetCodecInit",value:function(){var e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=this.webcodecsDecoder.hasInit:t.useMSE&&(e=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?this.audio.isPlaybackRateSpeed():e}},{key:"getPlayingTimestamp",value:function(){return this._stats.pTs}},{key:"getRecordingType",value:function(){var e=null;return this.recorder?this.recorder.getType():e}},{key:"getRecordingByteLength",value:function(){var e=0;return this.recording?this.recorder.getToTalByteLength():e}},{key:"getRecordingDuration",value:function(){var e=0;return this.recording?this.recorder.getTotalDuration():e}},{key:"getDecodeType",value:function(){var e="",t=this.getOption();return t.useMSE&&(e+="mse "),t.useWCS&&(e+="wcs "),t.useWasm&&(e+="wasm ",t.useSIMD)&&(e+="simd "),t.useOffscreen&&(e+="offscreen "),e}},{key:"getDemuxType",value:function(){return this.getOption().demuxType}},{key:"getRenderType",value:function(){var e="";return this.video?this.video.getType():e}},{key:"getCanvasRenderType",value:function(){var e="";return this.video?this.video.getCanvasType():e}},{key:"getAudioEngineType",value:function(){var e="";return this.audio?this.audio.getEngineType():e}},{key:"getStreamType",value:function(){var e="";return this.stream?this.stream.getStreamType():e}},{key:"getAllStatsData",value:function(){return this._allStatsData}},{key:"togglePerformancePanel",value:function(e){this.updateOption({showPerformance:e}),this.emit(N.togglePerformancePanel,e)}},{key:"setScaleMode",value:function(e){var t={isFullResize:!1,isResize:!1};switch(e=Number(e)){case 0:t.isFullResize=!1,t.isResize=!1;break;case 1:t.isFullResize=!1,t.isResize=!0;break;case 2:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(N.viewResizeChange,e)}},{key:"startVisibilityHiddenTimeout",value:function(){var e=this;this.clearVisibilityHiddenTimeout(),0<this._opt.pageVisibilityHiddenTimeout&&(this.visibilityHiddenTimeout=setTimeout((function(){e.emit(N.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}},{key:"objectDetect",value:function(e){this.objectDetectActive=e}},{key:"downloadNakedFlowFile",value:function(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}},{key:"hasCacheOnGopBuffer",value:function(){var e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps,r=!!(e&&t&&i)&&e<1e3/i*t;return r}},{key:"addContentToCanvas",value:function(){this.video&&this.video.addContentToCanvas(0<arguments.length&&void 0!==arguments[0]?arguments[0]:[])}},{key:"sendWebsocketMessage",value:function(e){var t=this.getStreamType();t===i||t===a+" "+i?this.stream.sendMessage(e):this.debug.warn("player","sendWebsocketMessage: stream type is not websocket, current stream type is "+this.getStreamType())}},{key:"checkIsInRender",value:function(){var e=this._stats;return 0<e.vbps&&0<e.fps}},{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?this.video.getVideoInfo():e}},{key:"getAudioInfo",value:function(){var e=null;return this.audio?this.audio.getAudioInfo():e}}])}(e),Ln=function(){function t(e){A(this,t);var i=e,r=(e=i.fromSampleRate,i.toSampleRate),n=i.channels,a=i.inputBufferSize;if(!e||!r||!n)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=e,this.toSampleRate=r,this.channels=n||0,this.inputBufferSize=a,this.initialize()}return y(t,[{key:"initialize",value:function(){this.fromSampleRate==this.toSampleRate?(this.resampler=function(e){return e},this.ratioWeight=1):(this.fromSampleRate<this.toSampleRate?(this.linearInterpolation(),this.lastWeight=1):(this.multiTap(),this.tailExists=!1,this.lastWeight=0),this.initializeBuffers(),this.ratioWeight=this.fromSampleRate/this.toSampleRate)}},{key:"bufferSlice",value:function(t){try{return this.outputBuffer.subarray(0,t)}catch(e){try{return this.outputBuffer.length=t,this.outputBuffer}catch(e){return this.outputBuffer.slice(0,t)}}}},{key:"initializeBuffers",value:function(){this.outputBufferSize=Math.ceil(this.inputBufferSize*this.toSampleRate/this.fromSampleRate/this.channels*1.0000004768371582)+this.channels+this.channels;try{this.outputBuffer=new Float32Array(this.outputBufferSize),this.lastOutput=new Float32Array(this.channels)}catch(e){this.outputBuffer=[],this.lastOutput=[]}}},{key:"linearInterpolation",value:function(){var e=this;this.resampler=function(t){var i,r,n,a,s,o,l,c,u,d=t.length,h=e.channels;if(d%h!=0)throw new Error("Buffer was of incorrect sample length.");if(d<=0)return[];for(i=e.outputBufferSize,r=e.ratioWeight,n=e.lastWeight,a=0,s=0,o=0,l=0,c=e.outputBuffer;n<1;n+=r)for(s=n%1,a=1-s,e.lastWeight=n%1,u=0;u<e.channels;++u)c[l++]=e.lastOutput[u]*a+t[u]*s;for(--n,d-=h,o=Math.floor(n)*h;l<i&&o<d;){for(s=n%1,a=1-s,u=0;u<e.channels;++u)c[l++]=t[o+(0<u?u:0)]*a+t[o+(h+u)]*s;n+=r,o=Math.floor(n)*h}for(u=0;u<h;++u)e.lastOutput[u]=t[o++];return e.bufferSlice(l)}}},{key:"multiTap",value:function(){var e=this;this.resampler=function(t){var i,r,n,a,s,o,l,c,u,d,h,f=t.length,p=e.channels;if(f%p!=0)throw new Error("Buffer was of incorrect sample length.");if(f<=0)return[];for(i=e.outputBufferSize,r=[],n=e.ratioWeight,a=0,o=0,c=!e.tailExists,e.tailExists=!1,u=e.outputBuffer,d=0,h=0,s=0;s<p;++s)r[s]=0;do{if(c)for(a=n,s=0;s<p;++s)r[s]=0;else{for(a=e.lastWeight,s=0;s<p;++s)r[s]=e.lastOutput[s];c=!0}for(;0<a&&o<f;){if(l=1+o-h,!(a>=l)){for(s=0;s<p;++s)r[s]+=t[o+(0<s?s:0)]*a;h+=a,a=0;break}for(s=0;s<p;++s)r[s]+=t[o++]*l;h=o,a-=l}if(0!==a){for(e.lastWeight=a,s=0;s<p;++s)e.lastOutput[s]=r[s];e.tailExists=!0;break}for(s=0;s<p;++s)u[d++]=r[s]/n}while(o<f&&d<i);return e.bufferSlice(d)}}},{key:"resample",value:function(e){return this.fromSampleRate==this.toSampleRate?this.ratioWeight=1:(this.fromSampleRate<this.toSampleRate?this.lastWeight=1:(this.tailExists=!1,this.lastWeight=0),this.initializeBuffers(),this.ratioWeight=this.fromSampleRate/this.toSampleRate),this.resampler(e)}}])}(),In=[255,511,1023,2047,4095,8191,16383,32767];function Bn(e,t,i){for(var r=0;r<i;r++)if(e<=t[r])return r;return i}var Pn=function(e){function t(e){var i;A(this,t);var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};i=p(this,t),e&&(i.player=e),i.tag="talk",e=xt(_e);return i._opt=Object.assign({},e,r),i._opt.sampleRate=parseInt(i._opt.sampleRate,10),i._opt.sampleBitsWidth=parseInt(i._opt.sampleBitsWidth,10),i.audioContext=null,i.gainNode=null,i.recorder=null,i.workletRecorder=null,i.biquadFilter=null,i.userMediaStream=null,i.bufferSize=512,i._opt.audioBufferLength=i.calcAudioBufferLength(),i.audioBufferList=[],i.socket=null,i.socketStatus=W,i.mediaStreamSource=null,i.heartInterval=null,i.checkGetUserMediaTimeout=null,i.wsUrl=null,i.startTimestamp=0,i.sequenceId=0,i.tempTimestamp=null,i.tempRtpBufferList=[],i.events=new Ot(i),i._initTalk(),i.player||(i.debug=new Oe(i)),i.log(i.tag,"init",i._opt),i}return g(t,e),y(t,[{key:"destroy",value:function(){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.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===V&&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.startTimestamp=0,this.log("talk","destroy")}},{key:"addRtpToBuffer",value:function(e){var t=e.length+this.tempRtpBufferList.length;t=new Uint8Array(t);t.set(this.tempRtpBufferList,0),t.set(e,this.tempRtpBufferList.length),this.tempRtpBufferList=t}},{key:"downloadRtpFile",value:function(){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()}catch(e){console.error("downloadRtpFile",e)}}},{key:"calcAudioBufferLength",value:function(){var e=this._opt["sampleRate"];return 8*e*.02/8}},{key:"socketStatusOpen",get:function(){return this.socketStatus===V}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._log.apply(this,["log"].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._log.apply(this,["warn"].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];this._log.apply(this,["error"].concat(t))}},{key:"_log",value:function(e){for(var t,i=arguments.length,r=new Array(1<i?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(t=this.player?this.player.debug:this.debug||console)[e].apply(t,r)}},{key:"_getSequenceId",value:function(){return++this.sequenceId}},{key:"_createWebSocket",value:function(){var e=this;return new Promise((function(t,i){var r=e.events.proxy;e.socket=new WebSocket(e.wsUrl),e.socket.binaryType="arraybuffer",e.emit(N.talkStreamStart),r(e.socket,"open",(function(){e.socketStatus=V,e.log(e.tag,"websocket open -> do talk"),e.emit(N.talkStreamOpen),t(),e._doTalk()})),r(e.socket,"message",(function(t){e.log(e.tag,"websocket message",t.data)})),r(e.socket,"close",(function(t){e.socketStatus="close",e.log(e.tag,"websocket close"),e.emit(N.talkStreamClose),i(t)})),r(e.socket,"error",(function(t){e.socketStatus="error",e.error(e.tag,"websocket error",t),e.emit(N.talkStreamError,t),i(t)}))}))}},{key:"_sendClose",value:function(){}},{key:"_initTalk",value:function(){this._initMethods(),this._opt.engine===Se?this._initWorklet():"script"===this._opt.engine&&this._initScriptProcessor(),this.log(this.tag,"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 Ln({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;this.audioContext.audioWorklet.addModule(_t((function(){var e=function(e){function t(e){var i;return A(this,t),i=p(this,t),i._cursor=0,i._bufferSize=e.processorOptions.bufferSize,i._buffer=new Float32Array(i._bufferSize),i}return g(t,e),y(t,[{key:"process",value:function(e,t,i){if(e.length&&e[0].length)for(var r=0;r<e[0][0].length;r++)this._cursor+=1,this._cursor===this._bufferSize&&(this._cursor=0,this.port.postMessage({eventType:"data",buffer:this._buffer})),this._buffer[this._cursor]=e[0][0][r];return!0}}])}(h(AudioWorkletProcessor));registerProcessor("talk-processor",e)}))).then((function(){var t=new AudioWorkletNode(e.audioContext,"talk-processor",{processorOptions:{bufferSize:e.bufferSize}});t.connect(e.gainNode),t.port.onmessage=function(t){"data"===t.data.eventType&&e._encodeAudioData(t.data.buffer)},e.workletRecorder=t}))}},{key:"_onaudioprocess",value:function(e){e=e.inputBuffer.getChannelData(0),this._encodeAudioData(new Float32Array(e))}},{key:"_encodeAudioData",value:function(e){if(0===e[0]&&0===e[1])this.log(this.tag,"empty audio data");else{var t=this.resampler.resample(e),i=t;if(16===this._opt.sampleBitsWidth?i=function(e){for(var t=e.length,i=new Int16Array(t);t--;){var r=Math.max(-1,Math.min(1,e[t]));i[t]=r<0?32768*r:32767*r}return i}(t):8===this._opt.sampleBitsWidth&&(i=function(e){for(var t=e.length,i=new Int8Array(t);t--;){var r=Math.max(-1,Math.min(1,e[t]));i[t]=parseInt(255/(65535/(32768+(r<0?32768*r:32767*r))),10)}return i}(t)),null!==i.buffer){var r=null;this._opt.encType===ge?r=function(e){var t=[];return Array.prototype.slice.call(e).forEach((function(e,i){t[i]=function(e){var t,i,r;return 0<=e?t=213:(t=85,(e=-e-1)<0&&(e=32767)),8<=(i=Bn(e,In,8))?127^t:(r=i<<4,(r|=i<2?e>>4&15:e>>i+3&15)^t)}(e)})),t}(i):this._opt.encType===me&&(r=function(e){var t=[];return Array.prototype.slice.call(e).forEach((function(e,i){t[i]=function(e){var t=0;t=e<0?(e=132-e,127):(e+=132,255);var i=Bn(e,In,8);return 8<=i?127^t:(i<<4|e>>i+3&15)^t}(e)})),t}(i));for(var n=Uint8Array.from(r),a=0;a<n.length;a++){var s=this.audioBufferList.length;this.audioBufferList[+s]=n[a],this.audioBufferList.length===this._opt.audioBufferLength&&(this._sendTalkMsg(new Uint8Array(this.audioBufferList)),this.audioBufferList=[])}}}}},{key:"_parseAudioMsg",value:function(e){var t=null;return"rtp"!==this._opt.packetType||this._opt.encType!==ge&&this._opt.encType!==me?"opus"===this._opt.packetType?t=this.opusPacket(e):"empty"===this._opt.packetType&&(t=e):t=this.rtpPacket(e),t}},{key:"rtpPacket",value:function(e){for(var t,i,r=[],n=0,a=this._opt.rtpSsrc,s=e.length,o=(s=(this._opt.encType===ge?n=8:this._opt.encType===me&&(n=0),this.startTimestamp||(this.startTimestamp=We()),i=We()-this.startTimestamp,t=this._getSequenceId(),s+12),r[0]=255&s>>8,r[1]=255&s>>0,r[2]=128,r[3]=128+n,r[4]=t/256,r[5]=t%256,r[6]=i/65536/256,r[7]=i/65536%256,r[8]=i%65536/256,r[9]=i%65536%256,r[10]=a/65536/256,r[11]=a/65536%256,r[12]=a%65536/256,r[13]=a%65536%256,r.concat(l(e))),c=new Uint8Array(o.length),u=0;u<o.length;u++)c[u]=o[u];return c}},{key:"opusPacket",value:function(e){return e}},{key:"_sendTalkMsg",value:function(e){null===this.tempTimestamp&&(this.tempTimestamp=We());var t=We(),i=t-this.tempTimestamp,r=this._parseAudioMsg(e);this.log(this.tag,"'send talk msg and diff is ".concat(i," and byteLength is ").concat(r.byteLength," and length is ").concat(r.length,", and g711 length is ")+e.length),"rtp"===this._opt.packetType&&this.addRtpToBuffer(r),r&&(this.socketStatusOpen?this.socket.send(r.buffer):this.emit(H.tallWebsocketClosedByError)),this.tempTimestamp=t}},{key:"_doTalk",value:function(){this._getUserMedia()}},{key:"_getUserMedia",value:function(){var e=this;this.log(this.tag,"getUserMedia"),void 0===window.navigator.mediaDevices&&(window.navigator.mediaDevices={}),void 0===window.navigator.mediaDevices.getUserMedia&&(this.log(this.tag,"window.navigator.mediaDevices.getUserMedia is undefined and init function"),window.navigator.mediaDevices.getUserMedia=function(e){var t=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;return t?new Promise((function(i,r){t.call(navigator,e,i,r)})):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),this._opt.checkGetUserMediaTimeout&&this._startCheckGetUserMediaTimeout(),window.navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1}).then((function(t){e.log(e.tag,"getUserMedia success"),e.userMediaStream=t,e.mediaStreamSource=e.audioContext.createMediaStreamSource(t),e.mediaStreamSource.connect(e.biquadFilter),e.recorder?(e.biquadFilter.connect(e.recorder),e.recorder.connect(e.gainNode)):e.workletRecorder&&(e.biquadFilter.connect(e.workletRecorder),e.workletRecorder.connect(e.gainNode)),e.gainNode.connect(e.audioContext.destination),e.emit(N.talkGetUserMediaSuccess),null===t.oninactive&&(t.oninactive=function(t){e._handleStreamInactive(t)})})).catch((function(t){e.error(e.tag,"getUserMedia error",t.toString()),e.emit(N.talkGetUserMediaFail,t.toString())})).finally((function(){e.log(e.tag,"getUserMedia finally"),e._stopCheckGetUserMediaTimeout()}))}},{key:"_getUserMedia2",value:function(){var e=this;this.log(this.tag,"getUserMedia"),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0}).then((function(t){e.log(e.tag,"getUserMedia2 success")})):navigator.getUserMedia({audio:!0},this.log(this.tag,"getUserMedia2 success"),this.log(this.tag,"getUserMedia2 fail"))}},{key:"_getUserMedia3",value:function(){var e=o(c().mark((function e(){var t;return c().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.log(this.tag,"getUserMedia3"),e.prev=1,e.next=4,navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1});case 4:t=e.sent,console.log("getUserMedia() got stream:",t),this.log(this.tag,"getUserMedia3 success"),e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](1),this.log(this.tag,"getUserMedia3 fail");case 11:case"end":return e.stop()}}),e,this,[[1,8]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"_handleStreamInactive",value:function(e){this.userMediaStream&&(this.error(this.tag,"stream oninactive"),this.emit(N.talkStreamInactive))}},{key:"_startCheckGetUserMediaTimeout",value:function(){var e=this;this._stopCheckGetUserMediaTimeout(),this.checkGetUserMediaTimeout=setTimeout((function(){e.log(e.tag,"check getUserMedia timeout"),e.emit(N.talkGetUserMediaTimeout)}),this._opt.getUserMediaTimeout)}},{key:"_stopCheckGetUserMediaTimeout",value:function(){this.checkGetUserMediaTimeout&&(this.log(this.tag,"stop checkGetUserMediaTimeout"),clearTimeout(this.checkGetUserMediaTimeout),this.checkGetUserMediaTimeout=null)}},{key:"_startHeartInterval",value:function(){var e=this;this.heartInterval=setInterval((function(){e.log(e.tag,"heart interval");var t=[35,36,0,0,0,0,0,0];t=new Uint8Array(t);e.socket.send(t.buffer)}),15e3)}},{key:"_stopHeartInterval",value:function(){this.heartInterval&&(this.log(this.tag,"stop heart interval"),clearInterval(this.heartInterval),this.heartInterval=null)}},{key:"startTalk",value:function(e){var t=this;return new Promise((function(i,r){return function(){var e=!1,t=window.navigator;return t?(e=!(!t.mediaDevices||!t.mediaDevices.getUserMedia))||!!(t.getUserMedia||t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia):e}()?(t.wsUrl=e,t._opt.testMicrophone?(t._doTalk(),i()):(t._createWebSocket().catch((function(e){r(e)})),t.once(N.talkGetUserMediaFail,(function(){r("getUserMedia fail")})),void t.once(N.talkGetUserMediaSuccess,(function(){i()})))):r("not support getUserMedia")}))}},{key:"setVolume",value:function(e){e=parseFloat(e).toFixed(2),isNaN(e)||(e=Ve(e,0,1),this.gainNode.gain.value=e)}},{key:"getOption",value:function(){return this._opt}},{key:"volume",get:function(){return this.gainNode?parseFloat(100*this.gainNode.gain.value).toFixed(0):null}}])}(e),Mn=function(){function e(t){A(this,e),this.player=t,this.globalSetting=null,t=nt(),this.defaultSettings={watermark_id:"JessibucaPro_"+t,watermark_prefix:"JessibucaPro_mask_"+t,watermark_txt:"JessibucaPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.player.debug.log("Watermark","int")}return y(e,[{key:"destroy",value:function(){this._removeMark(),this.globalSetting=null,this.defaultSettings={watermark_id:"",watermark_prefix:"",watermark_txt:"JessibucaPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.player.debug.log("Watermark","destroy")}},{key:"remove",value:function(){this._removeMark()}},{key:"load",value:function(e){this.globalSetting=e,this._loadMark(e)}},{key:"resize",value:function(){this.globalSetting&&this._loadMark(this.globalSetting)}},{key:"_loadMark",value:function(){var e=this.defaultSettings;if(1===arguments.length&&"object"==m(arguments[0])){var t,i=arguments[0]||{};for(t in i)i[t]&&e[t]&&i[t]===e[t]||!i[t]&&0!==i[t]||(e[t]=i[t])}var r=document.getElementById(e.watermark_id),n=(r&&r.parentNode&&r.parentNode.removeChild(r),"string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node),a=(r=n||document.body,r.getBoundingClientRect()),s=Math.max(r.scrollWidth,r.clientWidth,a.width),o=Math.max(r.scrollHeight,r.clientHeight,a.height),l=(a=arguments[0]||{},a=((a.watermark_parent_width||a.watermark_parent_height)&&r&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0),document.getElementById(e.watermark_id)),null);a?a.shadowRoot&&(l=a.shadowRoot):((a=document.createElement("div")).id=e.watermark_id,a.setAttribute("style","pointer-events: none !important; display: block !important"),l="function"==typeof a.attachShadow?a.attachShadow({mode:"open"}):a,(u=r.children)[d=Math.floor(Math.random()*(u.length-1))]?r.insertBefore(a,u[d]):r.appendChild(a)),e.watermark_cols=parseInt((s-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var c,u=parseInt((s-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=u&&e.watermark_x_space,e.watermark_rows=parseInt((o-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var d=parseInt((o-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=d&&e.watermark_y_space;for(var h=n?(c=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(c=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)),f=0;f<e.watermark_rows;f++)for(var p=n?0+e.watermark_y+(o-h)/2+(e.watermark_y_space+e.watermark_height)*f:e.watermark_y+(o-h)/2+(e.watermark_y_space+e.watermark_height)*f,g=0;g<e.watermark_cols;g++){var A=n?0+e.watermark_x+(s-c)/2+(e.watermark_width+e.watermark_x_space)*g:e.watermark_x+(s-c)/2+(e.watermark_width+e.watermark_x_space)*g,y=document.createElement("div"),v=document.createTextNode(e.watermark_txt);y.appendChild(v),y.id=e.watermark_prefix+f+g,y.style.webkitTransform="rotate(-"+e.watermark_angle+"deg)",y.style.MozTransform="rotate(-"+e.watermark_angle+"deg)",y.style.msTransform="rotate(-"+e.watermark_angle+"deg)",y.style.OTransform="rotate(-"+e.watermark_angle+"deg)",y.style.transform="rotate(-"+e.watermark_angle+"deg)",y.style.visibility="",y.style.position="absolute",y.style.left=A+"px",y.style.top=p+"px",y.style.overflow="hidden",y.style.zIndex="9999999",y.style.opacity=e.watermark_alpha,y.style.fontSize=e.watermark_fontsize,y.style.fontFamily=e.watermark_font,y.style.color=e.watermark_color,y.style.textAlign="center",y.style.width=e.watermark_width+"px",y.style.height=e.watermark_height+"px",y.style.display="block",y.style["-ms-user-select"]="none",l.appendChild(y)}}},{key:"_removeMark",value:function(){var e,t=this.defaultSettings;t=document.getElementById(t.watermark_id);t&&(e=t.parentNode)&&e.removeChild(t)}}])}(),On=function(e){function t(){var e;A(this,t);var i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e=p(this,t),Object.keys(i).forEach((function(e){if(void 0===i[e])throw new Error('Jessibuca-pro option "'.concat(e,'" can not be undefined'))}));var r=Lt();r=Object.assign({},r,i);r.url="";var n=i.container;if(!(n="string"==typeof i.container?document.querySelector(i.container):n))throw new Error("Jessibuca-pro need container option");if("CANVAS"===n.nodeName||"VIDEO"===n.nodeName)throw new Error("Jessibuca-pro container type can not be ".concat(n.nodeName," type"));if(r.videoBuffer>=r.heartTimeout)throw new Error("Jessibuca-pro videoBuffer ".concat(r.videoBuffer,"s must be less than heartTimeout ").concat(r.heartTimeout,"s"));if(n.classList.add("jessibuca-container"),Mt(r.isLive)){var a=document.createElement("video");a.muted=!0,a.setAttribute("controlsList","nodownload"),a.disablePictureInPicture="disablePictureInPicture",a.style.position="absolute",a.style.top=0,a.style.left=0,a.style.height="100%",a.style.width="100%",n.appendChild(a),e.$videoElement=a,e.$container=n,e._opt=r}else delete r.container,dt(r.videoBuffer)&&(r.videoBuffer=1e3*Number(r.videoBuffer)),dt(r.videoBufferDelay)&&(r.videoBufferDelay=1e3*Number(r.videoBufferDelay)),dt(r.networkDelay)&&(r.networkDelay=1e3*Number(r.networkDelay)),dt(r.timeout)&&(ct(r.loadingTimeout)&&(r.loadingTimeout=r.timeout),ct(r.heartTimeout))&&(r.heartTimeout=r.timeout),r.isMulti&&(r.debugUuid="xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))),e._opt=r,e._destroyed=!1,e.$container=n,e._loadingTimeoutReplayTimes=0,e._heartTimeoutReplayTimes=0,e.events=new Ot(e),e.debug=new Oe(e),e.watermark=new Mn(e),e._initPlayer(n,r),e._initWatermark();return e}return g(t,e),y(t,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,i){e._destroyed=!0,e.off(),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.removeChild(e.$videoElement),e.$videoElement=null),e.player?e.player.destroy().then((function(){e.player=null,e._destroy(),t()})).catch((function(){})):(e._destroy(),t())}))}},{key:"_destroy",value:function(){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.$container.classList.remove("jessibuca-container"),this.$container=null,this._resetOpt(),this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.debug&&this.debug.log("jessibuca","destroy")}},{key:"_resetOpt",value:function(){this._opt=Lt()}},{key:"_initPlayer",value:function(e,t){this.player=new xn(e,t),this.debug.log("jessibuca","_initPlayer",this.player.getOption()),this._bindEvents()}},{key:"_initTalk",value:function(){var e=0<arguments.length&&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 Pn(this.player,e),this.debug.log("jessibuca","_initTalk",this.talk.getOption()),this._bindTalkEvents()}},{key:"_resetPlayer",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(i,r){var n=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,n(),i()})):(n(),i())}))}},{key:"_bindEvents",value:function(){var e=this;Object.keys(G).forEach((function(t){e.player.on(G[t],(function(i){e.emit(t,i)}))})),this.player.once(N.beforeDestroy,(function(){e.emit(N.close),e.destroy().then((function(){})).catch((function(e){}))})),this.player.on(N.resize,(function(){e.watermark&&e.watermark.resize(),e.player.singleWatermark&&e.player.singleWatermark.resize()})),this.player.on(N.fullscreen,(function(){e.watermark&&e.watermark.resize(),e.player.singleWatermark&&e.player.singleWatermark.resize()})),this.player.on(N.videoInfo,(function(){e.player.singleWatermark&&e.player.singleWatermark.resize()}))}},{key:"_bindTalkEvents",value:function(){var e=this;Object.keys(z).forEach((function(t){e.player.on(z[t],(function(i){e.emit(t,i)}))}))}},{key:"_initWatermark",value:function(){var e;vt(this._opt.fullscreenWatermarkConfig)&&((e=ft(this.$container,this._opt.fullscreenWatermarkConfig)).watermark_txt?this.watermark.load(e):this.debug.warn("jessibuca","fullscreenWatermarkConfig text is empty"))}},{key:"isDestroyed",value:function(){return this._destroyed}},{key:"getOption",value:function(){return this.player?this.player.getOption():{}}},{key:"setDebug",value:function(e){this.player&&this.player.updateOption({debug:!!e})}},{key:"getIsDebug",value:function(){var e=!1;return this.player?this.player._opt.debug:e}},{key:"mute",value:function(){this.player&&this.player.mute(!0)}},{key:"cancelMute",value:function(){this.player&&this.player.mute(!1)}},{key:"setVolume",value:function(e){this.player&&(this.player.volume=e)}},{key:"getVolume",value:function(){var e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}},{key:"audioResume",value:function(){this.player&&this.player.audio&&this.player.audio.audioEnabled(!0)}},{key:"setTimeout",value:function(e){e=Number(e),this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}},{key:"setScaleMode",value:function(e){this.player&&this.player.setScaleMode(e)}},{key:"pause",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return new Promise((function(i,r){e.player?e.player.pause(t).then((function(e){i(e)})).catch((function(e){r(e)})):r("player is null")}))}},{key:"close",value:function(){var e=this;return new Promise((function(t,i){e._opt.url="",e._loadingTimeoutReplayTimes=0,e._heartTimeoutReplayTimes=0,e.player?e.player.close().then((function(){t()})).catch((function(e){i(e)})):i("player is null")}))}},{key:"clearView",value:function(){this.player&&this.player.video?this.getRenderType()===_?this.player.video.clearView():this.debug.warn("jessibuca","clearView","render type is video, not support clearView, please use canvas render type"):this.debug.warn("jessibuca","clearView","player is null")}},{key:"play",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r,n){if(t||e._opt.url)if(t=t&&(""+t).trim(),Mt(e._opt.isLive))e.$videoElement.controls="controls",e.$videoElement.muted=!1,e.$videoElement.src=t,e.$videoElement.play(),r(e.$videoElement);else{if(e._opt.isCrypto){var a,s=i.cryptoKey||e._opt.playOptions.cryptoKey,o=i.cryptoIV||e._opt.playOptions.cryptoIV;if(!s||!o)return a=t||e._opt.url,void e._cryptoPlay(a).then((function(a){var s=a,o=(a=s.cryptoIV,s.cryptoKey);e._opt.playOptions.cryptoKey=o,e._opt.playOptions.cryptoIV=a,i.cryptoIV=a,i.cryptoKey=o,e._playBefore(t,i).then((function(){r()})).catch((function(e){n(e)}))})).catch((function(e){n(e)}));e._opt.playOptions.cryptoKey=s,e._opt.playOptions.cryptoIV=o,i.cryptoIV=o,i.cryptoKey=s}e._playBefore(t,i).then((function(){r()})).catch((function(e){n(e)}))}else e.emit(N.error,H.playError),n("url is null and this._opt.url is null")}))}},{key:"_playBefore",value:function(e,t){var i=this;return new Promise((function(r,n){i.player?e?i._opt.url?e===i._opt.url?i.player.playing?(i.debug.log("jessibuca","_playBefore","playing and resolve()"),r()):(i.debug.log("jessibuca","_playBefore","pause -> play"),i.player.play(i._opt.url,i._opt.playOptions).then((function(){r(),i.player.resumeAudioAfterPause()})).catch((function(e){i.debug.error("Jessibuca","_playBefore this.player.play error",e),i.emit(N.crashLog,i.getCrashLog("this.player.play 1",e)),i.player.pause().then((function(){n(e)}))}))):i.player.pause().then((function(){i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(N.crashLog,i.getCrashLog("this.player.play 2",e)),n(e)}))})).catch((function(e){i.debug.error("Jessibuca","this.player.pause error",e),n(e)})):i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(N.crashLog,i.getCrashLog("this.player.play 3",e)),n(e)})):i.player.play(i._opt.url,i._opt.playOptions).then((function(){r(),i.player.resumeAudioAfterPause()})).catch((function(e){i.debug.error("Jessibuca","this.player.play error",e),i.emit(N.crashLog,i.getCrashLog("this.player.play 4",e)),i.player.pause().then((function(){n(e)}))})):e?i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(N.crashLog,i.getCrashLog("this.player.play 5",e)),n(e)})):i._play(i._opt.url,i._opt.playOptions).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(N.crashLog,i.getCrashLog("this.player.play 6",e)),n(e)}))}))}},{key:"_cryptoPlay",value:function(e){var t=this;return new Promise((function(i,r){var n,a=function(){var t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/"),r=t[1].substring(i);return-1!=r.indexOf("?")?r.split("?")[0]:r}(),s=t._opt.cryptoKeyUrl,o="";if(s)o=s;else{var l=function(e){var t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a"),r=e;return t&&(i.setAttribute("href",r),r=i.href),i.setAttribute("href",r),{origin:i.origin,href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}(e);s=l.origin+"/crypto/",o=s+"?stream="+a}n=o,new Promise((function(e,t){cr.get(n).then((function(t){e(t)})).catch((function(e){t(e)}))})).then((function(e){if(e){var t=e.split("."),n=Dt(t[0]),a=Dt(t[1]);a&&n?i({cryptoIV:a,cryptoKey:n}):r("get cryptoIV or cryptoKey error")}else r("cryptoKeyUrl: getM7SCryptoStreamKey ".concat(o," res is null"))})).catch((function(e){r(e)}))}))}},{key:"playback",value:function(e){var t=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r,n){if(Mt(t._opt.isLive))return n("this._opt.isLive is false, can not playback");var a=It();a=Object.assign({},a.playbackConfig,t._opt.playbackConfig,i);a.isUseFpsRender||a.isCacheBeforeDecodeForFpsRender&&(a.isCacheBeforeDecodeForFpsRender=!1,t.debug.error("Jessibuca","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===a.rateConfig.length&&a.showRateBtn&&(a.showRateBtn=!1,t.debug.error("Jessibuca","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),t._resetPlayer({videoBuffer:0,playbackConfig:a,playType:v,openWebglAlignment:!0,useMSE:!1,useWCS:!1,useSIMD:!0}).then((function(){t.play(e).then((function(){r()})).catch((function(e){n(e)}))})).catch((function(e){n(e)}))}))}},{key:"playbackPause",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this._opt.playType===s?Promise.reject("playType is player, can not call playbackPause method"):new Promise((function(i,r){if(!e.player)return r("player is null");Pt(t)?e.pause().then((function(){i()})).catch((function(e){r(e)})):(e.player.playbackPause=!0,i())}))}},{key:"playbackResume",value:function(){var e=this;return this._opt.playType===s?Promise.reject("playType is player, can not call playbackResume method"):new Promise((function(t,i){if(!e.player)return i();e.player.playbackPause=!1,t()}))}},{key:"forward",value:function(e){var t=this;return Mt(this._opt.isLive)||this._opt.playType===s?Promise.reject("forward() method only just for playback type"):st(Number(e))?new Promise((function(i,r){(t.player&&t.player.playing?(e=Ve(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),i):r)()})):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){e=Number(e),e=Ve(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player&&this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e})}},{key:"setPlaybackStartTime",value:function(e){var t=yt(e);this.player&&this.player.isPlayback()&&(t<10&&0!==e||this.player.playing&&(10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()))}},{key:"playbackClearCacheBuffer",value:function(){this.player&&this.player.isPlayback()&&(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.player.decoderWorker.clearWorkBuffer(!0))}},{key:"getPlaybackCurrentRate",value:function(){return this.player&&this.player.isPlayback()?this.player.playback.rate:1}},{key:"updatePlaybackLocalOneFrameTimestamp",value:function(e){this.player&&this.player.isPlayback()&&this.player.playback.updateLocalOneFrameTimestamp(e)}},{key:"setStreamQuality",value:function(e){this.player&&this.player._opt.operateBtns.quality&&(this.player._opt.qualityConfig||[]).includes(e)&&(this.player.streamQuality=e)}},{key:"_play",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r,n){e.player||n("player is null");var a=!1;e._opt.url&&e._opt.url!==t&&(a=!0),e._opt.url=t,e._opt.playOptions=i;var s=0===t.indexOf("http"),o=0===t.indexOf("webrtc"),l=0===t.indexOf("wt"),c=!o&&-1!==t.indexOf(".m3u8"),u=!o&&-1!==t.indexOf(".flv"),d=s?c?3:2:l?5:o?4:1;s=e._opt.isNakedFlow?T:s&&!c||u||e._opt.isFlv?k:c?"hls":o?"webrtc":l?E:"m7s";if(u&&!e._opt.isFlv&&(e._opt.isFlv=!0),!d||!s)return n("play protocol is ".concat(d,", demuxType is ")+s);var h=function(){e.player.once(H.webglAlignmentError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.webglAlignmentError,t)),e.pause().then((function(){if(e.player._opt.webglAlignmentErrorReplay){e.debug.log("Jessibuca","webglAlignmentError");var t=e._opt.url;e._resetPlayer({openWebglAlignment:!0}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","webglAlignmentError and play success")})).catch((function(t){e.debug.error("Jessibuca","webglAlignmentError and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","webglAlignmentError and _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.webglAlignmentError),e.debug.log("Jessibuca","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((function(t){e.debug.error("Jessibuca","webglAlignmentError and pause error",t)}))})),e.player.once(H.webglContextLostError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.webglContextLostError,t)),e.pause().then((function(){if(e.player._opt.webglContextLostErrorReplay){e.debug.log("Jessibuca","webglContextLostError");var t,i=e._opt.url,r={};e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","webglContextLostError and play success")})).catch((function(t){e.debug.error("Jessibuca","webglContextLostError and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","webglContextLostError and _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.webglContextLostError),e.debug.log("Jessibuca","webglContextLostError and webglContextLostErrorReplay is false")})).catch((function(t){e.debug.error("Jessibuca","webglAlignmentError and pause error",t)}))})),e.player.once(H.mediaSourceH265NotSupport,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceH265NotSupport,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.mediaSourceH265NotSupport),e.debug.log("Jessibuca","mediaSourceH265NotSupport and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceH265NotSupport and pause error",t)}))})),e.player.once(H.mediaSourceFull,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceFull,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","mediaSourceFull and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mediaSourceFull and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceFull and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceFull and _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.mediaSourceFull),e.debug.log("Jessibuca","mediaSourceFull and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceFull and pause error",t)}))})),e.player.once(H.mediaSourceAppendBufferError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceAppendBufferError,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","mediaSourceAppendBufferError and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mediaSourceAppendBufferError and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceAppendBufferError and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceAppendBufferError and _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.mediaSourceAppendBufferError),e.debug.log("Jessibuca","mediaSourceAppendBufferError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceAppendBufferError and pause error",t)}))})),e.player.once(H.mediaSourceBufferListLarge,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceBufferListLarge,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","media source buffer list large and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","media source buffer list large and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","media source buffer list large and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","media source buffer list large and _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.mediaSourceBufferListLarge),e.debug.log("Jessibuca","media source buffer list large and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","media source buffer list large and pause error",t)}))})),e.player.once(H.mediaSourceAppendBufferEndTimeout,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceAppendBufferEndTimeout,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","media source append buffer end timeout and auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","media source append buffer end timeout and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","media source append buffer end timeout and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","media source append buffer end timeout and _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.mediaSourceAppendBufferEndTimeout),e.debug.log("Jessibuca","media source append buffer end timeout and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","media source append buffer end timeout and pause error",t)}))})),e.player.once(H.mseSourceBufferError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mseSourceBufferError,t)),e.pause().then((function(){if(e.player._opt.mseDecodeErrorReplay){e.debug.log("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else e.emit(N.playFailedAndPaused,H.mseSourceBufferError),e.debug.log("Jessibuca","mseSourceBufferError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mseSourceBufferError and pause error",t)}))})),e.player.once(H.mseAddSourceBufferError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mseAddSourceBufferError,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else e.emit(N.playFailedAndPaused,H.mseAddSourceBufferError),e.debug.log("Jessibuca","mseAddSourceBufferError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mseAddSourceBufferError and pause error",t)}))})),e.player.once(H.mediaSourceDecoderConfigurationError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceDecoderConfigurationError,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else e.debug.log("Jessibuca","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceDecoderConfigurationError and pause error",t)}))})),e.player.once(H.mediaSourceTsIsMaxDiff,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceTsIsMaxDiff,t)),e.pause().then((function(){if(e.player._opt.mediaSourceTsIsMaxDiffReplay){e.debug.log("Jessibuca","mediaSourceTsIsMaxDiff reset player and play");var t=e._opt.url,i={};i.loadingBackground=e.screenshot("","png",.92,"base64"),e._resetPlayer(i).then((function(){e.play(t).then((function(){})).catch((function(t){e.debug.error("Jessibuca","mediaSourceTsIsMaxDiff replay error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceTsIsMaxDiff _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,H.mediaSourceTsIsMaxDiff),e.debug.log("Jessibuca","mediaSourceTsIsMaxDiff and replay is false")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceTsIsMaxDiff and pause error",t)}))})),e.player.once(H.mseWidthOrHeightChange,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mseWidthOrHeightChange,t)),e.debug.log("Jessibuca","mseWidthOrHeightChange and reset player and play");var i=e._opt.url,r=e.screenshot("","png",.92,"base64");e._resetPlayer({loadingBackground:r}).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","mseWidthOrHeightChange and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","mseWidthOrHeightChange and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mseWidthOrHeightChange and _resetPlayer error",t)}))})),e.player.once(H.mediaSourceUseCanvasRenderPlayFailed,(function(t){e.emit(N.crashLog,e.getCrashLog(H.mediaSourceUseCanvasRenderPlayFailed,t)),e.debug.log("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and reset player"),e.pause().then((function(){e._resetPlayer().then((function(){e.debug.log("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and reset player success")})).catch((function(t){e.debug.error("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and reset player error",t)}))})).catch((function(t){e.debug.error("Jessibuca","mediaSourceUseCanvasRenderPlayFailed and pause",t)}))})),e.player.once(H.webcodecsH265NotSupport,(function(t){e.emit(N.crashLog,e.getCrashLog(H.webcodecsH265NotSupport,t)),e.pause().then((function(){if(e.player._opt.autoWasm){e.debug.log("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");var t=e._opt.url;e._resetPlayer({useMSE:!1,useWCS:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else e.emit(N.playFailedAndPaused,H.webcodecsH265NotSupport),e.debug.log("Jessibuca","webcodecsH265NotSupport and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","webcodecsH265NotSupport and pause error",t)}))})),e.player.once(H.webcodecsDecodeError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.webcodecsDecodeError,t)),e.pause().then((function(){if(e.player._opt.wcsDecodeErrorReplay){e.debug.log("Jessibuca","webcodecs decode error reset player and play");var t,i=e._opt.url,r={};e.player._opt.autoWasm&&(r={useMSE:!1,useWCS:!1}),e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","webcodecs decode error reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","webcodecs decode error reset player and play error",t)}))})).catch((function(){e.debug.error("Jessibuca","webcodecs decode error _resetPlayer error")}))}else e.emit(N.playFailedAndPaused,H.webcodecsDecodeError),e.debug.log("Jessibuca","webcodecs decode error and autoWasm is false")})).catch((function(t){e.debug.error("Jessibuca","webcodecs decode error and pause error",t)}))})),e.player.once(H.wcsWidthOrHeightChange,(function(t){e.emit(N.crashLog,e.getCrashLog(H.wcsWidthOrHeightChange,t)),e.debug.log("Jessibuca","wcsWidthOrHeightChange and reset player and play");var i=e._opt.url,r=e.screenshot("","png",.92,"base64");e._resetPlayer({loadingBackground:r}).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wcsWidthOrHeightChange and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wcsWidthOrHeightChange and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wcsWidthOrHeightChange and _resetPlayer error",t)}))})),e.player.once(H.wasmDecodeError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.wasmDecodeError,t)),e.pause().then((function(){if(e.player._opt.wasmDecodeErrorReplay){e.debug.log("Jessibuca","wasm decode error and reset player and play");var t,i=e._opt.url,r={};e.player._opt.replayUseLastFrameShow&&(t=e.screenshot("","png",.92,"base64"),r.loadingBackground=t),e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasm decode error and reset player and play error",t)}))})).catch((function(){e.debug.error("Jessibuca","wasm decode error and _resetPlayer error")}))}else e.emit(N.playFailedAndPaused,H.wasmDecodeError),e.debug.log("Jessibuca","wasm decode error and wasmDecodeErrorReplay is false")})).catch((function(t){e.debug.error("Jessibuca","wasm decode error and pause error",t)}))})),e.player.once(H.wasmDecodeVideoNoResponseError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.wasmDecodeVideoNoResponseError,t)),e.pause().then((function(){e.debug.log("Jessibuca","wasm decode video no response error and reset player and play");var t=e._opt.url,i={};if(e.player._opt.replayUseLastFrameShow){var r=e.screenshot("","png",.92,"base64");i.loadingBackground=r}e._resetPlayer(i).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","wasm decode video no response error and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasm decode video no response error and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wasm decode video no response error and _resetPlayer error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wasm decode video no response error and pause error",t)}))})),e.player.once(H.wasmWidthOrHeightChange,(function(t){e.emit(N.crashLog,e.getCrashLog(H.wasmWidthOrHeightChange,t)),e.debug.log("Jessibuca","wasmWidthOrHeightChange and reset player and play");var i=e._opt.url,r=e.screenshot("","png",.92,"base64");e._resetPlayer({loadingBackground:r}).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wasmWidthOrHeightChange and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasmWidthOrHeightChange and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","wasmWidthOrHeightChange and _resetPlayer error",t)}))})),e.player.once(H.simdH264DecodeVideoWidthIsTooLarge,(function(t){e.emit(N.crashLog,e.getCrashLog(H.simdH264DecodeVideoWidthIsTooLarge,t)),e.pause().then((function(){e.debug.log("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play");var t=e._opt.url;e._resetPlayer({useSIMD:!1}).then((function(){e.play(t).then((function(){e.debug.log("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)}))})).catch((function(t){e.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))})).catch((function(t){e.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and pause error",t)}))})),e.player.once(N.networkDelayTimeout,(function(t){if(e.player._opt.networkDelayTimeoutReplay){e.emit(N.crashLog,e.getCrashLog(N.networkDelayTimeout,t)),e.debug.log("Jessibuca","network delay time out and reset player and play");var i=e._opt.url,r={};if(e.player._opt.replayUseLastFrameShow){var n=e.screenshot("","png",.92,"base64");r.loadingBackground=n}e._resetPlayer(r).then((function(){e.play(i).then((function(){e.debug.log("Jessibuca","wasm decode error and reset player and play success")})).catch((function(t){e.debug.error("Jessibuca","wasm decode error and reset player and play error",t)}))})).catch((function(){e.debug.error("Jessibuca","wasm decode error and _resetPlayer error")}))}})),e.player.once(H.fetchError,(function(t){e.emit(N.crashLog,e.getCrashLog(H.fetchError,t)),e.debug.log("Jessibuca","fetch error and reset player"),e.pause().then((function(){e._resetPlayer().then((function(){})).catch((function(){}))})).catch((function(t){e.debug.error("Jessibuca","fetch error and pause",t)}))})),e.player.on(N.delayTimeout,(function(t){e.emit(N.crashLog,e.getCrashLog(N.delayTimeout,t)),e.pause().then((function(){if(e.player&&e.player._opt.heartTimeoutReplay&&(e._heartTimeoutReplayTimes<e.player._opt.heartTimeoutReplayTimes||-1===e.player._opt.heartTimeoutReplayTimes))if(e.debug.log("Jessibuca","delay timeout replay time is ".concat(e._heartTimeoutReplayTimes," and heartTimeoutReplayTimes is ")+e.player._opt.heartTimeoutReplayTimes),e.isDestroyed())e.debug&&e.debug.warn("Jessibuca","delay timeout replay but player is destroyed");else{e._heartTimeoutReplayTimes+=1;var t=e._opt.url,i={};(e.player._opt.heartTimeoutReplayUseLastFrameShow||e.player._opt.replayUseLastFrameShow)&&(i.loadingBackground=e.screenshot("","png",.92,"base64")),e._resetPlayer(i).then((function(){e.play(t).then((function(){})).catch((function(t){e.debug.error("Jessibuca","delay timeout replay error",t)}))})).catch((function(t){e.debug.error("Jessibuca","delay timeout _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,N.delayTimeout),e.player&&e.player.emit(N.delayTimeoutRetryEnd),e.debug.warn("Jessibuca","delayTimeoutRetryEnd and\n opt.heartTimeout is ".concat(e.player&&e.player._opt.heartTimeout," and\n opt.heartTimeoutReplay is ").concat(e.player&&e.player._opt.heartTimeoutReplay," and\n opt.heartTimeoutReplayTimes is ").concat(e.player&&e.player._opt.heartTimeoutReplayTimes,",and\n local._heartTimeoutReplayTimes is ")+e._heartTimeoutReplayTimes)})).catch((function(t){e.debug.error("Jessibuca","delay timeout and pause error",t)}))})),e.player.on(N.loadingTimeout,(function(t){e.emit(N.crashLog,e.getCrashLog(N.loadingTimeout,t)),e.pause().then((function(){if(e.player&&e.player._opt.loadingTimeoutReplay&&(e._loadingTimeoutReplayTimes<e.player._opt.loadingTimeoutReplayTimes||-1===e.player._opt.loadingTimeoutReplayTimes))if(e.debug.log("Jessibuca","loading timeout and\n replay time is ".concat(e._loadingTimeoutReplayTimes," and\n loadingTimeoutReplayTimes is ")+e.player._opt.loadingTimeoutReplayTimes),e.isDestroyed())e.debug&&e.debug.warn("Jessibuca","delay timeout replay but player is destroyed");else{e._loadingTimeoutReplayTimes+=1;var t=e._opt.url;e._resetPlayer().then((function(){e.play(t).then((function(){})).catch((function(t){e.debug.error("Jessibuca","loading timeout replay error",t)}))})).catch((function(t){e.debug.error("Jessibuca","loading timeout _resetPlayer error",t)}))}else e.emit(N.playFailedAndPaused,N.loadingTimeout),e.player&&e.player.emit(N.loadingTimeoutRetryEnd),e.debug.log("Jessibuca","loadingTimeoutRetryEnd and\n opt.loadingTimeout is ".concat(e.player&&e.player._opt.loadingTimeout," and\n opt.loadingTimeoutReplay is ").concat(e.player&&e.player._opt.loadingTimeoutReplay," and\n local._loadingTimeoutReplayTimes time is ").concat(e._loadingTimeoutReplayTimes," and\n opt.loadingTimeoutReplayTimes is ")+(e.player&&e.player._opt.loadingTimeoutReplayTimes))})).catch((function(t){e.debug.error("Jessibuca","loading timeout and pause error",t)}))})),e.hasLoaded()?e.player.play(t,i).then((function(){r()})).catch((function(t){e.debug.error("Jessibuca","hasLoaded and play error",t),e.emit(N.crashLog,e.getCrashLog("hasLoaded and play error",t)),e.player.pause().then((function(){n(t)})).catch((function(t){e.debug.error("Jessibuca","hasLoaded and play error and next pause error",t)}))})):e.player.once(N.decoderWorkerInit,(function(){e.player.play(t,i).then((function(){r()})).catch((function(t){e.debug.error("Jessibuca","decoderWorkerInit and play error",t),e.emit(N.crashLog,e.getCrashLog("decoderWorkerInit and play error",t)),e.player.pause().then((function(){n(t)})).catch((function(t){e.debug.error("Jessibuca","decoderWorkerInit and play error and next pause error",t)}))}))}))};c||o||a?e._resetPlayer({protocol:d,demuxType:s,isHls:c,isWebrtc:o}).then((function(){h()})).catch((function(e){n("reset player error")})):(e.player.updateOption({protocol:d,demuxType:s,isFlv:e._opt.isFlv,cryptoKey:i.cryptoKey||"",cryptoIV:i.cryptoIV||""}),i.cryptoKey&&i.cryptoIV&&(e.player.decoderWorker&&e.player.decoderWorker.updateWorkConfig({key:"cryptoKey",value:i.cryptoKey}),e.player.decoderWorker)&&e.player.decoderWorker.updateWorkConfig({key:"cryptoIV",value:i.cryptoIV}),h())}))}},{key:"resize",value:function(){this.player&&this.player.resize()}},{key:"setBufferTime",value:function(e){e=Number(e),this.player&&(10<e&&console.warn("Jessibuca buffer time is ".concat(e," second, is too large, video will show blank screen until cache ").concat(e," second buffer data")),this.player.updateOption({videoBuffer:1e3*e}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"videoBuffer",value:1e3*e})}},{key:"setBufferDelayTime",value:function(e){e=Number(e),this.player&&(e<.2&&console.warn("Jessibuca buffer time delay is ".concat(e," second, is too small")),e=Ve(e,.2,100),this.player.updateOption({videoBufferDelay:1e3*e}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"videoBufferDelay",value:1e3*e})}},{key:"setRotate",value:function(e){e=parseInt(e,10),this.player&&this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)&&(this.player.updateOption({rotate:e}),this.resize())}},{key:"setMirrorRotate",value:function(e){this.player&&this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)&&(this.player.updateOption({mirrorRotate:e}),this.resize())}},{key:"hasLoaded",value:function(){return this.player&&this.player.loaded||!1}},{key:"setKeepScreenOn",value:function(){this.player&&this.player.updateOption({keepScreenOn:!0})}},{key:"setFullscreen",value:function(e){e=!!e,this.player&&this.player.fullscreen!==e&&(this.player.fullscreen=e)}},{key:"screenshot",value:function(e,t,i,r){return this.player&&this.player.video?this.player.video.screenshot(e,t,i,r):null}},{key:"screenshotWatermark",value:function(e){return this.player&&this.player.video?this.player.video.screenshotWatermark(e):null}},{key:"startRecord",value:function(e,t){var i=this;return new Promise((function(r,n){if(!i.player)return n();(i.player.playing?(i.player.startRecord(e,t),r):n)()}))}},{key:"stopRecordAndSave",value:function(e,t){var i=this;return new Promise((function(r,n){i.player&&i.player.recording?i.player.stopRecordAndSave(e,t).then((function(e){r(e)})).catch((function(e){n(e)})):n("not recording")}))}},{key:"isPlaying",value:function(){var e=!1;return this.player&&(this._opt.playType===s?e=this.player.playing:this._opt.playType===v&&(e=Mt(this.player.playbackPause)&&this.player.playing)),e}},{key:"isLoading",value:function(){return!!this.player&&this.player.loading}},{key:"isPause",value:function(){var e=!1;return this._opt.playType===s?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===v&&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===v&&this.player?this.player.playbackPause:e}},{key:"isMute",value:function(){var e=!0;return this.player?this.player.isAudioMute():e}},{key:"isRecording",value:function(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}},{key:"clearBufferDelay",value:function(){this.player&&this.player.clearBufferDelay()}},{key:"setNetworkDelayTime",value:function(e){e=Number(e),this.player&&(e<1&&console.warn("Jessibuca network delay is ".concat(e," second, is too small")),e=Ve(e,1,100),this.player.updateOption({networkDelay:1e3*e}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"networkDelay",value:1e3*e})}},{key:"getDecodeType",value:function(){var e="";return this.player?this.player.getDecodeType():e}},{key:"getRenderType",value:function(){var e="";return this.player?this.player.getRenderType():e}},{key:"getAudioEngineType",value:function(){var e="";return this.player?this.player.getAudioEngineType():e}},{key:"getPlayingTimestamp",value:function(){var e=0;return this.player?this.player.getPlayingTimestamp():e}},{key:"getStatus",value:function(){var e="destroy";return this.player?this.player.loading?"loading":this.player.playing?"playing":"paused":e}},{key:"getPlayType",value:function(){return this.player?this.player._opt.playType:s}},{key:"togglePerformancePanel",value:function(e){var t=this.player._opt.showPerformance,i=!t;(i=ut(e)?e:i)!==t&&this.player&&this.player.togglePerformancePanel(i)}},{key:"openZoom",value:function(){this.player&&(this.player.zooming=!0)}},{key:"closeZoom",value:function(){this.player&&(this.player.zooming=!1)}},{key:"isZoomOpen",value:function(){var e=!1;return this.player?this.player.zooming:e}},{key:"expandZoom",value:function(){this.player&&this.player.zoom&&this.player.zooming&&this.player.zoom.expandPrecision()}},{key:"narrowZoom",value:function(){this.player&&this.player.zoom&&this.player.zooming&&this.player.zoom.narrowPrecision()}},{key:"getCurrentZoomIndex",value:function(){var e=1;return this.player&&this.player.zoom?this.player.zoom.currentZoom:e}},{key:"startTalk",value:function(e){var t=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(r,n){t._initTalk(i),t.talk.startTalk(e).then((function(){r(),t.talk.once(N.talkStreamClose,(function(){t.stopTalk().catch((function(e){}))})),t.talk.once(N.talkStreamError,(function(){t.stopTalk().catch((function(e){}))})),t.talk.once(N.talkStreamInactive,(function(){t.stopTalk().catch((function(e){}))}))})).catch((function(e){n(e)}))}))}},{key:"stopTalk",value:function(){var e=this;return new Promise((function(t,i){e.talk||i("talk is not init"),e.talk.destroy(),t()}))}},{key:"getTalkVolume",value:function(){var e=this;return new Promise((function(t,i){e.talk||i("talk is not init"),t(e.talk.volume)}))}},{key:"setTalkVolume",value:function(e){var t=this;return new Promise((function(i,r){t.talk||r("talk is not init"),t.talk.setVolume(e/100),i()}))}},{key:"setNakedFlowFps",value:function(e){var t=this;return new Promise((function(i,r){var n;return t.player?ct(e)?r("fps is empty"):(n=Ve(n=Number(e),1,100),void t.player.updateOption({nakedFlowFps:n})):r("player is not init")}))}},{key:"getCrashLog",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"";if(this.player){var i=this.player.getAllStatsData(),r=this.player;i={url:this._opt.url,playType:r.isPlayback()?"playback":"live",demuxType:r.getDemuxType(),decoderType:r.getDecodeType(),renderType:r.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:r.getAudioEngineType(),allTimes:i.pTs,timestamp:We(),type:e,error:function(e){var t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:try{return e instanceof Error}catch(e){}}}(e)?e.message:null==e?"":"object"==m(e)?JSON.stringify(e,null,2):String(e)}(t)||e};if(r.video){var n=r.video.videoInfo||{};i.videoInfo={encType:n.encType||"",width:n.width||"",height:n.height||""}}if(r.audio){var a=r.audio.audioInfo||{};i.audioInfo={encType:a.encType||"",sampleRate:a.sampleRate||"",channels:a.channels||""}}return i}}},{key:"updateDebugLevel",value:function(e){!this.player||e!==R&&e!==D||e!==this.player._opt.debugLevel&&(this.player.updateOption({debugLevel:e}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"debugLevel",value:e})}},{key:"updateWatermark",value:function(e){this.player&&this.player.updateWatermark(e)}},{key:"removeWatermark",value:function(){this.player&&this.player.removeWatermark()}},{key:"updateFullscreenWatermark",value:function(e){vt(e)&&(this._opt.fullscreenWatermarkConfig=e,(e=ft(this.$container,e)).watermark_txt?this.watermark.load(e):this.debug.warn("jessibuca","fullscreenWatermarkConfig text is empty"))}},{key:"removeFullscreenWatermark",value:function(){this.watermark&&this.watermark.remove()}},{key:"faceDetectOpen",value:function(){this.player&&this.player.faceDetect(!0)}},{key:"faceDetectClose",value:function(){this.player&&this.player.faceDetect(!1)}},{key:"objectDetectOpen",value:function(){this.player&&this.player.objectDetect(!0)}},{key:"objectDetectClose",value:function(){this.player&&this.player.objectDetect(!1)}},{key:"sendWebsocketMessage",value:function(e){this.player?this.player.sendWebsocketMessage(e):this.debug.warn("jessibuca","player is not init")}},{key:"addContentToCanvas",value:function(e){this.player&&this.player.addContentToCanvas(e)}},{key:"clearContentToCanvas",value:function(){this.player&&this.player.addContentToCanvas([])}},{key:"setControlHtml",value:function(e){this.player&&this.player.setControlHtml(e)}},{key:"clearControlHtml",value:function(){this.player&&this.player.clearControlHtml()}},{key:"downloadTempNakedFlowFile",value:function(){var e=this;return new Promise((function(t,i){e.player?(e.player.downloadNakedFlowFile(),t()):i("player is not init")}))}},{key:"downloadTempRtpFile",value:function(){var e=this;return new Promise((function(t,i){e.talk?(e.talk.downloadRtpFile(),t()):i("talk is not init")}))}}])}(e);On.ERROR=H,On.EVENTS=G,window.JessibucaPro=On;var Fn=function(t){function i(){var e;A(this,i);var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};e=p(this,i),Object.keys(t).forEach((function(e){if(void 0===t[e])throw new Error('Jessibuca-pro-multi option "'.concat(e,'" can not be undefined'))}));var r=xt(Ie);e._opt=Object.assign({},r,t),e.LOG_TAG="jessibucaProMulti";var n=t.container;if(!(n="string"==typeof t.container?document.querySelector(t.container):n))throw new Error("Jessibuca-pro-multi need container option");if("CANVAS"===n.nodeName||"VIDEO"===n.nodeName)throw new Error("Jessibuca-pro-multi container type can not be ".concat(n.nodeName," type"));return n.classList.add("jessibuca-multi-container"),e.maxWindowSize=e._opt.maxSplit*e._opt.maxSplit,e.currentWindowIndex=-1,e.specialLayoutType=null,e.windowList=[],e.$container=n,e.debug=new Oe(e),e.events=new Ot(e),e._initWindows(),e._initEvents(),e._handleWindowSelect(0),e._listenFullscreenChange(),e}return g(i,t),y(i,[{key:"destroy",value:function(){var e=this;return new Promise((function(t,i){if(e.off(),e.events&&(e.events.destroy(),e.events=null),e.specialLayoutType=null,e.windowList){var r=[];e.windowList.forEach((function(e){e.$playerContainerEvents.forEach((function(e){e()})),e.player&&r.push(e.player.destroy())})),Promise.all(r).then((function(){e.windowList.forEach((function(e){e.player=null})),e.windowList=[],t()})).catch((function(e){i(e)}))}else t();e.debug&&e.debug.log(e.LOG_TAG,"destroy")}))}},{key:"_createPlayer",value:function(e){var t=this,i=this._findWindowItemIndex(e),r=this._opt,n=(r.supportDblclickContainerFullscreen&&(r.supportDblclickFullscreen=!1),new On(u(u({},r),{},{isMulti:!0,container:e.$player})));return Object.keys(G).forEach((function(e){n.on(G[e],(function(r){t.emit(e,i,r)}))})),n.on(N.close,(function(){t.emit(N.close,i),e.player=null})),n}},{key:"_initWindows",value:function(){for(var e,t,i,r,n=this._getContainerRect(),a=n.width,s=n.height,o="",l=this._opt.split,c=a%l,u=s%l,d=(a-c-2*l)/l,h=(s-u-2*l)/l,f=(a-c)/l,p=(s-u)/l,g=0;g<this.maxWindowSize;g++)e=d+(g%l==l-1?c:0),t=h+(g+l>=Math.pow(l,2)?u:0),i=f+(g%l==l-1?c:0),r=p+(g+l>=Math.pow(l,2)?u:0),o+='\n <div class="jessibuca-multi-player" wid="'.concat(g,"\" style='float: left;position:relative;overflow: hidden; background-color:").concat(this._opt.style.background,";width: ").concat(i+"px",";height: ").concat(r+"px",'\'>\n <div class="jessibuca-multi-player-draw-window" wid="').concat(g,"\" style='position:absolute; z-index: 1; width:").concat(e+"px","; height:").concat(t+"px",";border: 1px solid ").concat(this._opt.style.border,'\'></div>\n <div class="jessibuca-multi-player-video-window" wid="').concat(g,"\" style='position:absolute;left: 1px;top:1px; z-index: 2; width:").concat(e+"px","; height:").concat(t+"px",";'></div>\n </div>\n ");for(var m='<div class="jessibuca-multi-player-container" style="overflow: hidden;width:100%; height:100%; position: relative;">'.concat(o,"</div>"),A=(this.$container.innerHTML=m,this.$container.querySelectorAll(".jessibuca-multi-player")),y=0;y<this.maxWindowSize;y++){var v=A[y],b=v.querySelector(".jessibuca-multi-player-draw-window"),w=v.querySelector(".jessibuca-multi-player-video-window");this.windowList[y]={uuid:nt(),isContainerFullscreen:!1,$playerContainer:v,$playerBorder:b,$player:w,$playerContainerEvents:[],player:null}}for(var k=this._getCurrentMaxSplit();k<this.maxWindowSize;k++){var E=this.windowList[k];E.$player.style.display="none",E.$playerBorder.style.display="none",E.$playerContainer.style.width="0",E.$playerContainer.style.height="0"}}},{key:"_initEvents",value:function(){var e=this,t=this.events["proxy"];this.windowList.forEach((function(i,r){var n=i.$playerContainer,a=t(n,"click",(function(){e.emit(Be.selected,r),e.getSelectedWindowIndex()===r&&e.windowList[r].isContainerFullscreen||1!==e._opt.split&&e._handleWindowSelect(r)})),s=t(n,"dblclick",(function(){e.emit(Be.dblSelected,r),e._opt.supportDblclickContainerFullscreen&&1!==e._opt.split&&e._handleWindowContainerFullscreen(r)})),o=t(n,"mouseup",(function(){e.emit(Be.mouseUp,r)})),l=t(n,"mouseover",(function(){e.emit(Be.mouseOver,r)}));n=t(n,"mouseout",(function(){e.emit(Be.mouseOut,r)}));i.$playerContainerEvents=[a,o,l,n,s]}))}},{key:"_getContainerRect",value:function(){var e=this.$container.getBoundingClientRect();return{width:Math.max(e.width,this.$container.clientWidth),height:Math.max(e.height,this.$container.clientHeight)}}},{key:"_updateWindows",value:function(){for(var e=this._getContainerRect(),t=e.width,i=e.height,r=this._opt.split,n=t%r,a=i%r,s=(t-n-2*r)/r,o=(i-a-2*r)/r,l=(t-n)/r,c=(i-a)/r,u=this._getCurrentMaxSplit(),d=0;d<u;d++){var h=this.windowList[d],f=(h.isContainerFullscreen=!1,h.$playerContainer),p=(f.style.position="relative",f.style.left="auto",f.style.top="auto",f.style.zIndex="auto",h.$playerBorder),g=h.$player,m=s+(d%r==r-1?n:0),A=o+(d+r>=Math.pow(r,2)?a:0),y=l+(d%r==r-1?n:0),v=c+(d+r>=Math.pow(r,2)?a:0);f.style.width=y+"px",f.style.height=v+"px",f.style.display="block",g.style.width=m+"px",g.style.height=A+"px",g.style.display="block",p.style.width=m+"px",p.style.height=A+"px",p.style.display="block",h.player&&h.player.resize()}if(this.specialLayoutType){var b,w,k,E,T=this.windowList[0],S=T.$playerContainer,_=T.$player,C=T.$playerBorder,R=S.style.width.replace("px",""),D=S.style.height.replace("px",""),x=_.style.width.replace("px",""),L=_.style.height.replace("px","");this.specialLayoutType===Pe?(b=2*R,w=2*D,k=2*x+2,E=2*L+2):this.specialLayoutType===Me&&(b=3*R,w=3*D,k=3*x+4,E=3*L+4),S.style.width=b+"px",S.style.height=w+"px",_.style.width=k+"px",_.style.height=E+"px",C.style.width=k+"px",C.style.height=E+"px",T.player&&T.player.resize(),u=this._getSpecialMaxSplit()}for(var I=u;I<this.maxWindowSize;I++){var B=this.windowList[I];B.player&&(B.player.destroy(),B.player=null),B.$playerContainer.style.display="none",B.$playerContainer.style.width="0",B.$playerContainer.style.height="0",B.$player.style.display="none",B.$playerBorder.style.display="none"}1===this._opt.split&&(this.windowList[0].$playerBorder.style.display="none")}},{key:"_handleWindowSelect",value:function(e){var t=this,i=this.windowList[e];i?(this.currentWindowIndex=e,1<this.windowList.length&&(this.windowList.forEach((function(e){i.$playerBorder.style.display="block",e.$playerBorder.style.border="1px solid "+t._opt.style.border})),i.$playerBorder.style.border="1px solid "+this._opt.style.borderSelect)):this.debug.warn(this.LOG_TAG,"_handleWindowSelect() ".concat(e," is not exist")),1===this._opt.split&&(i.$playerBorder.style.display="none")}},{key:"_handleWindowContainerFullscreen",value:function(e){var t=this.windowList[e];if(t){if(t.isContainerFullscreen)t.$playerContainer.style.position="relative",t.$playerContainer.style.left="auto",t.$playerContainer.style.top="auto",t.$playerContainer.style.zIndex="auto",t.$playerContainer.style.width=t.prevInfo.playerContainerWidth,t.$playerContainer.style.height=t.prevInfo.playerContainerHeight,t.$player.style.width=t.prevInfo.playerWidth,t.$player.style.height=t.prevInfo.playerHeight,this.getSelectedWindowIndex()===e&&(t.$playerBorder.style.display="block");else{var i=this._getContainerRect(),r=i.width,n=i.height;t.prevInfo={playerContainerWidth:t.$playerContainer.style.width,playerContainerHeight:t.$playerContainer.style.height,playerWidth:t.$player.style.width,playerHeight:t.$player.style.height},t.$playerContainer.style.position="absolute",t.$playerContainer.style.top="0",t.$playerContainer.style.left="0",t.$playerContainer.style.zIndex="10",t.$playerContainer.style.width=r+"px",t.$playerContainer.style.height=n+"px",t.$player.style.width=r+"px",t.$player.style.height=n+"px",t.$playerBorder.style.display="none"}t.isContainerFullscreen=!t.isContainerFullscreen,t.player&&t.player.resize()}else this.debug.warn(this.LOG_TAG,"handleWindowContainerFullscreen() ".concat(e," is not exist"))}},{key:"_handleFullscreenResize",value:function(){var e=this,t=this._getContainerRect(),i=0,r=setInterval((function(){var n=e._getContainerRect();n.width===t.width&&n.height===t.height&&4<i?(e.resize(),clearInterval(r)):(t=n,i++)}),300)}},{key:"_listenFullscreenChange",value:function(){var t=this;try{var i=function(e){kt(e)===t.$container&&(t.emit(G.fullscreen,Ue.isFullscreen),Ue.isFullscreen?t._handleFullscreenResize():t.resize())};Ue.on("change",i),this.events.destroys.push((function(){Ue.off("change",i)}))}catch(e){}}},{key:"play",value:function(e,t,i){var r=this;return new Promise((function(n,a){st(t)&&(i=t={});var s=function(){var i=r._createPlayer(l);(l.player=i).play(e,t).then((function(){n()})).catch((function(e){a(e)}))},o=dt(i)?i:r.currentWindowIndex,l=r.windowList[o];l?l.player?l.player.destroy().then((function(){l.player=null,s()})).catch((function(){})):s():a("play() windowIndex ".concat(o," is not exist"))}))}},{key:"getOption",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getOption():(this.debug.warn(this.LOG_TAG,"getOption() windowIndex ".concat(e," is not exist")),{})}},{key:"setDebug",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setDebug(e):this.debug.warn(this.LOG_TAG,"setDebug() windowIndex ".concat(t," is not exist"))}},{key:"mute",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.mute():this.debug.warn(this.LOG_TAG,"mute() windowIndex ".concat(e," is not exist"))}},{key:"cancelMute",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.cancelMute():this.debug.warn(this.LOG_TAG,"cancelMute() windowIndex ".concat(e," is not exist"))}},{key:"setVolume",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setVolume(e):this.debug.warn(this.LOG_TAG,"setVolume() windowIndex ".concat(t," is not exist"))}},{key:"audioResume",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.audioResume():this.debug.warn(this.LOG_TAG,"audioResume() windowIndex ".concat(e," is not exist"))}},{key:"setTimeout",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setTimeout(e):this.debug.warn(this.LOG_TAG,"setTimeout() windowIndex ".concat(t," is not exist"))}},{key:"setScaleMode",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setScaleMode(e):this.debug.warn(this.LOG_TAG,"setScaleMode() windowIndex ".concat(t," is not exist"))}},{key:"pause",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=1<arguments.length?arguments[1]:void 0;return new Promise((function(r,n){i=st(i)?i:e.currentWindowIndex;var a=e.windowList[i];a&&a.player?a.player.pause(t).then((function(){r()})).catch((function(e){n(e)})):n("pause() windowIndex ".concat(i," is not exist"))}))}},{key:"close",value:function(e){var t=this;return new Promise((function(i,r){e=st(e)?e:t.currentWindowIndex;var n=t.windowList[e];n&&n.player?n.player.close().then((function(){i()})).catch((function(e){r(e)})):r("close() windowIndex ".concat(e," is not exist"))}))}},{key:"clearView",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.clearView():this.debug.warn(this.LOG_TAG,"clearView() windowIndex ".concat(e," is not exist"))}},{key:"setStreamQuality",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setStreamQuality(e):this.debug.warn(this.LOG_TAG,"setStreamQuality() windowIndex ".concat(t," is not exist"))}},{key:"resize",value:function(){this._updateWindows()}},{key:"setBufferTime",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setBufferTime(e):this.debug.warn(this.LOG_TAG,"setBufferTime() windowIndex ".concat(t," is not exist"))}},{key:"setBufferDelayTime",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setBufferDelayTime(e):this.debug.warn(this.LOG_TAG,"setBufferDelayTime() windowIndex ".concat(t," is not exist"))}},{key:"setRotate",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setRotate(e):this.debug.warn(this.LOG_TAG,"setRotate() windowIndex ".concat(t," is not exist"))}},{key:"setMirrorRotate",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setMirrorRotate(e):this.debug.warn(this.LOG_TAG,"setMirrorRotate() windowIndex ".concat(t," is not exist"))}},{key:"hasLoaded",value:function(e){return e=st(e)?e:this.currentWindowIndex,e=this.windowList[e],!(!e||!e.player)&&e.player.hasLoaded()}},{key:"setKeepScreenOn",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.setKeepScreenOn():this.debug.warn(this.LOG_TAG,"setKeepScreenOn() windowIndex ".concat(e," is not exist"))}},{key:"setFullscreen",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setFullscreen(e):this.debug.warn(this.LOG_TAG,"setFullscreen() windowIndex ".concat(t," is not exist"))}},{key:"screenshot",value:function(e,t){return t=st(t)?t:this.currentWindowIndex,t=this.windowList[t],t&&t.player?t.player.screenshot(e.filename,e.format,e.quality,e.type):null}},{key:"screenshotWatermark",value:function(e,t){return t=st(t)?t:this.currentWindowIndex,t=this.windowList[t],t&&t.player?t.player.screenshotWatermark(e):null}},{key:"startRecord",value:function(e,t,i){var r=this;return new Promise((function(n,a){i=st(i)?i:r.currentWindowIndex;var s=r.windowList[i];s&&s.player?s.player.startRecord(e,t).then((function(){n()})).catch((function(e){a(e)})):(r.debug.warn(r.LOG_TAG,"startRecord() windowIndex ".concat(i," is not exist")),a("windowIndex ".concat(i," is not exist")))}))}},{key:"stopRecordAndSave",value:function(e,t,i){var r=this;return new Promise((function(n,a){i=st(i)?i:r.currentWindowIndex;var s=r.windowList[i];s&&s.player?s.player.stopRecordAndSave(e,t).then((function(e){n(e)})).catch((function(e){a(e)})):(r.debug.warn(r.LOG_TAG,"stopRecordAndSave() windowIndex ".concat(i," is not exist")),a("windowIndex ".concat(i," is not exist")))}))}},{key:"isPlaying",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.isPlaying():(this.debug.warn(this.LOG_TAG,"isPlaying() windowIndex ".concat(e," is not exist")),!1)}},{key:"isLoading",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.isLoading():(this.debug.warn(this.LOG_TAG,"isLoading() windowIndex ".concat(e," is not exist")),!1)}},{key:"isPaused",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.isPaused():(this.debug.warn(this.LOG_TAG,"windowIndex ".concat(e," is not exist")),!1)}},{key:"isMute",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.isMute():(this.debug.warn(this.LOG_TAG,"isMute() windowIndex ".concat(e," is not exist")),!1)}},{key:"isRecording",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.isRecording():(this.debug.warn(this.LOG_TAG,"isRecording() windowIndex ".concat(e," is not exist")),!1)}},{key:"clearBufferDelay",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.clearBufferDelay():this.debug.warn(this.LOG_TAG,"clearBufferDelay() windowIndex ".concat(e," is not exist"))}},{key:"setNetworkDelayTime",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setNetworkDelayTime(e):this.debug.warn(this.LOG_TAG,"setNetworkDelayTime() windowIndex ".concat(t," is not exist"))}},{key:"getDecodeType",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getDecodeType():(this.debug.warn(this.LOG_TAG,"getDecodeType() windowIndex ".concat(e," is not exist")),null)}},{key:"getRenderType",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getRenderType():(this.debug.warn(this.LOG_TAG,"windowIndex ".concat(e," is not exist")),null)}},{key:"getAudioEngineType",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getAudioEngineType():(this.debug.warn(this.LOG_TAG,"windowIndex ".concat(e," is not exist")),null)}},{key:"getPlayingTimestamp",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getPlayingTimestamp():(this.debug.warn(this.LOG_TAG,"windowIndex ".concat(e," is not exist")),null)}},{key:"getStatus",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getStatus():(this.debug.warn(this.LOG_TAG,"getStatus() windowIndex ".concat(e," is not exist")),null)}},{key:"getPlayType",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getPlayType():(this.debug.warn(this.LOG_TAG,"getPlayType() windowIndex ".concat(e," is not exist")),null)}},{key:"togglePerformancePanel",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.togglePerformancePanel(e):this.debug.warn(this.LOG_TAG,"togglePerformancePanel() windowIndex ".concat(t," is not exist"))}},{key:"openZoom",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.openZoom():this.debug.warn(this.LOG_TAG,"openZoom() windowIndex ".concat(e," is not exist"))}},{key:"closeZoom",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.closeZoom():this.debug.warn(this.LOG_TAG,"closeZoom() windowIndex ".concat(e," is not exist"))}},{key:"isZoomOpen",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.isZoomOpen():(this.debug.warn(this.LOG_TAG,"isZoomOpen() windowIndex ".concat(e," is not exist")),!1)}},{key:"expandZoom",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.expandZoom():this.debug.warn(this.LOG_TAG,"expandZoom() windowIndex ".concat(e," is not exist"))}},{key:"narrowZoom",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.narrowZoom():this.debug.warn(this.LOG_TAG,"narrowZoom() windowIndex ".concat(e," is not exist"))}},{key:"getCurrentZoomIndex",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];return t&&t.player?t.player.getCurrentZoomIndex():(this.debug.warn(this.LOG_TAG,"getCurrentZoomIndex() windowIndex ".concat(e," is not exist")),0)}},{key:"setNakedFlowFps",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setNakedFlowFps(e):this.debug.warn(this.LOG_TAG,"setNakedFlowFps() windowIndex ".concat(t," is not exist"))}},{key:"updateDebugLevel",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.updateDebugLevel(e):this.debug.warn(this.LOG_TAG,"updateDebugLevel() windowIndex ".concat(t," is not exist"))}},{key:"updateWatermark",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.updateWatermark(e):this.debug.warn(this.LOG_TAG,"updateWatermark() windowIndex ".concat(t," is not exist"))}},{key:"removeWatermark",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.removeWatermark():this.debug.warn(this.LOG_TAG,"removeWatermark() windowIndex ".concat(e," is not exist"))}},{key:"updateFullscreenWatermark",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.updateFullscreenWatermark(e):this.debug.warn(this.LOG_TAG,"updateFullscreenWatermark() windowIndex ".concat(t," is not exist"))}},{key:"removeFullscreenWatermark",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.removeFullscreenWatermark():this.debug.warn(this.LOG_TAG,"removeFullscreenWatermark() windowIndex ".concat(e," is not exist"))}},{key:"faceDetectOpen",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.faceDetectOpen():this.debug.warn(this.LOG_TAG,"faceDetectOpen() windowIndex ".concat(e," is not exist"))}},{key:"faceDetectClose",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.faceDetectClose():this.debug.warn(this.LOG_TAG,"faceDetectClose() windowIndex ".concat(e," is not exist"))}},{key:"objectDetectOpen",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.objectDetectOpen():this.debug.warn(this.LOG_TAG,"objectDetectOpen() windowIndex ".concat(e," is not exist"))}},{key:"objectDetectClose",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.objectDetectClose():this.debug.warn(this.LOG_TAG,"objectDetectClose() windowIndex ".concat(e," is not exist"))}},{key:"sendWebsocketMessage",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.sendWebsocketMessage(e):this.debug.warn(this.LOG_TAG,"sendWebsocketMessage() windowIndex ".concat(t," is not exist"))}},{key:"addContentToCanvas",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.addContentToCanvas(e):this.debug.warn(this.LOG_TAG,"addContentToCanvas() windowIndex ".concat(t," is not exist"))}},{key:"clearContentToCanvas",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.clearContentToCanvas():this.debug.warn(this.LOG_TAG,"clearContentToCanvas() windowIndex ".concat(e," is not exist"))}},{key:"setControlHtml",value:function(e,t){t=st(t)?t:this.currentWindowIndex;var i=this.windowList[t];i&&i.player?i.player.setControlHtml(e):this.debug.warn(this.LOG_TAG,"setControlHtml() windowIndex ".concat(t," is not exist"))}},{key:"clearControlHtml",value:function(e){e=st(e)?e:this.currentWindowIndex;var t=this.windowList[e];t&&t.player?t.player.clearControlHtml():this.debug.warn(this.LOG_TAG,"clearControlHtml() windowIndex ".concat(e," is not exist"))}},{key:"destroySingle",value:function(e){var t=this;return new Promise((function(i,r){e=st(e)?e:t.currentWindowIndex;var n=t.windowList[e];n?n.player&&n.player.destroy().then((function(){n.player=null,i()})).catch((function(e){r(e)})):(r("windowIndex is not exist"),t.debug.warn(t.LOG_TAG,"destroySingle() windowIndex ".concat(e," is not exist")))}))}},{key:"setFullscreenMulti",value:function(e){var t=this;return new Promise((function(i,r){if(e)try{Ue.request(t.$container).then((function(){i()})).catch((function(e){t.debug.error(t.LOG_TAG,"fullscreen request inner error",e),r(e)}))}catch(i){t.debug.error(t.LOG_TAG,"fullscreen request error",i),r(i)}else try{Ue.exit().then((function(){i()})).catch((function(e){t.debug.error(t.LOG_TAG,"fullscreen exit inner error",e),r(e)}))}catch(i){t.debug.error(t.LOG_TAG,"fullscreen exit error",i),r(i)}}))}},{key:"selectWindow",value:function(e){this._handleWindowSelect(e)}},{key:"arrangeWindow",value:function(e){e?[Pe,Me].includes(e)?this._arrangeSpecialWindow(e):this._opt.split===e&&null===this.specialLayoutType?this.debug.warn(this.LOG_TAG,"arrangeWindow() split ".concat(e," is not changed")):(this.specialLayoutType=null,this._arrangeWindow(e)):this.debug.warn(this.LOG_TAG,"arrangeWindow() split ".concat(e," is not valid"))}},{key:"_arrangeWindow",value:function(e){(e=rt(e))<1||!st(e)?this.debug.warn(this.LOG_TAG,"arrangeWindow() split ".concat(e," is not valid")):(e>this._opt.maxSplit&&(e=this._opt.maxSplit),this._opt.split=e,this.currentWindowIndex=0,this._updateWindows(),this._handleWindowSelect(this.currentWindowIndex))}},{key:"_arrangeSpecialWindow",value:function(e){this._opt.maxSplit<=3&&e===Me||this._opt.maxSplit<=2&&e===Pe?this.debug.warn(this.LOG_TAG,"_arrangeSpecialWindow() type ".concat(e," is not valid because maxSplit is ")+this._opt.maxSplit):this.specialLayoutType&&this.specialLayoutType===e?this.debug.warn(this.LOG_TAG,"_arrangeSpecialWindow() type ".concat(e," is not changed")):(this.specialLayoutType=e)===Pe?this._arrangeWindow(3):e===Me?this._arrangeWindow(4):this.debug.warn(this.LOG_TAG,"_arrangeSpecialWindow() type ".concat(e," is not valid"))}},{key:"getCurrentSplit",value:function(){return this.specialLayoutType||this._opt.split}},{key:"_getCurrentMaxSplit",value:function(){if(this.specialLayoutType){var e=0;return this.specialLayoutType===Pe?e=9:this.specialLayoutType===Me&&(e=16),e}return this._opt.split*this._opt.split}},{key:"_getSpecialMaxSplit",value:function(){var e=0;return this.specialLayoutType===Pe?e=6:this.specialLayoutType===Me&&(e=8),e}},{key:"getSelectedWindowIndex",value:function(){return this.currentWindowIndex}},{key:"_findWindowItemIndex",value:function(e){return this.windowList.findIndex((function(t){return t.uuid===e.uuid}))}}])}(e);Fn.MULTI_EVENTS=Be,Fn.EVENTS=N,Fn.ERROR=H,window.JessibucaProMulti=Fn}))}).call(this,i("c8ba"),i("4362"))},"643a":function(e,t,i){function r(e){if(null==e)throw new TypeError("Cannot destructure "+e)}i("d9e2"),e.exports=r,e.exports.__esModule=!0,e.exports["default"]=e.exports}}]);