FastBee/docker/data/nginx/vue/static/js/chunk-2ccd7611.0ceeb56e.js
2025-07-07 09:21:15 +08:00

1 line
920 KiB
JavaScript
Raw Permalink 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-2ccd7611"],{"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},"946b5":function(e,t,i){(function(r,a){var n,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("5bc3").default,A=i("970b").default,y=i("7037").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){"object"==y(t)&&"undefined"!=typeof e?e.exports=a():(n=a,s="function"===typeof n?n.call(t,i,t,e):n,void 0===s||(e.exports=s))}(0,(function(){"use strict";var e="fetch",t="websocket",i="worker",n="player",s="playbackTF",v="mp4",b="webm",E="flv",k="webTransport",T="nakedFlow",w={flv:"FLV",m7s:"m7s",hls:"HLS",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流"},S="canvas",_="video",R="debug",C="warn",D="click",L={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:n,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!1,isCrypto:!1},x={playType:n,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isWebrtc:!1,isWebrtcForZLM:!1,isNakedFlow:!1,debug:!1,debugLevel:C,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:E,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:v,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,ptzClickType:D,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:""},I="init",B="initVideo",P="initAudio",M="audioCode",O="videoCode",F="videoCodec",j="closeEnd",U={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"},N={load:U.load,timeUpdate:U.timeUpdate,videoInfo:U.videoInfo,audioInfo:U.audioInfo,error:U.error,kBps:U.kBps,start:U.start,timeout:U.timeout,loadingTimeout:U.loadingTimeout,loadingTimeoutRetryEnd:U.loadingTimeoutRetryEnd,delayTimeout:U.delayTimeout,delayTimeoutRetryEnd:U.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:U.webFullscreen,play:U.play,pause:U.pause,mute:U.mute,stats:U.stats,performance:U.performance,recordingTimestamp:U.recordingTimestamp,recordStart:U.recordStart,recordEnd:U.recordEnd,recordBlob:U.recordBlob,playToRenderTimes:U.playToRenderTimes,playbackSeek:U.playbackSeek,playbackStats:U.playbackStats,playbackTimestamp:U.playbackTimestamp,playbackPauseOrResume:U.playbackPauseOrResume,playbackPreRateChange:U.playbackPreRateChange,playbackRateChange:U.playbackRateChange,ptz:U.ptz,streamQualityChange:U.streamQualityChange,zooming:U.zooming,crashLog:U.crashLog,focus:U.focus,blur:U.blur,visibilityHiddenTimeout:U.visibilityHiddenTimeout,visibilityChange:U.visibilityChange,websocketOpen:U.websocketOpen,websocketClose:U.websocketClose,networkDelayTimeout:U.networkDelayTimeout,aiObjectDetectorInfo:U.aiObjectDetectorInfo,playFailedAndPaused:U.playFailedAndPaused,audioResumeState:U.audioResumeState},z={talkStreamClose:U.talkStreamClose,talkStreamError:U.talkStreamError,talkStreamInactive:U.talkStreamInactive,talkGetUserMediaTimeout:U.talkGetUserMediaTimeout},G={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:U.mseSourceBufferFull,mseSourceBufferError:U.mseSourceBufferError,mseAddSourceBufferError:U.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:U.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",webglContextLostError:"webglContextLostError"},H="notConnect",V="open",W={download:"download",base64:"base64",blob:"blob"},K="download",q={7:"H264(AVC)",12:"H265(HEVC)"},Q="H264(AVC)",Y="H265(HEVC)",J={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)"},X={10:"AAC",7:"ALAW",8:"MULAW"},$=6,Z="webcodecs",ee="webgl",te="webgpu",ie="offscreen",re="mse",ae='video/mp4; codecs="avc1.64002A"',ne='video/mp4; codecs="hev1.1.6.L123.b0"',se="oneHour",oe="halfHour",le="fiveMin",ce={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},ue=["oneHour","halfHour","tenMin","fiveMin"],de=["up","right","down","left","left-up","right-up","left-down","right-down"],he="stop",fe="fiStop",pe="g711a",ge="g711u",me={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},Ae="canplay",ye="waiting",ve="timeupdate",be="ratechange",Ee="The user aborted a request",ke="AbortError",Te="AbortError",we="worklet",Se={encType:pe,packetType:"rtp",rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,debug:!1,debugLevel:C,testMicrophone:!1,audioBufferLength:160,engine:we,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4},_e="worklet",Re="script",Ce="active",De={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},Le={content:"",click:null,index:0},xe=m((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,"]"):"",a=arguments.length,n=new Array(1<a?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];(i=console).log.apply(i,["JessibucaPro".concat(r,":[✅✅✅][").concat(e,"]")].concat(n))}},this.warn=function(e){if(t._opt.debug&&(t._opt.debugLevel==R||t._opt.debugLevel==C)){for(var i,r=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",a=arguments.length,n=new Array(1<a?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];(i=console).log.apply(i,["JessibucaPro".concat(r,":[❗❗❗][").concat(e,"]")].concat(n))}},this.error=function(e){for(var i,r=t._opt.debugUuid?"[".concat(t._opt.debugUuid,"]"):"",a=arguments.length,n=new Array(1<a?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];(i=console).error.apply(i,["JessibucaPro".concat(r,":[❌❌❌][").concat(e,"]")].concat(n))}})),Ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof r?r:"undefined"!=typeof self?self:{};function Be(e,t){return e(t={exports:{}},t.exports),t.exports}var Pe=Be((function(e){var t,i,r,a,n;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,a=i.length,n={};r<a;r++)if((e=i[r])&&e[1]in t){for(r=0;r<e.length;r++)n[i[0][r]]=e[r];return n}return!1}(),a={change:r.fullscreenchange,error:r.fullscreenerror},n={request:function(e,i){return new Promise(function(a,n){var s=function(){this.off("change",s),a()}.bind(this),o=(this.on("change",s),(e=e||t.documentElement)[r.requestFullscreen](i));o instanceof Promise&&o.then(s).catch(n)}.bind(this))},exit:function(){return new Promise(function(e,i){var a,n;this.isFullscreen?(a=function(){this.off("change",a),e()}.bind(this),this.on("change",a),(n=t[r.exitFullscreen]())instanceof Promise&&n.then(a).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=a[e],e&&t.addEventListener(e,i,!1)},off:function(e,i){e=a[e],e&&t.removeEventListener(e,i,!1)},raw:r},r?(Object.defineProperties(n,{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=n:window.screenfull=n):i?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}));function Me(e){return e[0]>>4==10&&0===e[1]}function Oe(){}function Fe(e){for(var t=null,i=["webgl","experimental-webgl","moz-webgl","webkit-3d"],r=0;!t&&r<i.length;){var a=i[r];try{var n={preserveDrawingBuffer:!0};t=e.getContext(a,n)}catch(e){console.error(e),t=null}t&&"function"==typeof t.getParameter||(t=null),++r}return t}function je(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 Ue(){return(new Date).getTime()}function Ne(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function ze(e,t,i){e&&("object"==y(t)&&Object.keys(t).forEach((function(i){ze(e,i,t[i])})),e.style[t]=i)}function Ge(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 He(){return(performance&&"function"==typeof performance.now?performance:Date).now()}function Ve(e){var t=0,i=He();return function(r){var a;tt(r)&&(t+=r,1e3<=(a=(r=He())-i))&&(e(t/a*1e3),i=r,t=0)}}Pe.isEnabled;try{if("object"==("undefined"===typeof WebAssembly?"undefined":y(WebAssembly))&&"function"==typeof WebAssembly.instantiate){var We=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));We instanceof WebAssembly.Module&&(new WebAssembly.Instance(We),WebAssembly.Instance)}}catch(It){}function Ke(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function qe(){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 a="";if("IE"===r){var n=e.match(/(msie\s|trident.*rv:)([\w.]+)/);n&&2<n.length&&(a=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&&(a=o[1])}else if("Firefox"===r){var l=e.match(/firefox\/([\d.]+)/);l&&1<l.length&&(a=l[1])}else if("Opera"===r){var c=e.match(/opera\/([\d.]+)/);c&&1<c.length&&(a=c[1])}else if("Safari"===r){var u=e.match(/version\/([\d.]+)/);u&&1<u.length&&(a=u[1])}else if("Edge"===r){var d=e.match(/edge\/([\d.]+)/);d&&1<d.length&&(a=d[1])}else if("QQBrowser"===r){var h=e.match(/qqbrowser\/([\d.]+)/);h&&1<h.length&&(a=h[1])}t.type=r,t.version=parseInt(a)}return t}function Qe(){var e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function Ye(){var e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&e.match(/Safari/gi)}function Je(e,t){var i;return 0===arguments.length?null:(t=t||"{y}-{m}-{d} {h}:{i}:{s}",e="object"==y(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 Xe(){return"VideoFrame"in window}function $e(e){var t;return"string"!=typeof e||(t=Number(e),isNaN(t))?e:t}function Ze(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function et(e,t){var i,r,a=!1;return function n(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];a?(i=o,r=this):(a=!0,e.apply(this,o),setTimeout((function(){a=!1,i&&(n.apply(r,i),i=null,r=null)}),t))}}function tt(e){return"[object Number]"===Object.prototype.toString.call(e)}function it(){var e=!1;return"MediaStreamTrackGenerator"in window||e}function rt(){var e=!1;return"MediaStream"in window||e}function at(e){return null==e}function nt(e){return!0===e||!1===e}function st(e){return!at(e)}function ot(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 lt(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 ct(e,t){return new Promise((function(i,r){var a=ot(t);if(!a.image.src&&!a.text.content)return i(e);var n=document.createElement("canvas"),s=(n.width=t.width,n.height=t.height,n.getContext("2d")),o=0,l=0;tt(a.left)?o=a.left:tt(a.right)&&(o=n.width-a.right),tt(a.top)?l=a.top:tt(a.bottom)&&(l=n.height-a.bottom);var c=new Image;c.src=e,c.onload=function(){if(s.drawImage(c,0,0),a.image&&a.image.src){var e=new Image;e.src=a.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=function(){o-=a.image.width,s.drawImage(e,o,l,a.image.width,a.image.height),i(n.toDataURL(t.format,t.quality))},e.onerror=function(e){r()}}else a.text&&a.text.content&&(s.font=a.text.fontSize+"px 宋体",s.fillStyle=a.text.color,s.textAlign="right",s.fillText(a.text.content,o,l),i(n.toDataURL(t.format,t.quality)))},c.onerror=function(e){r(e)}}))}function ut(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 dt(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 ht(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 ft(e){return(""+e).length}function pt(e){return!e||0!==Object.keys(e).length}function gt(e){return"string"==typeof e}var mt=function(){return e=window.navigator.userAgent,/MicroMessenger/i.test(e)&&(e=window.navigator.userAgent.toLowerCase(),/android/i.test(e));var e};function At(e){return e=e||window.event,e.target||e.srcElement}function yt(e){return"function"==typeof e}function vt(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 bt(e){return Lt(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)}function Et(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 kt(e){e.close?e.close():e.destroy&&e.destroy()}function Tt(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function wt(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 St(e){var t="";if("object"==y(e))try{t=JSON.stringify(e),t=JSON.parse(t)}catch(It){t=e}else t=e;return t}function _t(){return St(L)}function Rt(){return St(x)}function Ct(e){return e[0]>>4==1&&0===e[1]}function Dt(e){return!0===e||"true"===e}function Lt(e){return!0!==e&&"true"!==e}var xt=function(){function e(t){A(this,e),this.destroys=[],this.proxy=this.proxy.bind(this),this.master=t}return m(e,[{key:"proxy",value:function(e,t,i){var r=this,a=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,a)}));e.addEventListener(t,i,a);var n=function(){yt(e.removeEventListener)&&e.removeEventListener(t,i,a)};return this.destroys.push(n),n}}},{key:"destroy",value:function(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((function(e){return e()}))}}])}(),It=function(){function e(){A(this,e)}return m(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 a(){r.off(e,a);for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];t.apply(i,s)}return a._=t,this.on(e,a,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),a=1;a<i;a++)r[a-1]=arguments[a];for(var n=0;n<t.length;n+=1)t[n].fn.apply(t[n].ctx,r);return this}},{key:"off",value:function(e,t){var i=this.e||(this.e={});if(e){var r=i[e],a=[];if(r&&t)for(var n=0,s=r.length;n<s;n+=1)r[n].fn!==t&&r[n].fn._!==t&&a.push(r[n]);return a.length?i[e]=a:delete i[e],this}Object.keys(i).forEach((function(e){delete i[e]})),delete this.e}}])}(),Bt="undefined"!=typeof Float32Array?Float32Array:Array;function Pt(){var e=new Bt(16);return Bt!=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 Mt(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 Ot(e,t,i){var r=new Bt(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)}),We=new Bt(3),Bt!=Float32Array&&(We[0]=0,We[1]=0,We[2]=0),kr=new Bt(4),Bt!=Float32Array&&(kr[0]=0,kr[1]=0,kr[2]=0,kr[3]=0);var Ft=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 m(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]),a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),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:a,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,a,n){var s=2*e/a-1;r=2*(n-t-r)/n-1,e=2*(e+i)/a-1,i=2*(n-t)/n-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,a){var n=this.gl;this._clear(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._ytexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e,t,0,n.LUMINANCE,n.UNSIGNED_BYTE,i),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._utexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,r),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,this._vtexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,a),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}},{key:"renderYUV",value:function(e,t,i){var r=i.slice(0,e*t),a=i.slice(e*t,e*t*5/4),n=(i=i.slice(e*t*5/4,e*t*3/2),this.gl);this._clear(),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._ytexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e,t,0,n.LUMINANCE,n.UNSIGNED_BYTE,r),n.activeTexture(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._utexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,a),n.activeTexture(n.TEXTURE2),n.bindTexture(n.TEXTURE_2D,this._vtexture),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,e/2,t/2,0,n.LUMINANCE,n.UNSIGNED_BYTE,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,a){var n=this.gl;n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,this._rgbatexture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,a),this._buffers.positions=this._calRect(i,r,a.width,a.height,e,t),this._drawScene(e,t,!1)}}])}(),jt=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 m(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})),a=(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(a,0,t),{positionBuffer:i,texpositionBuffer:r,indexBuffer:a}}},{key:"_initPipeline",value:function(){var e=this;return new Promise((function(t,i){var r=e.gpu.device,a=e.gpu.format;a={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:a}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};r.createRenderPipelineAsync(a).then((function(e){t(e)})).catch((function(e){i(e)}))}))}},{key:"_initMatrixGroupInfo",value:function(){var e,t,i,r,a,n,s,o,l,c,u,d=this.gpu.device,h=this.pipeline,f=Pt(),p=(e=(t=g=1)/((p=-1)-g),y=1/((i=-1)-t),o=1/((s=.1)-(n=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]=(n+s)*o,l[15]=1,Pt()),g=(Mt(p),Pt()),m=(e=g,t=Ot(0,0,0),i=Ot(0,0,-1),y=Ot(0,1,0),n=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(n-c)<1e-6&&Math.abs(s-u)<1e-6&&Math.abs(t-i)<1e-6?Mt(e):(c=n-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,a=c*y-u*A,(m=Math.hypot(l,r,a))?(l*=m=1/m,r*=m,a*=m):a=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]=a,e[10]=i,e[11]=0,e[12]=-(A*n+y*s+o*t),e[13]=-(l*n+r*s+a*t),e[14]=-(c*n+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,a=i.createTexture({size:[e,t],format:"r8unorm",usage:window.GPUTextureUsage.TEXTURE_BINDING|window.GPUTextureUsage.COPY_DST|window.GPUTextureUsage.RENDER_ATTACHMENT}),n=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:a.createView()},{binding:2,resource:n.createView()},{binding:3,resource:e.createView()}]});return{yTexture:a,uTexture:n,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,a,n;this.hasInited&&(r=i.slice(0,e*t),a=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2),n=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)),n.queue.writeTexture({texture:this.textureGroupInfo.yTexture},r,{bytesPerRow:e,rowsPerImage:t},[e,t]),n.queue.writeTexture({texture:this.textureGroupInfo.uTexture},a,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),n.queue.writeTexture({texture:this.textureGroupInfo.vTexture},i,{bytesPerRow:e/2,rowsPerImage:t/2},[e/2,t/2]),this._drawScene())}},{key:"clear",value:function(){}}])}(),Ut=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),m(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){st(e.encTypeCode)&&(this.videoInfo.encType=q[e.encTypeCode]),st(e.encType)&&(this.videoInfo.encType=e.encType),st(e.width)&&(this.videoInfo.width=e.width),st(e.height)&&(this.videoInfo.height=e.height),st(this.videoInfo.encType)&&st(this.videoInfo.height)&&st(this.videoInfo.width)&&!this.init&&(this.player.emit(U.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}}])}(It),Nt="object"==("undefined"===typeof window?"undefined":y(window))&&window.window===window?window:"object"==("undefined"===typeof self?"undefined":y(self))&&self.self===self?self:"object"==("undefined"===typeof r?"undefined":y(r))&&r.global===r?r:void 0;function zt(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Wt(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function Gt(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function Ht(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(It){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Vt=Nt.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Wt="object"!=("undefined"===typeof window?"undefined":y(window))||window!==Nt?function(){}:"download"in HTMLAnchorElement.prototype&&!Vt?function(e,t,i){var r=Nt.URL||Nt.webkitURL,a=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",a.download=t,a.rel="noopener","string"==typeof e?(a.href=e,a.origin!==location.origin?Gt(a.href)?zt(e,t,i):Ht(a,a.target="_blank"):Ht(a)):(a.href=r.createObjectURL(e),setTimeout((function(){r.revokeObjectURL(a.href)}),4e4),setTimeout((function(){Ht(a)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){var r;t=t||e.name||"download","string"==typeof e?Gt(e)?zt(e,t,i):((r=document.createElement("a")).href=e,r.target="_blank",setTimeout((function(){Ht(r)}))):navigator.msSaveOrOpenBlob((e=e,void 0===(i=i)?i={autoBom:!1}:"object"!=y(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 zt(e,t,i);t="application/octet-stream"===e.type,i=/constructor/i.test(Nt.HTMLElement)||Nt.safari;var a,n,s,o=/CriOS\/[\d]+/.test(navigator.userAgent);(o||t&&i||Vt)&&"undefined"!=typeof FileReader?((a=new FileReader).onloadend=function(){var e=a.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");r?r.location.href=e:location=e,r=null},a.readAsDataURL(e)):(n=Nt.URL||Nt.webkitURL,s=n.createObjectURL(e),r?r.location=s:location.href=s,r=null,setTimeout((function(){n.revokeObjectURL(s)}),4e4))},Kt=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 m(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,a=t.lineWidth,n=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,a),s.uniform3f(l.uniformLocations.linecolor,n[0],n[1],n[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,a=t.height,n=t.lineWidth,s=t.lineColor,o=t.canvasWidth,l=t.canvasHeight,c=(c=e/o,a=(l-i-a)/l,e=(e+r)/o,r=(l-i)/l,(i=new Bt(4))[0]=c,i[1]=a,i[2]=e,i[3]=r,i);s=Ot(1,0,0);this._drawScene({canvasWidth:o,canvasHeight:l,rect:c,lineWidth:n,lineColor:s})}}])}(),qt=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),m(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=Fe(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=Fe(t.$videoElement),t.contextGl&&t.contextGl.getContextAttributes().stencil?(t.webglRender=new Ft(t.contextGl,t.player._opt.openWebglAlignment),t.webglRectRender=new Kt(t.contextGl,t.player._opt.openWebglAlignment),t.isWebglContextLost=!1):(t.player.debug.error("canvasVideo","webglcontextlost error, getContextAttributes().stencil is false"),t.player.emit(G.webglContextLostError))}),500)})),i=i(this.$videoElement,"webglcontextrestored",(function(e){e.preventDefault(),t.player.debug.log("canvasVideo","webglcontextrestored ",e)})),this.webglRender=new Ft(this.contextGl,this.player._opt.openWebglAlignment),this.webglRectRender=new Kt(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(a){if(a){var n=t.getContext("webgpu");if(n){var s=navigator.gpu.getPreferredCanvasFormat();n.configure({device:a,format:s,alphaMode:"opaque"}),e({adapter:r,device:a,context:n,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 jt(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=ee,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||Ue(),r=r||W.download;var a=.92;!me[t]&&W[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(a=Number(i));var n=me[t]||me.png;i=this.$videoElement.toDataURL(n,a);if(r===W.base64)return i;var s=je(i);if(r===W.blob)return s;if(r===W.download){var o=n.split("/")[1];Wt(s,e+"."+o)}}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(i,r){(e=(e=gt(e)?{filename:e}:e)||{}).width=t.videoInfo.width,e.height=t.videoInfo.height,e.filename=e.filename||Ue(),e.format=e.format?me[e.format]:me.png,e.quality=Number(e.quality)||.92,e.type=e.type||W.download;var a=t.$videoElement.toDataURL(e.format,e.quality);ct(a,e).then((function(t){if(e.type===W.base64)i(a);else{var r=je(t);if(e.type===W.blob)i(r);else if(e.type===W.download){i();var n=e.format.split("/")[1];Wt(r,e.filename+"."+n)}}})).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;Ke()&&this.player.fullscreen&&e.useWebFullScreen?t-=r:i-=r}var a=this.$videoElement.width,n=this.$videoElement.height,s=e.rotate,o=(t-a)/2,l=(i-n)/2,c=(270!==s&&90!==s||(a=this.$videoElement.height,n=this.$videoElement.width),t/a),u=i/n,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 S}},{key:"getCanvasType",value:function(){return this.renderType===te?te:ee}},{key:"addContentToCanvas",value:function(){this.tempCanvasContentList=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[]}}])}(Ut),Qt=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),m(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=Z,this._initContext2D()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=re,this._initContext2D()):this.player._opt.isHls&&this.player._opt.useCanvasRender?(this.renderType="hls",this._initContext2D()):this._supportOffscreen()?(this.renderType=ie,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=te,this._initContextGPU()):(this.renderType=ee,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!==re&&(t={ts:e.ts||0,fps:!0},this.player.updateStats(t)),this.renderType){case ie:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case ee:case te: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===te)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===ee)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 Z:if(yt(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((function(t){i.context2D.drawImage(t,0,0,i.$videoElement.width,i.$videoElement.height),kt(e.videoFrame),i.doAddContentToCanvas()}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),kt(e.videoFrame),this.doAddContentToCanvas();break;case re: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 ie: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 ee:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case te:this.webGPURender.clear();break;case Z:case re: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 a=t.width,n=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;a&&n&&e.webglRectRender.drawBox({x:i,y:r,width:a,height:n,lineColor:s,lineWidth:o,canvasWidth:e.$videoElement.width,canvasHeight:e.$videoElement.height})}else if("text"===t.type){var l=t.text||"";l&&(a=t.fontSize||20,n=t.color||"#008000",e.tempTextCanvas||e._initTempTextCanvas(),e.tempTextCanvasCtx.clearRect(0,0,e.tempTextCanvas.width,e.tempTextCanvas.height),e.tempTextCanvasCtx.font=a+"px Arial",e.tempTextCanvasCtx.fillStyle=n,e.tempTextCanvasCtx.textBaseline="top",e.tempTextCanvasCtx.fillText(l,0,0),e.webglRender.drawDom(e.$videoElement.width,e.$videoElement.height,i,r,e.tempTextCanvas))}}))}}])}(qt),Yt=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 m(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")),a=(r.setAttribute("style","position: absolute; top: 0; left: 0; width: 0; height: 0;display: none;"),t.appendChild(r),e.children),n=Math.floor(Math.random()*(a.length-1));a[n]?e.insertBefore(i,a[n]):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:pt(e)&&t.push(e),e=t.map((function(e){return ot(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,a=i.height,n=this.player._opt,o=t,l=e;if(n.hasControl&&!n.controlAutoHide){var c=n.playType===s?48:38;Ke()&&this.player.fullscreen&&n.useWebFullScreen?l-=c:o-=c}var u=n.rotate,d=(l-r)/2,h=(o-a)/2,f=(270!==u&&90!==u||(r=i.height,a=i.width),l/r),p=o/a,g=p<f?p:f,m=(n.isResize||f!=p&&(g=f+","+p),"scale("+(g=n.isFullResize?p<f?f:p:g)+")");"none"===n.mirrorRotate&&u&&(m+=" rotate("+u+"deg)"),"level"===n.mirrorRotate?m+=" rotateY(180deg)":"vertical"===n.mirrorRotate&&(m+=" rotateX(180deg)"),this.scale=-1!==(""+g).indexOf(",")?f:g,this.shadowRootInnerDom.style.transform=m,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"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,tt(t.left)&&(i.style.left=t.left+"px"),tt(t.right)&&(i.style.right=t.right+"px"),tt(t.top)&&(i.style.top=t.top+"px"),tt(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="")}}])}(),Jt=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e;var r=document.createElement("video"),a=document.createElement("canvas"),n=(a=(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=a,i.canvasContext=a.getContext("2d"),i.mediaStream=null,i.vwriter=null,e.canVideoTrackWritter()&&it()&&rt()&&(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=a(i.$videoElement,"canplay",(function(){i.player.debug.log("Video","canplay"),i._delayPlay&&i._play()})),a(i.$videoElement,"waiting",(function(){i.player.debug.log("Video","waiting")}))),s=a(i.$videoElement,"loadedmetadata",(function(){i.player.debug.log("Video","loadedmetadata")})),o=a(i.$videoElement,"timeupdate",(function(t){t=parseInt(t.timeStamp,10),(i.player._opt.isWebrtc||i.player._opt.isHls)&&i.player.emit(U.timeUpdate,t),e._opt.isWebrtc&&e.handleRender()}));a=a(i.$videoElement,"error",(function(){i.player.debug.error("Video","Error "+i.$videoElement.error.code+"; details: "+i.$videoElement.error.message)}));return i.eventListenList.push(r,n,o,a,s),i.player.debug.log("Video","init"),i}return g(t,e),m(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=qe().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||Ue(),r=r||W.download;var a=.92;!me[t]&&W[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(a=Number(i));i=this.$videoElement;var n=this.$canvasElement,s=(n.width=i.videoWidth,n.height=i.videoHeight,this.canvasContext.drawImage(i,0,0,n.width,n.height),me[t]||me.png);i=n.toDataURL(s,a);if(this.canvasContext.clearRect(0,0,n.width,n.height),n.width=0,n.height=0,r===W.base64)return i;var o=je(i);if(r===W.blob)return o;if(r===W.download){var l=s.split("/")[1];Wt(o,e+"."+l)}}},{key:"screenshotWatermark",value:function(e){var t=this;return new Promise((function(i,r){gt(e)&&(e={filename:e});var a=t.$videoElement,n=((e=e||{}).width=a.videoWidth,e.height=a.videoHeight,e.filename=e.filename||Ue(),e.format=e.format?me[e.format]:me.png,e.quality=Number(e.quality)||.92,e.type=e.type||W.download,t.$canvasElement);n.width=a.videoWidth,n.height=a.videoHeight,t.canvasContext.drawImage(a,0,0,n.width,n.height);var s=n.toDataURL(e.format,e.quality);t.canvasContext.clearRect(0,0,n.width,n.height),n.width=0,n.height=0,ct(s,e).then((function(t){if(e.type===W.base64)i(s);else{var r=je(t);if(e.type===W.blob)i(r);else if(e.type===W.download){i();var a=e.format.split("/")[1];Wt(r,e.filename+"."+a)}}})).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),kt(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),kt(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 a=i.playType===s?48:38;Ke()&&this.player.fullscreen&&i.useWebFullScreen?e-=a:t-=a}this.$videoElement.width=e,this.$videoElement.height=t,270!==r&&90!==r||(this.$videoElement.width=t,this.$videoElement.height=e);var n=(e-this.$videoElement.width)/2,o=(t-this.$videoElement.height)/2,l="contain",c=(i.isResize||(l="fill"),i.isFullResize&&(l="none"),"");"none"===i.mirrorRotate&&r&&(c+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?c+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(c+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=l),this.$videoElement.style.transform=c,this.$videoElement.style.left=n+"px",this.$videoElement.style.top=o+"px"}},{key:"getType",value:function(){return _}},{key:"isPlaying",value:function(){return this.$videoElement&&Lt(this.$videoElement.paused)&&Lt(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 Yt(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:Ue()}),t}}])}(Ut),Xt=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(U.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),m(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=te,this._initContextGPU()):(this.renderType=ee,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()===ee)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()===te)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=Ue());var t=e,i=Ue(),r=i-this._startFpsTimestamp;r<=1e3?this._renderFps+=1:(this.player.emit(U.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=Ne(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=Ne(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,a=1;if(0<e.length&&(t=e[1])&&1e5<t.ts-i.ts&&(i=t,a=2),i)for(var n=a;n<e.length;n++){var s=e[n];s&&1e3<=s.ts-i.ts&&e[n-1].ts-i.ts<1e3&&(r=n+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 a=this.bufferList.length,n=a/(this.fps*this.playbackRate);this.player.debug.log("CanvasPlaybackLoader","rate is",n),n<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(n*this.playbackRate)),this.player.debug.warn("CanvasPlaybackLoader","rate is",n,"fps is",this.fps,"bufferListLength is",a))}}},{key:"initVideo",value:function(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}},{key:"initVideoDelay",value:function(){var e=this,t=this.player._opt.playbackDelayTime;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}}])}(qt),$t=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return m(e,null,[{key:"getLoaderFactory",value:function(e){return e.useMSE?e.mseUseCanvasRender?Qt:Jt:e.isHls?e.useCanvasRender?Qt:Jt:e.isWebrtc?Jt:e.useWCS?!e.useOffscreen&&e.wcsUseVideoRender?Jt:Qt:e.playType===s?Xt:e.wasmUseVideoRender&&!e.useOffscreen?Jt:Qt}}])}(),Zt=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(U.videoSyncAudio,(function(e){i.audioSyncVideoOption=e})),i}return g(t,e),m(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=Oe,this.scriptNode=null),this.workletProcessorNode&&(this.workletProcessorNode.port.onmessage=Oe,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=X[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(U.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(U.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(U.mute,e),this.setVolume(.5))}},{key:"setVolume",value:function(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=Ne(e,0,1),this.gainNode.gain.value=e,this.player.emit(U.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(U.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}}])}(It),ei=function(){function e(t,i,r,a){A(this,e),this.player=t,this.audio=i,this.channel=r,this.bufferSize=a}return m(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,a=0,n=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],n),i.set(c.buffer[1],n)):(t.set(c.buffer[0],n),i.set(c.buffer[0],n)),n+=this.bufferSize,a=c.ts}r=t.length}return{size:r,ts:a,left:t,right:i}}},{key:"destroy",value:function(){this.buffer=null,this.channel=null}}])}(),ti=function(){function e(){A(this,e),this._vector=new Float32Array,this._position=0,this._frameCount=0}return m(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)),a=(this.ensureCapacity(i+this._frameCount),this.endIndex);this.vector.set(e.subarray(t,t+r),a),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)}}])}(),ii=function(){function e(t){A(this,e),t?(this._inputBuffer=new ti,this._outputBuffer=new ti):this._inputBuffer=this._outputBuffer=null}return m(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()}}])}(),ri=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),m(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,a=this._outputBuffer.endIndex,n=0,s=0;this.slopeCount<1;)r[a+2*s]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],r[a+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,(n+=1)>=e-1)break e;var o=i+2*n;r[a+2*s]=(1-this.slopeCount)*t[o]+this.slopeCount*t[o+2],r[a+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}}])}(ii);function ai(){}var ni=function(e){function t(e,i){var r;A(this,t);var a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:ai;return r=p(this,t,[i]),r.callback=a,r.sourceSound=e,r.historyBufferSize=22050,r._sourcePosition=0,r.outputBufferPosition=0,r._position=0,r}return g(t,e),m(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 m(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()}}])}()),si=[[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]],oi=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),m(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,a,n=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,r=0,a=0;n<4;n+=1){for(var s=0;si[n][s]&&!((a=r+si[n][s])>=this.seekLength);)(i=this.calculateCrossCorrelationStereo(2*a,this.refMidBuffer))>t&&(t=i,e=a),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,a=0,n=2,s=2*this.overlapLength;n<s;n+=2)r=n+e,a+=i[r]*t[n]+i[r+1]*t[n+1];return a}},{key:"overlap",value:function(e){this.overlapStereo(2*e)}},{key:"overlapStereo",value:function(e){for(var t,i,r,a,n,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[(n=(t=2*c)+l)+0]=s[(a=t+e)+0]*r+this.midBuffer[0+t]*i,o[n+1]=s[a+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)}}}])}(ii);function li(e,t){return 1e-10<(t<e?e-t:t-e)}var ci=function(){function e(){A(this,e),this.transposer=new ri(!1),this.stretch=new oi(!1),this._inputBuffer=new ti,this._intermediateBuffer=new ti,this._outputBuffer=new ti,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}return m(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,li(this._tempo,e)&&(this.stretch.tempo=this._tempo),li(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()}}])}(),ui=function(){function e(t,i,r){A(this,e),this.player=t,this.audio=i,this.soundTouch=new ci,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new ni(r,this.soundTouch)}return m(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),a=new Float32Array(i),n=0;n<i;n++)r[n]=t[2*n],a[n]=t[2*n+1];return{size:i,left:r,right:a,ts:this.audio.tempAudioTimestamp||0}}},{key:"destroy",value:function(){this.soundTouch&&(this.soundTouch.clear(),this.soundTouch=null),this.filter&&(this.filter=null)}}])}(),di=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,(mt()&&null===e._opt.audioEngine||i.engineType===Ce)&&(i.audioBufferSize=e._opt.weiXinInAndroidAudioBufferSize||4800),i.scriptStartTime=0,i.player.debug.log("AudioContext","init",{audioBufferSize:i.audioBufferSize}),i}return g(t,e),m(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===Ce}},{key:"initProcessor",value:function(){this.processor=new ei(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new ui(this.player,this,this.processor)}},{key:"initScriptNode",value:function(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.player._opt.audioEngine?this.player._opt.audioEngine===_e&&Tt()?this.initWorkletScriptNode():this.player._opt.audioEngine===Ce?this.initIntervalScriptNode():this.player._opt.audioEngine===Re?this.initProcessScriptNode():this.autoInitScriptNode():this.autoInitScriptNode())}},{key:"autoInitScriptNode",value:function(){mt()?this.initIntervalScriptNode():!Qe()&&Tt()?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=Ce;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=_e,this.audioContext&&this.audioContext.audioWorklet.addModule(Et((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),m(t,[{key:"process",value:function(e,t,i){var r=t[0][0],a=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 n=this.samplesArray[0],s=0;s<r.length;s++)1===this.channels?r[s]=n.left[s+this.offset]:2===this.channels&&(r[s]=n.left[s+this.offset],a)&&(a[s]=n.right[s+this.offset]);else 1===this.channels?r.fill(0):2===this.channels&&(r.fill(0),a)&&a.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],a=(t=t||Oe,e.length);r&&(i=e,a=this.audioBufferSize);var n,s=this.audioInfo.channels;this.bufferList.length&&this.playing?(n=this.player._opt).syncAudioAndVideo&&n.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===(n=this._provide(a)).size?r?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,s):(n&&n.ts&&(this.player.audioTimestamp=n.ts),r?i.port.postMessage({message:"data",buffer:n}):this.fillScriptNodeOutputBuffer(e,s,n)):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 a=e.getChannelData(0),n=e.getChannelData(1);i&&0!==i.size?(a.set(i.left),n.set(i.right)):(a.fill(0),n.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)}}])}(Zt),hi=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),m(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){st(e.encTypeCode)&&(this.audioInfo.encType=X[e.encTypeCode]),st(e.encType)&&(this.audioInfo.encType=e.encType),st(e.channels)&&(this.audioInfo.channels=e.channels),st(e.sampleRate)&&(this.audioInfo.sampleRate=e.sampleRate),st(this.audioInfo.sampleRate)&&st(this.audioInfo.channels)&&st(this.audioInfo.encType)&&!this.init&&(this.player.emit(U.audioInfo,this.audioInfo),this.init=!0)}},{key:"isPlaying",get:function(){return!0}},{key:"volume",get:function(){return Dt(this.$video.muted)?0:this.$video.volume}},{key:"isMute",get:function(){return 0===this.$video.volume||Dt(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=Ne(e,0,1),this.$video.muted&&(this.$video.muted=!1),this.$video.volume=e,this.player.emit(U.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}}])}(It),fi=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.player.on(U.playbackPause,(function(e){i.listenPlaybackPause(e)})),i.player.debug.log("AudioPlaybackContext","init"),i}return g(t,e),m(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"))}}])}(di),pi=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return m(e,null,[{key:"getLoaderFactory",value:function(e){return e.playType===s?fi:e.isHls||e.isWebrtc?hi:di}}])}(),gi=function(t){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=Ve((function(t){e.emit(U.kBps,(t/1024).toFixed(2))})),t.streamRateInterval=null,e.debug.log("FetchStream","init"),t}return g(i,t),m(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=Ue(),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(U.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(Ee)&&-1===i.indexOf(ke)&&e.name!==Te&&(t.abort(),t.emit(G.fetchError,e),t.player.emit(U.error,G.fetchError))}}));else{t.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");var i=e.body.getReader(),a=function(){i.read().then((function(e){var i=e,n=(e=i.done,i.value);e?r.close():(t.streamRate&&t.streamRate(n.byteLength),r.dispatch(n),a())})).catch((function(e){r.close();var i=e.toString();-1===i.indexOf(Ee)&&-1===i.indexOf(ke)&&e.name!==Te&&(t.abort(),t.emit(G.fetchError,e),t.player.emit(U.error,G.fetchError))}))};a()}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(G.fetchError,"fetch response status is ".concat(e.status," and ok is ")+e.ok),t.player.emit(U.error,G.fetchError)})).catch((function(e){"AbortError"!==e.name&&(r.close(),t.abort(),t.emit(G.fetchError,e),t.player.emit(U.error,G.fetchError))}))}},{key:"abort",value:function(){this.abortController&&(this.abortController.abort(),this.abortController=null)}},{key:"getStreamType",value:function(){return e}}])}(It),mi=function(e){function i(e){var t;return A(this,i),t=p(this,i),t.player=e,t.socket=null,t.socketStatus=H,t.wsUrl=null,t.socketDestroyFnList=[],t.streamRate=Ve((function(t){e.emit(U.kBps,(t/1024).toFixed(2))})),t.streamRateInterval=null,e.debug.log("WebsocketStream","init"),t}return g(i,e),m(i,[{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,a=t.demux;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";var n=r(this.socket,"open",(function(){i.log("WebsocketStream","socket open"),e.socketStatus=V,e.emit(U.streamSuccess),e.player.emit(U.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(U.websocketClose),e.emit(U.streamEnd)})),l=r(this.socket,"error",(function(t){i.log("WebsocketStream","socket error"),e.socketStatus="error",e.emit(G.websocketError,t),e.player.emit(U.error,G.websocketError),a.close(),i.log("WebsocketStream","socket error:",t)}));this.socketDestroyFnList.push(n,s,o,l)}},{key:"_closeWebSocket",value:function(){this.socketDestroyFnList.forEach((function(e){return e()})),this.socket&&(this.socket.close(),this.socket=null),this.socketStatus=H,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=Ue(),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 t}}])}(It),Ai=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),m(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=Ue(),i.loadSource(e).then((function(){t.player.debug.log("HlsStream","loadSource success"),t.emit(U.streamSuccess)})).catch((function(e){t.emit(G.hlsError,e),t.emit(U.error,G.hlsError)}))}},{key:"getStreamType",value:function(){return"hls"}}])}(It),yi=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),m(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=Ue(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),i.loadSource(this.webrctUrl).then((function(){t.player.debug.log("WebrtcStream","loadSource success"),t.emit(U.streamSuccess)})).catch((function(e){t.emit(G.webrtcError,e),t.emit(U.error,G.webrtcError)}))}},{key:"getStreamType",value:function(){return"webrtc"}}])}(It),vi=function(e){function t(e){var i;return A(this,t),i=p(this,t),i.player=e,i.transport=null,i.wtUrl=null,i.streamRate=Ve((function(t){e.emit(U.kBps,(t/1024).toFixed(2))})),i.streamRateInterval=null,e.debug.log("WebTransportLoader","init"),i}return g(t,e),m(t,[{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(U.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=Ue(),this.wtUrl=e.replace(/^wt/,"https"),this._createWebTransport()}},{key:"abort",value:function(){if(this.transport)try{this.transport.close(),this.transport=null}catch(It){this.transport=null}}},{key:"getStreamType",value:function(){return"webTransport"}}])}(It),bi=function(r){function a(e){var t;return A(this,a),t=p(this,a),t.player=e,t.workUrl=null,e.debug.log("WorkerStream","init"),t}return g(a,r),m(a,[{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=Ue(),this.player.decoderWorker.workerFetchStream(e)}},{key:"getStreamType",value:function(){var r=this.player._opt.protocol;return i+" "+(2===r?e:t)}}])}(It),Ei=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return m(e,null,[{key:"getLoaderFactory",value:function(e){var t=e.protocol,i=e.useWasm,r=e.playType;return 2===t?r!==n||i&&!bt(e)?bi:gi:1===t?r!==n||i&&!bt(e)?bi:mi:3===t?Ai:4===t?yi:5===t?vi:void 0}}])}(),ki=Be((function(e){function t(e,a){if(!e)throw"First parameter is required.";a=new i(e,a=a||{type:"video"});var n=this;function s(t){t&&(a.initCallback=function(){t(),t=a.initCallback=null});var i=new r(e,a);(f=new i(e,a)).record(),h("recording"),a.disableLogs||console.log("Initialized recorderType:",f.constructor.name,"for output-type:",a.type)}function o(e){function t(t){if(f){Object.keys(f).forEach((function(e){"function"!=typeof f[e]&&(n[e]=f[e])}));var i,r=f.blob;if(!r){if(!t)throw"Recording failed.";f.blob=r=t}if(r&&!a.disableLogs&&console.log(r.type,"->",m(r.size)),e){try{i=c.createObjectURL(r)}catch(t){}"function"==typeof e.call?e.call(n,i):e(i)}a.autoWriteToDisk&&u((function(e){var t={};t[a.type+"Blob"]=e,x.Store(t)}))}else"function"==typeof e.call?e.call(n,""):e("")}e=e||function(){},f?"paused"===n.state?(n.resumeRecording(),setTimeout((function(){o(e)}),1)):("recording"===n.state||a.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',n.state),a.disableLogs||console.log("Stopped recording "+a.type+" stream."),"gif"!==a.type?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)):(a.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout((function(){u(e,t)}),1e3))}function d(e){e=e||0,"paused"!==n.state?"stopped"!==n.state&&(e>=n.recordingDuration?o(n.onRecordingStopped):(e+=1e3,setTimeout((function(){d(e)}),1e3))):setTimeout((function(){d(e)}),1e3)}function h(e){n&&(n.state=e,"function"==typeof n.onStateChanged.call?n.onStateChanged.call(n,e):n.onStateChanged(e))}var f,p='It seems that recorder is destroyed or "startRecording" is not invoked for '+a.type+" recorder.";function g(){!0!==a.disableLogs&&console.warn(p)}var y={startRecording:function(t){return a.disableLogs||console.log("RecordRTC version: ",n.version),(a=t?new i(e,t):a).disableLogs||console.log("started recording "+a.type+" stream."),f?(f.clearRecordedData(),f.record(),h("recording"),n.recordingDuration&&d()):s((function(){n.recordingDuration&&d()})),n},stopRecording:o,pauseRecording:function(){f?"recording"===n.state?(h("paused"),f.pause(),a.disableLogs||console.log("Paused recording.")):a.disableLogs||console.warn("Unable to pause the recording. Recording state: ",n.state):g()},resumeRecording:function(){f?"paused"===n.state?(h("recording"),f.resume(),a.disableLogs||console.log("Resumed recording.")):a.disableLogs||console.warn("Unable to resume the recording. Recording state: ",n.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 n.recordingDuration=e,n.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){n.onRecordingStopped=e}}},clearRecordedData:function(){f?(f.clearRecordedData(),a.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?A(f.blob,e):g()},getFromDisk:function(e){f?t.getFromDisk(a.type,e):g()},setAdvertisementArray:function(e){a.advertisement=[];for(var t=e.length,i=0;i<t;i++)a.advertisement.push({duration:i,image:e[i]})},blob:null,bufferSize:0,sampleRate:0,buffer:null,reset:function(){"recording"!==n.state||a.disableLogs||console.warn("Stop an active recorder."),f&&"function"==typeof f.clearRecordedData&&f.clearRecordedData(),f=null,h("inactive"),n.blob=null},onStateChanged:function(e){a.disableLogs||console.log("Recorder state changed:",e)},state:"inactive",getState:function(){return n.state},destroy:function(){var e=a.disableLogs;a={disableLogs:!0},n.reset(),h("destroyed"),y=n=null,k.AudioContextConstructor&&(k.AudioContextConstructor.close(),k.AudioContextConstructor=null),a.disableLogs=e,a.disableLogs||console.log("RecordRTC is destroyed.")},version:"5.6.2"};if(this){for(var v in y)this[v]=y[v];n=this}else n=y;return y}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===R||t.recorderType===_||t.recorderType===M?t.type="video":t.recorderType===I?t.type="gif":t.recorderType===S?t.type="audio":t.recorderType===w&&(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=w),"video"===t.type&&(f||d)&&(i=R,"undefined"!=typeof ReadableStream)&&(i=M),"gif"===t.type&&(i=I),"canvas"===t.type&&(i=_),T()&&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=w):"function"==typeof MediaRecorder.isTypeSupported&&MediaRecorder.isTypeSupported("video/webm")&&(i=w)),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?w:i}function n(e){this.addStream=function(t){t&&(e=t)},this.mediaType={audio:!0,video:!0},this.startRecording=function(){var i,r,a,n,s=this.mediaType,o=this.mimeType||{audio:null,video:null,gif:null};if("function"!=typeof s.audio&&T()&&!b(e,"audio").length&&(s.audio=!1),"function"!=typeof s.video&&T()&&!b(e,"video").length&&(s.video=!1),"function"!=typeof s.gif&&T()&&!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,T()&&s.audio&&"function"==typeof s.audio&&(n=b(e,"video")[0],h?((r=new g).addTrack(n),i&&i===R&&(i=w)):(r=new g).addTrack(n)),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&&(a=this,n=!0===T(),!0===(n=!(s.audio instanceof S&&s.video||!0!==s.audio&&!0!==s.video&&s.audio!==s.video)&&n)?(a.audioRecorder=null,a.videoRecorder.startRecording()):a.videoRecorder.initRecorder((function(){a.audioRecorder.initRecorder((function(){a.videoRecorder.startRecording(),a.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!"),x.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){x.Store({audioBlob:t,videoBlob:i,gifBlob:e})}))}))})):e.audio&&e.video?e.audio.getDataURL((function(t){e.video.getDataURL((function(e){x.Store({audioBlob:t,videoBlob:e})}))})):e.audio&&e.gif?e.audio.getDataURL((function(t){e.gif.getDataURL((function(e){x.Store({audioBlob:t,gifBlob:e})}))})):e.video&&e.gif?e.video.getDataURL((function(t){e.gif.getDataURL((function(e){x.Store({videoBlob:t,gifBlob:e})}))})):e.audio?e.audio.getDataURL((function(e){x.Store({audioBlob:e})})):e.video?e.video.getDataURL((function(e){x.Store({videoBlob:e})})):e.gif&&e.gif.getDataURL((function(e){x.Store({gifBlob:e})}))},n.getFromDisk=t.getFromDisk,n.writeToDisk=t.writeToDisk,t.MRecordRTC=n,(e=void 0!==Ie?Ie:null)&&"undefined"==typeof window&&void 0!==Ie&&(Ie.navigator={userAgent:"Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45",getUserMedia:function(){}},Ie.console||(Ie.console={}),void 0!==Ie.console.log&&void 0!==Ie.console.error||(Ie.console.error=Ie.console.log=Ie.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=Ie);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)),a=setTimeout((function(){e(i+r)}),r);return s=i+r,a})),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 m(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 A(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"==y(window.process)&&"renderer"===window.process.type||!("undefined"==typeof a||"object"!=y(a.versions)||!a.versions.electron)||"object"==("undefined"===typeof navigator?"undefined":y(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 E(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=A,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,a=EBML.tools,n=new FileReader;n.onload=function(e){r.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var n=a.makeMetadataSeekable(i.metadatas,i.duration,i.cues),s=this.result.slice(i.metadataSize);n=new Blob([n,s],{type:"video/webm"});t(n)},n.readAsArrayBuffer(e)},t.bytesToSize=m,t.isElectron=v;var k={};function T(){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 w(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 a,n=[];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 a&&a.mimeType?a.mimeType:e.mimeType||"video/webm"}function l(){n=[],a=null,r.timestamps=[]}this.getArrayOfBlobs=function(){return n},this.record=function(){r.blob=null,r.clearRecordedData(),r.timestamps=[],c=[],n=[];var l=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",l),a=a&&null,f&&!T()&&(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{a=new MediaRecorder(e,l),t.mimeType=l.mimeType}catch(i){a=new MediaRecorder(e)}l.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in a&&!1===a.canRecordMimeType(l.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",l.mimeType)),a.ondataavailable=function(e){e.data&&c.push("ondataavailable: "+m(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&&(n.push(e.data),s(),"function"==typeof t.ondataavailable)&&(e=t.getNativeBlob?e.data:new Blob([e.data],{type:o(l)}),t.ondataavailable(e))},a.onstart=function(){c.push("started")},a.onpause=function(){c.push("paused")},a.onresume=function(){c.push("resumed")},a.onstop=function(){c.push("stopped")},a.onerror=function(e){e&&(e.name||(e.name="UnknownError"),c.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",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&&a&&"inactive"===a.state?(delete t.timeslice,a.start(6e5)):setTimeout(void 0,1e3),"inactive"!==a.state)&&"stopped"!==a.state&&a.stop()},"number"==typeof t.timeSlice?(s(),a.start(t.timeSlice)):a.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},r.manuallyStopped=!0,a&&(this.recordingCallback=e,"recording"===a.state&&a.stop(),"number"==typeof t.timeSlice)&&setTimeout((function(){r.blob=new Blob(n,{type:o(t)}),r.recordingCallback(r.blob)}),100)},this.pause=function(){a&&"recording"===a.state&&a.pause()},this.resume=function(){a&&"paused"===a.state&&a.resume()},this.clearRecordedData=function(){a&&"recording"===a.state&&r.stop(l),l()},this.getInternalRecorder=function(){return a},this.blob=null,this.getState=function(){return a&&a.state||"inactive"};var c=[];this.getAllStates=function(){return c},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1),r=this,function i(){if(a&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void 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,a=this,n=[],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,a=e.leftBuffers.slice(0),n=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)),a=[],n=Number((e.length-1)/(r-1));a[0]=e[0];for(var s,o=1;o<r-1;o++){var l=o*n,c=Number(Math.floor(l)).toFixed(),u=Number(Math.ceil(l)).toFixed();a[o]=(s=e[c],u=e[u],s+(u-s)*(l-c))}return a[r-1]=e[e.length-1],a}function c(e,t){for(var i=new Float64Array(t),r=0,a=e.length,n=0;n<a;n++){var s=e[n];i.set(s,r),r+=s.length}return i}function u(e,t,i){for(var r=i.length,a=0;a<r;a++)e.setUint8(t+a,i.charCodeAt(a))}2===r&&(a=c(a,o),n=c(n,o),e)&&(a=l(a,e,s),n=l(n,e,s)),1===r&&(a=c(a,o),e)&&(a=l(a,e,s)),e&&(s=e),2===r&&(i=function(e,t){for(var i=e.length+t.length,r=new Float64Array(i),a=0,n=0;n<i;)r[n++]=e[a],r[n++]=t[a],a++;return r}(a,n));o=(i=1===r?a: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,a,n;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"})),(a=new Worker(r)).workerURL=r,(n=a).onmessage=function(e){t(e.data.buffer,e.data.view),c.revokeObjectURL(n.workerURL),n.terminate()},n.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.";E(),T=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:n,rightBuffers:1===u?[]:s,noWorker:i.noWorker},(function(t,i){a.blob=new Blob([i],{type:"audio/wav"}),a.buffer=new ArrayBuffer(i.buffer.byteLength),a.view=i,a.sampleRate=d||y,a.bufferSize=A,a.length=l,T=!1,e&&e(a.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 E(){n=[],l=0,v=o=T=!(s=[]),p=null,a.leftchannel=n,a.rightchannel=s,a.numberOfAudioChannels=u,a.desiredSampRate=d,a.sampleRate=y,a.recordingLength=l,w={left:[],right:[],recordingLength:0}}function k(){r&&(r.onaudioprocess=null,r.disconnect(),r=null),g&&(g.disconnect(),g=null),E()}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 T=!(this.toString=function(){return this.name}),w=(r.onaudioprocess=function(e){var t,c;v||(!1===h()&&(i.disableLogs||console.log("MediaStream seems stopped."),r.disconnect(),o=!1),o?(T||(T=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback()),t=e.inputBuffer.getChannelData(0),t=new Float32Array(t),n.push(t),2===u&&(e=e.inputBuffer.getChannelData(1),c=new Float32Array(e),s.push(c)),l+=A,a.recordingLength=l,void 0!==i.timeSlice&&(w.recordingLength+=A,w.left.push(t),2===u)&&w.right.push(c)):g&&(g.disconnect(),g=null))},p.createMediaStreamDestination?r.connect(p.createMediaStreamDestination()):r.connect(p.destination),this.leftchannel=n,this.rightchannel=s,this.numberOfAudioChannels=u,this.desiredSampRate=d,this.sampleRate=y,a.recordingLength=l,{left:[],right:[],recordingLength:0});function S(){o&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(w.left.length?(f({desiredSampRate:d,sampleRate:y,numberOfAudioChannels:u,internalInterleavedLength:w.recordingLength,leftBuffers:w.left,rightBuffers:1===u?[]:w.right},(function(e,t){t=new Blob([t],{type:"audio/wav"}),i.ondataavailable(t),setTimeout(S,i.timeSlice)})),w={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,a,n,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(n=!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.";(a=new w(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 a=r-i;t.disableLogs||console.log(a+"/"+r+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(a,r),a=e.image.toDataURL("image/webp",1);f.frames[i].image=a})),t.disableLogs||console.log("Generating WebM")),i()};var c=!(this.stop=function(e){n=!1;var r=this;i&&a?a.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=n=!1}function d(){if(c)return h=(new Date).getTime(),setTimeout(d,500);var i,r,a;"canvas"===e.nodeName.toLowerCase()?(i=(new Date).getTime()-h,h=(new Date).getTime(),f.frames.push({image:(a=(r=document.createElement("canvas")).getContext("2d"),r.width=e.width,r.height=e.height,a.drawImage(e,0,0),r),duration:i}),n&&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}),n&&setTimeout(d,t.frameInterval)}})}this.pause=function(){c=!0,a instanceof w&&a.pause()},this.resume=function(){c=!1,a instanceof w?a.resume():n||this.record()},this.clearRecordedData=function(){n&&this.stop(u),u()},this.name="CanvasRecorder",this.toString=function(){return this.name};var h=(new Date).getTime(),f=new C.Video(100)}function R(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-o;return t?a?(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"),E(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 C.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)}),a=!(this.stop=function(e){e=e||function(){},r=!0;var i=this;setTimeout((function(){var r,a,n,s,o,u,d,h,f,p,g,m,A,y,v,b,E;r=l.frames,a=-1,s=n=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===a,g=a&&0<a&&a<=r.length?a:r.length,m=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),A=n&&0<=n&&n<=1?n:0,y=s&&0<=s&&s<=1?s:0,v=!1,b=-1,E=(d={length:g,functionToLoop:function(e,t){function i(){!v&&s-a<=s*y||(p&&(v=!0),f.push(r[t])),e()}var a,n,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);a=0,n=e.data.length,s=e.data.length/4;for(var t=0;t<n;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&&a++}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!==E?setTimeout((function(){d.functionToLoop(e,b)}),1):d.callback()}()}),10)});function n(){l.frames=[],a=!(r=!0)}this.pause=function(){a=!0},this.resume=function(){a=!1,r&&this.record()},this.clearRecordedData=function(){r||this.stop(n),n()},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=w,t.StereoAudioRecorder=S,t.CanvasRecorder=_,t.WhammyRecorder=R,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=L,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 C={Video:D};function D(e){this.frames=[],this.duration=e||1,this.quality=.8}function L(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=[],a=0;a<e.length;a++){var n=e[a].data,s=(n="string"==typeof(n="number"==typeof(n="object"==y(n)?i(n):n)?t(n.toString(2)):n)?new Uint8Array(n.split("").map((function(e){return e.charCodeAt(0)}))):n).size||n.byteLength||n.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[a].id)),r.push(t(o)),r.push(n)}return new Blob(r,{type:"video/webm"})}function r(e){for(var t=0,i={};t<e.length;){var a=e.substr(t,4),n=(n=t,parseInt(e.substr(n+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,n);t+=8+n,i[a]=i[a]||[],"RIFF"===a||"LIST"===a?i[a].push(r(s)):i[a].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,a=1;a<e.length;a++)r+=e[a].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,a=[{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}]}]}]}]}],n=0,s=0;n<e.length;){for(var o=[],l=0;o.push(e[n]),l+=e[n].duration,++n<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)};a[1].data.push(c),s+=l}return i(a)}(e.map((function(e){var t=function(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),r=0,a=[];r<4;r++)a[r]=t.charCodeAt(i+3+r);return{width:16383&(a[1]<<8|a[0]),height:16383&(a[3]<<8|a[2]),data:t,riff:e}}(r(atob(e.image.slice(23))));return t.duration=e.duration,t}))),postMessage(e)}t.Whammy=C;var x={init:function(){var e,t,i,r=this;function a(e){e.createObjectStore(r.dataStoreName)}function n(){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(){a(e),n()}:n()},i.onupgradeneeded=function(e){a(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,a=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement,n=(this.record=function(){"undefined"!=typeof GIFEncoder&&u?(a||(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(n)return setTimeout((function(){e(i)}),100);f=o(e),i-d<90||(!a&&r.paused&&r.play(),a||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(){n=!0},this.resume=function(){n=!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=(a&&(e instanceof CanvasRenderingContext2D?s=(c=e).canvas:e instanceof HTMLCanvasElement&&(c=e.getContext("2d"),s=e)),!0);a||((r=document.createElement("video")).muted=!0,r.autoplay=!0,r.playsInline=!0,u=!1,r.onloadedmetadata=function(){u=!0},E(e,r),r.play());var d,h,f=null,p=this}function B(e,t){t=t||"multi-streams-mixer";var i=[],r=!1,a=document.createElement("canvas"),n=a.getContext("2d"),s=(a.style.opacity=0,a.style.position="absolute",a.style.zIndex=-1,a.style.top="-1000em",a.style.left="-1000em",a.className=t,(document.body||document.documentElement).appendChild(a),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,n;r||(e=i.length,t=!1,n=[],i.forEach((function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:n.push(e)})),t?(a.width=t.stream.width,a.height=t.stream.height):n.length?(a.width=1<e?2*n[0].width:n[0].width,a.height=n[0].height*(9!==e&&10!==e?7!==e&&8!==e?5!==e&&6!==e?3!==e&&4!==e?1:2:3:4:5)):(a.width=s.width||360,a.height=s.height||240),t&&t instanceof HTMLVideoElement&&d(t),n.forEach((function(e,t){d(e,t)})),setTimeout(u,s.frameInterval))}function d(e,t){var i,a,s,o;r||(a=i=0,s=e.width,o=e.height,1===t&&(i=e.width),2===t&&(a=e.height),3===t&&(i=e.width,a=e.height),4===t&&(a=2*e.height),5===t&&(i=e.width,a=2*e.height),6===t&&(a=3*e.height),7===t&&(i=e.width,a=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(a=e.stream.top),void 0!==e.stream.width&&(s=e.stream.width),void 0!==e.stream.height&&(o=e.stream.height),n.drawImage(e,i,a,s,o),"function"==typeof e.stream.onRender&&e.stream.onRender(n,i,a,s,o,t))}function h(e){var i,r,a=document.createElement("video");return i=e,!("srcObject"in(r=a))&&"mozSrcObject"in r?r.mozSrcObject=i:r.srcObject=i,a.className=t,a.muted=!0,a.volume=0,a.width=e.width||s.width||360,a.height=e.height||s.height||240,a.play(),a}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,a=new l;t.getTracks().filter((function(e){return"video"===e.kind})).length&&((r=h(t)).stream=t,i.push(r),a.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),a.addTrack(s.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])),e.push(a)}))},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,n.clearRect(0,0,a.width,a.height),a.stream&&(a.stream.stop(),a.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 a?n=a.captureStream():"mozCaptureStream"in a?n=a.mozCaptureStream():s.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features"),t=new l,n.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)}));var t,i=a.stream=t,n=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 n&&n.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,a=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var a;i=new B(e,t.elementClass||"multi-streams-mixer"),a=[],e.forEach((function(e){b(e,"video").forEach((function(e){a.push(e)}))})),a.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 w(i.getMixedStream(),t)).record()},this.stop=function(e){r&&r.stop((function(t){a.blob=t,e(t),a.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(a){if(!a)throw"First parameter is required.";a instanceof Array||(a=[a]),e.concat(a),r&&i&&(i.appendStreams(a),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,a;function n(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){n(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(n){"READY"===n.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 a=document.createElement("canvas"),n=document.createElement("video"),s=!0;n.srcObject=e,n.muted=!0,n.height=t.height,n.width=t.width,n.volume=0,n.onplaying=function(){a.width=t.width,a.height=t.height;var e=a.getContext("2d"),o=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),r.close()),s&&(s=!1,t.onVideoProcessStarted)&&t.onVideoProcessStarted(),e.drawImage(n,0,0),"closed"!==r._controlledReadableStream.state)try{r.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),o)},n.play()}}).pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):r.postMessage(e.data.buffer,[e.data.buffer])}}))):!n.data||a||s.push(n.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(){a=!(s=[]),this.blob=null,n(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){a=!0},this.resume=function(){a=!1};var s=[];this.stop=function(e){i=!0;var t,a=this;t=function(){a.blob=new Blob(s,{type:"video/webm"}),e(a.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(){a=!(s=[]),this.blob=null},this.blob=null}t.DiskStorage=x,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})),Ti=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 m(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)}}])}(),wi=function(){function e(){A(this,e)}return m(e,null,[{key:"_ebsp2rbsp",value:function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),a=0,n=0;n<i;n++)2<=n&&3===t[n]&&0===t[n-1]&&0===t[n-2]||(r[a]=t[n],a++);return new Uint8Array(r.buffer,0,a)}},{key:"parseSPS",value:function(t){var i=e._ebsp2rbsp(t),r=new Ti(i);r.readByte();t=r.readByte();var a=(r.readByte(),r.readByte());r.readUEG();var n=e.getProfileString(t),s=e.getLevelString(a),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(),a=r.readUEG(),0===a)r.readUEG();else if(1===a){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),a=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),E=1,k=0,T=!0,w=0,S=0,_=(r.readBool()&&(r.readBool()&&(0<(L=r.readByte())&&L<16?(b=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][L-1],E=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][L-1]):255===L&&(b=r.readByte()<<8|r.readByte(),E=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())&&(L=r.readBits(32),D=r.readBits(32),T=r.readBool(),w=D,S=2*L,k=w/S),1),R=(1===b&&1===E||(_=b/E),0),C=0;C=0===o?(R=1,2-g):(R=3===o?1:2,(1===o?2:1)*(2-g));var D=16*(a+1),L=16*(p+1)*(2-g);D-=(m+A)*R,L-=(y+v)*C,a=Math.ceil(D*_);return r.destroy(),r=null,{profile_string:n,level_string:s,bit_depth:c,ref_frames:t,chroma_format:l,chroma_format_string:e.getChromaFormatString(l),frame_rate:{fixed:T,fps:k,fps_den:S,fps_num:w},sar_ratio:{width:b,height:E},codec_size:{width:D,height:L},present_size:{width:a,height:L}}}},{key:"parseSPS$2",value:function(t){for(var i=t.subarray(1,4),r="avc1.",a=0;a<3;a++){var n=i[a].toString(16);n.length<2&&(n="0"+n),r+=n}var s=e._ebsp2rbsp(t),o=new Ti(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()),E=o.readUEG(),k=o.readBits(1);0===k&&o.readBits(1),o.readBits(1);var T=0,w=0,S=0,_=0,R=(o.readBool()&&(T=o.readUEG(),w=o.readUEG(),S=o.readUEG(),_=o.readUEG()),1),C=1,D=0,L=!0,x=0,I=0,B=(o.readBool()&&(o.readBool()&&(0<(F=o.readByte())&&F<16?(R=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][F-1],C=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][F-1]):255===F&&(R=o.readByte()<<8|o.readByte(),C=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),L=o.readBool(),x=O,I=2*F,D=x/I),1),P=(1===R&&1===C||(B=R/C),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*(E+1)*(2-k);O-=(T+w)*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:L,fps:D,fps_den:I,fps_num:x},sar_ratio:{width:R,height:C},codec_size:{width:O,height:F},present_size:{width:b,height:F}}}},{key:"_skipScalingList",value:function(e,t){for(var i,r=8,a=8,n=0;n<t;n++)0!==a&&(i=e.readSEG(),a=(r+i+256)%256),r=0===a?r:a}},{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"}}}])}(),Si=function(){function e(t){A(this,e),this.buffer=t,this.buflen=t.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}return m(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 _i(e){var t={},i=new DataView(e.buffer),r=i.getUint8(0),a=i.getUint8(1);if(i.getUint8(2),i.getUint8(3),1!==r||0===a)return{};var n=1+(3&i.getUint8(4));if(3!=n&&4!=n)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,wi.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,E=new Uint8Array([b>>>24&255,b>>>16&255,b>>>8&255,255&b]),k=new Uint8Array(b+4);k.set(E,0),k.set(t.sps,4),t.sps=k}if(t.pps){var T=t.pps.byteLength,w=new Uint8Array([T>>>24&255,T>>>16&255,T>>>8&255,255&T]),S=new Uint8Array(T+4);S.set(w,0),S.set(t.pps,4),t.pps=S}return t}function Ri(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 Ci(e){return 31&e[0]}function Di(e){return e===$}function Li(e){return 7!==e&&8!==e&&!Di(e)}var xi=function(e){for(var t=e,i=t.byteLength,r=new Uint8Array(i),a=0,n=0;n<i;n++)2<=n&&3===t[n]&&0===t[n-1]&&0===t[n-2]||(r[a]=t[n],a++);return new Uint8Array(r.buffer,0,a)};function Ii(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],a=e.slice(23),n=0;n<r&&!(a.length<3);n++){var s=63&a[0],o=a[1]<<8|a[2];a=a.slice(3);for(var l=0;l<o&&!(a.length<2);l++){var c,u=a[0]<<8|a[1];if(a.length<2+u)break;a=a.slice(2),33==s&&((c=new Uint8Array(u)).set(a.slice(0,u),0),i.psps=function(e){var t,i,r={},a=e.length,n=[],s=new Si(e);s.read(1),s.read(6),s.read(6),s.read(3);for(var o=2;o<a;o++)o+2<a&&3==s.look(24)?(n.push(s.read(8)),n.push(s.read(8)),o+=2,s.read(8)):n.push(s.read(8));return e=new Uint8Array(n),e=new Si(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 a=t;a<8;a++)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 n=0;n<t;n++)i.sub_layer_profile_present_flag[n]&&(i.sub_layer_profile_space[n]=e.read(2),i.sub_layer_tier_flag[n]=e.read(1),i.sub_layer_profile_idc[n]=e.read(5),i.sub_layer_profile_compatibility_flag[n]=e.read(32),i.sub_layer_progressive_source_flag[n]=e.read(1),i.sub_layer_interlaced_source_flag[n]=e.read(1),i.sub_layer_non_packed_constraint_flag[n]=e.read(1),i.sub_layer_frame_only_constraint_flag[n]=e.read(1),e.read(32),e.read(12)),i.sub_layer_level_present_flag[n]?i.sub_layer_level_idc[n]=e.read(8):i.sub_layer_level_idc[n]=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)),a=a.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 Bi(e){return(126&e[0])>>1}var Pi=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),m(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=_i(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)),a=e[t+=i];if(33!=(63&a))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is "+a),{};t+=2;a=e[1+ ++t]|e[t]<<8;var n=e.slice(t+=2,t+a),s=e[t+=a];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([a>>>24&255,a>>>16&255,a>>>8&255,255&a]);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]);a=new Uint8Array(4+a),a.set(t,0),a.set(n,4),t=new Uint8Array(4+s),t.set(o,0),t.set(e,4),n=new Uint8Array(4+i);return n.set(l,0),n.set(r,4),{sps:a,pps:t,vps:n}}(r);var a=Ii(e);i=Object.assign(i,a)}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)}}])}(It),Mi=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),m(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,a=new FileReader;return new Promise((function(n,s){a.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();var a=r.makeMetadataSeekable(t.metadatas,t.duration,t.cues),s=this.result.slice(t.metadataSize);a=new Blob([a,s],{type:"video/webm"});n(a)},a.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()===S?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 a=this.player.audio.mediaStreamAudioDestinationNode.stream;if(0<a.getAudioTracks().length){var n=a.getAudioTracks()[0];n&&n.enabled&&r.addTrack(n)}}this.recorder=ki(r,i)}else t.error("RecorderRTC","startRecord error and can not create stream"),this.emit(U.recordCreateError)}catch(i){t.error("RecorderRTC","startRecord error",i),this.emit(U.recordCreateError)}this.recorder&&(this._isRecording=!0,this.player.emit(U.recording,!0),this.recorder.startRecording(),t.log("RecorderRTC","start recording"),this.player.emit(U.recordStart),this.startRecordingInterval())}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(U.recordingTimestamp,e._recordingTimestamp)}),1e3)}},{key:"stopRecordAndSave",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:K,i=1<arguments.length?arguments[1]:void 0;return new Promise((function(r,a){e.recorder&&e._isRecording||a("recorder is not ready"),i&&e.setFileName(i),e.recorder.stopRecording((function(){e.player.debug.log("RecorderRTC","stop recording");var i=(e.fileName||Ue())+"."+b;if(e.recorder.getBlob(),"blob"===t){var a=e.recorder.getBlob();r(a),e.player.emit(U.recordBlob,a)}else r(),e.recorder.save(i);e.player.emit(U.recordEnd),e._reset(),e.player.emit(U.recording,!1)}))}))}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}},{key:"getTotalDuration",value:function(){return this.recordTime}},{key:"getType",value:function(){return b}},{key:"initMetaData",value:function(){}}])}(Pi),Oi=function(){function e(){A(this,e)}return m(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),a=r.length,n=0;n<a;n++)t+=r[n].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<a;o++)i.set(r[o],s),s+=r[o].byteLength;return i}},{key:"generateInitSegment",value:function(t,i,r){var a=e.box(e.types.ftyp,e.constants.FTYP),n=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=a.byteLength+n.byteLength+s,d.data);o.set(d,s),s+=d.byteLength}}return r=e.moov(t,i),t=new Uint8Array(a.byteLength+r.byteLength+o.byteLength+n.byteLength),t.set(a,0),t.set(n,a.byteLength),t.set(o,a.byteLength+n.byteLength),t.set(r,a.byteLength+o.byteLength+n.byteLength),t}},{key:"moov",value:function(t,i){for(var r=t.timescale,a=t.duration,n=i.length,s=e.mvhd(r,a),o=new Uint8Array,l=0;l<n;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,a=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,a>>>8&255,255&a,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,a=0;a<i;a++)"video"===t[a].type&&(r+=t[a].duration);var n=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,n>>>24&255,n>>>16&255,n>>>8&255,255&n,0,0,0,0,0,1,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))}},{key:"mdhd",value:function(t){var 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}],a=[i[0].duration],n=i.length,s=0;s<n;s++)for(var o=0;o<r.length;o++)i[s].duration===r[o].duration?r[o].num++:a.indexOf(i[s].duration)<0&&(a.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]),a=r.byteLength,n=new Uint8Array(a+8*i);n.set(r,0);for(var s=0;s<i;s++)n.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]),a),a+=8;return e.box(e.types.stts,n)}},{key:"stss",value:function(t){for(var i=[],r=t.length,a=0;a<r;a++)!0===t[a].isKeyframe&&i.push(a+1);var n=i.length,s=new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n]),o=s.byteLength,l=new Uint8Array(o+4*n);l.set(s,0);for(var c=0;c<n;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]),a=r.byteLength,n=new Uint8Array(a+12*i);n.set(r,0);for(var s=0;s<i;s++){var o=t[s].chunkNo,l=t[s].num,c=t[s].sampleDelte;n.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]),a),a+=12}return e.box(e.types.stsc,n)}},{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]),a=r.byteLength,n=new Uint8Array(a+4*i);n.set(r,0);for(var s=0;s<i;s++){var o=t[s].data.byteLength;n.set(new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o]),a),a+=4}return e.box(e.types.stsz,n)}},{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,a=(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,a.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,a)}},{key:"sdtp",value:function(t){for(var i=t.samples||[],r=i.length,a=new Uint8Array(4+r),n=0;n<r;n++){var s=i[n].flags;a[n+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,a)}},{key:"trun",value:function(t,i){var r=t.samples||[],a=r.length,n=(t=12+16*a,new Uint8Array(t));n.set([0,0,15,1,a>>>24&255,a>>>16&255,a>>>8&255,255&a,(i+=8+t)>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var s=0;s<a;s++){var o=r[s].duration,l=r[s].size,c=r[s].flags,u=r[s].cts;n.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,n)}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}}])}();Oi.init();var Fi=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),m(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(U.recording,!0),e.log(this.tagName,"start recording"),this.player.emit(U.recordStart),this.startRecordingInterval()}},{key:"startRecordingInterval",value:function(){var e=this;this.stopRecordingInterval(),this.recordingInterval=window.setInterval((function(){e.player.emit(U.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 a=new Uint8Array(r.byteLength+i.byteLength);a.set(r,0),a.set(i,r.byteLength),t.data=a}else if(this.isH265){var n=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);n.set(this.vps,0),n.set(this.sps,this.vps.byteLength),n.set(this.pps,this.vps.byteLength+this.sps.byteLength),a=new Uint8Array(n.byteLength+i.byteLength),a.set(n,0),a.set(i,n.byteLength),t.data=a}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 v}},{key:"getToTalByteLength",value:function(){return this.totalByteLength}},{key:"stopRecordAndSave",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:K,i=1<arguments.length?arguments[1]:void 0;return new Promise((function(r,a){if(!e.isRecording)return e.player.debug.error(e.tagName,"stop recording fail, isRecording is false "),a("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 "),a("stop recording fail, this.bufferList.length is 0 ");if(i&&e.setFileName(i),a=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),a=Oi.generateInitSegment({timescale:1e3,duration:e.totalDuration},[a],e.totalByteLength),e.player.debug.log(e.tagName,"stop recording"),a=new Blob([a],{type:"application/octet-stream"}),"blob"===t)r(a),e.player.emit(U.recordBlob,a);else{r(),r=(e.fileName||Ue())+"."+v;var n=window.URL.createObjectURL(a),s=window.document.createElement("a");s.download=r,s.href=n,r=window.document.createEvent("MouseEvents"),r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((function(){window.URL.revokeObjectURL(n)}),Qe()?1e3:0)}e._reset(),e.player.emit(U.recording,!1)}))}}])}(Pi),ji=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt))(t)}return m(e,null,[{key:"getLoaderFactory",value:function(e){return e.recordType===v&&(e.useWasm||e.useMSE||e.useWCS)?Fi:Mi}}])}(),Ui=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(U.visibilityChange,(function(){i.updateWorkConfig({key:"visibility",value:t.visibility})}))}return m(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,i=this.player,r=i.debug;d(i.events),this.decoderWorker.onmessage=function(i){var a=i.data;switch(a.cmd){case I:r.log("decoderWorker","onmessage:",I),e.decoderWorker&&e._initWork(),e.player.loaded||e.player.emit(U.load),e.player.emit(U.decoderWorkerInit);break;case O:r.log("decoderWorker","onmessage:",O,a.code),e.player._times.decodeStart||(e.player._times.decodeStart=Ue()),e.player.video.updateVideoInfo({encTypeCode:a.code});break;case F:r.log("decoderWorker","onmessage:",F,a.codecId),e.player.recorder&&e.player.recorder.initMetaData(a.buffer,a.codecId);break;case M:r.log("decoderWorker","onmessage:",M,a.code),e.player.audio&&e.player.audio.updateAudioInfo({encTypeCode:a.code});break;case B:r.log("decoderWorker","onmessage:",B,"width:".concat(a.w,",height:")+a.h),e.player.video.updateVideoInfo({width:a.w,height:a.h}),e.player._opt.openWebglAlignment||a.w/2%4==0||e.player.getRenderType()!==S?(e.player.video.initCanvasViewSize(),e.player._opt.playType===s&&(e.player.video.initFps(),e.player.video.initVideoDelay())):e.player.emit(G.webglAlignmentError);break;case P:r.log("decoderWorker","onmessage:",P,"channels:".concat(a.channels,",sampleRate:")+a.sampleRate),2<a.channels?(e.player.emit(U.error,G.audioChannelError),e.player.emit(G.audioChannelError,"audio channel is ".concat(a.channels,", max is 2"))):e.player.audio&&(e.player.audio.updateAudioInfo(a),e.player._opt.playType===n?e.player.audio.initScriptNode():e.player._opt.playType===s&&e.player.audio.initScriptNodeDelay());break;case"render":if(e.player.video)if(e.player._opt.playType===n){if(Lt(e.player.video.getHasInit()))return void r.warn("decoderWorker","onmessage render but video has not init");e.player.video.render(a),e.player.handleRender(),e.player.emit(U.timeUpdate,a.ts),e.player.updateStats({dfps:!0,buf:a.delay}),e.player._times.videoStart||(e.player._times.videoStart=Ue(),e.player.handlePlayToRenderTimes())}else e.player._opt.playType===s&&(e.player.updateStats({dfps:!0}),Lt(e.player.playbackPause)?(e.player.playback.isUseLocalCalculateTime&&e.player.playback.increaseLocalTimestamp(),e.player.playback.isUseFpsRender?e.player.video.pushData(a):e.player.video.render$2(a)):!e.player.playback.isPlaybackPauseClearCache&&e.player.playback.isCacheBeforeDecodeForFpsRender&&e.player.playback.isUseFpsRender&&e.player.video.pushData(a));else r.warn("decoderWorker","onmessage render but video is null");break;case"videoNalu":e.player.recorder&&e.player.recorder.isRecording&&e.player._opt.recordType===v&&e.player.recorder.handleAddNaluTrack(a.buffer,a.isIFrame,a.ts,a.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===n||e.player._opt.playType===s&&(Lt(e.player.playbackPause)||!e.player.playback.isPlaybackPauseClearCache&&e.player.playback.isCacheBeforeDecodeForFpsRender&&e.player.playback.isUseFpsRender))&&e.player.audio.play(a.buffer,a.ts):r.warn("decoderWorker","onmessage playAudio but audio is null");break;case"workerFetch":if(a.type===U.streamSuccess)e.player.stream?e.player.stream.emit(U.streamSuccess):r.warn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(a.type===U.streamRate)e.player.emit(U.kBps,(a.value/1024).toFixed(2));else if(a.type===U.streamEnd)e.player?(a.value===t&&e.player.emit(U.websocketClose),e.player.stream?e.player.stream.emit(U.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(a.type===G.websocketError)e.player&&e.player.stream?e.player.stream.emit(G.websocketError,a.value):r&&r.warn("decoderWorker","onmessage and workerFetch response websocket error but stream is null"),e.player&&e.player.emit(U.error,G.websocketError);else if(a.type===G.fetchError)e.player&&e.player.stream?e.player.stream.emit(G.fetchError,a.value):r&&r.warn("decoderWorker","onmessage and workerFetch response fetch error but stream is null"),e.player&&e.player.emit(U.error,G.fetchError);else if(a.type===U.streamAbps)e.player.updateStats({abps:a.value});else if(a.type===U.streamVbps)e.player._times.demuxStart||(e.player._times.demuxStart=Ue()),e.player.updateStats({vbps:a.value});else if(a.type===U.streamDts)e.player.updateStats({dts:a.value});else if(a.type===U.netBuf)e.player.updateStats({netBuf:a.value});else if(a.type===U.networkDelayTimeout)e.player.emit(U.networkDelayTimeout,a.value);else if(a.type===U.streamStats){var o=JSON.parse(a.value);e.player.updateStats({workerStats:o})}else a.type===U.websocketOpen&&e.player.emit(U.websocketOpen);break;case"iframeIntervalTs":e.player&&(e.player.videoIframeIntervalTs=a.value);break;case"playbackStreamVideoFps":e.player&&e.player.video&&e.player.video.setStreamFps(a.value);break;case"wasmError":a.message&&-1!==a.message.indexOf("Invalid NAL unit size")&&(e.player.emit(U.error,G.wasmDecodeError),e.player.emit(G.wasmDecodeError));break;case"wasmDecodeVideoNoResponseError":e.player.emit(U.error,G.wasmDecodeVideoNoResponseError),e.player.emit(G.wasmDecodeVideoNoResponseError);break;case"simdH264DecodeVideoWidthIsTooLarge":e.player.emit(U.error,G.simdH264DecodeVideoWidthIsTooLarge),e.player.emit(G.simdH264DecodeVideoWidthIsTooLarge);break;case"wasmWidthOrHeightChange":e.player.emit(U.error,G.wasmWidthOrHeightChange),e.player.emit(G.wasmWidthOrHeightChange);break;case j:r.log("decoderWorker","onmessage:",j),e._destroy();break;default:e.player[a.cmd]&&e.player[a.cmd](a)}}}},{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===n?this._decodeVideo(e,t,i):this.player._opt.playType===s&&(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===n?this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===s&&(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})}}])}(),Ni=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),m(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===n;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 a=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(a,", delay is ")+this.delay);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();e.isIFrame&&a<=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 a=this.player,s={ts:i,cts:4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,type:t,isIFrame:!1};2===t&&a._opt.playType===n&&this.calcNetworkDelay(i),a._opt.useWCS&&!a._opt.useOffscreen||a._opt.useMSE?(2===t&&(s.isIFrame=r),this.pushBuffer(e,s)):2===t?a.decoderWorker&&a.decoderWorker.decodeVideo(e,i,r):1===t&&a._opt.hasAudio&&a.decoderWorker&&a.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,a=this.player._opt.playType===n;if(1===t.type&&Me(e))this.player.debug.log("CommonDemux","pushBuffer audio ts is ".concat(t.ts,", isAacCodecPacket is ")+Me(e)),this._doDecoderDecode({ts:t.ts,payload:e,type:1});else{if(0<this.preTimestampDuration&&0<this.preTimestamp&&2===t.type){var s=t.ts-this.preTimestamp;s>=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(s," 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),a&&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 Dt(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=Ue()):e<this.bufferStartDts&&(this.player.debug.warn("CommonDemux","calcNetworkDelay dts is ".concat(e," and bufferStartDts is ")+this.bufferStartDts),this.bufferStartDts=e,this.bufferStartLocalTs=Ue()),(r=(t=e-this.bufferStartDts)<(i=Ue()-this.bufferStartLocalTs)?i-t:0)>this.player._opt.networkDelay&&this.player._opt.playType===n&&(this.player.debug.warn("CommonDemux","delay is more than networkDelay and now dts:".concat(e,",start dts is ").concat(this.bufferStartDts,", vs start is ").concat(t,",local diff is ").concat(i," ,delay is ").concat(r,", _opt.networkDelay is ")+this.player._opt.networkDelay),this.player.emit(U.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(){}}])}(It),zi=[[Uint8Array,Int8Array],[Uint16Array,Int16Array],[Uint32Array,Int32Array,Float32Array],[Float64Array]],Gi=Symbol(32),Hi=Symbol(16),Vi=Symbol(8),Wi=new Map;zi.forEach((function(e,t){return e.forEach((function(e){return Wi.set(e,t)}))}));var Ki=function(){function e(t){A(this,e),this.g=t,this.consumed=0,t&&(this.need=t.next().value)}return m(e,[{key:"fillFromReader",value:function(e){return t=this,a=c().mark((function t(){var i,r,a;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,a=i.value,t.abrupt("return",r?void this.close():(this.write(a),this.fillFromReader(e)));case 6:case"end":return t.stop()}}),t,this)})),new(r=(r=i=void 0)||Promise)((function(e,n){function s(e){try{l(a.next(e))}catch(e){n(e)}}function o(e){try{l(a.throw(e))}catch(e){n(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((a=a.apply(t,i||[])).next())}));var t,i,r,a}},{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(Gi)}},{key:"readU16",value:function(){return this.read(Hi)}},{key:"readU8",value:function(){return this.read(Vi)}},{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===Gi){if(r(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Hi){if(r(2))return;e=t[0]<<8|t[1]}else if(this.need===Vi){if(r(1))return;e=t[0]}else if(Wi.has(this.need.constructor)){if(r(this.need.length<<Wi.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}}])}();Ki.U32=Gi,Ki.U16=Hi,Ki.U8=Vi;var qi,Qi="application/json, text/javascript",Yi="text/html",Ji=/^(?:text|application)\/xml/i,Xi=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,$i=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Zi=/^\s*$/,er={},tr={},ir="",rr={type:"GET",beforeSend:ar,success:ar,error:ar,complete:ar,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:Qi,xml:"application/xml, text/xml",html:Yi,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:ar,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function ar(){}function nr(e,t){"object"==y(e)&&(t=e,e=void 0);var i,r=hr({},t=t||{});for(i in rr)void 0===r[i]&&(r[i]=rr[i]);try{var a={},n=new Promise((function(e,t){a.resolve=e,a.reject=t}));n.resolve=a.resolve,n.reject=a.reject,r.promise=n}catch(e){r.promise={resolve:ar,reject:ar}}n=$i.exec(window.location.href.toLowerCase())||[];var s,o,l,c,u,d=(r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,n[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)||(n=(r.jsonp||"callback")+"=?",r.url=ur(r.url,n)),l=(s=r).jsonpCallback||"jsonp"+gr(),c=window.document.createElement("script"),u={abort:function(){l in window&&(window[l]=ar)}},n=window.document.getElementsByTagName("head")[0]||window.document.documentElement,c.onerror=function(e){e=e,window.clearTimeout(o),u.abort(),lr(e.type,u,e.type,s),f()},window[l]=function(e){window.clearTimeout(o),sr(e,u,s),f()},dr(s),c.src=s.url.replace(/=\?/,"="+l),c.src=ur(c.src,"_="+(new Date).getTime()),c.async=!0,s.scriptCharset&&(c.charset=s.scriptCharset),n.insertBefore(c,n.firstChild),0<s.timeout&&(o=window.setTimeout((function(){u.abort(),lr("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]}dr(r);var p=r.accepts[h]||r.accepts["*"],g={};/^([\w-]+:)\/\//.test(r.url)?RegExp.$1:window.location.protocol;var m,A=rr.xhr();r.crossDomain||g["X-Requested-With"]||(g["X-Requested-With"]="XMLHttpRequest"),r.ifModified&&(er[d]&&(g["If-Modified-Since"]=er[d]),tr[d])&&(g["If-None-Match"]=tr[d]),p&&(-1<(g.Accept=p).indexOf(",")&&(p=p.split(",",2)[0]),A.overrideMimeType)&&A.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_="+gr()):d+(/\?/.test(d)?"&":"?")+"_="+gr()),r.headers=hr(g,r.headers||{}),A.onreadystatechange=function(){if(4===A.readyState){clearTimeout(m);var e,t=!1;if(200<=A.status&&A.status<300||304===A.status){ir=A.getAllResponseHeaders(),r.ifModified&&((i=cr("Last-Modified"))&&(er[d]=i),i=cr("etag"))&&(tr[d]=i),h=h||(i=A.getResponseHeader("content-type"))&&(i===Yi?"html":i===Qi?"json":Ji.test(i)&&"xml")||"text",e=A.responseText;try{"xml"===h?e=A.responseXML:"json"===h&&(e=Zi.test(e)?null:JSON.parse(e))}catch(e){t=e}t?lr(t,"parseerror",A,r):sr(e,A,r)}else lr(null,"error",A,r)}var i},p=!("async"in r)||r.async;if(A.open(r.type,r.url,p,r.username,r.password),r.xhrFields)for(var v in r.xhrFields)A[v]=r.xhrFields[v];for(v in r.mimeType&&A.overrideMimeType&&A.overrideMimeType(r.mimeType),r.headers)void 0!==r.headers[v]&&A.setRequestHeader(v,r.headers[v]+"");return!1===function(e){var t=e.context;if(!1===e.beforeSend.call(t,A,e))return!1}(r)?(A.abort(),!1):(0<r.timeout&&(m=window.setTimeout((function(){A.onreadystatechange=ar,A.abort(),lr(null,"timeout",A,r)}),r.timeout)),A.send(r.data||null),r.promise.abort=function(){A.abort()},r.promise)}function sr(e,t,i){var r=i.context,a="success";i.success.call(r,e,a,t),i.promise.resolve(e,a,t),or(a,t,i)}function or(e,t,i){var r=i.context;i.complete.call(r,t,e)}function lr(e,t,i,r){var a=r.context;r.error.call(a,i,t,e),r.promise.reject(i,t,e),or(t,i,r)}function cr(e){var t;if(!qi){for(qi={};t=Xi.exec(ir);)qi[t[1].toLowerCase()]=t[2];t=qi[e.toLowerCase()]}return null===t?null:t}function ur(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function dr(e){var t,i;!fr(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,a){var n=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(i);for(var s in i){var o=i[s];a&&(s=r?a:a+"["+(n?"":s)+"]"),!a&&n?t.add(o.name,o.value):(r?n:fr)(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=ur(e.url,e.data))}function hr(e){for(var t=Array.prototype.slice.call(arguments,1),i=0,r=t.length;i<r;i++){var a,n=t[i]||{};for(a in n)n.hasOwnProperty(a)&&void 0!==n[a]&&(e[a]=n[a])}return e}function fr(e){var t=y(e);return"function"==t||"object"==t&&!!e}function pr(e){return"function"==typeof e}function gr(){return(new Date).getTime()}function mr(e){return parseInt(e)===e}function Ar(e){if(mr(e.length)){for(var t=0;t<e.length;t++)if(!mr(e[t])||e[t]<0||255<e[t])return;return 1}}function yr(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(Ar(e))return new Uint8Array(e);throw new Error("Array contains invalid value: "+e)}if(mr(e.length)&&Ar(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function vr(e){return new Uint8Array(e)}function br(e,t,i,r,a){null==r&&null==a||(e=e.slice?e.slice(r,a):Array.prototype.slice.call(e,r,a)),t.set(e,i)}nr.get=function(e,t,i,r){return pr(t)&&(r=r||i,i=t,t=void 0),nr({url:e,data:t,success:i,dataType:r})},nr.post=function(e,t,i,r){return pr(t)&&(r=r||i,i=t,t=void 0),nr({type:"POST",url:e,data:t,success:i,dataType:r})},nr.getJSON=function(e,t,i){return pr(t)&&(i=t,t=void 0),nr({url:e,data:t,success:i,dataType:"json"})},nr.ajaxSetup=function(e,t){return t?hr(hr(e,rr),t):hr(rr,e)};var Er,kr={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 yr(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("")}},Tr=(Er="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(Er[(240&r)>>4]+Er[15&r])}return t.join("")}}),wr={16:10,24:12,32:14},Sr=[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],_r=[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],Rr=[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],Cr=[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],Dr=[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],Lr=[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],xr=[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],Ir=[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],Br=[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],Pr=[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],Mr=[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],Or=[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],Fr=[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],jr=[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],Ur=[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 Nr(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 zr(e){if(!(this instanceof zr))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:yr(e,!0)}),this._prepare()}function Gr(e){if(!(this instanceof Gr))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new zr(e)}function Hr(e,t){if(!(this instanceof Hr))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=vr(16);this._lastCipherblock=yr(t,!0),this._aes=new zr(e)}function Vr(e,t,i){if(!(this instanceof Vr))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=vr(16);this.segmentSize=i=i||1,this._shiftRegister=yr(t,!0),this._aes=new zr(e)}function Wr(e,t){if(!(this instanceof Wr))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=vr(16);this._lastPrecipher=yr(t,!0),this._lastPrecipherIndex=16,this._aes=new zr(e)}function Kr(e){if(!(this instanceof Kr))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0!==e?e||1:e)?(this._counter=vr(16),this.setValue(e)):this.setBytes(e)}function qr(e,t){if(!(this instanceof qr))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Kr||(t=new Kr(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new zr(e)}zr.prototype._prepare=function(){var e=wr[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),a=this.key.length/4,n=Nr(this.key);for(t=0;t<a;t++)this._Ke[i=t>>2][t%4]=n[t],this._Kd[e-i][t%4]=n[t];for(var s,o=0,l=a;l<r;){if(s=n[a-1],n[0]^=_r[s>>16&255]<<24^_r[s>>8&255]<<16^_r[255&s]<<8^_r[s>>24&255]^Sr[o]<<24,o+=1,8!=a)for(t=1;t<a;t++)n[t]^=n[t-1];else{for(t=1;t<a/2;t++)n[t]^=n[t-1];for(s=n[a/2-1],n[a/2]^=_r[255&s]^_r[s>>8&255]<<8^_r[s>>16&255]<<16^_r[s>>24&255]<<24,t=a/2+1;t<a;t++)n[t]^=n[t-1]}for(t=0;t<a&&l<r;)this._Ke[c=l>>2][u=l%4]=n[t],this._Kd[e-c][u]=n[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]=Or[s>>24&255]^Fr[s>>16&255]^jr[s>>8&255]^Ur[255&s]},zr.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=Nr(e),a=0;a<4;a++)r[a]^=this._Ke[0][a];for(var n=1;n<t;n++){for(a=0;a<4;a++)i[a]=Cr[r[a]>>24&255]^Dr[r[(a+1)%4]>>16&255]^Lr[r[(a+2)%4]>>8&255]^xr[255&r[(a+3)%4]]^this._Ke[n][a];r=i.slice()}var s,o=vr(16);for(a=0;a<4;a++)s=this._Ke[t][a],o[4*a]=255&(_r[r[a]>>24&255]^s>>24),o[4*a+1]=255&(_r[r[(a+1)%4]>>16&255]^s>>16),o[4*a+2]=255&(_r[r[(a+2)%4]>>8&255]^s>>8),o[4*a+3]=255&(_r[255&r[(a+3)%4]]^s);return o},zr.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=Nr(e),a=0;a<4;a++)r[a]^=this._Kd[0][a];for(var n=1;n<t;n++){for(a=0;a<4;a++)i[a]=Ir[r[a]>>24&255]^Br[r[(a+3)%4]>>16&255]^Pr[r[(a+2)%4]>>8&255]^Mr[255&r[(a+1)%4]]^this._Kd[n][a];r=i.slice()}var s,o=vr(16);for(a=0;a<4;a++)s=this._Kd[t][a],o[4*a]=255&(Rr[r[a]>>24&255]^s>>24),o[4*a+1]=255&(Rr[r[(a+3)%4]>>16&255]^s>>16),o[4*a+2]=255&(Rr[r[(a+2)%4]>>8&255]^s>>8),o[4*a+3]=255&(Rr[255&r[(a+1)%4]]^s);return o},Gr.prototype.encrypt=function(e){if((e=yr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=vr(e.length),i=vr(16),r=0;r<e.length;r+=16)br(e,i,0,r,r+16),br(i=this._aes.encrypt(i),t,r);return t},Gr.prototype.decrypt=function(e){if((e=yr(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=vr(e.length),i=vr(16),r=0;r<e.length;r+=16)br(e,i,0,r,r+16),br(i=this._aes.decrypt(i),t,r);return t},Hr.prototype.encrypt=function(e){if((e=yr(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=vr(e.length),i=vr(16),r=0;r<e.length;r+=16){br(e,i,0,r,r+16);for(var a=0;a<16;a++)i[a]^=this._lastCipherblock[a];this._lastCipherblock=this._aes.encrypt(i),br(this._lastCipherblock,t,r)}return t},Hr.prototype.decrypt=function(e){if((e=yr(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=vr(e.length),i=vr(16),r=0;r<e.length;r+=16){br(e,i,0,r,r+16);i=this._aes.decrypt(i);for(var a=0;a<16;a++)t[r+a]=i[a]^this._lastCipherblock[a];br(e,this._lastCipherblock,0,r,r+16)}return t},Vr.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t=yr(e,!0),i=0;i<t.length;i+=this.segmentSize){for(var r=this._aes.encrypt(this._shiftRegister),a=0;a<this.segmentSize;a++)t[i+a]^=r[a];br(this._shiftRegister,this._shiftRegister,0,this.segmentSize),br(t,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return t},Vr.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t=yr(e,!0),i=0;i<t.length;i+=this.segmentSize){for(var r=this._aes.encrypt(this._shiftRegister),a=0;a<this.segmentSize;a++)t[i+a]^=r[a];br(this._shiftRegister,this._shiftRegister,0,this.segmentSize),br(e,this._shiftRegister,16-this.segmentSize,i,i+this.segmentSize)}return t},Wr.prototype.decrypt=Wr.prototype.encrypt=function(e){for(var t=yr(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},Kr.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)},Kr.prototype.setBytes=function(e){if(16!=(e=yr(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Kr.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}},qr.prototype.decrypt=qr.prototype.encrypt=function(e){for(var t=yr(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 Qr={AES:zr,Counter:Kr,ModeOfOperation:{ecb:Gr,cbc:Hr,cfb:Vr,ofb:Wr,ctr:qr},utils:{hex:Tr,utf8:kr},padding:{pkcs7:{pad:function(e){var t=16-(e=yr(e,!0)).length%16,i=vr(e.length+t);br(e,i);for(var r=e.length;r<i.length;r++)i[r]=t;return i},strip:function(e){if((e=yr(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 a=vr(i);return br(e,a,0,0,i),a}}},_arrayTest:{coerceArray:yr,createArray:vr,copyArray:br}},Yr=function(e){function t(e){var i;return A(this,t),i=p(this,t,[e]),i.input=new Ki(i.demux()),e.debug.log("FlvDemux","init"),i}return g(t,e),m(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,a,n,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),a=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 n=e.sent,s=n[4],i[0]=n[7],i[1]=n[6],i[2]=n[5],o=r[0],i[0]=n[10],i[1]=n[9],i[2]=n[8],i[3]=n[11],l=r[0],e.next=15,o;case 15:if(u=e.sent.slice(),a){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 a._opt.hasAudio&&(a.updateStats({abps:u.byteLength}),0<u.byteLength)&&this._doDecode(u,1,l),e.abrupt("break",26);case 23:return a._opt.hasVideo&&(a.updateStats({vbps:u.byteLength,dts:l}),d=u[0]>>4&15,h=1==d,1!=d&&2!=d&&a.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],a._times.demuxStart||(a._times.demuxStart=Ue()),p=u,a._opt.isCrypto&&(a._opt.cryptoKey&&0<a._opt.cryptoKey.byteLength&&a._opt.cryptoIV&&0<a._opt.cryptoIV.byteLength?p=function(e,t,i){t=new Uint8Array(t),i=new Uint8Array(i);for(var r,a=e.byteLength,n=5;n<a;){if(r=(r=e.slice(n,n+4))[3]|r[2]<<8|r[1]<<16|r[0]<<24,r>a)break;var s=e[n+4];if(1==(s&=31)||5==s){var o=e.slice(n+4+2,n+4+r),l=new Qr.ModeOfOperation.ctr(t,new Qr.Counter(i));s=l.decrypt(o),l=null,e.set(s,n+4+2)}n=n+4+r}return e}(u,a._opt.cryptoKey,a._opt.cryptoIV):a.debug.error("FlvDemux","cryptoKey.length is ".concat(a._opt.cryptoKey&&a._opt.cryptoKey.byteLength," or cryptoIV.length is ").concat(a._opt.cryptoIV&&a._opt.cryptoIV.byteLength," null"))),this._doDecode(p,2,l,h,f))),e.abrupt("break",26);case 25:a.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}}])}(Ni),Jr=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),m(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),a=i.getUint32(1,!1);switch(r){case 1:if(t._opt.hasAudio){var n=new Uint8Array(e,5);t.updateStats({abps:n.byteLength}),0<n.byteLength&&this._doDecode(n,r,a)}break;case 2:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=Ue()),5<i.byteLength){var s=new Uint8Array(e,5),o=i.getUint8(5)>>4==1,l=a;this.player._opt.useMSE&&st(this.player.mseDecoder.firstRenderTime)&&(l=a-this.player.mseDecoder.firstRenderTime),t.updateStats({vbps:s.byteLength,dts:l}),0<s.byteLength&&(o&&this.calcIframeIntervalTimestamp(a),this._doDecode(s,r,a,o))}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}])}(Ni),Xr=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),m(t,[{key:"destroy",value:function(){this.player.debug.log("WebTransportDemux","destroy"),f(t,"destroy",this,3)([])}}])}(Yr),$r=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),m(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,a=e.byteLength,n=0,s=[];r<a;)switch(t=e[r++],n){case 0:0===t&&(n=1);break;case 1:n=0===t?2:0;break;case 2:case 3:n=0===t?3:(1===t&&r<a&&(e[r],i&&s.push(e.subarray(i,r-n-1)),i=r),0)}return i&&s.push(e.subarray(i,a)),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,a=-2,n=new Array,s=0;s<t.length;s+=2){var o=t[s],l=t[s+1];0==r&&0==o&&0==l?n.push(s-1):1==l&&0==o&&0==r&&0==a&&n.push(s-2),a=o,r=l}if(1<n.length)for(var c=0;c<n.length-1;++c){var u=t.subarray(n[c],n[c+1]+1);this.handleNALu(u),i=n[c+1]}else i=n[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:Q)||32!=(i=(126&e[0])>>1)&&33!=i&&34!=i?t:Y}(i)),this.streamVideoType===Q){var r=this.handleAddNaluStartCode(i),a=this.extractNALu(r);if(0===a.length)this.player.debug.warn(this.name,"handleVideoNalu","naluList.length === 0");else{var n=[];if(a.forEach((function(e){var i=Ci(e);8===i||7===i?t.handleVideoH264Nalu(e):Li(i)&&n.push(e)})),1===n.length)this.handleVideoH264Nalu(n[0]);else{var s=function(e){if(0===e.length)return!1;for(var t=Ci(e[0]),i=1;i<e.length;i++)if(t!==Ci(e[i]))return!1;return!0}(n);if(s){var o=Ci(n[0]),l=5===o;this.handleVideoH264NaluList(n,l,o)}else n.forEach((function(e){t.handleVideoH264Nalu(e)}))}}}else this.streamVideoType===Y?34===Bi(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){Di(Ci(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===Bi(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=J.AAC);var t=new Uint8Array(e),i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){var r=(192&i[2])>>6,a=(60&i[2])>>2,n=(1&i[2])<<2|(192&i[3])>>6,s=new Uint8Array([175,0,r<<3|(14&a)>>1,(1&a)<<7|n<<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=J.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=J.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,a=Ci(e);switch(a){case 7:this.sps=e;break;case 8:this.pps=e}if(this.isSendSeqHeader)if(Li(a)){this.player._times.demuxStart||(this.player._times.demuxStart=Ue());var n=5===a,s=this.getNaluDts(),o=(t=e,(i=[])[0]=n?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}),n&&this.calcIframeIntervalTimestamp(s),this._doDecode(o,2,s,n,0)}else this.player.debug.warn(this.name,"handleVideoH264Nalu is avc seq head nalType is "+a);else if(this.sps&&this.pps){this.isSendSeqHeader=!0;var l=function(e){var t=e,i=t.sps,r=t.pps,a=8+i.byteLength+1+2+r.byteLength,n=!1,s=(e=wi.parseSPS$2(i),66!==i[3]&&77!==i[3]&&88!==i[3]&&(n=!0,a+=4),new Uint8Array(a)),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,n&&(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=Ue());var r=this.getNaluDts(),a=(e=e.reduce((function(e,t){e=Ri(e),t=Ri(t);var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i})),(n=[])[0]=t?23:39,n[1]=1,n[2]=0,n[3]=0,n[4]=0,(s=new Uint8Array(n.length+e.byteLength)).set(n,0),s.set(e,n.length),s);this.player.updateStats({vbps:a.byteLength,dts:r}),t&&this.calcIframeIntervalTimestamp(r),this._doDecode(a,2,r,t,0)}else this.player.debug.warn(this.name,"handleVideoH264NaluList isSendSeqHeader is false");var n,s}},{key:"handleVideoH265Nalu",value:function(e){var t,i,r=Bi(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=Ue());var a=16<=r&&r<=21,n=this.getNaluDts(),s=(r=e,(t=[])[0]=a?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:n}),a&&this.calcIframeIntervalTimestamp(n),this._doDecode(s,2,n,a,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,a={configurationVersion:1},n=function(e){return e=xi(e),e=new Ti(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=xi(e),i=new Ti(t);i.readByte(),i.readByte();i.readBits(4);for(var r=i.readBits(3),a=(e=(i.readBool(),i.readBits(2)),i.readBool()),n=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 E=0;E<r;E++)A[E]&&(i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte(),i.readByte()),A[E]&&i.readByte();i.readUEG();for(var k,T=i.readUEG(),w=(3==T&&i.readBits(1),i.readUEG()),S=i.readUEG(),_=(i.readBool()&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readUEG()),R=i.readUEG(),C=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 L=0;L<4;L++)for(var x=0;x<(3===L?2:6);x++)if(i.readBool()){var I=Math.min(64,1<<4+(L<<1));1<L&&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(),z=!1;N||(z=i.readBool()),(N||z)&&j++}M=j}else{var G=i.readUEG(),H=i.readUEG();M=G+H;for(var V=0;V<G;V++)i.readUEG(),i.readBool();for(var W=0;W<H;W++)i.readUEG(),i.readBool()}}if(i.readBool())for(var K=i.readUEG(),q=0;q<K;q++){for(var Q=0;Q<C+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 ae=0;ae<=r;ae++){var ne=i.readBool();$=ne;var se=!1,oe=!1;if((se=ne?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(n,".1.L").concat(m,".B0"),de=w,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:n,bit_depth:_+8,ref_frames:1,chroma_format:T,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"}}(T),general_level_idc:m,general_profile_space:e,general_tier_flag:a,general_profile_idc:n,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:T,bit_depth_luma_minus8:_,bit_depth_chroma_minus8:R,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=xi(e),e=new Ti(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);a=Object.assign(a,n,s,o),n=23+(5+e.byteLength)+(5+r.byteLength)+(5+i.byteLength),(s=new Uint8Array(n))[0]=1,s[1]=(3&a.general_profile_space)<<6|(a.general_tier_flag?1:0)<<5|31&a.general_profile_idc,s[2]=a.general_profile_compatibility_flags_1||0,s[3]=a.general_profile_compatibility_flags_2||0,s[4]=a.general_profile_compatibility_flags_3||0,s[5]=a.general_profile_compatibility_flags_4||0,s[6]=a.general_constraint_indicator_flags_1||0,s[7]=a.general_constraint_indicator_flags_2||0,s[8]=a.general_constraint_indicator_flags_3||0,s[9]=a.general_constraint_indicator_flags_4||0,s[10]=a.general_constraint_indicator_flags_5||0,s[11]=a.general_constraint_indicator_flags_6||0,s[12]=60,s[13]=240|(3840&a.min_spatial_segmentation_idc)>>8,s[14]=255&a.min_spatial_segmentation_idc,s[15]=252|3&a.parallelismType,s[16]=252|3&a.chroma_format_idc,s[17]=248|7&a.bit_depth_luma_minus8,s[18]=248|7&a.bit_depth_chroma_minus8,s[19]=0,s[20]=0,s[21]=(3&a.constant_frame_rate)<<6|(7&a.num_temporal_layers)<<3|(a.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(n=new Uint8Array(o.length+s.byteLength)).set(o,0),n.set(s,o.length),n}({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}}])}(Ni),Zr=function(){function e(t){return A(this,e),new(e.getLoaderFactory(t._opt.demuxType))(t)}return m(e,null,[{key:"getLoaderFactory",value:function(e){return"m7s"===e?Jr:e===E?Yr:e===k?Xr:e===T?$r:void 0}}])}(),ea=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),m(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=Ue(),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 a=15&e[0],n={};7==a?n=_i(e.slice(5)):12==a&&(n=Ii(e));var s=this.player.video.videoInfo;s&&s.width&&s.height&&n&&n.codecWidth&&n.codecHeight&&(n.codecWidth!==s.width||n.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(n.codecWidth,", new height is ").concat(n.codecHeight,", and emit change event")),this.isWidthOrHeightChanged=!0,this.player.emit(U.error,G.wcsWidthOrHeightChange),this.player.emit(G.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("Webcodecs","decodeVideo: video width or height is changed, and return");else if(Ct(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(U.timeUpdate,t),this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===v&&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(G.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=qe()).type.toLowerCase()&&107<=c.version){this.player._times.decodeStart||(this.player._times.decodeStart=Ue());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 a=t[r].toString(16);a.length<2&&(a="0"+a),i+=a}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===v&&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=qe();this.player.debug.warn("Webcodecs","WebcodecsDecoder not support hevc decode",g.type,g.version),this.emit(G.webcodecsH265NotSupport)}}}},{key:"getDecodeDiffTimes",value:function(){return this.decodeDiffTimestamp}},{key:"isDecodeStateClosed",value:function(){return"closed"===this.decoder.state}}])}(It),ta={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"加载",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活"},ia=Object.keys(ta).reduce((function(e,t){return e[t]='\n <i class="jessibuca-icon jessibuca-icon-'.concat(t,'"></i>\n ').concat(ta[t]?'<span class="icon-title-tips"><span class="icon-title">'.concat(ta[t],"</span></span>"):"","\n"),e}),{});function ra(e,t){var i=!1;return e.forEach((function(e){i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function aa(e,t,i){var r=0<arguments.length&&void 0!==e?e:[],a=1<arguments.length&&void 0!==t?t:[],n=2<arguments.length?i:void 0,s=r.length,o=a.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 ")),a[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&&n.$playbackTimeListOne.insertAdjacentHTML("beforeend",t),i&&n.$playbackTimeListSecond.insertAdjacentHTML("beforeend",i),(d+=1)<u&&(n.rafId=window.requestAnimationFrame(e))}()}function na(e,t){aa(function(e){for(var t,i,r,a=0<arguments.length&&void 0!==e?e:[],n=[],s=(a[0]||{}).startTimestamp,o=0;o<1440;o++){var l=o%60==0,c=!1;s&&(c=ra(a,(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)))),n.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,at(t)||(t<10&&(t="0"+t),r+=":"+t)),r}(o),timestamp:o,dataType:"min",hasRecord:c,isStart:l})}return n}(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 sa=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",ze(r,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});var a=e.width,n=e.height,o=et((function(){e.width===a&&e.height===n||(a=e.width,n=e.height,e.emit(U.resize),d())}),500),l=(i(r,"load",(function(){i(r.contentDocument.defaultView,"resize",(function(){o()}))})),e.$container.appendChild(r),e.on(U.destroy,(function(){e.$container.removeChild(r)})),e.on(U.volumechange,(function(){var i,r,a;0===(i=e.volume)?(ze(t.$volumeOn,"display","none"),ze(t.$volumeOff,"display","flex"),ze(t.$volumeHandle,"top","48px")):t.$volumeHandle&&t.$volumePanel&&(r=Ge(t.$volumePanel,"height")||60,a=Ge(t.$volumeHandle,"height"),ze(t.$volumeHandle,"top",r-(r-a)*i-a+"px"),ze(t.$volumeOn,"display","flex"),ze(t.$volumeOff,"display","none")),t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*i))})),e.on(U.loading,(function(i){ze(t.$loading,"display",i?"flex":"none"),(Lt(e._opt.backgroundLoadingShow)&&Dt(i)||Lt(i))&&ze(t.$poster,"display","none"),i&&ze(t.$playBig,"display","none"),Ke()||i||(t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",ze(t.$loadingBg,"display","none"))})),function(t){e.fullscreen&&At(t)!==e.$container||c()}),c=function(i){i=nt(i)?i:e.fullscreen,ze(t.$fullscreenExit,"display",i?"flex":"none"),ze(t.$fullscreen,"display",i?"none":"flex")},u=function(){return e._opt.playType===s&&e._opt.playbackConfig.showControl},d=function(i){Ke()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((function(){if(e.fullscreen){var r=u()?48:38,a=e.height/2-e.width+r/2,n=e.height/2-r/2;t.$controls.style.transform="translateX(".concat(-a,"px) translateY(-").concat(n,"px) rotate(-90deg)")}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)";i&&i()}),10)};try{Pe.on("change",l),e.events.destroys.push((function(){Pe.off("change",l)}))}catch(e){}e.on(U.webFullscreen,(function(e){Ke()&&(c(e),d((function(){f()})))})),e.on(U.recording,(function(){e.playing&&(ze(t.$record,"display",e.recording?"none":"flex"),ze(t.$recordStop,"display",e.recording?"flex":"none"),e._opt.hasControl||e._opt.isShowRecordingUI)&&ze(t.$recording,"display",e.recording?"flex":"none")})),e.on(U.recordingTimestamp,(function(e){t.$recordingTime&&(t.$recordingTime.innerHTML=ut(e))})),e.on(U.zooming,(function(){e.playing&&(ze(t.$zoom,"display",e.zooming?"none":"flex"),ze(t.$zoomStop,"display",e.zooming?"flex":"none"),e._opt.hasControl||e._opt.isShowZoomingUI)&&ze(t.$zoomControls,"display",e.zooming?"flex":"none")})),e.on(U.playing,(function(e){h(e)}));var h=function(i){ze(t.$play,"display",i?"none":"flex"),ze(t.$playBig,"display",i?"none":"block"),ze(t.$pause,"display",i?"flex":"none"),ze(t.$screenshot,"display",i?"flex":"none"),ze(t.$record,"display",i?"flex":"none"),ze(t.$qualityMenu,"display",i?"flex":"none"),ze(t.$volume,"display",i?"flex":"none"),ze(t.$ptz,"display",i?"flex":"none"),ze(t.$zoom,"display",i?"flex":"none"),ze(t.$scaleMenu,"display",i?"flex":"none"),ze(t.$faceDetect,"display",i?"flex":"none"),ze(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&ze(t.$speedMenu,"display",i?"flex":"none"),c(),t.extendBtnList.forEach((function(e){e.$iconWrap&&ze(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&ze(e.$activeIconWrap,"display","none")})),e._opt.showPerformance?ze(t.$performanceActive,"display",i?"flex":"none"):ze(t.$performance,"display",i?"flex":"none"),ze(t.$poster,"display","none"),ze(t.$ptzActive,"display","none"),ze(t.$recordStop,"display","none"),ze(t.$zoomStop,"display","none"),ze(t.$faceDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML="0 KB/s"),ze(t.$zoomControls,"display","none"),ze(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jessibuca-ptz-controls-show")),f()},f=(e.on(U.playbackPause,(function(e){h(!e)})),e.on(U.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),f())})),function(){if(u()){var i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;Ke()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}});if(u()){var p=function(){if(u()){var i,r,a=0,n=e.playback&&e.playback.playingTimestamp;n&&(i=(n=new Date(n)).getHours(),r=n.getMinutes(),n=n.getSeconds(),e.playback.is60Min?a=60*i+r:e.playback.is30Min?a=2*(60*i+r)+parseInt(n/30,10):e.playback.is10Min?a=6*(60*i+r)+parseInt(n/10,10):e.playback.is5Min?a=12*(60*i+r)+parseInt(n/5,10):e.playback.is1Min&&(a=60*(60*i+r)+parseInt(n,10)),t.$playbackCurrentTime.style.left=a+"px")}},g=function(e){t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===se&&t.$playbackNarrow.classList.add("disabled"),e===le&&t.$playbackExpand.classList.add("disabled")},m=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(U.playbackTime,(function(e){t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=Je(e,"{h}:{i}:{s}")),p()})),e.on(U.playbackPrecision,(function(e,i){t.$playbackTimeScroll.classList.remove(ce.oneHour,ce.halfHour,ce.fiveMin,ce.tenMin),t.$playbackTimeScroll.classList.add(ce[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 se:na(i,t);break;case oe:a=t,aa(function(e){for(var t=0<arguments.length&&void 0!==e?e:[],i=[],r=(t[0]||{}).startTimestamp,a=0;a<1440;a++){var n=60*a,s=n%1800==0,o=!1;r&&(o=ra(t,ht(r,n))),i.push({title:dt(n),timestamp:n,dataType:"second",hasRecord:o,isStart:s});var l=60*a+30;s=l%1800==0,r&&(o=ra(t,ht(r,l))),i.push({title:dt(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}(),a);break;case"tenMin":a=t,aa(function(e){for(var t=0<arguments.length&&void 0!==e?e:[],i=[],r=(t[0]||{}).startTimestamp,a=0;a<144;a++)for(var n=0;n<60;n++){var s=10*n+600*a,o=s%600==0,l=!1;r&&(l=ra(t,ht(r,s))),i.push({title:dt(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 a=r+"0";e.push({title:i.replace(":00",":"+a),hour:t,min:10*r,second:0})}}return e}(),a);break;case le:r=t,aa(function(e){for(var t=0<arguments.length&&void 0!==e?e:[],i=[],r=(t[0]||{}).startTimestamp,a=0;a<288;a++)for(var n=0;n<60;n++){var s=5*n+300*a,o=s%300==0,l=!1;r&&(l=ra(t,ht(r,s))),i.push({title:dt(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 a=r+"0",n=r+"5";e.push({title:i.replace(":00",":"+a),hour:t,min:10*r,second:0}),e.push({title:i.replace(":00",":"+n),hour:t,min:10*r+5,second:0})}}return e}(),r)}var r,a;p(),g(e),m()}),16)})),e.on(U.resize,(function(){f()})),f()}if(e._opt.operateBtns.quality&&0<e._opt.qualityConfig.length){e.on(U.streamQualityChange,(function(e){A(e)}));var A=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")}))},y=e._opt.qualityConfig||[],v="";y.forEach((function(e){v+='\n <div class="jessibuca-quality-menu-item" data-quality="'.concat(e,'">').concat(e,"</div>\n ")})),v&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",v),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jessibuca-quality-menu-item")}),setTimeout((function(){var t=y[0];e.streamQuality=t}),0)),e.streamQuality&&A(e.streamQuality)}if(e._opt.operateBtns.scale&&0<e._opt.scaleConfig.length){e.on(U.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"),$e(t)===$e(i)&&e.classList.add("jessibuca-scale-menu-item-active")}))},E=e._opt.scaleConfig||[],k="";E.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(U.playbackRateChange,(function(e){T(e)}));var T=function(i){var r=e._opt.playbackConfig.rateConfig.find((function(e){return $e(e.value)===$e(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"),$e(t)===$e(i)&&e.classList.add("jessibuca-speed-menu-item-active")})))};E=e._opt.playbackConfig.rateConfig;var _="";E.forEach((function(e,t){_+='\n <div class="jessibuca-speed-menu-item" data-speed="'.concat(e.value,'">').concat(e.label,"</div>\n ")})),_&&(t.$speedMenuList.insertAdjacentHTML("beforeend",_),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jessibuca-speed-menu-item")}));var R=e.playback?e.playback.playbackRate:1;T(R)}e.on(U.stats,(function(){var i,r,a,n,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?(ze(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="",i=e.video&&e.video.videoInfo||{},r=e.audio&&e.audio.audioInfo||{},a=e._times||{},n=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=ut(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(w[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(n,"</span>\n </div>\n ").concat(n===S?'\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(J[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(a.playTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>开始请求地址(ms) ').concat(a.streamTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>请求响应(ms) ').concat(a.streamResponseTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>解封装(ms) ').concat(a.demuxTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>解码(ms) ').concat(a.decodeTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>页面开始渲染(ms) ').concat(a.videoTimestamp,'</span>\n </div>\n <div class="jessibuca-performance-item">\n <span>初始化到页面渲染(ms) ').concat(a.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(ut(y.pTs),'</span>\n </div>\n <div class="jessibuca-performance-item-block"></div>\n '),t.$performancePanel.insertAdjacentHTML("beforeend",g)):(t.$performancePanel.innerHTML="",ze(t.$performancePanel,"display","none"))})),e.on(U.togglePerformancePanel,(function(e){ze(t.$performance,"display",e?"none":"flex"),ze(t.$performanceActive,"display",e?"flex":"none")})),e.on(U.faceDetectActive,(function(e){ze(t.$faceDetect,"display",e?"none":"flex"),ze(t.$faceDetectActive,"display",e?"flex":"none")}))};function oa(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 la(e,t){t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function ca(e,t,i){e.style[t]=i}function ua(e,t){return e.composedPath&&-1<e.composedPath().indexOf(t)}function da(e){var t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}oa('@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 ha=function(){function e(t){var i=this;A(this,e),this.player=t,this.extendBtnList=[],n=this,(a=t)._opt.hasControl&&a._opt.controlAutoHide?a.$container.classList.add("jessibuca-controls-show-auto-hide"):a.$container.classList.add("jessibuca-controls-show"),o=a._opt,l=o.operateBtns,c='\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(ia.narrow,'</div>\n <div class="jessibuca-controls-item jessibuca-playback-expand">').concat(ia.expand,"</div>\n </div>\n </div>\n "),a.$container.insertAdjacentHTML("beforeend","\n ".concat(o.background?'<div class="jessibuca-poster" style="background-image: url('.concat(o.background,')"></div>'):"",'\n <div class="jessibuca-loading-bg">\n <img class="jessibuca-loading-bg-image" src="" alt="">\n </div>\n ').concat(o.loadingIcon?'\n <div class="jessibuca-loading">\n '.concat(ia.loading,"\n ").concat(o.loadingText?'<div class="jessibuca-loading-text">'.concat(o.loadingText,"</div>"):"","\n </div>\n "):"","\n ").concat(o.hasControl&&l.play?'<div class="jessibuca-play-big"></div>':"","\n ").concat(o.hasControl&&l.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(o.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(o.ptzZoomShow?'\n <div class="jessibuca-ptz-expand"></div>\n <div class="jessibuca-ptz-narrow"></div>\n ':"","\n\n ").concat(o.ptzApertureShow?'\n <div class="jessibuca-ptz-aperture-far"></div>\n <div class="jessibuca-ptz-aperture-near"></div>\n ':"","\n ").concat(o.ptzFocusShow?'\n <div class="jessibuca-ptz-focus-far"></div>\n <div class="jessibuca-ptz-focus-near"></div>\n ':"","\n </div>\n "):"","\n ").concat(o.hasVideo?'\n <div class="jessibuca-zoom-controls">\n <div class="jessibuca-zoom-narrow">'.concat(ia.narrow,'</div>\n <div class="jessibuca-zoom-tips">电子放大</div>\n <div class="jessibuca-zoom-expand">').concat(ia.expand,'</div>\n <div class="jessibuca-zoom-stop2">').concat(ia.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(ia.recordStop,"</div>\n </div>\n "):"","\n\n ").concat(o.hasControl?'\n <div class="jessibuca-controls">\n <div class="jessibuca-controls-bottom">\n <div class="jessibuca-controls-left">\n '.concat(o.showBandwidth?'<div class="jessibuca-controls-item jessibuca-speed"></div>':"",'\n <div class="jessibuca-controls-item-html">').concat(o.controlHtml,"</div>\n </div>\n ").concat(o.playType===s&&o.playbackConfig.showControl?c:"",'\n\n <div class="jessibuca-controls-right">\n ').concat(o.playType===s&&o.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(l.close?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-close">'.concat(ia.close,"</div></div>"):"","\n ").concat(l.performance?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-performance">'.concat(ia.performance,'</div><div class="jessibuca-controls-item jessibuca-performance-active">').concat(ia.performanceActive,"</div></div>"):"","\n ").concat(l.aiFace?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-face">'.concat(ia.face,'</div><div class="jessibuca-controls-item jessibuca-face-active">').concat(ia.faceActive,"</div></div>"):"","\n ").concat(l.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(l.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(l.audio?'\n <div class="jessibuca-controls-item-wrap">\n <div class="jessibuca-controls-item jessibuca-volume">\n '.concat(ia.audio,"\n ").concat(ia.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(l.play?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-play">'.concat(ia.play,'</div><div class="jessibuca-controls-item jessibuca-pause">').concat(ia.pause,"</div></div>"):"","\n ").concat(l.screenshot?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-screenshot">'.concat(ia.screenshot,"</div></div>"):"","\n ").concat(l.record?' <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-record">'.concat(ia.record,'</div><div class="jessibuca-controls-item jessibuca-record-stop">').concat(ia.recordStop,"</div></div>"):"","\n ").concat(l.ptz?' <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-ptz">'.concat(ia.ptz,'</div><div class="jessibuca-controls-item jessibuca-ptz-active">').concat(ia.ptzActive,"</div></div>"):"","\n ").concat(l.zoom?' <div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-zoom">'.concat(ia.zoom,'</div><div class="jessibuca-controls-item jessibuca-zoom-stop">').concat(ia.zoomStop,"</div></div>"):"","\n ").concat(l.fullscreen?'<div class="jessibuca-controls-item-wrap"><div class="jessibuca-controls-item jessibuca-fullscreen">'.concat(ia.fullscreen,'</div><div class="jessibuca-controls-item jessibuca-fullscreen-exit">').concat(ia.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(n,"$poster",{value:a.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(n,"$loadingBg",{value:a.$container.querySelector(".jessibuca-loading-bg")}),Object.defineProperty(n,"$loadingBgImage",{value:a.$container.querySelector(".jessibuca-loading-bg-image")}),Object.defineProperty(n,"$loading",{value:a.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(n,"$play",{value:a.$container.querySelector(".jessibuca-play")}),Object.defineProperty(n,"$playBig",{value:a.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(n,"$recording",{value:a.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(n,"$recordingTime",{value:a.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(n,"$recordingStop",{value:a.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(n,"$pause",{value:a.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(n,"$controls",{value:a.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(n,"$controlsInner",{value:a.$container.querySelector(".jessibuca-controls-bottom")}),Object.defineProperty(n,"$controlsLeft",{value:a.$container.querySelector(".jessibuca-controls-left")}),Object.defineProperty(n,"$controlsRight",{value:a.$container.querySelector(".jessibuca-controls-right")}),Object.defineProperty(n,"$volume",{value:a.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(n,"$volumePanelWrap",{value:a.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(n,"$volumePanelText",{value:a.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(n,"$volumePanel",{value:a.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(n,"$volumeHandle",{value:a.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(n,"$volumeOn",{value:a.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(n,"$volumeOff",{value:a.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(n,"$fullscreen",{value:a.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(n,"$fullscreenExit",{value:a.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(n,"$record",{value:a.$container.querySelector(".jessibuca-record")}),Object.defineProperty(n,"$recordStop",{value:a.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(n,"$screenshot",{value:a.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(n,"$speed",{value:a.$container.querySelector(".jessibuca-speed")}),Object.defineProperty(n,"$controlHtml",{value:a.$container.querySelector(".jessibuca-controls-item-html")}),Object.defineProperty(n,"$playbackTime",{value:a.$container.querySelector(".jessibuca-controls-playback-time")}),Object.defineProperty(n,"$playbackTimeInner",{value:a.$container.querySelector(".jessibuca-controls-playback-time-inner")}),Object.defineProperty(n,"$playbackTimeScroll",{value:a.$container.querySelector(".jessibuca-controls-playback-time-scroll")}),Object.defineProperty(n,"$playbackTimeList",{value:a.$container.querySelector(".jessibuca-controls-playback-time-list")}),Object.defineProperty(n,"$playbackTimeListOne",{value:a.$container.querySelector(".jessibuca-playback-time-one-wrap")}),Object.defineProperty(n,"$playbackTimeListSecond",{value:a.$container.querySelector(".jessibuca-playback-time-second-wrap")}),Object.defineProperty(n,"$playbackCurrentTime",{value:a.$container.querySelector(".jessibuca-controls-playback-current-time")}),Object.defineProperty(n,"$playbackCurrentTimeText",{value:a.$container.querySelector(".jessibuca-controls-playback-current-time-text")}),Object.defineProperty(n,"$controlsPlaybackBtns",{value:a.$container.querySelector(".jessibuca-controls-playback-btns")}),Object.defineProperty(n,"$playbackNarrow",{value:a.$container.querySelector(".jessibuca-playback-narrow")}),Object.defineProperty(n,"$playbackExpand",{value:a.$container.querySelector(".jessibuca-playback-expand")}),Object.defineProperty(n,"$ptz",{value:a.$container.querySelector(".jessibuca-ptz")}),Object.defineProperty(n,"$ptzActive",{value:a.$container.querySelector(".jessibuca-ptz-active")}),Object.defineProperty(n,"$ptzControl",{value:a.$container.querySelector(".jessibuca-ptz-controls")}),Object.defineProperty(n,"$ptzBgActive",{value:a.$container.querySelector(".jessibuca-ptz-bg-active")}),Object.defineProperty(n,"$ptzControlCircular",{value:a.$container.querySelector(".jessibuca-ptz-control")}),Object.defineProperty(n,"$ptzArrows",{value:a.$container.querySelectorAll(".jessibuca-ptz-arrow")}),Object.defineProperty(n,"$ptzExpand",{value:a.$container.querySelector(".jessibuca-ptz-expand")}),Object.defineProperty(n,"$ptzNarrow",{value:a.$container.querySelector(".jessibuca-ptz-narrow")}),Object.defineProperty(n,"$ptzApertureFar",{value:a.$container.querySelector(".jessibuca-ptz-aperture-far")}),Object.defineProperty(n,"$ptzApertureNear",{value:a.$container.querySelector(".jessibuca-ptz-aperture-near")}),Object.defineProperty(n,"$ptzFocusFar",{value:a.$container.querySelector(".jessibuca-ptz-focus-far")}),Object.defineProperty(n,"$ptzFocusNear",{value:a.$container.querySelector(".jessibuca-ptz-focus-near")}),Object.defineProperty(n,"$qualityText",{value:a.$container.querySelector(".jessibuca-quality-icon-text")}),Object.defineProperty(n,"$qualityMenu",{value:a.$container.querySelector(".jessibuca-quality-menu")}),Object.defineProperty(n,"$qualityMenuList",{value:a.$container.querySelector(".jessibuca-quality-menu-list")}),Object.defineProperty(n,"$scaleText",{value:a.$container.querySelector(".jessibuca-scale-icon-text")}),Object.defineProperty(n,"$scaleMenu",{value:a.$container.querySelector(".jessibuca-scale-menu")}),Object.defineProperty(n,"$scaleMenuList",{value:a.$container.querySelector(".jessibuca-scale-menu-list")}),Object.defineProperty(n,"$zoom",{value:a.$container.querySelector(".jessibuca-zoom")}),Object.defineProperty(n,"$zoomStop",{value:a.$container.querySelector(".jessibuca-zoom-stop")}),Object.defineProperty(n,"$zoomNarrow",{value:a.$container.querySelector(".jessibuca-zoom-narrow")}),Object.defineProperty(n,"$zoomExpand",{value:a.$container.querySelector(".jessibuca-zoom-expand")}),Object.defineProperty(n,"$zoomStop2",{value:a.$container.querySelector(".jessibuca-zoom-stop2")}),Object.defineProperty(n,"$close",{value:a.$container.querySelector(".jessibuca-close")}),Object.defineProperty(n,"$zoomControls",{value:a.$container.querySelector(".jessibuca-zoom-controls")}),Object.defineProperty(n,"$performancePanel",{value:a.$container.querySelector(".jessibuca-performance-panel")}),Object.defineProperty(n,"$performance",{value:a.$container.querySelector(".jessibuca-performance")}),Object.defineProperty(n,"$performanceActive",{value:a.$container.querySelector(".jessibuca-performance-active")}),Object.defineProperty(n,"$faceDetect",{value:a.$container.querySelector(".jessibuca-face")}),Object.defineProperty(n,"$faceDetectActive",{value:a.$container.querySelector(".jessibuca-face-active")}),Object.defineProperty(n,"$contextmenus",{value:a.$container.querySelector(".jessibuca-contextmenus")}),Object.defineProperty(n,"$speedText",{value:a.$container.querySelector(".jessibuca-speed-icon-text")}),Object.defineProperty(n,"$speedMenu",{value:a.$container.querySelector(".jessibuca-speed-menu")}),Object.defineProperty(n,"$speedMenuList",{value:a.$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}}}),sa(t,this);var r,a,n,o,l,c,u=function(e){var t=h.$volumePanel.getBoundingClientRect(),i=t.bottom,r=t.height,a=h.$volumeHandle.getBoundingClientRect()["height"];return Ne(i-e.y-a/2,0,r-a/2)/(r-a)},d=t,h=this,f=d["events"]["proxy"],p=d._opt,g=p.operateBtns;if(f(window,["click","contextmenu"],(function(e){-1<e.composedPath().indexOf(d.$container)?h.isFocus=!0:h.isFocus=!1})),f(window,"orientationchange",(function(){setTimeout((function(){d.resize()}),300)})),f(h.$controls,"click",(function(e){e.stopPropagation()})),g.play&&(f(h.$pause,"click",(function(e){p.playType===s&&p.playbackConfig.uiUsePlaybackPause?d.playbackPause=!0:yt(g.pauseFn)?g.pauseFn():d.pause()})),f(h.$play,"click",(function(e){p.playType===s&&d.playbackPause?d.playbackPause=!1:yt(g.playFn)?g.playFn():(d.play(),d.resumeAudioAfterPause())}))),f(h.$playBig,"click",(function(e){p.playType===s&&d.playbackPause?d.playbackPause=!1:yt(g.playFn)?g.playFn():(d.play(),d.resumeAudioAfterPause())})),g.screenshot&&f(h.$screenshot,"click",(function(e){e.stopPropagation(),yt(g.screenshotFn)?g.screenshotFn():d.video.screenshot()})),g.audio&&(f(h.$volume,"mouseover",(function(){h.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")})),f(h.$volume,"mouseout",(function(){h.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")})),f(h.$volumeOn,"click",(function(e){e.stopPropagation(),ze(h.$volumeOn,"display","none"),ze(h.$volumeOff,"display","block"),e=d.volume,d.volume=0,d._lastVolume=e})),f(h.$volumeOff,"click",(function(e){e.stopPropagation(),ze(h.$volumeOn,"display","block"),ze(h.$volumeOff,"display","none"),d.volume=d.lastVolume||.5})),f(h.$volumePanel,"click",(function(e){e.stopPropagation(),d.volume=u(e)})),f(h.$volumeHandle,"mousedown",(function(){h.isVolumeDroging=!0})),f(h.$volumeHandle,"mousemove",(function(e){h.isVolumeDroging&&(d.volume=u(e))})),f(document,"mouseup",(function(){h.isVolumeDroging&&(h.isVolumeDroging=!1)}))),g.record&&(f(h.$record,"click",(function(e){e.stopPropagation(),yt(g.recordFn)?g.recordFn():d.recording=!0})),f(h.$recordStop,"click",(function(e){e.stopPropagation(),yt(g.recordStopFn)?g.recordStopFn():d.recording=!1}))),f(h.$recordingStop,"click",(function(e){e.stopPropagation(),yt(g.recordStopFn)?g.recordStopFn():d.recording=!1})),g.fullscreen&&(f(h.$fullscreen,"click",(function(e){e.stopPropagation(),yt(g.fullscreenFn)?g.fullscreenFn():d.fullscreen=!0})),f(h.$fullscreenExit,"click",(function(e){e.stopPropagation(),yt(g.fullscreenExitFn)?g.fullscreenExitFn():d.fullscreen=!1}))),g.ptz&&(f(h.$ptz,"click",(function(e){e.stopPropagation(),ze(h.$ptzActive,"display","flex"),ze(h.$ptz,"display","none"),h.$ptzControl.classList.add("jessibuca-ptz-controls-show")})),f(h.$ptzActive,"click",(function(e){e.stopPropagation(),ze(h.$ptz,"display","flex"),ze(h.$ptzActive,"display","none"),h.$ptzControl.classList.remove("jessibuca-ptz-controls-show")})),h.$ptzArrows.forEach((function(e){if(p.ptzClickType===D)f(e,"click",(function(e){e.stopPropagation(),e=e.currentTarget.dataset.arrow,h.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),h.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),h.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),d.emit(U.ptz,e),setTimeout((function(){h.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),de.forEach((function(e){h.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),h.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)})),d.emit(U.ptz,he)}),1e3*p.ptzStopEmitDelay)}));else if("mouseDownAndUp"===p.ptzClickType){var t=!1;f(e,"mousedown",(function(e){e.stopPropagation(),t=!0,e=e.currentTarget.dataset.arrow,h.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),h.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),h.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),d.emit(U.ptz,e)}));var i=function(){t=!1,h.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),de.forEach((function(e){h.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),h.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)})),d.emit(U.ptz,he)};f(e,"mouseup",(function(e){e.stopPropagation(),t&&i()})),f(window,"mouseup",(function(e){e.stopPropagation(),t&&i()}))}})),p.ptzZoomShow&&(f(h.$ptzExpand,"click",(function(e){e.stopPropagation(),d.emit(U.ptz,"zoomExpand"),setTimeout((function(){d.emit(U.ptz,he)}),1e3*p.ptzStopEmitDelay)})),f(h.$ptzNarrow,"click",(function(e){e.stopPropagation(),d.emit(U.ptz,"zoomNarrow"),setTimeout((function(){d.emit(U.ptz,he)}),1e3*p.ptzStopEmitDelay)}))),p.ptzApertureShow&&(f(h.$ptzApertureFar,"click",(function(e){e.stopPropagation(),d.emit(U.ptz,"apertureFar"),setTimeout((function(){d.emit(U.ptz,fe)}),1e3*p.ptzStopEmitDelay)})),f(h.$ptzApertureNear,"click",(function(e){e.stopPropagation(),d.emit(U.ptz,"apertureNear"),setTimeout((function(){d.emit(U.ptz,fe)}),1e3*p.ptzStopEmitDelay)}))),p.ptzFocusShow)&&(f(h.$ptzFocusFar,"click",(function(e){e.stopPropagation(),d.emit(U.ptz,"focusFar"),setTimeout((function(){d.emit(U.ptz,fe)}),1e3*p.ptzStopEmitDelay)})),f(h.$ptzFocusNear,"click",(function(e){e.stopPropagation(),d.emit(U.ptz,"focusNear"),setTimeout((function(){d.emit(U.ptz,fe)}),1e3*p.ptzStopEmitDelay)}))),g.performance&&(f(h.$performance,"click",(function(e){e.stopPropagation(),d.togglePerformancePanel(!0)})),f(h.$performanceActive,"click",(function(e){e.stopPropagation(),d.togglePerformancePanel(!1)}))),g.aiFace&&(f(h.$faceDetect,"click",(function(e){e.stopPropagation(),d.faceDetect(!0)})),f(h.$faceDetectActive,"click",(function(e){e.stopPropagation(),d.faceDetect(!1)}))),d._opt.hasControl&&d._opt.controlAutoHide){f(d.$container,"mouseover",(function(){d.fullscreen||(ze(h.$controls,"display","block"),y())})),f(d.$container,"mousemove",(function(){d.$container&&h.$controls&&(d.fullscreen,"none"===h.$controls.style.display)&&(ze(h.$controls,"display","block"),y())})),f(d.$container,"mouseout",(function(){v(),ze(h.$controls,"display","none")}));var m=null,y=function(){v(),m=setTimeout((function(){ze(h.$controls,"display","none")}),5e3)},v=function(){m&&(clearTimeout(m),m=null)}}if(d._opt.playType===s&&(f(h.$playbackNarrow,"click",(function(e){e.stopPropagation(),d.playback&&d.playback.narrowPrecision()})),f(h.$playbackExpand,"click",(function(e){e.stopPropagation(),d.playback&&d.playback.expandPrecision()})),f(h.$playbackTimeList,"click",(function(e){e=At(e),e.matches("div.jessibuca-playback-time-minute-one")&&d.playback&&d.playback.seek(e.dataset)})),d._opt.playbackConfig.showRateBtn&&(f(h.$speedMenu,"mouseover",(function(){h.$speedMenuList.classList.add("jessibuca-speed-menu-shown")})),f(h.$speedMenu,"mouseout",(function(){h.$speedMenuList.classList.remove("jessibuca-speed-menu-shown")})),f(h.$speedMenuList,"click",(function(e){var t=At(e);if(t.matches("div.jessibuca-speed-menu-item")){var i=t.dataset;d.emit(U.playbackPreRateChange,i.speed)}}))),d._opt.playbackConfig.supportWheel)&&f(h.$playbackTimeInner,"wheel",(function(e){e.preventDefault(),0<(e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3)?d.playback&&d.playback.expandPrecision():d.playback&&d.playback.narrowPrecision()})),g.quality&&(f(h.$qualityMenu,"mouseover",(function(){h.$qualityMenuList.classList.add("jessibuca-quality-menu-shown")})),f(h.$qualityMenu,"mouseout",(function(){h.$qualityMenuList.classList.remove("jessibuca-quality-menu-shown")})),f(h.$qualityMenuList,"click",(function(e){var t=At(e);if(t.matches("div.jessibuca-quality-menu-item")){var i=t.dataset;d.streamQuality=i.quality}}))),g.scale&&(f(h.$scaleMenu,"mouseover",(function(){h.$scaleMenuList.classList.add("jessibuca-scale-menu-shown")})),f(h.$scaleMenu,"mouseout",(function(){h.$scaleMenuList.classList.remove("jessibuca-scale-menu-shown")})),f(h.$scaleMenuList,"click",(function(e){var t=At(e);if(t.matches("div.jessibuca-scale-menu-item")){var i=t.dataset;d.setScaleMode(i.scale)}}))),g.zoom&&(f(h.$zoom,"click",(function(e){e.stopPropagation(),d.zooming=!0})),f(h.$zoomStop,"click",(function(e){e.stopPropagation(),d.zooming=!1}))),f(h.$zoomExpand,"click",(function(e){e.stopPropagation(),d.zoom&&d.zoom.expandPrecision()})),f(h.$zoomNarrow,"click",(function(e){e.stopPropagation(),d.zoom&&d.zoom.narrowPrecision()})),f(h.$zoomStop2,"click",(function(e){e.stopPropagation(),d.zooming=!1})),g.close&&f(h.$close,"click",(function(e){e.stopPropagation(),d.doDestroy()})),t._opt.hotKey){var b=function(e,t){w[e]?w[e].push(t):w[e]=[t]},E=t,k=this,T=E["events"]["proxy"],w={};b(27,(function(){E.fullscreen&&(E.fullscreen=!1)})),b(38,(function(){E.volume+=.05})),b(40,(function(){E.volume-=.05})),T(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=w[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 m(e,[{key:"destroy",value:function(){var e;this.$performancePanel&&(this.$performancePanel.innerHTML="",da(this.$performancePanel)||(e=this.player.$container.querySelector(".jessibuca-performance-panel"))&&this.player.$container.removeChild(e)),this.$poster&&!da(this.$poster)&&(e=this.player.$container.querySelector(".jessibuca-poster"))&&this.player.$container.removeChild(e),this.$loading&&!da(this.$loading)&&(e=this.player.$container.querySelector(".jessibuca-loading"))&&this.player.$container.removeChild(e),this.$loadingBg&&!da(this.$loadingBg)&&(e=this.player.$container.querySelector(".jessibuca-loading-bg"))&&this.player.$container.removeChild(e),this.$controls&&!da(this.$controls)&&(e=this.player.$container.querySelector(".jessibuca-controls"))&&this.player.$container.removeChild(e),this.$playBig&&!da(this.$playBig)&&(e=this.player.$container.querySelector(".jessibuca-play-big"))&&this.player.$container.removeChild(e),this.$recording&&!da(this.$recording)&&(e=this.player.$container.querySelector(".jessibuca-recording"))&&this.player.$container.removeChild(e),this.$ptzControl&&!da(this.$ptzControl)&&(e=this.player.$container.querySelector(".jessibuca-ptz-controls"))&&this.player.$container.removeChild(e),this.$zoomControls&&!da(this.$zoomControls)&&(e=this.player.$container.querySelector(".jessibuca-zoom-controls"))&&this.player.$container.removeChild(e),this.$contextmenus&&(this.$contextmenus.innerHTML="",da(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,a=e.video.$videoElement.width/e.video.$videoElement.height;if(r>a){var n=(t-i*a)/2;e.$container.style.padding="0 ".concat(n,"px")}else{var s=(i-t/a)/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===s?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 a="contain",n=(i.isResize||(a="fill"),i.isFullResize&&(a="none"),"");"none"===i.mirrorRotate&&r&&(n+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.$loadingBgImage.style.transform=n,this.$loadingBgImage.style.objectFit=a,ca(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=St(De);if(t=Object.assign({},i,t),this._validateExtendBtn(t)){var r=t.name||"",a=this.$controlsRight,n=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(a.children)[t.index],l=(o?o.insertAdjacentHTML("beforebegin",s):la(a,s),t.icon?a.querySelector(".jessibuca-icon-extend-"+r):null),c=t.icon?a.querySelector(".jessibuca-control-extend-"+r):null,u=t.activeIcon?a.querySelector(".jessibuca-icon-extend-".concat(r,"-active")):null,d=t.activeIcon?a.querySelector(".jessibuca-control-extend-".concat(r,"-active")):null,h=this.player["events"].proxy;t.icon&&(ca(l,"background","url(".concat(t.icon,") no-repeat center")),ca(l,"background-size","100% 100%"),ca(c,"display","none"),t.iconHover)&&(h(l,"mouseover",(function(){ca(l,"background","url(".concat(t.iconHover,") no-repeat center")),ca(l,"background-size","100% 100%")})),h(l,"mouseout",(function(){ca(l,"background","url(".concat(t.icon,") no-repeat center")),ca(l,"background-size","100% 100%")}))),t.activeIcon&&(ca(u,"background","url(".concat(t.activeIcon,") no-repeat center")),ca(u,"background-size","100% 100%"),ca(d,"display","none"),t.activeIconHover)&&(h(u,"mouseover",(function(){ca(u,"background","url(".concat(t.activeIconHover,") no-repeat center")),ca(u,"background-size","100% 100%")})),h(u,"mouseout",(function(){ca(u,"background","url(".concat(t.activeIcon,") no-repeat center")),ca(u,"background-size","100% 100%")}))),t.click&&l&&h(l,"click",(function(i){i.preventDefault(),n&&(ca(c,"display","none"),ca(d,"display","flex")),t.click.call(e.player,e,i)})),t.activeClick&&u&&h(u,"click",(function(i){i.preventDefault(),ca(c,"display","flex"),ca(d,"display","none"),t.activeClick.call(e.player,e,i)})),this.extendBtnList.push({name:r,$iconWrap:c,$activeIconWrap:d})}}}])}();oa(".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 fa=function(){function e(){A(this,e)}return m(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),a=r.length,n=0;n<a;n++)t+=r[n].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<a;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,a=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,a>>>8&255,255&a,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,a=(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,a.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,i,t,a)}},{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),a=(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),n=t.flags;t=t.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.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)}}])}();fa.init();var pa=function(e){function t(e){var i;A(this,t),i=p(this,t),i.player=e,i.isAvc=!0,i.mediaSource=new window.MediaSource,i.sourceBuffer=null,i.hasInit=!1,i.isInitInfo=!1,i.cacheTrack={},i.timeInit=!1,i.sequenceNumber=0,i.dropping=!1,i.firstRenderTime=null,i.$videoElement=null,i.mediaSourceAppendBufferFull=!1,i.mediaSourceAppendBufferError=!1,i.isDecodeFirstIIframe=!1,i.prevTimestamp=null,i.decodeDiffTimestamp=null,i.prevDts=null,i.prevPayloadBufferSize=0,i.isWidthOrHeightChanged=!1,i.prevTs=null,i.mediaSourceObjectURL=window.URL.createObjectURL(i.mediaSource),i.eventListenList=[],e._opt.mseUseCanvasRender?(i.$videoElement=document.createElement("video"),i.$videoElement.src=i.mediaSourceObjectURL,i.initVideoEvents()):(i.player.video.$videoElement.src=i.mediaSourceObjectURL,i.$videoElement=i.player.video.$videoElement);var r=e["events"].proxy,a=r(i.mediaSource,"sourceopen",(function(){i.player&&i.player.emit(U.mseSourceOpen)})),n=r(i.mediaSource,"sourceclose",(function(){i.player&&i.player.emit(U.mseSourceClose)})),s=r(i.mediaSource,"sourceended",(function(){i.player&&i.player.emit(U.mseSourceended)}));if(i.eventListenList.push(a,n,s),i.player.isPlayer){var o=r(i.$videoElement,ve,(function(t){if(i._handleUpdatePlaybackRate(),e._opt.mseUseCanvasRender)if(i.player.checkIsInRender())i.player.handleRender();else{var r=parseInt(t.timeStamp,10);i.player.debug.warn("MediaSource","mseUseCanvasRender is true and $videoElement ts is ".concat(r,", but not in render"))}else i.player.handleRender()})),l=r(i.$videoElement,be,(function(){e.debug.log("MediaSource","video playback Rate change",i.$videoElement&&i.$videoElement.playbackRate)}));i.eventListenList.push(o,l)}return e.debug.log("MediaSource","init"),i}return g(t,e),m(t,[{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,Ae,(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(G.mediaSourceUseCanvasRenderPlayFailed),e.player.emit(U.error,G.mediaSourceUseCanvasRenderPlayFailed)}))})),r=t(this.$videoElement,ye,(function(){e.player.debug.log("MediaSource","video waiting")}));t=t(this.$videoElement,ve,(function(t){t=parseInt(t.timeStamp,10),e.player.emit(U.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 a=this.player;if(a)if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){var n=15&e[0],s={};7==n?s=_i(e.slice(5)):12==n&&(s=Ii(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(U.error,G.mseWidthOrHeightChange),this.player.emit(G.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)this.player.debug.warn("MediaSource","decodeVideo: video width or height is changed, and return");else if(Ct(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(G.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(G.mediaSourceTsIsMaxDiff)}this._decodeVideo(e,l,i,r,t),this.prevDts=l,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t,this.player.getRenderType()===_&&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];a.video.updateVideoInfo({encTypeCode:c}),12!=c||function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(ne))||e}()?(a._times.decodeStart||(a._times.decodeStart=Ue()),this.hasInit=this._decodeConfigurationRecord(e,t,i,c)):this.emit(G.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 a=e.slice(5),n={};return 7===r?n=_i(a):12===r&&(n=Ii(e)),this.player.recorder&&this.player._opt.recordType===v&&this.player.recorder.initMetaData(e,r),0===n.codecWidth&&0===n.codecHeight?(this.player.debug.error("MediaSource","_decodeConfigurationRecord",n),this.emit(G.mediaSourceDecoderConfigurationError),!1):(e={id:1,type:"video",timescale:1e3,duration:0,avcc:a,codecWidth:n.codecWidth,codecHeight:n.codecHeight,videoType:n.videoType},e=fa.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,a){var n=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&&n.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=n._opt.videoBufferDelay+n._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?(n.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(fa.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===v&&this.player.recorder.handleAddFmp4Track(this.cacheTrack),h=fa.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),n.emit(U.timeUpdate,a),n.updateStats({fps:!0,ts:a,mseTs:t,buf:n.demux&&n.demux.delay||0}),n._times.videoStart||(n._times.videoStart=Ue(),n.handlePlayToRenderTimes())):(n.debug.log("MediaSource","timeInit set false , cacheTrack = {} now dts is ".concat(t,", and ts is ").concat(a," 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||(n.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,e.currentTime=e.buffered.end(0)),!this.isInitInfo&&0<e.videoWidth&&0<e.videoHeight&&(n.debug.log("MediaSource","updateVideoInfo: ".concat(e.videoWidth,",")+e.videoHeight),n.video.updateVideoInfo({width:e.videoWidth,height:e.videoHeight}),n.video.initCanvasViewSize(),this.isInitInfo=!0),n._opt.mseUseCanvasRender&&n.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,a=i.events.proxy;if(null===this.sourceBuffer){var n=this.isAvc?ae:ne;try{this.sourceBuffer=this.mediaSource.addSourceBuffer(n)}catch(e){r.warn("MediaSource","this.mediaSource.addSourceBuffer()",e.code,e),this.player.emit(U.mseAddSourceBufferError,e)}n=a(this.sourceBuffer,"error",(function(e){t.player.emit(U.mseSourceBufferError,e)})),a=a(this.sourceBuffer,"updateend",(function(){})),this.eventListenList.push(n,a)}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(G.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(G.mediaSourceAppendBufferError)):(r.error("MediaSource","appendBuffer error",e),this.player.emit(U.mseSourceBufferError,e))}else this.isStateClosed?this.player.emit(G.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emit(G.mseSourceBufferError,"mediaSource is end"):Dt(this.sourceBuffer.updating)&&this.player.emit(U.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(It){this.player.debug.warn("MediaSource","endOfStream() error",It)}}},{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(It){this.player.debug.warn("MediaSource","removeSourceBuffer() error",It)}}},{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),a=i-r;t=Math.max(5,3+t),t=(t<a?(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(a," and new time is ")+i),e.currentTime=i,r=e.currentTime):a<0&&(this.player.debug.warn("MediaSource","handleUpdatePlaybackRate and delay buffer is ".concat(i," - current is ").concat(r," = ").concat(a," < 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}}])}(It),ga=function(){return"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")},ma=function(){function e(t){var i=this;A(this,e),this.player=t,this.enabled=!1,ga()?(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 m(e,[{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 ga()?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 e=this.player.debug;if(ga())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(It){e.warn("NoSleep","Failed to remove noSleepVideo element.")}}this.enabled=!1}}])}(),Aa=(Tr=Be((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,a="~";function n(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,r,n){if("function"!=typeof i)throw new TypeError("The listener must be a function");return i=new s(i,r||e,n),r=a?a+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 n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(a=!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(a?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},c.prototype.listeners=function(e){e=a?a+e:e;var t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,r=t.length,n=new Array(r);i<r;i++)n[i]=t[i].fn;return n},c.prototype.listenerCount=function(e){return e=a?a+e:e,e=this._events[e],e?e.fn?1:e.length:0},c.prototype.emit=function(e,t,i,r,n,s){var o=a?a+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,n),!0;case 6:return c.fn.call(c.context,t,i,r,n,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=a?a+e:e,this._events[e])if(t){var n=this._events[e];if(n.fn)n.fn!==t||r&&!n.once||i&&n.context!==i||l(this,e);else{for(var s=0,o=[],c=n.length;s<c;s++)(n[s].fn!==t||r&&!n[s].once||i&&n[s].context!==i)&&o.push(n[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=a?a+e:e,this._events[e]&&l(this,e)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=a,e.exports=c.EventEmitter=c},"./node_modules/url-toolkit/src/url-toolkit.js":function(e,t,i){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,a=/^([^\/?#]*)([^]*)$/,n=/(?:\/|^)\.(?=\/)/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=a.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var n;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?(n=(n=t.path).substring(0,n.lastIndexOf("/")+1)+r.path,e.path=o.normalizePath(n)):(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(n,"");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 a;return(t[r]||(a=t[r]={i:r,l:!1,exports:{}},e[r].call(a.exports,a,a.exports,i),a.l=!0,a)).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 a="[\\.|\\-|\\+|\\w|/|@]+",n="\\(\\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)+n,"g");c=u.exec(l);)"dll-reference"!==c[3]&&o[r].push(c[3]);for(u=new RegExp("\\("+s(t)+'\\("(dll-reference\\s('+a+'))"\\)\\)'+n,"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 E})),i.d(t,"mergeConfig",(function(){return k})),i.d(t,"enableStreamingMode",(function(){return T}));t=i("./src/controller/abr-controller.ts");var r=i("./src/controller/audio-stream-controller.ts"),a=i("./src/controller/audio-track-controller.ts"),n=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,a;r=e,a=i[t=t],t in r?Object.defineProperty(r,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[t]=a})):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 E=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:n.SubtitleStreamController,subtitleTrackController:s.default,timelineController:l.TimelineController,audioStreamController:r.default,audioTrackController:a.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 T(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"),a=i("./src/utils/ewma-bandwidth-estimator.ts"),n=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 a.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}(i=d.prototype).registerListeners=function(){var e=this.hls;e.on(n.Events.FRAG_LOADING,this.onFragLoading,this),e.on(n.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(n.Events.ERROR,this.onError,this)},i.unregisterListeners=function(){var e=this.hls;e.off(n.Events.FRAG_LOADING,this.onFragLoading,this),e.off(n.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(n.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,a=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(a&&!l.paused&&l.playbackRate&&l.readyState){a=performance.now()-u.loading.start;var h=Math.abs(l.playbackRate);if(!(a<=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/a)),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(a,u.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),i.trigger(n.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:u}))}}}}},i.onFragLoaded=function(e,t){var i,a,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&&(a=((o=this.hls.levels[c.level]).loaded?o.loaded.bytes:0)+i.loaded,s=(o.loaded?o.loaded.duration:0)+s,o.loaded={bytes:a,duration:s},o.realBitrate=Math.round(8*a/s)),c.bitrateTest)&&(o={stats:i,frag:c,part:t,id:c.type},this.onFragBuffered(n.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,a=i.config,n=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():a.abrEwmaDefaultEstimate;i=(s.BufferHelper.bufferInfo(i,e,a.maxBufferHole).end-e)/o,e=this.findBestLevel(l,n,r,i,a.abrBandWidthFactor,a.abrBandWidthUpFactor);if(0<=e)return e;c.logger.trace((i?"rebuffering expected":"buffer is empty")+", finding optimal quality level");o=t?Math.min(t,a.maxStarvationDelay):a.maxStarvationDelay;var u,d=a.abrBandWidthFactor,h=a.abrBandWidthUpFactor;return i||(u=this.bitrateTestDelay)&&(o=(t?Math.min(t,a.maxLoadingDelay):a.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,n,r,i+o,d,h),Math.max(e,0)},i.findBestLevel=function(e,t,i,r,a,n){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?a*e:n*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"),a=i("./src/controller/base-stream-controller.ts"),n=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=a.default,i=b,(E=k).prototype=Object.create(i.prototype),v(E.prototype.constructor=E,i),(E=k.prototype).onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(n.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(n.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(n.Events.ERROR,this.onError,this),e.on(n.Events.BUFFER_RESET,this.onBufferReset,this),e.on(n.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(n.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(n.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(n.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(n.Events.ERROR,this.onError,this),e.off(n.Events.BUFFER_RESET,this.onBufferReset,this),e.off(n.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(n.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(n.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.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===a.State.WAITING_INIT_PTS)&&this.tick()},E.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=a.State.IDLE):(this.loadedmetadata=!1,this.state=a.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this.startPosition=e,this.state=a.State.STOPPED)},E.doTick=function(){switch(this.state){case a.State.IDLE:this.doTickIdle();break;case a.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=a.State.WAITING_INIT_PTS}break;case a.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=a.State.IDLE);break;case a.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=a.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=a.State.IDLE}this.onTickEnd()},E.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=a.State.IDLE)},E.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)},E.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=a.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(n.Events.BUFFER_EOS,{type:"audio"}),this.state=a.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)))))},E.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)},E.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(e,t){t=t.audioTracks,this.resetTransmuxer(),this.levels=t.map((function(e){return new l.Level(e)}))},E.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=a.State.IDLE):this.state=a.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(e,t){this.mainDetails=t.details},E.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 n=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;n=!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,n),this.state!==a.State.WAITING_TRACK||this.waitForCdnTuneIn(r)||(this.state=a.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)},E._handleFragmentLoadProgress=function(e){var t,i,r,n,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?(n=o?o.index:-1,n=new f.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,e.byteLength,n,-1!==n),p.push(e,r,l,"",s,o,t.totalduration,!1,n,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=a.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")},E._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:b.prototype._handleFragmentLoadComplete.call(this,e)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},E.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(n.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.fragBufferedComplete(i,t)))},E.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!==a.State.ERROR&&this.state!==a.State.STOPPED&&(this.state=t.fatal?a.State.ERROR:a.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!==a.State.PARSING&&this.state!==a.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())}},E.onBufferFlushed=function(e,t){t.type===u.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._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=a.State.PARSING,this.audioSwitch&&i&&this.completeAudioSwitch(),null!=h&&h.tracks&&(this._bufferInitSegment(h.tracks,t,e),d.trigger(n.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(n.Events.FRAG_PARSING_METADATA,l)),r&&(c=y({frag:t,id:"audio"},r),d.trigger(n.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))},E._bufferInitSegment=function(e,t,i){var r;this.state===a.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(n.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(n.Events.BUFFER_APPENDING,r)),this.tick())},E.loadFragment=function(e,t,i){var n=this.fragmentTracker.getState(e);this.fragCurrent=e,!this.audioSwitch&&n!==o.FragmentState.NOT_LOADED&&n!==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=a.State.WAITING_INIT_PTS):(this.startFragRequested=!0,b.prototype.loadFragment.call(this,e,t,i)))},E.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(n.Events.AUDIO_TRACK_SWITCHED,{id:i})};var b,E;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"),a=i("./src/errors.ts"),n=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=n.default,i=c,(n=u).prototype=Object.create(i.prototype),l(n.prototype.constructor=n,i),(n=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)},n.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)},n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,c.prototype.destroy.call(this)},n.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},n.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},n.onAudioTrackLoaded=function(e,t){var i,r=t.id,a=t.details,n=this.tracksInGroup[r];n?(i=n.details,n.details=t.details,this.log("audioTrack "+r+" loaded ["+a.startSN+"-"+a.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,i))):this.warn("Invalid audio track id "+r)},n.onLevelLoading=function(e,t){this.switchLevel(t.level)},n.onLevelSwitching=function(e,t){this.switchLevel(t.level)},n.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())},n.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)},n.setAudioTrack=function(e){var t,i,a,n,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,a=void 0===(a=l.groupId)?"":a,n=l.name,s=l.type,o=l.url,this.trackId=e,this.trackName=n,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:i,groupId:a,name:n,type:s,url:o}),l.details&&!l.details.live||(e=this.switchParams(l.url,null==t?void 0:t.details),this.loadPlaylist(e)))},n.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:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},n.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},n.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,a=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:a,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"),a=i("./src/types/level.ts"),n=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 n=0;n<i.length;n++){var s=i[n],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 a.HlsUrlParameters(o,Object(r.isFiniteNumber)(s)?s:void 0,a.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,a=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(a.advancedDateTime=Date.now()-o,a.live||null!=i&&i.live){if(a.reloaded(i),i&&this.log("live playlist "+e+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),i&&0<a.fragments.length&&Object(n.mergeDetails)(i,a),this.canLoad&&a.live){o=void 0;var l,c=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var u=this.hls.config.lowLatencyMode,d=a.lastPartSn,h=a.endSN,f=a.lastPartIndex,p=d===h;d=(-1!==f?(o=p?h+1:d,c=p?u?0:f:f+1):o=h+1,a.age),f=d+a.ageHeader,h=Math.min(f-a.partTarget,1.5*a.targetduration);if(0<h&&(i&&h>i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+h+" with playlist age: "+a.age),h=0):(o+=f=Math.floor(h/a.targetduration),void 0!==c&&(c+=Math.round(h%a.targetduration/a.partTarget)),this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+h+" skip sn "+f+" to part "+c)),a.tuneInGoal=h),l=this.getDeliveryDirectives(a,t.deliveryDirectives,o,c),u||!p)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(a,t.deliveryDirectives,o,c);i=Object(n.computeReloadInterval)(a,s),void 0!==o&&a.canBlockReload&&(i-=a.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 n=Object(a.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=a.HlsSkip.No),new a.HlsUrlParameters(i,r,n)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,a=this.retryCount<r.levelLoadingMaxRetry;return a?(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),a},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 E})),i.d(t,"default",(function(){return k}));var r=i("./src/polyfills/number.ts"),a=(t=i("./src/task-loop.ts"),i("./src/controller/fragment-tracker.ts")),n=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,E={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=T).prototype=Object.create(i.prototype),v(t.prototype.constructor=t,i),(t=T.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=E.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],n.BufferHelper.isBuffered(this.media,t.start+t.duration/2)):(e=r.getState(i))===a.FragmentState.PARTIAL||e===a.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===E.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,a=this.mediaBuffer,s=this.state,o=i?i.currentTime:0;a=n.BufferHelper.bufferInfo(a||i,o,e.maxBufferHole);this.log("media seeking to "+(Object(r.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+s),s===E.ENDED?this.resetLoadingState():t&&!a.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||a.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===E.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels&&(this.state=E.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=E.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=E.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===E.BACKTRACKING)?(r.fragmentTracker.backtrack(e,t),void r.resetFragmentLoading(e)):void r._handleFragmentLoadComplete(t);i!==E.FRAG_LOADING&&i!==E.BACKTRACKING&&(r.fragCurrent||i!==E.PARSING)||(r.fragmentTracker.removeFragment(e),r.state=E.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,a=t.hls,n=i.payload,s=e.decryptdata;return n&&0<n.byteLength&&s&&s.key&&s.iv&&"AES-128"===s.method?(r=self.performance.now(),t.decrypter.webCryptoDecrypt(new Uint8Array(n),s.key.buffer,s.iv.buffer).then((function(t){var n=self.performance.now();return a.trigger(o.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:r,tdecrypt:n}}),i.payload=t,i}))):i})).then((function(i){var r=t.fragCurrent,a=t.hls,n=t.levels;if(!n)throw new Error("init load aborted, missing levels");n=n[e.level].details,console.assert(n,"Level details are defined when init segment is loaded"),n=e.stats,t.state=E.IDLE,t.fragLoadError=0,e.data=new Uint8Array(i.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),i.frag===r&&a.trigger(o.Events.FRAG_BUFFERED,{stats:n,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(n.BufferHelper.getBuffered(i))),this.state=E.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,a){var n=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&&a){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=E.FRAG_LOADING,this.hls.trigger(o.Events.FRAG_LOADING,{frag:e,part:s[c],targetBufferTime:i}),this.doFragPartsLoad(e,s,c,a).catch((function(e){return n.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=E.FRAG_LOADING,this.hls.trigger(o.Events.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragmentLoader.load(e,a).catch((function(e){return n.handleFragLoadError(e)}))},t.doFragPartsLoad=function(e,t,i,r){var a=this;return new Promise((function(n,s){var l=[];!function i(c){var u=t[c];a.fragmentLoader.loadPart(e,u,r).then((function(r){var s=(l[u.index]=r).part;a.hls.trigger(o.Events.FRAG_LOADED,r),r=t[c+1];if(!r||r.fragment!==e)return n({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,a=this.getCurrentContext(e);a&&this.state===E.PARSING?(t=a.frag,i=a.part,a=a.level,r=self.performance.now(),t.stats.parsing.end=r,i&&(i.stats.parsing.end=r),this.updateLevelTiming(t,i,a,e.partial)):this.fragCurrent||(this.state=E.IDLE)},t.getCurrentContext=function(e){var t,i=this.levels,r=e.level,a=e.sn;e=e.part;return i&&i[r]?(i=i[r],(t=(e=-1<e?Object(f.getPartWith)(i,a,e):null)?e.fragment:Object(f.getFragmentWithSN)(i,a,this.fragCurrent))?{frag:t,part:e,level:i}:null):(this.warn("Levels object was unset while buffering fragment "+a+" of level "+r+". The current chunk will not be buffered."),null)},t.bufferFragmentData=function(e,t,i,r){var a,n,s;e&&this.state===E.PARSING&&(s=e.data1,a=e.data2,n=(n=s)&&a?Object(u.appendUint8Array)(s,a):n)&&n.length&&(s={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:n},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&&(n.BufferHelper.isBuffered(r,r.currentTime)?(t=r.currentTime,r=n.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,a=this.getLoadPosition();if(!Object(r.isFiniteNumber)(a))return null;var s=n.BufferHelper.bufferInfo(e,a,i.maxBufferHole);return 0===s.len&&void 0!==s.nextStart&&(t=this.fragmentTracker.getBufferedFrag(a,t),t&&s.nextStart<t.end)?n.BufferHelper.bufferInfo(e,a,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 a,n=this.config,s=i[0].start;if(t.live){var o=n.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||(a=this.getInitialLiveFragment(t,i),this.startPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=s&&(a=i[0]);return a||(r=n.lowLatencyMode?t.partEnd:t.fragmentEnd,a=this.getFragmentAtPosition(e,r,t)),null==(o=a)||!o.initSegment||null!=(s=a)&&s.initSegment.data||this.bitrateTest?a:a.initSegment},t.getNextPart=function(e,t,i){for(var r=-1,a=!1,n=!0,s=0,o=e.length;s<o;s++){var l=e[s];n=n&&!l.independent;if(-1<r&&i<l.start)break;var c=l.loaded;!c&&(a||l.independent||n)&&l.fragment===t&&(r=s),a=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,a=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),a=Object(h.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),a||((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: "+(a=i).sn),a)||(a=Object(h.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+a.sn)):null!==(i=this.hls.liveSyncPosition)&&(a=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),a},t.getFragmentAtPosition=function(e,t,i){var r,n=this.config,s=this.fragPrevious,o=i.fragments,l=i.endSN,c=i.fragmentHint,u=n.maxFragLookUpTolerance;n=!!(n.lowLatencyMode&&i.partList&&c);if(n&&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)===a.FragmentState.BACKTRACKED){r=null;for(var d=t;o[d]&&this.fragmentTracker.getState(o[d])===a.FragmentState.BACKTRACKED;)r=s?o[d--]:o[--d];r=r||e}else s&&r.sn===s.sn&&!n&&u&&(r=r.sn<l&&this.fragmentTracker.getState(e)!==a.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,a,n=this.config,s=this.media;s&&(t=this.hls.liveSyncPosition,i=s.currentTime,a=e.fragments[0].start,r=e.edge,a=i>=a-n.maxFragLookUpTolerance&&i<=r,null!==t)&&s.duration>t&&(i<t||!a)&&(n=void 0!==n.liveMaxLatencyDuration?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*e.targetduration,!a&&s.readyState<4||i<r-n)&&(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,a,n,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,n=!t,a=e.alignedSliding&&Object(r.isFiniteNumber)(i),n||!a&&!i?(Object(d.alignStream)(l,s,e),n=e.fragments[0].start,this.log("Live playlist sliding: "+n.toFixed(2)+" start-sn: "+(t?t.startSN:"na")+"->"+e.startSN+" prev-sn: "+(l?l.sn:"na")+" fragments: "+o),n):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,a=this.startPosition;-1!==(a=a<t?-1:a)&&-1!==this.lastCurrentTime||(i=e.startTimeOffset,Object(r.isFiniteNumber)(i)?(a=t+i,i<0&&(a+=e.totalduration),a=Math.min(Math.max(t,a),t+e.totalduration),this.log("Start time offset "+i+" found in playlist, adjust startPosition to "+a),this.startPosition=a):e.live?a=this.hls.liveSyncPosition||t:this.startPosition=a=0,this.lastCurrentTime=a),this.nextLoadPosition=a},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=E.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=E.FRAG_LOADING_WAITING_RETRY):t.levelRetry?(e===A.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=E.IDLE):(s.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=E.ERROR))},t.afterBufferFlushed=function(e,t,i){e&&(e=n.BufferHelper.getBuffered(e),this.fragmentTracker.detectEvictedFragments(t,e,i),this.state===E.ENDED)&&this.resetLoadingState()},t.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=E.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 a=this,n=i.details;console.assert(!!n,"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?(a.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+l+") resetting transmuxer to fallback to playlist timing"),a.resetTransmuxer(),t||!1):(l=r?0:Object(f.updateFragPTSDTS)(n,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS),a.hls.trigger(o.Events.LEVEL_PTS_UPDATED,{details:n,level:i,drift:l,type:s,frag:e,start:c.startPTS,end:c.endPTS}),!0):t}),!1)?(this.state=E.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(T.prototype,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}]),T);function T(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=E.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"),a=i("./src/events.ts"),n=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(a.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(a.Events.BUFFER_RESET,this.onBufferReset,this),e.on(a.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(a.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(a.Events.BUFFER_EOS,this.onBufferEos,this),e.on(a.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(a.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(a.Events.FRAG_PARSED,this.onFragParsed,this),e.on(a.Events.FRAG_CHANGED,this.onFragChanged,this)},i.unregisterListeners=function(){var e=this.hls;e.off(a.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(a.Events.BUFFER_RESET,this.onBufferReset,this),e.off(a.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(a.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(a.Events.BUFFER_EOS,this.onBufferEos,this),e.off(a.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(a.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(a.Events.FRAG_PARSED,this.onFragParsed,this),e.off(a.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,n.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(n.logger.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){n.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()):n.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(a.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){n.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 a,n,s,o;r?(a=i.tracks[e])&&"function"==typeof a.buffer.changeType&&(n=(o=t[e]).codec,s=o.levelCodec,o=o.container,(a.levelCodec||a.codec).replace(d,"$1")!==(s||n).replace(d,"$1"))&&i.appendChangeType(e,o+";codecs="+(s||n)):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 a=i.sourceBuffer[e];a&&(n.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),a.changeType(t)),r.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){n.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))&&(n.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),n={};for(e in r)n[e]=o.BufferHelper.getBuffered(r[e]);i.appendError=0,i.hls.trigger(a.Events.BUFFER_APPENDED,{type:d,frag:h,part:f,chunkMeta:p,parent:h.type,timeRanges:n})},onError:function(e){n.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&&(n.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),r.trigger(a.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(a.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){n.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&&n.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(a.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 a=i.sourceBuffer[r];return t.type&&t.type!==r||a&&!a.ended&&(a.ended=!0,n.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),e&&!(a&&!a.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,n,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),n=Math.floor(c/t)*t-i,e.forEach((function(e){var t=u[e];t&&0<(t=o.BufferHelper.getBuffered(t)).length&&n>t.start(0)&&(s.trigger(a.Events.BACK_BUFFER_REACHED,{bufferEnd:n}),l.live&&s.trigger(a.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n}),s.trigger(a.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:e}))}))))},i.updateMediaElementDuration=function(){var e,t,i,a,s,o;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,s=this.media,i=this.mediaSource,a=e.fragments[0].start+e.totalduration,s=s.duration,o=Object(r.isFiniteNumber)(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(n.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(o<a&&s<a||!Object(r.isFiniteNumber)(s))&&(n.logger.log("[buffer-controller]: Updating Media Source duration to "+a.toFixed(3)),i.duration=a))},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(a.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;n.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){n.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(a.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:u})}}o&&this.hls.trigger(a.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){n.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(a.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 a=this.media,s=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[e];a&&s&&l?(a=Object(r.isFiniteNumber)(a.duration)?a.duration:1/0,s=Object(r.isFiniteNumber)(s.duration)?s.duration:1/0,(t=Math.max(0,t))<(i=Math.min(i,a,s))?(n.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)):(n.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)):(n.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,a=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=a.sourceBuffer[e];t&&t.updating||i.shiftAndExecuteNext(e)}))}))):(n.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;n.logger.log("[buffer-controller]: Media source opened"),i&&(t.updateMediaElementDuration(),e.trigger(a.Events.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){n.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){n.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 a}));var r=i("./src/utils/logger.ts"),a=((t=n.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,a=t[e];i=i[e];if(i.length){var n=i[0];try{n.execute()}catch(t){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),n.onError(t),a&&a.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]},n);function n(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 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)}}(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,a=e.length-1,n=0;n<e.length;n+=1){var s=e[n];if((s.width>=t||s.height>=i)&&(!(r=e[n+1])||s.width!==r.width||s.height!==r.height)){a=n;break}}return a},i=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],a((n=s).prototype,[{key:"mediaWidth",get:function(){return this.getDimensions().width*s.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*s.contentScaleFactor}}]),a(n,i);var n=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=n},"./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"),a=i("./src/types/cmcd.ts"),n=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:a.CMCDVersion,sf:a.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===a.CMCDObjectType.INIT||t.ot===a.CMCDObjectType.VIDEO||t.ot===a.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?a.CMCDObjectType.TIMED_TEXT:"initSegment"===e.sn?a.CMCDObjectType.INIT:"audio"===t?a.CMCDObjectType.AUDIO:"main"===t?this.hls.audioTracks.length?a.CMCDObjectType.VIDEO:a.CMCDObjectType.MUXED:void 0},t.getTopBandwidth=function(e){for(var t=0,i=this.hls,r=c(e===a.CMCDObjectType.AUDIO?i.audioTracks:(e=-1<(e=i.maxAutoLevel)?e+1:i.levels.length,i.levels.slice(0,e)));!(n=r()).done;){var n=n.value;n.bitrate>t&&(t=n.bitrate)}return 0<t?t:NaN},t.getBufferLength=function(e){var t=this.hls.media;e=e===a.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return e&&t?1e3*n.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)},a={br:i,d:i,bl:r,dl:r,mtp:r,nor:function(e){return encodeURIComponent(e)},rtp:r,tb:i},n=c(Object.keys(e||{}).sort());!(l=n()).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=y(u=(s=a[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=[{},{},{},{}],a={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},n=0,s=Object.keys(e);n<s.length;n++){var o=s[n];r[null!=a[o]?a[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:a.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],n=t.getObjectType(i),o={d:1e3*i.duration,ot:n};n!==a.CMCDObjectType.VIDEO&&n!==a.CMCDObjectType.AUDIO&&n!=a.CMCDObjectType.MUXED||(o.br=r.bitrate/1e3,o.tb=t.getTopBandwidth(n)/1e3,o.bl=t.getBufferLength(n)),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"),a=i("./src/errors.ts"),n=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 a=i,n=r,o={audioCapabilities:[],videoCapabilities:[]},t.forEach((function(e){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:n.audioRobustness||""})})),a.forEach((function(e){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:n.videoRobustness||""})})),[o];var a,n,o;throw new Error("Unknown key-system: "+e)}(e,t,this._drmSystemOptions),n.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){n.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},i._onMediaKeySystemAccessObtained=function(e,t){var i=this,r=(n.logger.log('Access for key-system "'+e+'" obtained'),{mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e}),a=(this._mediaKeysList.push(r),Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return r.mediaKeys=t,n.logger.log('Media-keys created for key-system "'+e+'"'),i._onMediaKeysCreated(),t})));return a.catch((function(e){n.logger.error("Failed to create media-keys:",e)})),a},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;n.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(i){t._onKeySessionMessage(e,i.message)}),!1)},i._onKeySessionMessage=function(e,t){n.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){n.logger.log("Received license data (length: "+(t&&t.byteLength)+"), updating key-session"),e.update(t)}))},i.onMediaEncrypted=function(e){var t,i=this;n.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):(n.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.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?(n.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0):(n.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0})))},i._generateRequestWithPreferredKeySession=function(e,t){var i,s=this,o=this._mediaKeysList[0];o?o.mediaKeysSessionInitialized?n.logger.warn("Key-Session already initialized but requested again"):(i=o.mediaKeysSession)?t?(n.logger.log('Generating key-session request for "'+e+'" init data type'),o.mediaKeysSessionInitialized=!0,i.generateRequest(e,t).then((function(){n.logger.debug("Key-session generation succeeded")})).catch((function(e){n.logger.error("Error generating key-session request:",e),s.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))):(n.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0})):(n.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0})):(n.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.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){n.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,n.logger.log("License request succeeded");var o=e.response,l=this._licenseResponseCallback;if(l)try{o=l.call(this.hls,e,t)}catch(e){n.logger.error(e)}s(o)}else n.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,3<this._requestLicenseFailureCount?this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0}):(l=3-this._requestLicenseFailureCount+1,n.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){n.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=(n.logger.log("Sending license request to URL: "+s),this._generateLicenseRequestChallenge(i,e));o.send(l)}catch(e){n.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}else n.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(r.Events.ERROR,{type:a.ErrorTypes.KEY_SYSTEM_ERROR,details:a.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"),a=i("./src/utils/logger.ts");function n(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=n.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 n,s,o,l,c=performance.now();t&&(this.lastTime&&(l=c-this.lastTime,n=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,l=1e3*n/l,(o=this.hls).trigger(r.Events.FPS_DROP,{currentDropped:n,currentDecoded:s,totalDroppedFrames:i}),0<l)&&n>o.config.fpsDroppedMonitoringThreshold*s&&(l=o.currentLevel,a.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=n},"./src/controller/fragment-finders.ts":function(e,t,i){i.r(t),i.d(t,"findFragmentByPDT",(function(){return n})),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"),a=i("./src/utils/binary-search.ts");function n(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 a=0;a<e.length;++a){var n=e[a];if(l(t,i,n))return n}}return null}function s(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=null;return e?n=t[e.sn-t[0].sn+1]||null:0===i&&0===t[0].start&&(n=t[0]),(!n||0!==o(i,r,n))&&a.default.search(t,o.bind(null,i,r))||n}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 a.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,a=i("./src/events.ts"),n=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(a.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this)},i._unregisterListeners=function(){var e=this.hls;e.off(a.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this)},i.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},i.getAppendedFrag=function(e,t){if(t===n.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var a=r.length;a--;){var s=r[a],o=s?s.end:i.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return 9<a&&(this.activeParts=r.slice(a-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),a=r.length;a--;){var n=i[r[a]];if((null==n?void 0:n.body.type)===t&&n.buffered&&(n=n.body,n.start<=e&&e<=n.end))return n}return null},i.detectEvictedFragments=function(e,t,i){var r=this;Object.keys(this.fragments).forEach((function(a){var n=r.fragments[a];n&&(n.buffered?(a=n.range[e])&&a.time.some((function(e){return e=!r.isTimeBuffered(e.startPTS,e.endPTS,t),e&&r.removeFragment(n.body),e})):n.body.type===i&&r.removeFragment(n.body))}))},i.detectPartialFragments=function(e){var t,i=this,r=this.timeRanges,a=e.frag,n=e.part;r&&"initSegment"!==a.sn&&(e=c(a),t=this.fragments[e])&&(Object.keys(r).forEach((function(e){var s,o=a.elementaryStreams[e];o&&(s=r[e],o=null!==n||!0===o.partial,t.range[e]=i.getBufferedTimes(a,n,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 a={time:[],partial:i},n=(t||e).start,s=(t||e).end,o=e.minEndPTS||s,l=e.maxStartPTS||n,c=0;c<r.length;c++){var u=r.start(c)-this.bufferPadding,d=r.end(c)+this.bufferPadding;if(u<=l&&o<=d){a.time.push({startPTS:Math.max(n,r.start(c)),endPTS:Math.min(s,r.end(c))});break}if(n<d&&u<s)a.partial=!0,a.time.push({startPTS:Math.max(n,r.start(c)),endPTS:Math.min(s,r.end(c))});else if(s<=u)break}return a},i.getPartialFragment=function(e){var t,i,r=null,a=0,n=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach((function(o){o=s[o],o&&l(o)&&(t=o.body.start-n,i=o.body.end+n,t<=e)&&e<=i&&(t=Math.min(e-t,i-e),a<=t)&&(r=o.body,a=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,a,n=0;n<i.length;n++){if(r=i.start(n)-this.bufferPadding,a=i.end(n)+this.bufferPadding,r<=e&&t<=a)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,a=t.part,s=t.timeRanges;r.type===n.PlaylistLevelType.MAIN&&(this.activeFragment=r,a?((t=this.activeParts)||(this.activeParts=t=[]),t.push(a)):this.activeParts=null),this.timeRanges=s,Object.keys(s).forEach((function(e){var t=s[e];if(i.detectEvictedFragments(e,t),!a)for(var n=0;n<t.length;n++)r.appendedPTS=Math.max(t.end(n),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(a){a=r.fragments[a];a&&a.buffered&&(a=a.body).type===i&&a.start<t&&a.end>e&&r.removeFragment(a)}))},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"),a=i("./src/errors.ts"),n=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,a=this.stalled,n=i.currentTime,c=i.seeking,u=this.seeking&&!c,d=!this.seeking&&c;if(this.seeking=c,n===e){if((d||u)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&r.BufferHelper.getBuffered(i).length&&(e=r.BufferHelper.bufferInfo(i,n,0),d=0<e.len,u=e.nextStart||0,d||u)){if(c){d=e.len>l;var h=!u||l<u-n&&!this.fragmentTracker.getPartialFragment(n);if(d||h)return;this.moved=!1}if(!this.moved&&null!==this.stalled&&(d=Math.max(u,e.start||0)-n,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!==a?(d=h-a,!c&&o<=d&&this._reportStall(e.len),u=r.BufferHelper.bufferInfo(i,n,t.maxBufferHole),this._tryFixBufferStall(u,d)):this.stalled=h}}else this.moved=!0,null!==a&&(this.stallReported&&(c=self.performance.now()-a,s.logger.warn("playback not stuck anymore @"+n+", 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,a=this.media.currentTime;r=r.getPartialFragment(a);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(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.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(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.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(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.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(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.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"),a=i("./src/utils/texttrack-utils.ts"),n=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(a.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(a.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 a=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<r.length;s++){var o=n.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];n.isTimeStampFrame(h)||((d=new a(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(a.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"),a=i("./src/events.ts"),n=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(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(a.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(a.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){this.hls.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(a.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(a.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(a.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++,n.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},t.timeupdate=function(){var e,t,i,r=this.media,a=this.levelDetails;r&&a&&(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+a.targetduration),a.live&&i&&.05<t&&1<this.forwardBufferLength?(a=Math.min(2,Math.max(1,e)),i=Math.round(2/(1+Math.exp(-.75*t-this.edgeStalled))*20)/20,r.playbackRate=Math.min(a,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,a,n=this.levelDetails;return null===n?null:(e=n.holdBack,r=n.partHoldBack,n=n.targetduration,t=(a=this.config).liveSyncDuration,i=a.liveSyncDurationCount,a=a.lowLatencyMode&&r||e,(a=(r=this.hls.userConfig).liveSyncDuration||r.liveSyncDurationCount||0===a?void 0!==t?t:i*n:a)+Math.min(+this.stallCount,n))}},{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"),a=i("./src/events.ts"),n=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(a.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(a.Events.ERROR,this.onError,this)},t._unregisterListeners=function(){var e=this.hls;e.off(a.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(a.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(a.Events.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.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,a,s=!1,o=!0;switch(t.details){case n.ErrorDetails.FRAG_LOAD_ERROR:case n.ErrorDetails.FRAG_LOAD_TIMEOUT:case n.ErrorDetails.KEY_LOAD_ERROR:case n.ErrorDetails.KEY_LOAD_TIMEOUT:t.frag&&(!(a=this._levels[t.frag.level])||(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry))&&(r=t.frag.level);break;case n.ErrorDetails.LEVEL_LOAD_ERROR:case n.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(o=!1),r=i.level),s=!0;break;case n.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 a=e.details,n=this._levels[t];if(n.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}r&&(1<(i=n.url.length)&&n.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(a+": 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,a=this._levels[i];a?i===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0,this.retryCount=0),this.playlistLoaded(i,t,a.details)):null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0):(this.warn("Invalid level index "+i),null!=(a=t.deliveryDirectives)&&a.skip&&(r.deltaUpdateFailed=!0))},t.onAudioTrackSwitched=function(e,t){var i=this.hls.levels[this.currentLevelIndex];if(i&&i.audioGroupIds){for(var r=-1,a=this.hls.audioTracks[t.id].groupId,n=0;n<i.audioGroupIds.length;n++)if(i.audioGroupIds[n]===a){r=n;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(a.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,a){return a!==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(a.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(a.Events.ERROR,{type:n.ErrorTypes.OTHER_ERROR,details:n.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(a.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 n})),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"),a=i("./src/utils/logger.ts");function n(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,a=t.startPTS;Object(r.isFiniteNumber)(a)?(i=0,(a=t.sn>e.sn?(i=a-e.start,e):(i=e.start-a,t)).duration!==i&&(a.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,n,s,o){n-i<=0&&(a.logger.warn("Fragment should have a positive duration",t),n=i+t.duration,o=s+t.duration);var c=i,u=n,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(n,h),n=Math.max(n,h),o=Math.max(o,t.endDTS)),t.duration=n-i,i-t.start);t.appendedPTS=n,t.start=t.startPTS=i,t.maxStartPTS=c,t.startDTS=s,t.endPTS=n,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,n=e.fragments,s=n.length-1;0<=s;s--){var o=n[s].initSegment;if(o){i=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var l,u=0;if(h(e,t,(function(e,a){e.relurl&&(u=e.cc-a.cc),Object(r.isFiniteNumber)(e.startPTS)&&Object(r.isFiniteNumber)(e.endPTS)&&(a.start=a.startPTS=e.startPTS,a.startDTS=e.startDTS,a.appendedPTS=e.appendedPTS,a.maxStartPTS=e.maxStartPTS,a.endPTS=e.endPTS,a.endDTS=e.endDTS,a.minEndPTS=e.minEndPTS,a.duration=e.endPTS-e.startPTS,a.duration&&(l=a),t.PTSKnown=t.alignedSliding=!0),a.elementaryStreams=e.elementaryStreams,a.loader=e.loader,a.stats=e.stats,a.urlId=e.urlId,e.initSegment&&(a.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)){a.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){a.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,a=0,n=e.length;a<=n;a++){var s=e[a],o=t[a+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,a=Math.max(e.startSN,t.startSN)-t.startSN,n=(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=a;c<=n;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,a=r/2,n=e.age,s=0<n&&n<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(a,2*t),i),e.availabilityDelay=(e.availabilityDelay||0)+i):i=a:i=s?(o=Math.min(o||r/2,n),(e.availabilityDelay=o)+r-n):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 a=r.length;a--;){var n=r[a];if(n.index===i&&n.fragment.sn===t)return n}}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"),a=i("./src/controller/base-stream-controller.ts"),n=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=a.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=a.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()):(this._forceStartLoad=!0,this.state=a.State.STOPPED)},i.stopLoad=function(){this._forceStartLoad=!1,y.prototype.stopLoad.call(this)},i.doTick=function(){switch(this.state){case a.State.IDLE:this.doTickIdle();break;case a.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=a.State.IDLE}break;case a.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=a.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,n=e.config,o=e.nextLoadLevel;null===t||!(r||!this.startFragRequested&&n.startFragPrefetch)||this.altAudio&&this.audioOnly||!i||!i[o]||(t=i[o],this.level=e.nextLoadLevel=o,!(n=t.details)||this.state===a.State.WAITING_LEVEL||n.live&&this.levelLastLoaded!==o?this.state=a.State.WAITING_LEVEL:null===(i=this.getFwdBufferInfo(this.mediaBuffer||r,c.PlaylistLevelType.MAIN))||i.len>=this.getMaxBufferLength(t.maxBitrate)||(this._streamEnded(i,n)?(e={},this.altAudio&&(e.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,e),this.state=a.State.ENDED):(o=i.end,t=this.getNextFragment(o,n),this.couldBacktrack&&!this.fragPrevious&&t&&"initSegment"!==t.sn&&1<(e=t.sn-n.startSN)&&(t=n.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,n)),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,n,o):this.loadKey(t,n)))))},i.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,r===l.FragmentState.BACKTRACKED){var a=this.fragmentTracker.getBacktrackData(e);if(a)return this._handleFragmentLoadProgress(a),void this._handleFragmentLoadComplete(a);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==(a=this.media)?void 0:a.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===a.State.KEY_LOADING&&(this.state=a.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,a=!1;t.levels.forEach((function(e){(i=e.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(r=!0),-1!==i.indexOf("mp4a.40.5"))&&(a=!0)})),this.audioCodecSwitch=r&&a&&!Object(n.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===a.State.IDLE&&(!(i=i[t.level]).details||i.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(i.details))&&(this.state=a.State.WAITING_LEVEL)},i.onLevelLoaded=function(e,t){var i=this.levels,r=t.level,n=t.details,o=n.totalduration;if(i){if(this.log("Level "+r+" loaded ["+n.startSN+","+n.endSN+"], cc ["+n.startCC+", "+n.endCC+"] duration:"+o),o=this.fragCurrent,!o||this.state!==a.State.FRAG_LOADING&&this.state!==a.State.FRAG_LOADING_WAITING_RETRY||o.level!==t.level&&o.loader&&(this.state=a.State.IDLE,o.loader.abort()),t=i[r],o=0,n.live||null!=(i=t.details)&&i.live){if(n.fragments[0]||(n.deltaUpdateFailed=!0),n.deltaUpdateFailed)return;o=this.alignPlaylists(n,t.details)}if(t.details=n,this.levelLastLoaded=r,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:n,level:r}),this.state===a.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(n))return;this.state=a.State.IDLE}this.startFragRequested?n.live&&this.synchronizeToLiveEdge(n):this.setStartPosition(n,o),this.tick()}else this.warn("Levels were reset while loading level "+r)},i._handleFragmentLoadProgress=function(e){var t,i,r,a,n,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,a=null==(a=l.initSegment)?void 0:a.data,f=this._getAudioCodec(f),n=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],n.push(e,a,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,a=!1;for(i in r){var n,s,o=r[i];"main"===o.id?(s=o,"video"===(n=i)&&(o=r[i])&&(this.videoBuffer=o.buffer)):a=!0}a&&s?(this.log("Alternate track found, use "+n+".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===a.State.PARSED&&(this.state=a.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!==a.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=a.State.ERROR):t.levelRetry||this.state!==a.State.WAITING_LEVEL||(this.state=a.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"main"!==t.parent||this.state!==a.State.PARSING&&this.state!==a.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=a.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,n=t.hls;!i||n.nextLoadLevel||t.fragContextChanged(e)||(t.fragLoadError=0,t.state=a.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(),n.trigger(s.Events.FRAG_LOADED,i))}))},i._handleTransmuxComplete=function(e){var t="main",i=this.hls,n=e.remuxResult,o=(e=e.chunkMeta,this.getCurrentContext(e));if(o){var l=o.frag,c=o.part,d=(o=o.level,n.video),h=n.text,f=n.id3,p=n.initSegment,g=this.altAudio?void 0:n.audio;if(!this.fragContextChanged(l)){if(this.state=a.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!==n.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===n.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&&(n={frag:l,id:t,samples:f.samples},i.trigger(s.Events.FRAG_PARSING_METADATA,n)),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 n,o,l,c,u,d=this;this.state===a.State.PARSING&&(this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio,n=t.audio,o=t.video,l=t.audiovideo,n&&(c=e.audioCodec,u=navigator.userAgent.toLowerCase(),this.audioCodecSwitch&&(c=c&&(-1!==c.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==n.metadata.channelCount)&&-1===u.indexOf("firefox")&&(c="mp4a.40.5"),-1!==u.indexOf("android")&&"audio/mpeg"!==n.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+'"'),n.levelCodec=c,n.id="main",this.log("Init audio buffer, container:"+n.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(e.audioCodec||"")+"/"+n.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 a=t[e].initSegment;null!=a&&a.byteLength&&d.hls.trigger(s.Events.BUFFER_APPENDING,{type:e,data:a,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=a.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"),a=i("./src/utils/buffer-helper.ts"),n=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 a,n=i.start,s=0;s<r.length;s++)if(n>=r[s].start&&n<=r[s].end){a=r[s];break}t=i.start+i.duration,a?a.end=t:r.push(a={start:n,end:t}),this.fragmentTracker.fragBuffered(i)}}},i.onBufferFlushing=function(e,t){var i,r,a,n=t.startOffset,s=t.endOffset;0===n&&s!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(r=this.levels).length)&&r[i]&&r[i].details&&((a=s-r[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,a),this.tracksBuffered.forEach((function(e){for(var t=0;t<e.length;)if(e[t].end<=a)e.shift();else{if(!(e[t].start<a))break;e[t].start=a,t++}})),this.fragmentTracker.removeFragmentsInRange(n,a,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),a=this.levels;if(a.length){var l=a[r];if(!(t>=a.length||t!==r)&&l){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!=(a=l.details)&&a.live){if(r=this.mainDetails,i.deltaUpdateFailed||!r)return;a=r.fragments[0],l.details?0===this.alignPlaylists(i,l.details)&&a&&Object(o.addSliding)(i,a.start):i.hasProgramDateTime&&r.hasProgramDateTime?Object(s.alignMediaPlaylistByPDT)(i,r):a&&Object(o.addSliding)(i,a.start)}l.details=i,this.levelLastLoaded=t,this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==c.State.IDLE||Object(n.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,a=(e=e.payload,i.decryptdata),n=this.hls;!this.fragContextChanged(i)&&e&&0<e.byteLength&&a&&a.key&&a.iv&&"AES-128"===a.method&&(t=performance.now(),this.decrypter.webCryptoDecrypt(new Uint8Array(e),a.key.buffer,a.iv.buffer).then((function(e){var a=performance.now();n.trigger(r.Events.FRAG_DECRYPTED,{frag:i,payload:e,stats:{tstart:t,tdecrypt:a}})})))},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=a.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(n.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"),a=i("./src/utils/texttrack-utils.ts"),n=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=n.default,i=c,(n=u).prototype=Object.create(i.prototype),l(n.prototype.constructor=n,i),(n=u.prototype).destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,c.prototype.destroy.call(this)},n.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)},n.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)},n.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))},n.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,e)},n.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(a.clearCurrentCues)(e)})),this.subtitleTrack=-1,this.media=null)},n.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},n.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},n.onSubtitleTrackLoaded=function(e,t){var i,r=t.id,a=t.details,n=this.trackId;n=this.tracksInGroup[n];n?(i=n.details,n.details=t.details,this.log("subtitle track "+r+" loaded ["+a.startSN+"-"+a.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,i))):this.warn("Invalid subtitle track id "+r)},n.onLevelLoading=function(e,t){this.switchLevel(t.level)},n.onLevelSwitching=function(e,t){this.switchLevel(t.level)},n.switchLevel=function(e){var t,i,a,n;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,a=this.findTrackId(null==e?void 0:e.name)||this.findTrackId(),this.groupId=t,n={subtitleTracks:i},this.log("Updating subtitle tracks, "+i.length+' track(s) found in "'+t+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,n),-1!==a)&&this.setSubtitleTrack(a,e)},n.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},n.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)},n.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var i=t.id,a=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:a,deliveryDirectives:e||null})}},n.toggleTrackModes=function(e){var t,i=this,r=this.media,a=this.subtitleDisplay,n=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[n])&&(r.mode="disabled"),n=t[e])&&(n.mode=a?"showing":"hidden")},n.setSubtitleTrack=function(e,t){var i,a,n,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,a=i.groupId,n=i.name,s=i.type,o=i.url,this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:l,groupId:void 0===a?"":a,name:n,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},n.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"),a=i("./src/events.ts"),n=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(a.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(a.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(a.Events.FRAG_LOADING,this.onFragLoading,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(a.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(a.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(a.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(a.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(e,t,i,r,n){for(var s,o,l,c=!1,u=n.length;u--;){var d=n[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||n.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(a.Events.CUES_PARSED,{type:"captions",cues:l,track:e}))},t.onInitPtsFound=function(e,t){var i=this,r=t.frag,n=t.id,s=t.initPTS,o=(t=t.timescale,this.unparsedVttFrags);"main"===n&&(this.initPTS[r.cc]=s,this.timescale[r.cc]=t),o.length&&(this.unparsedVttFrags=[],o.forEach((function(e){i.onFragLoaded(a.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,a,n;this.captionsTracks[e]||(a=this.captionsProperties,t=this.captionsTracks,i=this.media,r=(a=a[e]).label,a=a.languageCode,(n=this.getExistingTrack(e))?(t[e]=n,Object(l.clearCurrentCues)(t[e]),Object(l.sendAddTrackEvent)(t[e],i)):(n=this.createTextTrack("captions",r,a))&&(n[e]=!0,t[e]=n))},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(a.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,n=(t=(this.textTracks=[],t.subtitleTracks||[]),t.some((function(e){return e.textCodec===c.IMSC1_CODEC})));(this.config.enableWebVTT||n&&this.config.enableIMSC1)&&(n=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 a,n,s;if(t<i.length){for(var o=null,c=0;c<i.length;c++)if(n=i[c],s=e,n&&n.label===s.name&&!n.textTrack1&&!n.textTrack2){o=i[c];break}o&&(a=o)}a?Object(l.clearCurrentCues)(a):(a=r.createTextTrack("subtitles",e.name,e.lang))&&(a.mode="disabled"),a&&(a.groupId=e.groupId,r.textTracks.push(a))}))):!n&&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(a.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,a=this.cea608Parser2,n=this.lastSn,s=this.lastPartIndex;this.enabled&&r&&a&&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===n+1||i===n&&t===s+1||(r.reset(),a.reset()),this.lastSn=i,this.lastPartIndex=t)},t.onFragLoaded=function(e,t){var i,n,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,n="stats"in t,null!=i&&null!=i.key&&"AES-128"===i.method&&!n||(i=this.tracks[s.level],(n=this.vttCCs)[s.cc]||(n[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,n))):(d.push(t),l.length&&this.hls.trigger(a.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Missing initial subtitle PTS")})):this.hls.trigger(a.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(a.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){d.logger.log("Failed to parse IMSC1: "+t),r.trigger(a.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))},t._parseVTTs=function(e,t,i){var r=this,n=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),n.trigger(a.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(i){r._fallbackToIMSC1(e,t),d.logger.log("Failed to parse VTT cue: "+i),n.trigger(a.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(a.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(a.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 a=0;a<t.samples.length;a++){var n=t.samples[a].bytes;n&&(n=this.extractCea608Data(n),i.addData(t.samples[a].pts,n[0]),r.addData(t.samples[a].pts,n[1]))}},t.onBufferFlushing=function(e,t){var i,r,a=t.startOffset,n=t.endOffset,s=t.endOffsetSubtitles,o=(t=t.type,this.media);!o||o.currentTime<n||(t&&"video"!==t||(i=this.captionsTracks,Object.keys(i).forEach((function(e){return Object(l.removeCuesInRange)(i[e],a,n)}))),this.config.renderTextTracksNatively&&0===a&&void 0!==s&&(r=this.textTracks,Object.keys(r).forEach((function(e){return Object(l.removeCuesInRange)(r[e],a,s)}))))},t.extractCea608Data=function(e){for(var t=31&e[0],i=2,r=[[],[]],a=0;a<t;a++){var n=e[i++],s=127&e[i++],o=127&e[i++],l=3&n;0==s&&0==o||0==(4&n)||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 n.default(1,t,i),this.cea608Parser2=new n.default(3,r,o)),e.on(a.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(a.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(a.Events.FRAG_LOADING,this.onFragLoading,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(a.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(a.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(a.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(a.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})),a.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)};var r=a;function a(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 a})),i.d(t,"default",(function(){return n}));var r=i("./src/utils/typed-array.ts");function a(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],a=i[1],n=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,a[h]=v<<16|v>>>16,n[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 a=this.keySize=t.length;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size="+a);for(var n,s,o,l=this.ksRows=4*(a+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<a?s=c[A]=t[A]:(o=s,A%a==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/a|0]<<24):6<a&&A%a==4&&(o=d[o>>>24]<<24|d[o>>>16&255]<<16|d[o>>>8&255]<<8|d[255&o]),c[A]=s=(c[A-a]^o)>>>0);for(n=0;n<l;n++)A=l-n,o=3&n?c[A]:c[A-4],u[n]=n<4||A<=4?o:f[d[o>>>24]]^p[d[o>>>16&255]]^g[d[o>>>8&255]]^m[d[255&o]],u[n]=u[n]>>>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,a,n,s,o,l,c,u,d,h,f,p,g,m,A=this.keySize+6,y=this.invKeySchedule,v=this.invSBox,b=this.invSubMix,E=b[0],k=b[1],T=b[2],w=b[3],S=(b=this.uint8ArrayToUint32Array_(i),b[0]),_=b[1],R=b[2],C=b[3],D=new Int32Array(e),L=new Int32Array(D.length),x=this.networkToHostOrderSwap;t<D.length;){for(d=x(D[t]),h=x(D[t+1]),f=x(D[t+2]),p=x(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=E[o>>>24]^k[l>>16&255]^T[c>>8&255]^w[255&u]^y[g],a=E[l>>>24]^k[c>>16&255]^T[u>>8&255]^w[255&o]^y[g+1],n=E[c>>>24]^k[u>>16&255]^T[o>>8&255]^w[255&l]^y[g+2],s=E[u>>>24]^k[o>>16&255]^T[l>>8&255]^w[255&c]^y[g+3],o=r,l=a,c=n,u=s,g+=4;r=v[o>>>24]<<24^v[l>>16&255]<<16^v[c>>8&255]<<8^v[255&u]^y[g],a=v[l>>>24]<<24^v[c>>16&255]<<16^v[u>>8&255]<<8^v[255&o]^y[g+1],n=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],L[t]=x(r^S),L[t+1]=x(s^_),L[t+2]=x(n^R),L[t+3]=x(a^C),S=d,_=h,R=f,C=p,t+=4}return L.buffer};var n=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"),a=i("./src/crypt/fast-aes-key.ts"),n=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(n.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 a;this.config.enableSoftwareAES?(this.softwareDecrypt(new Uint8Array(e),t,i),(a=this.flush())&&r(a.buffer)):this.webCryptoDecrypt(new Uint8Array(e),t,i).then(r)},t.softwareDecrypt=function(e,t,i){var r=this.currentIV,a=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 n.default)).expandKey(t),r=a,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 n=this,s=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new a.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 n.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})),a.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])};var r=a;function a(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"),a=i("./src/demux/adts.ts"),n=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(a.probe(e,t))return n.logger.log("ADTS sync word found !"),!0;return!1},r.canParse=function(e,t){return a.canParse(e,t)},r.appendFrame=function(e,t,i){if(a.initTrackConfig(e,this.observer,t,i,e.manifestCodec),e=a.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"),a=i("./src/errors.ts"),n=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(n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.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,a,n){e.samplerate||(t=s(t,i,a,n))&&(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,a){var n=l(e,t);e=c(e,t);if(0<(e-=n))return{headerLength:n,frameLength:e,stamp:i+r*a}}function A(e,t,i,r,a){var n,s,o;r=m(t,i,r,a,g(e.samplerate));if(r)return a=r.frameLength,s=r.headerLength,r=r.stamp,a=s+a,(o=Math.max(0,i+a-t.length))?(n=new Uint8Array(a-s)).set(t.subarray(i+s,t.length),0):n=t.subarray(i+s,i+a),t={unit:n,pts:r},o||e.samples.push(t),{sample:t,length:a,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"),a=i("./src/demux/id3.ts"),n=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=a.getID3Data(e,0),d=u?u.length:0,h=this._audioTrack,f=this._id3Track,p=u?a.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:a.canParse(e,d)?(u=a.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(n.dummyTrack)(),id3Track:f,textTrack:Object(n.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(n.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(n.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=a.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,a=0;a<e.length;a++){var n=e[a];i.set(n,r),r+=n.length}return i}(e),this.reset(),e):new Uint8Array(0)},i.reset=function(){this.chunks.length=0,this.dataLength=0};var r=a;function a(){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 a(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=a.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,a=0,n=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(),a=c(),n=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*a),height:(2-l)*(f+1)*16-(l?2:4)*(n+s),pixelRatio:m}},i.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t.default=a},"./src/demux/id3.ts":function(e,t,i){i.r(t),i.d(t,"isHeader",(function(){return a})),i.d(t,"isFooter",(function(){return n})),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,a=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},n=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;a(e,t);)r=(r+=10)+o(e,t+6),n(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 a(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=[];a(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}n(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,a;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!==(a=i.indexOf("\0"))?i.substring(0,a):i:i.replace(/\0/g,"");for(var n,s,o,l=e.length,c="",u=0;u<l;){if(0===(n=e[u++])&&t)return c;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(n);break;case 12:case 13:s=e[u++],c+=String.fromCharCode((31&n)<<6|63&s);break;case 14:s=e[u++],o=e[u++],c+=String.fromCharCode((15&n)<<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"),a=i("./src/demux/id3.ts"),n=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=(a.getID3Data(e,0)||[]).length,i=e.length;t<i;t++)if(s.probe(e,t))return n.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"),a=i("./src/demux/dummy-demuxed-track.ts");(i=n.prototype).resetTimeStamp=function(){},i.resetInitSegment=function(){},i.resetContiguity=function(){},n.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(a.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(a.dummyTrack)(),avcTrack:i,id3Track:Object(a.dummyTrack)(),textTrack:Object(a.dummyTrack)()}},i.flush=function(){var e=Object(a.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(a.dummyTrack)(),avcTrack:e,id3Track:Object(a.dummyTrack)(),textTrack:Object(a.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=n;function n(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,a=[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],n=[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,a){if(!(i+24>t.length)){var n=c(t,i);if(n&&i+n.frameLength<=t.length)return r+=a*(9e4*n.samplesPerFrame/n.sampleRate),a={unit:t.subarray(i,i+n.frameLength),pts:r,dts:r},e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(a),{sample:a,length:n.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*a[14*(3==h?3-f:3==f?3:4)+p-1],g=n[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"),a=i("./src/demux/tsdemuxer.ts");function n(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new r.default(e,t,{removePKCS7Padding:!1})}(i=n.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 a=e[t].unit,n=a.subarray(16,a.length-a.length%16),s=(n=n.buffer.slice(n.byteOffset,n.byteOffset+n.length),this);this.decryptBuffer(n,(function(n){n=new Uint8Array(n),a.set(n,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,a=32;a<e.length-16;a+=160,r+=16)i.set(e.subarray(a,a+16),r);return i},i.getAvcDecryptedUnit=function(e,t){for(var i=new Uint8Array(t),r=0,a=32;a<e.length-16;a+=160,r+=16)e.set(i.subarray(r,r+16),a);return e},i.decryptAvcSample=function(e,t,i,r,n,s){var o=Object(a.discardEPB)(n.data),l=this.getAvcEncryptedData(o),c=this;this.decryptBuffer(l.buffer,(function(a){n.data=c.getAvcDecryptedUnit(o,a),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 a=e[t].units;!(i>=a.length);i++){var n=a[i];if(!(n.data.length<=48||1!==n.type&&5!==n.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,n,s),!s)return}}}},t.default=n},"./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"),a=i("./src/events.ts"),n=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,a,o,l,c,u,d){var h=this,f=(u.transmuxing.start=self.performance.now(),this.transmuxer),p=this.worker,g=(o||a).start,m=a.decryptdata,A=this.frag,y=!(A&&a.cc===A.cc),v=!(A&&u.level===A.level),b=A?u.sn-A.sn:-1,E=this.part?u.part-this.part.index:1,k=!v&&(1==b||0==b&&1==E),T=self.performance.now();(v||b||0===a.stats.parsing.start)&&(a.stats.parsing.start=T),!o||!E&&k||(o.stats.parsing.start=T),T=!(A&&(null==(b=a.initSegment)?void 0:b.url)===(null==(E=A.initSegment)?void 0:E.url)),b=new n.TransmuxState(y,k,c,v,g,T);k&&!y&&!T||(s.logger.log("[transmuxer-interface, "+a.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: "+T),A=new n.TransmuxConfig(i,r,t,l,d),this.configureTransmuxer(A)),this.frag=a,this.part=o,p?p.postMessage({cmd:"demux",data:e,decryptdata:m,chunkMeta:u,state:b},e instanceof ArrayBuffer?[e]:[]):f&&(E=f.push(e,m,u,b),Object(n.isPromise)(E)?E.then((function(e){h.handleTransmuxComplete(e)})):this.handleTransmuxComplete(E))},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(n.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(a.Events.FRAG_DECRYPTED,d),this.observer.on(a.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(a.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 n.default(this.observer,u,i,p,t),this.worker=null}}else this.transmuxer=new n.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"),a=i("./src/events.ts"),n=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(a.Events.FRAG_DECRYPTED,t),i.on(a.Events.ERROR,t),e.addEventListener("message",(function(a){var s=a.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(n.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,a;((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(a=t.remuxResult).audio,a=a.video,r&&c(i,r),a&&c(i,a),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 E})),i.d(t,"TransmuxState",(function(){return k}));var r,a=i("./src/events.ts"),n=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,a){var n=this,s=i.transmuxing,o=(e=(s.executeStart=r(),new Uint8Array(e)),this.cache),l=this.config,c=this.currentTransmuxState,u=this.transmuxConfig;a&&(this.currentTransmuxState=a),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=n.push(e,null,i),n.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=a||c,l=d.contiguous,a=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;(a||c||d)&&this.resetInitSegment(b,g,m,v),(a||d)&&this.resetInitialTimestamp(A),l||this.resetContiguity(),this.needsProbing(e,a,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(a.Events.ERROR,a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.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 a=t.audioTrack,n=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),a=this.remuxer.remux(a,n,s,t,o,l,!0,this.id);e.push({remuxResult:a,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 a=this.demuxer,n=this.remuxer;a&&n&&(a.resetInitSegment(t,i,r),n.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,a){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,r,a):this.transmuxUnencrypted(e,i,r,a)},i.transmuxUnencrypted=function(e,t,i,r){e=this.demuxer.demux(e,t,!1,!this.config.progressive);var a=e.audioTrack,n=e.avcTrack,s=e.id3Track;e=e.textTrack;return{remuxResult:this.remuxer.remux(a,n,s,e,t,i,!1,this.id),chunkMeta:r}},i.transmuxSampleAes=function(e,t,i,r,a){var n=this;return this.demuxer.demuxSampleAes(e,t,i).then((function(e){return{remuxResult:n.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,i,r,!1,n.id),chunkMeta:a}}))},i.configureTransmuxer=function(e,t){for(var i,r=this.config,a=this.observer,n=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(a,r,n,s)),A&&A instanceof b||(this.demuxer=new b(a,r,n),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,a){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=a}function b(e){return"then"in e&&e.then instanceof Function}var E=function(e,t,i,r,a){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=a},k=function(e,t,i,r,a,n){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=a,this.initSegmentChange=n}},"./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"),a=i("./src/demux/mpegaudio.ts"),n=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 a,n=this._avcTrack,s=this._audioTrack,o=this._id3Track,h=n.pid,p=n.pesData,m=s.pid,A=o.pid,y=s.pesData,v=o.pesData,b=!1,E=this.pmtParsed,k=this._pmtId,T=e.length;if(this.remainderData&&(T=(e=Object(c.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),T<188&&!r)return this.remainderData=e,{audioTrack:s,avcTrack:n,id3Track:o,textTrack:this._txtTrack};var w=Math.max(0,f.syncOffset(e));(T-=(T+w)%188)<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,T,e.buffer.byteLength-T));for(var S,_=0,R=w;R<T;R+=188)if(71===e[R]){var C=!!(64&e[R+1]),D=((31&e[R+1])<<8)+e[R+2],L=void 0;if(1<(48&e[R+3])>>4){if((L=R+5+e[R+4])===R+188)continue}else L=R+4;switch(D){case h:C&&(p&&(a=g(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(L,R+188)),p.size+=R+188-L);break;case m:C&&(y&&(a=g(y))&&(s.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),y={data:[],size:0}),y&&(y.data.push(e.subarray(L,R+188)),y.size+=R+188-L);break;case A:C&&(v&&(a=g(v))&&this.parseID3PES(a),v={data:[],size:0}),v&&(v.data.push(e.subarray(L,R+188)),v.size+=R+188-L);break;case 0:C&&(L+=e[L]+1),k=this._pmtId=(31&(x=e)[(S=L)+10])<<8|x[S+11];break;case k:C&&(L+=e[L]+1);var x=function(e,t,i,r){var a={audio:-1,avc:-1,id3:-1,isAAC:!0},n=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<n;){var s=(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===a.audio&&(a.audio=s);break;case 21:-1===a.id3&&(a.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===a.avc&&(a.avc=s);break;case 3:case 4:i?-1===a.audio&&(a.audio=s,a.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 a}(e,L,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,i);0<(h=x.avc)&&(n.pid=h),0<(m=x.audio)&&(s.pid=m,s.isAAC=x.isAAC),0<(A=x.id3)&&(o.pid=A),b&&!E&&(u.logger.log("reparse from beginning"),b=!1,R=w-188),E=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"}),n.pesData=p,s.pesData=y,o.pesData=v;var I={audioTrack:s,avcTrack:n,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,a=(e=e.id3Track,r.pesData),n=i.pesData,s=e.pesData;a&&(t=g(a))?(this.parseAVCPES(t,!0),r.pesData=null):r.pesData=a,n&&(t=g(n))?(i.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),i.pesData=null):(null!=n&&n.size&&u.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=n),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,a=e.avcTrack;r.samples&&r.isAAC?t.decryptAacSamples(r.samples,0,(function(){a.samples?t.decryptAvcSamples(a.samples,0,0,(function(){i(e)})):i(e)})):a.samples&&t.decryptAvcSamples(a.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,a=this._avcTrack,o=this.parseAVCNALu(e.data),l=this.avcSample,c=!1;e.data=null,l&&o.length&&!a.audFound&&(m(l,a),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 n.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 n.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,E=[v,u.readUByte()],k=0;k<b;k++)E.push(u.readUByte()),E.push(u.readUByte()),E.push(u.readUByte());A(r._txtTrack.samples,{type:3,pts:e.pts,bytes:E})}}else if(5===d&&0!==u.bytesAvailable){if(f=!0,16<h){for(var T=[],w=0;w<16;w++)T.push(u.readUByte().toString(16)),3!==w&&5!==w&&7!==w&&9!==w||T.push("-");for(var S=h-16,_=new Uint8Array(S),R=0;R<S;R++)_[R]=u.readUByte();A(r._txtTrack.samples,{pts:e.pts,payloadType:d,uuid:T.join(""),userData:Object(s.utf8ArrayToStr)(_),userDataBytes:_})}}else if(h<u.bytesAvailable)for(var C=0;C<h;C++)u.readUByte()}break;case 7:if(c=i=!0,!a.sps){o=new n.default(t.data).readSPS(),a.width=o.width,a.height=o.height,a.pixelRatio=o.pixelRatio,a.sps=[t.data],a.duration=r._duration;for(var D=t.data.subarray(1,4),L="avc1.",x=0;x<3;x++){var I=D[x].toString(16);L+=I=I.length<2?"0"+I:I}a.codec=L}break;case 8:i=!0,a.pps||(a.pps=[t.data]);break;case 9:i=!1,a.audFound=!0,l&&m(l,a),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,a),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,a,n,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))&&((a=new Uint8Array(r.data.byteLength+i)).set(r.data,0),a.set(e.subarray(0,i),r.data.byteLength),r.data=a,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&&(n={data:e.subarray(f,o),type:p,state:c},d.push(n)),0===d.length&&(n=this.getLastNalUnit())&&((s=new Uint8Array(n.data.byteLength+e.byteLength)).set(n.data,0),s.set(e,n.data.byteLength),n.data=s),l.naluState=c,d},i.parseAACPES=function(e){var t,i,a,n,s=0,o=this._audioTrack,c=this.aacOverFlow,h=e.data;for(c&&(this.aacOverFlow=null,f=(n=c.sample.unit.byteLength)-(n=Math.min(c.missing,n)),c.sample.unit.set(h.subarray(0,n),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||(n=t<i-1?(a="AAC PES did not start with ADTS header,offset:"+t,!1):(a="no ADTS header found in AAC PES",!0),u.logger.warn("parsing error:"+a),this.observer.emit(l.Events.ERROR,l.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:n,reason:a}),!n)){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,n=0,s=e.pts;if(void 0!==s)for(;n<i;)if(a.isHeader(t,n)){var o=a.appendFrame(this._audioTrack,t,n,s,r);if(!o)break;n+=o.length,r++}else n++;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,a,n=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-(a=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-a)/9e4)+"s delta between PTS and DTS, align them"),r=a):a=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,n),n+=p}return i&&(i-=l+3),{data:d,pts:r,dts:a,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 a=t-i.length,n=new Uint8Array(a),s=0;for(r=0;r<a;s++,r++)s===i[0]&&(s++,i.shift()),n[r]=e[s];return n}i.minProbeByteLength=188,t.default=i},"./src/errors.ts":function(e,t,i){var r,a;i.r(t),i.d(t,"ErrorTypes",(function(){return r})),i.d(t,"ErrorDetails",(function(){return a})),(i=r=r||{}).NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",(t=a=a||{}).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"),a=i("./src/loader/playlist-loader.ts"),n=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,a=this.url=r.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});h.logger.log("loadSource:"+a),t&&i&&i!==a&&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 a.default(this)),m=new n.default(this),A=new s.default(this),y=this.levelController=new l.default(this),b=new c.FragmentTracker(this),E=this.streamController=new u.default(this,b);r.setStreamController(E),d.setStreamController(E),y=[y,E],this.networkControllers=y,E=[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,E),this.emeController=this.createController(t.emeController,null,E),this.cmcdController=this.createController(t.cmcdController,null,E),this.latencyController=this.createController(o.default,null,E),this.coreComponents=E}y.defaultConfig=void 0},"./src/is-supported.ts":function(e,t,i){i.r(t),i.d(t,"isSupported",(function(){return n})),i.d(t,"changeTypeSupported",(function(){return s}));var r=i("./src/utils/mediasource-helper.ts");function a(){return self.SourceBuffer||self.WebKitSourceBuffer}function n(){var e,t=Object(r.getMediaSource)();return!!t&&(e=a(),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=a();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"),a=i("./src/errors.ts");function n(e){var t="function"==typeof Map?new Map:void 0;return(n=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:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var n=this.config,s=n.fLoader,o=n.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var u=i.loader=e.loader=new(s||o)(n),d=h(e),f={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=u.stats,u.load(d,f,{onSuccess:function(t,a,n,s){i.resetLoader(e,u),r({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,r,n){i.resetLoader(e,u),l(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:n}))},onAbort:function(t,r,n){i.resetLoader(e,u),l(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:n}))},onTimeout:function(t,r,n){i.resetLoader(e,u),l(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:n}))},onProgress:function(i,r,a,n){t&&t({frag:e,part:null,payload:a,networkDetails:n})}})}))},t.loadPart=function(e,t,i){var r=this,n=(this.abort(),this.config),s=n.fLoader,o=n.loader;return new Promise((function(l,u){r.loader&&r.loader.destroy();var d=r.loader=e.loader=new(s||o)(n),f=h(e,t),g={timeout:n.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:n.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=d.stats,d.load(f,g,{onSuccess:function(a,n,s,o){r.resetLoader(e,d),r.updateStatsFromPart(e,t),a={frag:e,part:t,payload:a.data,networkDetails:o},i(a),l(a)},onError:function(i,n,s){r.resetLoader(e,d),u(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:i,networkDetails:s}))},onAbort:function(i,n,s){e.stats.aborted=t.stats.aborted,r.resetLoader(e,d),u(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(i,n,s){r.resetLoader(e,d),u(new p({type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,a=r.total;i.loaded+=r.loaded,a?(a=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/a),e)))*Math.round(i.loaded/t),i.total=i.loaded+a):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=n(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),a=1;a<i;a++)r[a-1]=arguments[a];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,a=i("./src/polyfills/number.ts"),n=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(n.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,a,n){void 0===n&&(n=!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,a)):s[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:a,partial:n}},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(a.isFiniteNumber)(this.programDateTime)?(e=Object(a.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,a){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,a),a&&(i.fragOffset=a.fragOffset+a.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"),a=i("./src/errors.ts"),n=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,a,s=t.type,o=this.loaders[s];t.decryptdata?(i=t.decryptdata.uri)!==this.decrypturl||null===this.decryptkey?(a=this.hls.config,o&&(n.logger.warn("abort previous key loader for type:"+s),o.abort()),i?(o=a.loader,s=t.loader=this.loaders[s]=new o(a),this.decrypturl=i,this.decryptkey=null,o={url:i,frag:t,responseType:"arraybuffer"},i={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},a={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},s.load(o,i,a)):n.logger.warn("key uri is falsy")):this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:t})):n.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})):n.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:a.ErrorTypes.NETWORK_ERROR,details:a.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:a.ErrorTypes.NETWORK_ERROR,details:a.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 n}));var r=i("./src/polyfills/number.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)}}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)},a(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 n=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 n}));var r=i("./node_modules/url-toolkit/src/url-toolkit.js");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)}}s.fromURL=function(e,t){return new s(e,t)},s.fromURI=function(e){return new s(e)},a(s.prototype,[{key:"uri",get:function(){return this._uri}}]);var n=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"),a=i("./node_modules/url-toolkit/src/url-toolkit.js"),n=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 a.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(e,t){var i,r,a,n,s=[],o={},c=!1;for(d.lastIndex=0;null!=(i=d.exec(e));)i[1]?(a={attrs:r=new l.AttrList(i[1]),bitrate:r.decimalInteger("AVERAGE-BANDWIDTH")||r.decimalInteger("BANDWIDTH"),name:r.NAME,url:A.resolve(i[2],t)},(n=r.decimalResolution("RESOLUTION"))&&(a.width=n.width,a.height=n.height),function(e,t){["video","audio","text"].forEach((function(i){var r,a=e.filter((function(e){return Object(u.isCodecType)(e,i)}));a.length&&(r=a.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)})),t[i+"Codec"]=(0<r.length?r:a)[0],e=e.filter((function(e){return-1===a.indexOf(e)})))})),t.unknownCodecs=e}((r.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),a),a.videoCodec&&-1!==a.videoCodec.indexOf("avc1")&&(a.videoCodec=A.convertAVC1ToAVCOTI(a.videoCodec)),s.push(a)):i[3]&&(n=new l.AttrList(i[3]))["DATA-ID"]&&(c=!0,o[n["DATA-ID"]]=n);return{levels:s,sessionData:c?o:null}},A.parseMasterPlaylistMedia=function(e,t,i,r){void 0===r&&(r=[]);var a=[],n=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:n++,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")),a.push(o))}return a},A.parseLevelPlaylist=function(e,t,i,u,d){var h,m,A,y=new s.LevelDetails(t),b=y.fragments,E=null,k=0,T=0,w=0,S=0,_=null,R=new n.Fragment(u,t),C=-1,D=!1;for(f.lastIndex=0,y.m3u8=e;null!==(h=f.exec(e));){D&&(D=!1,(R=new n.Fragment(u,t)).start=w,R.sn=k,R.cc=S,R.level=i,E)&&(R.initSegment=E,R.rawProgramDateTime=E.rawProgramDateTime);var L=h[1];if(L){R.duration=parseFloat(L);var x=(" "+h[2]).slice(1);R.title=x||null,R.tagList.push(x?["INF",L,x]:["INF",L])}else if(h[3])Object(r.isFiniteNumber)(R.duration)&&(R.start=w,A&&(R.levelkey=A),R.sn=k,R.level=i,R.cc=S,R.urlId=d,b.push(R),R.relurl=(" "+h[3]).slice(1),v(R,_),w+=(_=R).duration,k++,D=!(T=0));else if(h[4])x=(" "+h[4]).slice(1),_?R.setByteRange(x,_):R.setByteRange(x);else if(h[5])R.rawProgramDateTime=(" "+h[5]).slice(1),R.tagList.push(["PROGRAM-DATE-TIME",R.rawProgramDateTime]),-1===C&&(C=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)&&R.tagList.push(P?[B,P]:[B]);break;case"DIS":S++;case"GAP":R.tagList.push([I]);break;case"BITRATE":R.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"),z=M.enumeratedString("KEYID"),G=null!=(G=M.enumeratedString("KEYFORMAT"))?G:"identity";-1<["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(G)?c.logger.warn("Keyformat "+G+" is not supported from the manifest"):"identity"===G&&O&&(A=o.LevelKey.fromURL(t,j),j)&&0<=["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(O)&&(A.method=O,A.keyFormat=G,z&&(A.keyID=z),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":G=new l.AttrList(B),R.relurl=G.URI,G.BYTERANGE&&R.setByteRange(G.BYTERANGE),R.level=i,R.sn="initSegment",A&&(R.levelkey=A),R.initSegment=null,E=R,D=!0;break;case"SERVER-CONTROL":z=new l.AttrList(B),y.canBlockReload=z.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=z.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=0<y.canSkipUntil&&z.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=z.optionalFloat("PART-HOLD-BACK",0),y.holdBack=z.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<T?U[U.length-1]:void 0,V=T++;V=new n.Part(new l.AttrList(B),R,t,V,H);U.push(V),R.duration+=V.duration;break;case"PRELOAD-HINT":H=new l.AttrList(B),y.preloadHint=H;break;case"RENDITION-REPORT":V=new l.AttrList(B),y.renditionReports=y.renditionReports||[],y.renditionReports.push(V);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(),w-=_.duration,y.partList&&(y.fragmentHint=_)):y.partList&&(v(R,_),R.cc=S,y.fragmentHint=R);var W=b.length,K=b[0],q=b[W-1];return 0<(w+=y.skippedSegments*y.targetduration)&&W&&q?(y.averagetargetduration=w/W,W=q.sn,y.endSN="initSegment"!==W?W: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=a.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"),(R=new n.Fragment(u,t)).relurl=q.relurl,R.level=i,R.sn="initSegment",K.initSegment=R,y.needSidxRanges=!0))):(y.endSN=0,y.startCC=0),y.fragmentHint&&(w+=y.fragmentHint.duration),y.totalduration=w,y.endCC=S,0<C&&function(e,t){for(var i=e[t],r=t;r--;){var a=e[r];if(!a)return;a.programDateTime=i.programDateTime-1e3*a.duration,i=a}}(b,C),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"),a=i("./src/events.ts"),n=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(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(a.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(a.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},i.unregisterListeners=function(){var e=this.hls;e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(a.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(a.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,a=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:null,level:r,responseType:"text",type:c.PlaylistContextType.LEVEL,url:a,deliveryDirectives:t})},i.onAudioTrackLoading=function(e,t){var i=t.id,r=t.groupId,a=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:a,deliveryDirectives:t})},i.onSubtitleTrackLoading=function(e,t){var i=t.id,r=t.groupId,a=t.url;t=t.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:a,deliveryDirectives:t})},i.load=function(e){var t,i,r,a,n=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=n.manifestLoadingMaxRetry,i=n.manifestLoadingTimeOut,r=n.manifestLoadingRetryDelay,a=n.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:t=0,i=n.levelLoadingTimeOut;break;default:t=n.levelLoadingMaxRetry,i=n.levelLoadingTimeOut,r=n.levelLoadingRetryDelay,a=n.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:a,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 a;void 0===r&&(r=null),i.isSidxRequest?(this.handleSidxRequest(e,i),this.handlePlaylistLoaded(e,t,i,r)):(this.resetInternalLoader(i.type),0===(a=e.data).indexOf("#EXTM3U")?(t.parsing.start=performance.now(),0<a.indexOf("#EXTINF:")||0<a.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 n,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?(n=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}})),n=l.default.parseMasterPlaylistMedia(h,f,"AUDIO",n),o=l.default.parseMasterPlaylistMedia(h,f,"SUBTITLES",o),h=l.default.parseMasterPlaylistMedia(h,f,"CLOSED-CAPTIONS"),n.length&&!n.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"),n.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new u.AttrList({}),bitrate:0,url:""})),c.trigger(a.Events.MANIFEST_LOADED,{levels:g,audioTracks:n,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(a.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(a.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.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(a.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.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=n.ErrorDetails.UNKNOWN,l=!1,u=this.getInternalLoader(e);switch(e.type){case c.PlaylistContextType.MANIFEST:o=i?n.ErrorDetails.MANIFEST_LOAD_TIMEOUT:n.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:o=i?n.ErrorDetails.LEVEL_LOAD_TIMEOUT:n.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:o=i?n.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:o=i?n.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:n.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(e.type),u={type:n.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:u,context:e,networkDetails:t},r&&(u.response=r),this.hls.trigger(a.Events.ERROR,u)},i.handlePlaylistLoaded=function(e,t,i,r){var n=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)),n){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(a.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(a.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(a.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 a}));var r=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},a=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;a.init=function(){for(var e in a.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:[]})a.types.hasOwnProperty(e)&&(a.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=(a.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=(a.STTS=a.STSC=a.STCO=i,a.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),a.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),a.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),a.STSD=new Uint8Array([0,0,0,0,0,0,0,1]),new Uint8Array([105,115,111,109])),new Uint8Array([97,118,99,49])),n=new Uint8Array([0,0,0,1]);a.FTYP=a.box(a.types.ftyp,i,n,i,r),a.DINF=a.box(a.types.dinf,a.box(a.types.dref,t))},a.box=function(e){for(var t=8,i=arguments.length,r=new Array(1<i?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];for(var n=r.length,s=n;n--;)t+=r[n].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),n=0,t=8;n<s;n++)o.set(r[n],t),t+=r[n].byteLength;return o},a.hdlr=function(e){return a.box(a.types.hdlr,a.HDLR_TYPES[e])},a.mdat=function(e){return a.box(a.types.mdat,e)},a.mdhd=function(e,t){t*=e;var i=Math.floor(t/(1+r));t=Math.floor(t%(1+r));return a.box(a.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]))},a.mdia=function(e){return a.box(a.types.mdia,a.mdhd(e.timescale,e.duration),a.hdlr(e.type),a.minf(e))},a.mfhd=function(e){return a.box(a.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},a.minf=function(e){return"audio"===e.type?a.box(a.types.minf,a.box(a.types.smhd,a.SMHD),a.DINF,a.stbl(e)):a.box(a.types.minf,a.box(a.types.vmhd,a.VMHD),a.DINF,a.stbl(e))},a.moof=function(e,t,i){return a.box(a.types.moof,a.mfhd(e),a.traf(i,t))},a.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=a.trak(e[t]);return a.box.apply(null,[a.types.moov,a.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(a.mvex(e)))},a.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=a.trex(e[t]);return a.box.apply(null,[a.types.mvex].concat(i))},a.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 a.box(a.types.mvhd,e)},a.sdtp=function(e){for(var t,i=e.samples||[],r=new Uint8Array(4+i.length),n=0;n<i.length;n++)t=i[n].flags,r[n+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return a.box(a.types.sdtp,r)},a.stbl=function(e){return a.box(a.types.stbl,a.stsd(e),a.box(a.types.stts,a.STTS),a.box(a.types.stsc,a.STSC),a.box(a.types.stsz,a.STSZ),a.box(a.types.stco,a.STCO))},a.avc1=function(e){for(var t,i,r=[],n=[],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,n.push(i>>>8&255),n.push(255&i),n=n.concat(Array.prototype.slice.call(t));var o=a.box(a.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(n))),l=e.width,c=e.height,u=e.pixelRatio[0],d=e.pixelRatio[1];return a.box(a.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,a.box(a.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),a.box(a.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,d>>24,d>>16&255,d>>8&255,255&d])))},a.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]))},a.mp4a=function(e){var t=e.samplerate;return a.box(a.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]),a.box(a.types.esds,a.esds(e)))},a.mp3=function(e){var t=e.samplerate;return a.box(a.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]))},a.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?a.box(a.types.stsd,a.STSD,a.mp4a(e)):a.box(a.types.stsd,a.STSD,a.mp3(e)):a.box(a.types.stsd,a.STSD,a.avc1(e))},a.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,n=e.width,s=(e=e.height,Math.floor(i/(1+r)));i=Math.floor(i%(1+r));return a.box(a.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,n>>8&255,255&n,0,0,e>>8&255,255&e,0,0]))},a.traf=function(e,t){var i=a.sdtp(e),n=e.id,s=Math.floor(t/(1+r));t=Math.floor(t%(1+r));return a.box(a.types.traf,a.box(a.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),a.box(a.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])),a.trun(e,i.length+16+20+8+16+8+8),i)},a.trak=function(e){return e.duration=e.duration||4294967295,a.box(a.types.trak,a.tkhd(e),a.mdia(e))},a.trex=function(e){return e=e.id,a.box(a.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]))},a.trun=function(e,t){var i,r,n,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,n=o.size,s=o.flags,o=o.cts,u.set([r>>>24&255,r>>>16&255,r>>>8&255,255&r,n>>>24&255,n>>>16&255,n>>>8&255,255&n,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 a.box(a.types.trun,u)},a.initSegment=function(e){a.types||a.init();e=a.moov(e);var t=new Uint8Array(a.FTYP.byteLength+e.byteLength);return t.set(a.FTYP),t.set(e,a.FTYP.byteLength),t},i=a;function a(){}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"),a=i("./src/remux/aac-helper.ts"),n=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,a,n,s,o){var u,d,h,f,p,g,m,y=a,v=a,b=-1<e.pid,E=-1<t.pid,k=t.samples.length,T=0<e.samples.length,w=1<k;return(b&&!T||E&&!w)&&!this.ISGenerated&&!s||(this.ISGenerated||(h=this.generateIS(e,t,a)),b=this.isVideoContiguous,s=-1,w&&(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&&(T&&w&&(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)),T?(e.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,a)),d=this.remuxAudio(e,y,this.isAudioContiguous,n,E||w||o===c.PlaylistLevelType.AUDIO?v:void 0),w&&(m=d?d.endPTS-d.startPTS:0,t.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,a)),u=this.remuxVideo(t,v,b,m))):w&&(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,a)),r.samples.length)?this.remuxText(r,a):f,id3:p}},t.generateIS=function(e,t,i){var a,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):n.default.initSegment([e]),metadata:{channelCount:e.channelCount}},h)&&(a=e.inputTimeScale,o=s=l[0].pts-Math.round(a*i)),t.sps&&t.pps&&c.length&&(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:n.default.initSegment([t]),metadata:{width:t.width,height:t.height}},h)&&(a=t.inputTimeScale,f=this.getVideoStartPts(c),u=Math.round(a*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:a}},t.remuxVideo=function(e,t,i,r){var a,c=e.inputTimeScale,f=e.samples,g=[],m=f.length,v=this._initPTS,b=this.nextAvcDts,E=8,k=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,w=0,S=!1;i&&null!==b||(b=t*c-(f[0].pts-A(f[0].dts,f[0].pts)));for(var _=0;_<m;_++){var R=f[_];R.pts=A(R.pts-v,b),R.dts=A(R.dts-v,b),R.dts>R.pts&&(w=Math.max(Math.min(w,R.pts-R.dts),-18e3)),R.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})),C=f[0].dts;t=f[f.length-1].dts;var C,D=Math.round((t-C)/(m-1));if(w<0){if(w<-2*D){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-D,!0)+" ms");for(var L=w,x=0;x<m;x++)f[x].dts=L=Math.max(L,f[x].pts-D),f[x].pts=Math.max(L,f[x].pts)}else{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(u.toMsFromMpegTsClock)(w,!0)+" ms to overcome this issue");for(var I=0;I<m;I++)f[I].dts=f[I].dts+w}C=f[0].dts}i&&((G=D<(i=C-b))||i<-1)&&(G?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"),C=b,G=f[0].pts-i,f[0].dts=C,f[0].pts=G,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(G,!0)+"/"+Object(u.toMsFromMpegTsClock)(C,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(i,!0)+" ms")),p&&(C=Math.max(0,C));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,C),O.pts=Math.max(O.pts,O.dts,0),k=Math.min(O.pts,k),T=Math.max(O.pts,T)}t=f[m-1].dts;var z,G=P+4*B+8;try{z=new Uint8Array(G)}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:G,reason:"fail allocating video mdat "+G})}var H=new DataView(z.buffer);H.setUint32(0,G),z.set(n.default.types.mdat,4);for(var V=0;V<m;V++){for(var W,K=f[V],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(E,X),E+=4,z.set($,E),E+=X,Q+=4+X}V<m-1?a=f[V+1].dts-K.dts:(Z=this.config,W=K.dts-f[0<V?V-1:V].dts,Z.stretchShortVideoTrack&&null!==this.nextAudioPts&&Math.floor(Z.maxBufferHole*c)<(Z=(r?k+r*c:this.nextAudioPts)-K.pts)?((a=Z-W)<0&&(a=W),l.logger.log("[mp4-remuxer]: It is approximately "+Z/90+" ms to the next segment; using duration "+a/90+" ms for the last video frame.")):a=W);var Z=Math.round(K.pts-K.dts);g.push(new y(K.key,a,Q,Z))}return g.length&&h&&h<70&&((i=g[0].flags).dependsOn=2,i.isNonSync=0),console.assert(void 0!==a,"mp4SampleDuration must be computed"),this.nextAvcDts=b=t+a,this.isVideoContiguous=!0,G={data1:n.default.moof(e.sequenceNumber++,C,d({},e,{samples:g})),data2:z,startPTS:k/c,endPTS:(T+a)/c,startDTS:C/c,endDTS:b/c,type:"video",hasAudio:!1,hasVideo:!0,nb:g.length,dropped:e.dropped},e.samples=[],e.dropped=0,console.assert(z.length,"MDAT length must not be zero"),G},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,E=m?0:8,k=this.nextAudioPts||-1,T=t*u;if(this.isAudioContiguous=i=i||b.length&&0<k&&(r&&Math.abs(T-k)<9e3||Math.abs(A(b[0].pts-g,T)-k)<20*p),b.forEach((function(e){e.pts=A(e.pts-g,T)})),!i||k<0){if(!(b=b.filter((function(e){return 0<=e.pts}))).length)return;k=0===c?0:r?Math.max(0,T):b[0].pts}if(e.isAAC)for(var w=void 0!==c,S=this.config.maxAudioFramesDrift,_=0,R=k;_<b.length;_++){var C=b[_],D=C.pts,L=D-R,x=Math.abs(1e3*L/u);if(L<=-S*p&&w)0===_&&(l.logger.warn("Audio frame @ "+(D/u).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*L/u)+" ms."),this.nextAudioPts=k=R=D);else if(S*p<=L&&x<1e4&&w){var I=Math.round(L/p);(R=D-I*p)<0&&(I--,R+=p),0===_&&(this.nextAudioPts=k=R),l.logger.warn("[mp4-remuxer]: Injecting "+I+" audio frame @ "+(R/u).toFixed(3)+"s due to "+Math.round(1e3*L/u)+" ms gap.");for(var B=0;B<I;B++){var P=Math.max(R,0),M=a.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=C.unit.subarray()),b.splice(_,0,{unit:M,pts:P}),R+=p,_++}}C.pts=R,R+=p}for(var O,F=null,j=null,U=0,N=b.length;N--;)U+=b[N].unit.byteLength;for(var z=0,G=b.length;z<G;z++){var H=b[z],V=H.unit;H=H.pts;if(null!==j)v[z-1].duration=Math.round((H-j)/h);else{if(F=H=i&&e.isAAC?k:H,!(0<U))return;U+=E;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(n.default.types.mdat,4))}O.set(V,E),V=V.byteLength,E+=V,v.push(new y(!0,f,V,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):n.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 n=e.inputTimeScale,s=n/(e.samplerate||n),o=this.nextAudioPts,c=(null!==o?o:r.startDTS*n)+this._initDTS,u=(o=r.endDTS*n+this._initDTS,1024*s),d=Math.ceil((o-c)/u),h=a.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,a=this._initPTS,n=this._initDTS,s=0;s<i;s++){var o=e.samples[s];o.pts=A(o.pts-a,t*r)/r,o.dts=A(o.dts-n,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,a=this._initPTS,n=0;n<i;n++){var s=e.samples[n];s.pts=A(s.pts-a,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"),a=i("./src/utils/mp4-tools.ts"),n=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(a.parseInitSegment)(e),r=r||c(t.audio,n.ElementaryStreamTypes.AUDIO),o=o||c(t.video,n.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,n,l){var c,u,d,h=this.initPTS,f=this.lastEndDTS,p={audio:void 0,video:void 0,text:n,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(a.getDuration)(l,d))+(f=f),Object(a.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=n,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(a.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===n.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=a.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=a;function a(){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 a})),i.d(t,"CMCDStreamType",(function(){return n}));var r,a,n,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=a=a||{}).DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o",(i=n=n||{}).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 a;function n(e,t){var i=e.canSkipUntil,r=e.canSkipDateRanges;e=e.endSN;return i&&(void 0!==t?t-e:0)<i?r?a.v2:a.Yes:a.No}i.r(t),i.d(t,"HlsSkip",(function(){return a})),i.d(t,"getSkipValue",(function(){return n})),i.d(t,"HlsUrlParameters",(function(){return s})),i.d(t,"Level",(function(){return o})),(i=a=a||{}).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,a;i.r(t),i.d(t,"PlaylistContextType",(function(){return r})),i.d(t,"PlaylistLevelType",(function(){return a})),(i=r=r||{}).MANIFEST="manifest",i.LEVEL="level",i.AUDIO_TRACK="audioTrack",i.SUBTITLE_TRACK="subtitleTrack",(t=a=a||{}).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,a,n){void 0===r&&(r=0),void 0===a&&(a=-1),void 0===n&&(n=!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=a,this.partial=n}},"./src/utils/attr-list.ts":function(e,t,i){i.r(t),i.d(t,"AttrList",(function(){return n}));var r=/^(\d+)x(\d+)$/,a=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,n=((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(a.lastIndex=0;null!==(t=a.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,a=0,n=e.length-1;a<=n;){var s=t(r=e[i=(a+n)/2|0]);if(0<s)a=1+i;else{if(!(s<0))return r;n=i-1}}return null}}},"./src/utils/buffer-helper.ts":function(e,t,i){i.r(t),i.d(t,"BufferHelper",(function(){return n}));var r=i("./src/utils/logger.ts"),a={length:0,start:function(){return 0},end:function(){return 0}},n=(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),a=[],n=0;n<r.length;n++)a.push({start:r.start(n),end:r.end(n)});return this.bufferedInfo(a,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 a=0;a<e.length;a++){var n,s=r.length;s&&(n=r[s-1].end,e[a].start-n<i)?e[a].end>n&&(r[s-1].end=e[a].end):r.push(e[a])}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),a}},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 a(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 n,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=n=n||{})[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",R.prototype.log=function(e,t){this.verboseLevel>=e&&s.logger.log(this.time+" ["+e+"] "+t)},R),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=w.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(n.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>c&&(this.logger.log(n.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(n.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)},w),v=((i=T.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(n.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},i.setPAC=function(e){this.logger.log(n.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,a=this.lastOutputScreen;if(a){var s=a.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(a.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(n.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(n.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(n.INFO,"Rolling up")):this.logger.log(n.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 a=this.rows[r].getTextString();a&&t.push(e?"Row "+(r+1)+": '"+a+"'":a.trim())}return 0<t.length?e?"["+t.join(" | ")+"]":t.join("\n"):i},i.getTextAndFormat=function(){return this.rows},T),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(n.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(n.INFO,i+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(n.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},i.ccRCL=function(){this.logger.log(n.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},i.ccBS=function(){this.logger.log(n.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(n.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},i.ccRU=function(e){this.logger.log(n.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},i.ccFON=function(){this.logger.log(n.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},i.ccRDC=function(){this.logger.log(n.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},i.ccTR=function(){this.logger.log(n.INFO,"TR"),this.setMode("MODE_TEXT")},i.ccRTD=function(){this.logger.log(n.INFO,"RTD"),this.setMode("MODE_TEXT")},i.ccEDM=function(){this.logger.log(n.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},i.ccCR=function(){this.logger.log(n.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},i.ccENM=function(){this.logger.log(n.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},i.ccEOC=function(){var e;this.logger.log(n.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(n.TEXT,"DISP: "+this.displayedMemory.getDisplayText())),this.outputDataUpdate(!0)},i.ccTO=function(e){this.logger.log(n.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(n.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 E(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 T(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 w(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,a,n){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new m(t,i,r,a,n)}function _(e,t,i,r,a){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=a||!1}function R(){this.time=null,this.verboseLevel=n.ERROR}function C(e,t,i){i.a=e,i.b=t}function D(e,t,i){return i.a===e&&i.b===t}(i=E.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(n.DATA,"["+a([t[s],t[s+1]])+"] -> ("+a([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(n.WARNING,"No channel found yet. TEXT-MODE?")),i)||r||this.logger.log(n.WARNING,"Couldn't parse cleaned data "+a([l,c])+" orig: "+a([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)?(C(null,null,s),this.logger.log(n.DEBUG,"Repeated command ("+a([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),C(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(n.ERROR,"Mismatch channel in midrow parsing"),!1):!!(i=this.channels[i])&&(i.ccMIDROW(t),this.logger.log(n.DEBUG,"MIDROW ("+a([e,t])+")"),!0))},i.parsePAC=function(e,t){var i,r,a=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,a)?(C(null,null,a),!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)),C(e,t,a),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(n.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=a(s),this.logger.log(n.DEBUG,"Char codes = "+i.join(",")),C(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),C(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=E},"./src/utils/codecs.ts":function(e,t,i){i.r(t),i.d(t,"isCodecType",(function(){return a})),i.d(t,"isCodecSupportedInMp4",(function(){return n}));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 a(e,t){return t=r[t],!!t&&!0===t[e.slice(0,4)]}function n(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"),a=i("./src/utils/webvtt-parser.ts"),n=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(a.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(n.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"),a=i("./src/utils/logger.ts"),n=i("./src/controller/level-helper.ts");function s(e,t){for(var i=null,r=0,a=e.length;r<a;r++){var n=e[r];if(n&&n.cc===t){i=n;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;a.logger.log("No frag in previous level to align on")}else a.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,a=i.length;r<a;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)&&(a.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(n.adjustSliding)(t.details,i))}function h(e,t){var i,n;t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime&&(i=t.fragments[0].programDateTime,t=((n=e.fragments[0].programDateTime)-i)/1e3+t.fragments[0].start)&&Object(r.isFiniteNumber)(t)&&(a.logger.log("Adjusting PTS using programDateTime delta "+(n-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 a(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=a.prototype).update=function(e,t){var i=this.slow_,a=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,a.getEstimate(),a.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=a},"./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"),a=i("./src/loader/load-stats.ts"),n=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 a.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 a=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.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(){a.abortInternal(),i.onTimeout(n,e,a.response)}),t.timeout),self.fetch(this.request).then((function(i){var s,c;if((a.response=a.loader=i).ok)return n.loading.first=Math.max(self.performance.now(),n.loading.start),n.total=parseInt(i.headers.get("Content-Length")||"0"),o&&Object(r.isFiniteNumber)(t.highWaterMark)?a.loadProgressively(i,n,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=a.response,u=(self.clearTimeout(a.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first),n.loaded=n.total=s[c],{url:l.url,data:s});o&&!Object(r.isFiniteNumber)(t.highWaterMark)&&o(n,e,s,l),i.onSuccess(u,n,e,l)})).catch((function(t){var r;self.clearTimeout(a.requestTimeout),n.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,a){void 0===r&&(r=0);var s=new n.default,o=e.body.getReader();return function n(){return o.read().then((function(o){var l;return o.done?(s.dataLength&&a(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&&a(t,i,s.flush(),e)):a(t,i,o,e),n())})).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"),a=i("./src/utils/vttparser.ts"),n=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,a,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{a(function(e,t){var i,r,a,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}),{}),a="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,a){return"br"===r.nodeName&&a?t+"\n":null!=(a=r.childNodes)&&a.length?e(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}(e,a);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 n.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,n,s;return e?(null===(i=Object(a.parseTimeStamp)(e))&&(d.test(e)?(r=t,n=d.exec(e),s=(0|n[4])+(0|n[5])/r.subFrameRate,i=3600*(0|n[1])+60*(0|n[2])+(0|n[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 a={trace:r,debug:r,log:r,warn:r,info:r,error:r},n=a;function s(e){if(self.console&&!0===e||"object"==y(e)){!function(e){for(var t=arguments.length,i=new Array(1<t?t-1:0),a=1;a<t;a++)i[a-1]=arguments[a];i.forEach((function(t){var i;n[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{n.log()}catch(e){n=a}}else n=a}var o=a},"./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 a})),(i=r=r||{}).WIDEVINE="com.widevine.alpha",i.PLAYREADY="com.microsoft.playready";var r,a="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"),a=i("./src/loader/fragment.ts"),n=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,a=[];if(t.length)for(var n=("data"in e?(i=e.data,r=e.start,e.end):(r=0,(i=e).byteLength)),l=r;l<n;){var u,h=c(i,l);h=1<h?l+h:n;o(i.subarray(l+4,l+8))===t[0]&&(1===t.length?a.push({data:i,start:l+8,end:h}):(u=d({data:i,start:l+8,end:h},t.slice(1))).length&&s.apply(a,u)),l=h}return a}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],a=(e=r.data[0],0===e?8:16),n=c(r,a),s=r.end+0,o=l(r,a=(a+=4)+(0===e?8:16)+2);a+=2;for(var u=0;u<o;u++){var h=a,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/n,start:s,end:s+p-1}}),s+=p,a=h+=4}return{earliestPresentationTime:0,timescale:n,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 n,s,l,u=i[r],h=d(u,["tkhd"])[0];h&&(h=c(h,0===h.data[h.start]?12:20),n=d(u,["mdia","mdhd"])[0])&&(n=c(n,0===n.data[n.start]?12:20),s=d(u,["mdia","hdlr"])[0])&&(s=o(s.data.subarray(s.start+8,s.start+12)),s={soun:a.ElementaryStreamTypes.AUDIO,vide:a.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:n,type:s},t[s]={timescale:n,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],a=r.data[r.start];i=d(i,["tfhd"]).reduce((function(t,i){if(i=c(i,4),i=e[i],i){var n=c(r,4);n=(n=1===a?(n*=Math.pow(2,32))+c(r,8):n)/(i.timescale||9e4);if(isFinite(n)&&(null===t||n<t))return n}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,n=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===a.ElementaryStreamTypes.VIDEO?r+=i/y:f.type===a.ElementaryStreamTypes.AUDIO&&(n+=i/y)}}return 0===r&&0===n&&(e=h(e),null!=e&&e.references)?e.references.reduce((function(e,t){return e+t.info.duration||0}),0):r||n}function m(e){var t=c(e,0),i=8;1&t&&(i+=4),4&t&&(i+=4);for(var r=0,a=c(e,4),n=0;n<a;n++)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 a;r=c(r,4),r=e[r];r&&(a=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*a):(r=(r=(r*=Math.pow(2,32))+c(e,8))-i*a,r=Math.max(r,0),t=Math.floor(r/(n+1)),r=Math.floor(r%(n+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=a.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=a;function a(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 a})),i.d(t,"addCueToTrack",(function(){return n})),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 a(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 n(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 a=new self.TextTrackCue(t.startTime,t.endTime,t.text);a.id=t.id,e.addCue(a)}"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 a=l(e.cues,t,i),n=0;n<a.length;n++)e.removeCue(a[n]);"disabled"===r&&(e.mode=r)}function l(e,t,i){var r=[],a=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,a=i;r<=a;){var n=Math.floor((a+r)/2);if(t<e[n].startTime)a=n-1;else{if(!(t>e[n].startTime&&r<i))return n;r=n+1}}return e[r].startTime-t<t-e[a].startTime?r:a}(e,t);if(-1<a)for(var n=a,s=e.length;n<s;n++){var o=e[n];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 a(e,t,i,a){return r(e,t,1/(i=void 0===i?1:i),a=void 0!==a&&a)}function n(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 a})),i.d(t,"toMsFromMpegTsClock",(function(){return n})),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 a(e){return r(l,e)}function n(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 a=1;a<arguments.length;a++){var n,s=arguments[a];for(n in s)e[n]=s[n]}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",E=50,k="middle";Object.defineProperty(s,"id",n({},l,{get:function(){return c},set:function(e){c=""+e}})),Object.defineProperty(s,"pauseOnExit",n({},l,{get:function(){return u},set:function(e){u=!!e}})),Object.defineProperty(s,"startTime",n({},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",n({},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",n({},l,{get:function(){return f},set:function(e){f=""+e,this.hasBeenReset=!0}})),Object.defineProperty(s,"region",n({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"vertical",n({},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",n({},l,{get:function(){return m},set:function(e){m=!!e,this.hasBeenReset=!0}})),Object.defineProperty(s,"line",n({},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",n({},l,{get:function(){return y},set:function(e){if(e=a(e),!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"position",n({},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",n({},l,{get:function(){return b},set:function(e){if(e=a(e),!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",n({},l,{get:function(){return E},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",n({},l,{get:function(){return k},set:function(e){if(e=a(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"),a=(n.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},n);function n(){}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 a,n,s=r?e.split(r):[e];for(a in s)"string"==typeof s[a]&&2===(n=s[a].split(i)).length&&t(n[0],n[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 a="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var n=(a=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!n||!n[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:a=i(),t.state){case"HEADER":/:/.test(a)?c(a,(function(e,t){}),/:/):a||(t.state="ID");continue;case"NOTE":a||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){t.state="NOTE";break}if(!a)continue;if(t.cue=new r.default(0,0,""),t.state="CUE",-1===a.indexOf("--\x3e")){t.cue.id=a;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{!function(e,t,i){var r,a,n=e;function l(){var t=s(e);if(null===t)throw new Error("Malformed timestamp: "+n);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'): "+n);e=e.substr(3),h(),t.endTime=l(),h(),r=e,t=t,a=new o,c(r,(function(e,t){var r;switch(e){case"region":for(var n=i.length-1;0<=n;n--)if(i[n].id===t){a.set(e,i[n].region);break}break;case"vertical":a.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),a.integer(e,r[0]),a.percent(e,r[0])&&a.set("snapToLines",!1),a.alt(e,r[0],["auto"]),2===r.length&&a.alt("lineAlign",r[1],["start",d,"end"]);break;case"position":r=t.split(","),a.percent(e,r[0]),2===r.length&&a.alt("positionAlign",r[1],["start",d,"end","line-left","line-right","auto"]);break;case"size":a.percent(e,t);break;case"align":a.alt(e,t,["start",d,"end","left","right"])}}),/:/,/\s/),t.region=a.get("region",null),t.vertical=a.get("vertical",""),"auto"===(r=a.get("line","auto"))&&-1===u.line&&(r=-1),t.line=r,t.lineAlign=a.get("lineAlign","start"),t.snapToLines=a.get("snapToLines",!0),t.size=a.get("size",100),t.align=a.get("align",d),"auto"===(r=a.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}(a,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var f=-1!==a.indexOf("--\x3e");if(!a||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+=a;continue;case"BADCUE":a||(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 a,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"),a=i("./src/utils/vttparser.ts"),n=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 a.VTTParser,y=(e=Object(n.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(l,"\n").split("\n"),[]),v=Object(s.toMpegTsClockFromTimescale)(t,i),b="00:00.000",E=0,k=0,T=!0,w=!1;A.oncue=function(e){var t=u[h],i=u.ccOffset,r=(E-v)/9e4;null!=t&&t.new&&(void 0!==k?i=u.ccOffset=t.start:function(e,t){var i,r=e[h],a=e[r.prevCC];if(!a||!a.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,r.new=!1;for(;null!=(i=a)&&i.new;)e.ccOffset+=r.start-a.start,r.new=!1,a=e[(r=a).prevCC];e.presentationOffset=t}(u,r)),r&&(i=r-u.presentationOffset),w&&(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(T){if(c(e,"X-TIMESTAMP-MAP=")){w=!(T=!1),e.substr(16).split(",").forEach((function(e){c(e,"LOCAL:")?b=e.substr(6):c(e,"MPEGTS:")&&(E=parseInt(e.substr(7)))}));try{k=function(e){var t=parseInt(e.substr(-3)),i=parseInt(e.substr(-6,2)),a=parseInt(e.substr(-9,2)),n=9<e.length?parseInt(e.substr(0,e.indexOf(":"))):0;if(Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(a)&&Object(r.isFiniteNumber)(n))return t+1e3*i+6e4*a+36e5*n;throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e)}(b)/1e3}catch(e){w=!1,m=e}return}""===e&&(T=!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"),a=i("./src/loader/load-stats.ts"),n=/^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 a.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 a=this.context.headers;if(a)for(var n in a)i.setRequestHeader(n,a[n])}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,a,n=this.context,s=this.loader,o=this.stats;n&&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),a="arraybuffer"===n.responseType?(i=s.response).byteLength:(i=s.responseText).length,o.loaded=o.total=a,this.callbacks&&((a=this.callbacks.onProgress)&&a(o,n,i,s),this.callbacks)&&(a={url:s.responseURL,data:i},this.callbacks.onSuccess(a,o,n,s))):o.retry>=e.maxRetry||400<=t&&t<499?(r.logger.error(t+" while loading "+n.url),this.callbacks.onError({code:t,text:s.statusText},n,s)):(r.logger.warn(t+" while loading "+n.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&&n.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"==y(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 a in t)e.d(r,a,function(e){return t[e]}.bind(null,a));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 a;return(i[r]||(a=i[r]={i:r,l:!1,exports:{}},t[r].call(a.exports,a,a.exports,e),a.l=!0,a)).exports}var t,i}())})))&&Tr.__esModule&&Object.prototype.hasOwnProperty.call(Tr,"default")?Tr.default:Tr,ya=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=[],Aa.isSupported()?(i.$videoElement=i.player.video.$videoElement,i.hls=new Aa({}),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),m(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(U.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,Ye()&&(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,ve,(function(i){e.hls&&(i=parseInt(i.timeStamp,10),t.handleRender(),t.updateStats({ts:i,dts:i}),t.emit(U.videoTimeUpdate,i))}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(Aa.Events.ERROR,(function(t,i){if(i.fatal)switch(i.type){case Aa.ErrorTypes.NETWORK_ERROR:e.player.debug.error("HlsDecoder","fatal network error encountered, try to recover"),e.hls.startLoad();break;case Aa.ErrorTypes.MEDIA_ERROR:e.player.debug.error("HlsDecoder","fatal media error encountered, try to recover"),e.hls.recoverMediaError()}})),this.hls.on(Aa.Events.MEDIA_ATTACHING,(function(){})),this.hls.on(Aa.Events.MEDIA_ATTACHED,(function(){})),this.hls.on(Aa.Events.MEDIA_DETACHING,(function(){})),this.hls.on(Aa.Events.MEDIA_DETACHED,(function(){})),this.hls.on(Aa.Events.BUFFER_RESET,(function(){})),this.hls.on(Aa.Events.BUFFER_CODECS,(function(){})),this.hls.on(Aa.Events.BUFFER_CREATED,(function(){})),this.hls.on(Aa.Events.BUFFER_APPENDING,(function(t,i){e.player.debug.log("HlsDecoder","BUFFER_APPENDING",i)})),this.hls.on(Aa.Events.BUFFER_APPENDED,(function(){})),this.hls.on(Aa.Events.BUFFER_EOS,(function(){})),this.hls.on(Aa.Events.BUFFER_FLUSHING,(function(){})),this.hls.on(Aa.Events.BUFFER_FLUSHED,(function(){})),this.hls.on(Aa.Events.MANIFEST_LOADING,(function(){e.player.debug.log("HlsDecoder","MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(Aa.Events.MANIFEST_LOADED,(function(t,i){e.player.debug.log("HlsDecoder","MANIFEST_LOADED playlist m3u8文件加载完成",i)})),this.hls.on(Aa.Events.MANIFEST_PARSED,(function(){e.player.debug.log("HlsDecoder","MANIFEST_PARSED playlist m3u8解析完成"),t._times.demuxStart||(t._times.demuxStart=Ue())})),this.hls.on(Aa.Events.LEVEL_LOADING,(function(){})),this.hls.on(Aa.Events.LEVEL_LOADED,(function(e,t){})),this.hls.on(Aa.Events.FRAG_LOADING,(function(){})),this.hls.on(Aa.Events.FRAG_LOADED,(function(e,i){t._times.decodeStart||(t._times.decodeStart=Ue())})),this.hls.on(Aa.Events.BUFFER_APPENDING,(function(){t._times.videoStart||(t._times.videoStart=Ue(),t.handlePlayToRenderTimes())})),this.hls.on(Aa.Events.FRAG_DECRYPTED,(function(){})),this.hls.on(Aa.Events.KEY_LOADING,(function(){})),this.hls.on(Aa.Events.KEY_LOADING,(function(){})),this.hls.on(Aa.Events.FPS_DROP,(function(e){})),this.hls.on(Aa.Events.FPS_DROP_LEVEL_CAPPING,(function(e){})),this.hls.on(Aa.Events.FRAG_PARSING_INIT_SEGMENT,(function(t,i){e.player.debug.log("HlsDecoder","FRAG_PARSING_INIT_SEGMENT",i);var r,a=!!(i&&i.tracks&&i.tracks.audio),n=!!(i&&i.tracks&&i.tracks.video);if(a&&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})}n&&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,Ae,(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,ye,(function(){e.player.debug.log("HlsDecoder","video waiting")})),a=t(this.$videoElement,ve,(function(t){t=parseInt(t.timeStamp,10),e.player.handleRender(),e.player.updateStats({ts:t}),e.player.emit(U.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,be,(function(){e.player.debug.log("HlsDecoder","video playback Rate change",e.$videoElement&&e.$videoElement.playbackRate)}));this.eventsDestroy.push(i,r,a,t)}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){t.canVideoPlay?(t.initVideoPlay(e),i()):t.hls.on(Aa.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),a=i-r;t=Math.max(5,3+t),t=(t<a?(this.player.debug.warn("HlsDecoder","handleUpdatePlaybackRate and delay buffer is more than ".concat(t," is ").concat(a," and new time is ").concat(i," ")),e.currentTime=i,r=e.currentTime):a<0&&this.player.debug.warn("HlsDecoder","handleUpdatePlaybackRate and delay buffer is less than 0 is ".concat(a," 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}}])}(It),va=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),m(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(U.webrtcDisconnect);break;case"failed":i.emit(U.webrtcFailed);break;case"closed":i.emit(U.webrtcClosed)}},this.rtcPeerConnection=t}},{key:"loadSource",value:function(e){var t=this;return new Promise((function(i,r){var a=t.rtcPeerConnection;a.createOffer().then((function(n){a.setLocalDescription(n),t.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp loadSource"),n=n.sdp,fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:n}).then((function(e){e.text().then((function(e){t.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp response"),a.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)}))}))}}])}(It),ba=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),m(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 a=t.rtcPeerConnection;a.createOffer().then((function(n){a.setLocalDescription(n),t.player.debug.log(t.tagName,"getWebRtcRemoteSdp loadSource"),n=n.sdp,nr({url:e,type:"POST",data:n,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);a.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)}))}))}}])}(It),Ea=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=!!Dt(i.isUseFpsRender),r._rate=1,r._audioTimestamp=0,r._videoTimestamp=0,r._currentLocalTimestamp=0,r._localOneFrameTimestamp=i.localOneFrameTimestamp||40,r._localCalculateTimeInterval=null,r._isUseLocalCalculateTime=!!Dt(i.isUseLocalCalculateTime),r._isPlaybackPauseClearCache=!Lt(i.isPlaybackPauseClearCache),r._isCacheBeforeDecodeForFpsRender=!!Dt(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(U.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),m(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(U.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=Ue()),st(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1),Ue()),e-this._startFpsTimestamp);if(!(t<1e3)){var i=null;this._startfpsTime&&(i=this._playbackTs-this._startfpsTime),this.player.emit(U.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===ft(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=Je(e.startTimestamp)),10===ft(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=Je(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(se)}},{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(U.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===se}},{key:"is30Min",get:function(){return this.showPrecision===oe}},{key:"is10Min",get:function(){return"tenMin"===this.showPrecision}},{key:"is5Min",get:function(){return this.showPrecision===le}},{key:"is1Min",get:function(){return this.showPrecision===le}},{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(U.playbackPrecision,this._showPrecision,this.playbackList))}},{key:"setPlayingTimestamp",value:function(e){e=this.startTime+e;var t=(this._playingTimestamp=e,this.player.emit(U.playbackTime,e),new Date(e));this.player.emit(U.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=ue.indexOf(this.showPrecision)-1;0<=e&&(e=ue[e],this.setShowPrecision(e))}},{key:"expandPrecision",value:function(){var e=ue.indexOf(this.showPrecision)+1;e<=ue.length-1&&(e=ue[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(U.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))}}}])}(It),ka=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(U.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,a=i.player.video.$videoElement.style.top;r=parseFloat(r),a=parseFloat(a),r=(r&&(i.videoPosition.left=r),a&&(i.videoPosition.top=a),(i.prevVideoElementStyleTransform=t).match(/scale\([0-9., ]*\)/g));r&&r[0]&&(a=r[0].replace("scale(","").replace(")",""),i.prevVideoElementStyleScale=a.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),m(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,a;e.stopPropagation(),this.isDragging&&this.player.zooming&&(t=vt(e),e=t.posX,i=t.posY,r=this.tempPosition.x-e,a=this.tempPosition.y-i,this.videoPosition.left=this.videoPosition.left-r,this.videoPosition.top=this.videoPosition.top-a,this.tempPosition.x=e,this.tempPosition.y=i,this.updateVideoPosition())}},{key:"handleMouseDown",value:function(e){e.stopPropagation();var t=At(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){var i=vt(e),r=i.posX,a=i.posY;this.player.$container.style.cursor="grabbing",this.tempPosition.x=r,this.tempPosition.y=a,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}},{key:"handleMouseUp",value:function(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(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 a=this.prevVideoElementStyleScale[0],n=(void 0!==a&&(i=a,r=a),this.prevVideoElementStyleScale[1]);void 0!==n&&(r=n)}r=$e(r);var s=.5*(i=$e(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}}])}(It),Ta=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),m(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(U.aiObjectDetectorInfo,t)}))}))}}},{key:"destroy",value:function(){this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.off()}}])}(It),wa=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,Ke()?i.player.debug.warn(i.LOG_NAME,"not support mobile"):i.init(),e.debug.log(i.LOG_NAME,"init"),i}return g(t,e),m(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()),a=r.height,n=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+n<i+u&&(d=n-u),o+a<t+c&&(h=a-c),ze(e.$contextmenus,{left:d+"px",top:h+"px"})})),t(this.player.$container,"click",(function(t){ua(t,e.$contextmenus)||e.hide()})),this.player.on(U.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,a=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=St(Le);n=Object.assign({},s,n),this._validateMenuItem(n)&&(e=this.player,s=e.events.proxy,e.debug,i='\n <div class="jessibuca-contextmenu jessibuca-contextmenu-'.concat(t=Ze(),'">\n ').concat(n.content,"\n </div>\n "),(r=Array.from(this.$contextmenus.children)[n.index])?r.insertAdjacentHTML("beforebegin",i):la(this.$contextmenus,i),r=this.$contextmenus.querySelector(".jessibuca-contextmenu-"+t),n.click&&s(r,"click",(function(e){e.preventDefault(),n.click.call(a.player,a,e),a.hide()})),this.menuList.push({uuid:t,$menuItem:r}))}}])}(It),Sa=function(e){function r(e,t){var i;A(this,r),i=p(this,r),i.$container=e;e=Rt();var a,n=(i._opt=Object.assign({},e,t),i.debug=new xe(i),i._opt.forceNoOffscreen=!0,Ke()&&(i._opt.controlAutoHide=!1),i._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(i._opt.forceNoOffscreen=!0,i._opt.useOffscreen=!1):i._opt.useOffscreen=!0),(i._opt.isHls||i._opt.isWebrtc)&&(i._opt.useWCS=!1,i._opt.useMSE=!1,i._opt.isNakedFlow=!1),i._opt.isNakedFlow,i._opt.isHls||i._opt.isWebrtc||(i._opt.useWCS&&(i._opt.useWCS="VideoEncoder"in window,i._opt.useWCS||i.debug.warn("Player","useWCS is true, but not support so set useWCS false"),i._opt.useWCS)&&(i._opt.useOffscreen?i._opt.wcsUseVideoRender=!1:i._opt.wcsUseVideoRender&&(i._opt.wcsUseVideoRender=it()&&rt(),i._opt.wcsUseVideoRender||i.debug.warn("Player","wcsUseVideoRender is true, but not support so set wcsUseVideoRender false"))),i._opt.useMSE&&(i._opt.useMSE=function(){var e=!1;return!(!("MediaSource"in window)||!window.MediaSource.isTypeSupported(ae))||e}(),i._opt.useMSE||i.debug.warn("Player","useMSE is true, but not support so set useMSE false"))),i._opt.useMSE?(i._opt.useWCS&&i.debug.warn("Player","useMSE is true and useWCS is true then useWCS set true->false"),i._opt.forceNoOffscreen||i.debug.warn("Player","useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),i._opt.useWCS=!1,i._opt.forceNoOffscreen=!0):i._opt.useWCS,!i._opt.useSIMD&&-1===i._opt.decoder.indexOf("-simd")||(i._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])),i._opt.useSIMD)||i.debug.warn("Player","useSIMD is true, but not support so set useSIMD false"),i._opt.useSIMD?-1===i._opt.decoder.indexOf("-simd")&&(i._opt.decoder=i._opt.decoder.replace("decoder-pro","decoder-pro-simd")):-1!==i._opt.decoder.indexOf("-simd")&&(i._opt.decoder=i._opt.decoder.replace("decoder-pro-simd","decoder-pro")),Lt(i._opt.hasAudio)&&(i._opt.operateBtns.audio=!1),Lt(i._opt.hasVideo)&&(i._opt.operateBtns.fullscreen=!1,i._opt.operateBtns.screenshot=!1,i._opt.operateBtns.record=!1,i._opt.operateBtns.ptz=!1,i._opt.operateBtns.quality=!1,i._opt.operateBtns.zoom=!1),i._opt.qualityConfig&&0===i._opt.qualityConfig.length&&i._opt.operateBtns.quality&&(i._opt.operateBtns.quality=!1,i.debug.warn("Player","_opt.qualityConfig is empty, so set operateBtns.quality false")),Dt(i._opt.useWebGPU)&&(i._opt.useWebGPU=function(){var e=!1;return"gpu"in navigator||e}(),Lt(i._opt.useWebGPU))&&i.debug.warn("Player","useWebGPU is true, but not support so set useWebGPU false"),i._opt.hasControl=i._hasControl(),i._loading=!1,i._playing=!1,i._playbackPause=!1,i._hasLoaded=!1,i._zooming=!1,i._destroyed=!1,i._checkHeartTimeout=null,i._checkLoadingTimeout=null,i._checkStatsInterval=null,i._checkVisibleHiddenTimeout=null,i._startBpsTime=null,i._isPlayingBeforePageHidden=!1,i._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},i._allStatsData={},i._faceDetectActive=!1,i._objectDetectActive=!1,i._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},i._videoTimestamp=0,i._audioTimestamp=0,i._videoIframeIntervalTs=0,i._streamQuality=i._opt.defaultStreamQuality||"",i._visibility=!0,i._lastestVisibilityChangeTimestamp=null,i._tempWorkerStats=null,i._isPlayback()&&(i._opt.useMSE=!1,i._opt.useWCS=!1),Lt(i._opt.useMSE)&&Lt(i._opt.useWCS)&&Lt(i._opt.isWebrtc)&&Lt(i._opt.isHls)&&(i._opt.useWasm=!0),(i._opt.isHls||i._opt.isWebrtc)&&(i._opt.hasVideo=!0,i._opt.hasAudio=!0),i._opt.hasVideo||(i._opt.useMSE=!1,i._opt.useWCS=!1),i._opt.useWasm&&(i._opt.useOffscreen?i._opt.wasmUseVideoRender=!1:i._opt.wasmUseVideoRender&&(i._opt.wasmUseVideoRender=Xe()&&it()&&rt(),i._opt.wasmUseVideoRender||i.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")),i._opt.useSIMD?i.debug.log("Player","use simd wasm"):i.debug.log("Player","use wasm")),i._opt.useWasm&&(i._opt.useFaceDetector&&window.JessibucaProFaceDetector||i._opt.useObjectDetector&&window.JessibucaProObjectDetector)?(i.ai=new Ta(i),i._opt.useFaceDetector&&window.JessibucaProFaceDetector||(i._opt.operateBtns.aiFace=!1),i._opt.useObjectDetector&&window.JessibucaProObjectDetector||(i._opt.operateBtns.aiObject=!1)):(i._opt.operateBtns.aiObject=!1,i._opt.operateBtns.aiFace=!1),!i._opt.useFaceDetector||i._opt.useWasm&&window.JessibucaProFaceDetector||i.debug.warn("Player","use face detector, useWasm is ".concat(i._opt.useWasm," and window.JessibucaProFaceDetector is ")+!!window.JessibucaProFaceDetector),!i._opt.useObjectDetector||i._opt.useWasm&&window.JessibucaProObjectDetector||i.debug.warn("Player","use object detector, useWasm is ".concat(i._opt.useWasm," and window.JessibucaProObjectDetector is ")+!!window.JessibucaProObjectDetector),i._opt.useVideoRender&&(i._opt.useWasm&&!i._opt.useOffscreen?(i._opt.wasmUseVideoRender=Xe()&&it()&&rt(),i._opt.wasmUseVideoRender||i.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")):i._opt.useWCS&&!i._opt.useOffscreen&&(i._opt.wcsUseVideoRender=it()&&rt(),i._opt.wcsUseVideoRender||i.debug.warn("Player","use wcs video render, but not support so set wcsUseVideoRender false"))),i._opt.useCanvasRender&&(i._opt.useMSE&&(i._opt.mseUseCanvasRender=!0),i._opt.useWasm&&(i._opt.wasmUseVideoRender=!1),i._opt.useWCS&&(i._opt.wcsUseVideoRender=!1),i._opt.isHls)&&!Ye()&&(i._opt.hlsUseCanvasRender=!0),i._opt.useVideoRender=!1,i._opt.useCanvasRender=!1,i._opt.useWasm?i._opt.wasmUseVideoRender?i._opt.useVideoRender=!0:i._opt.useCanvasRender=!0:i._opt.useWCS?i._opt.wcsUseVideoRender?i._opt.useVideoRender=!0:i._opt.useCanvasRender=!0:i._opt.useMSE?i._opt.mseUseCanvasRender?i._opt.useCanvasRender=!0:i._opt.useVideoRender=!0:i._opt.isHls?i._opt.hlsUseCanvasRender?i._opt.useCanvasRender=!0:i._opt.useVideoRender=!0:i._opt.isWebrtc&&(i._opt.useVideoRender=!0),a=i,Object.defineProperty(a,"rect",{get:function(){var e=a.$container.getBoundingClientRect();return e.width=Math.max(e.width,a.$container.clientWidth),e.height=Math.max(e.height,a.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(a,e,{get:function(){return a.rect[e]}})})),i.events=new xt(i),i._opt.hasVideo&&(i.video=new $t(i),i.recorder=new ji(i)),i._opt.isHls?(i.hlsDecoder=new ya(i),i.loaded=!0):i._opt.isWebrtc?(i._opt.isWebrtcForZLM?i.webrtc=new ba(i):i.webrtc=new va(i),i.loaded=!0):bt(i._opt)?i.loaded=!0:i.decoderWorker=new Ui(i),i._opt.hasAudio&&(i.audio=new pi(i)),i.stream=null,i.demux=null,i._lastVolume=null,i._isInZoom=!1,i._playingStartTimestamp=null,i._opt.useWCS&&(i.webcodecsDecoder=new ea(i),i._opt.hasAudio||(i.loaded=!0)),i._opt.useMSE&&(i.mseDecoder=new pa(i),i._opt.hasAudio||(i.loaded=!0)),i.control=new ha(i),0<i._opt.contextmenuBtns.length&&(i.contextmenu=new wa(i)),i._isPlayback()&&(i.playback=new Ea(i,i._opt.playbackConfig)),i._opt.operateBtns.zoom&&(i.zoom=new ka(i)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&(i.keepScreenOn=new ma(i)),i);try{var s=function(e){At(e)===n.$container&&(n.emit(N.fullscreen,n.fullscreen),!n.fullscreen||n._opt.useMSE)&&n.resize()};Pe.on("change",s),n.events.destroys.push((function(){Pe.off("change",s)}))}catch(n){}if(n.on(U.decoderWorkerInit,(function(){n.debug.log("player","listen decoderWorkerInit and set loaded true"),n.loaded=!0})),n.on(U.play,(function(){n.loading=!1})),n.on(U.fullscreen,(function(e){if(e)try{Pe.request(n.$container).then((function(){})).catch((function(e){n.debug.error("player","fullscreen request error",e),Ke()&&n._opt.useWebFullScreen&&(n.webFullscreen=!0)}))}catch(e){Ke()&&n._opt.useWebFullScreen&&(n.webFullscreen=!0)}else try{Pe.exit().then((function(){n.webFullscreen&&(n.webFullscreen=!1)})).catch((function(e){n.debug.error("player","fullscreen exit error",e),n.webFullscreen&&(n.webFullscreen=!1)}))}catch(e){n.webFullscreen&&(n.webFullscreen=!1)}})),Ke()&&n.on(U.webFullscreen,(function(e){e?n.$container.classList.add("jessibuca-fullscreen-web"):n.$container.classList.remove("jessibuca-fullscreen-web"),n.emit(N.fullscreen,n.fullscreen)})),n.on(U.resize,(function(){n.video&&n.video.resize()})),n._opt.debug){var o=[U.timeUpdate];Object.keys(U).forEach((function(e){n.on(U[e],(function(t){o.includes(e)||n.debug.log("player events",U[e],t)}))})),Object.keys(G).forEach((function(e){n.on(G[e],(function(t){n.debug.log("player event error",G[e],t)}))}))}var l=i,c=l._opt,u=l.debug,d=l.events.proxy;if(c.supportDblclickFullscreen&&d(l.$container,"dblclick",(function(e){e=At(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){ua(e,l.$container)?(l.isInput="INPUT"===e.target.tagName,l.isFocus=!0,l.emit(U.focus)):(l.isInput=!1,l.isFocus=!1,l.emit(U.blur))})),c.autoResize){var h=et((function(){l.resize()}),500);d(window,["resize","orientationchange"],(function(){h()})),screen&&screen.orientation&&screen.orientation.onchange&&d(screen.orientation,"change",(function(){h()}))}return i.singleWatermark=new Yt(i),i._opt.watermarkConfig&&i.updateWatermark(i._opt.watermarkConfig),i._opt.useWCS&&i.debug.log("Player","use WCS"),i._opt.useMSE&&i.debug.log("Player","use MSE"),i._opt.useOffscreen&&i.debug.log("Player","use offscreen"),i._opt.isHls&&i.debug.log("Player","use hls"),i._opt.isWebrtc&&i.debug.log("Player","use webrtc"),i._isPlayback()&&i.debug.log("Player","use playback"),i._opt.hasVideo&&(0===i.width&&i.debug.warn("Player","container width is 0, please check the container width"),0===i.height)&&i.debug.warn("Player","container height is 0, please check the container height"),i.debug.log("Player options",i._opt),i}return g(r,e),m(r,[{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=Rt(),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 Pe.isFullscreen||this.webFullscreen},set:function(e){var t=this;Ke()&&this._opt.useWebFullScreen?(this.emit(U.webFullscreen,e),setTimeout((function(){t.updateOption({rotate:e?270:0}),t.resize()}),10)):this.emit(U.fullscreen,e)}},{key:"webFullscreen",get:function(){return this.$container.classList.contains("jessibuca-fullscreen-web")},set:function(e){this.emit(U.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(U.playing,e),this.emit(U.volumechange,this.volume),e?this.emit(U.play):this.emit(U.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(U.loading,this._loading))}},{key:"zooming",get:function(){return this._zooming},set:function(e){this.zooming!==e&&(this.zoom||(this.zoom=new ka(this)),this._zooming=e,this.emit(U.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(U.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(U.streamQualityChange,e))}},{key:"isDebug",get:function(){return Dt(this._opt.debug)}},{key:"scaleType",get:function(){var e=this._opt,t=e.isResize,i=(e=e.isFullResize,0);return Lt(e)&&Lt(t)?i=0:Lt(e)&&Dt(t)?i=1:Dt(e)&&Dt(t)&&(i=2),i}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility!==e&&(this._visibility=e,this.emit(U.visibilityChange,e),this._lastestVisibilityChangeTimestamp=Ue(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}},{key:"playbackPause",get:function(){return this._playbackPause},set:function(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(U.playbackPause,e),this.emit(U.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(U.faceDetectActive,e))}},{key:"objectDetectActive",get:function(){return this._objectDetectActive},set:function(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(U.objectDetectActive,e))}},{key:"isUseWorkerDemuxAndDecode",get:function(){return this.stream&&this.stream.getStreamType()===i}},{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 $t(e)),e.audio||e._opt.hasAudio&&(e.audio=new pi(e)),e.stream||(e.stream=new Ei(e)),e._opt.isHls?(e.hlsDecoder||(e.hlsDecoder=new ya(e),e.loaded=!0),t()):e._opt.isWebrtc?(e.webrtc||(e._opt.isWebrtcForZLM?e.webrtc=new ba(e):e.webrtc=new va(e),e.loaded=!0),t()):(e.demux||e._opt.hasVideo&&!e.isUseWorkerDemuxAndDecode&&(e.demux=new Zr(e)),e._opt.useWCS&&!e.webcodecsDecoder&&(e.webcodecsDecoder=new ea(e)),e._opt.useMSE&&!e.mseDecoder&&(e.mseDecoder=new pa(e)),e.decoderWorker?e.loaded?t():e.once(U.decoderWorkerInit,(function(){e.loaded=!0,t()})):bt(e._opt)?t():(e.decoderWorker=new Ui(e),e.once(U.decoderWorkerInit,(function(){e.loaded=!0,t()}))))}))}},{key:"play",value:function(e,t){var i=this;return new Promise((function(r,a){if(!e&&!i._opt.url)return a("url is empty");i.loading=!0,i.playing=!1,i._times.playInitStart=Ue(),e=e||i._opt.url,i._opt.url=e,i.clearCheckHeartTimeout(),i.init().then((function(){i._times.playStart=Ue(),i._opt.isNotMute&&i.mute(!1),i.webcodecsDecoder&&i.webcodecsDecoder.once(G.webcodecsH265NotSupport,(function(){i.emit(G.webcodecsH265NotSupport),i._opt.autoWasm||i.emit(U.error,G.webcodecsH265NotSupport)})),i.mseDecoder&&(i.mseDecoder.once(G.mediaSourceH265NotSupport,(function(){i.emit(G.mediaSourceH265NotSupport),i._opt.autoWasm||i.emit(U.error,G.mediaSourceH265NotSupport)})),i.mseDecoder.once(G.mediaSourceFull,(function(){i.emit(G.mediaSourceFull)})),i.mseDecoder.once(G.mediaSourceAppendBufferError,(function(){i.emit(G.mediaSourceAppendBufferError)})),i.mseDecoder.once(G.mediaSourceBufferListLarge,(function(){i.emit(G.mediaSourceBufferListLarge)})),i.mseDecoder.once(G.mediaSourceAppendBufferEndTimeout,(function(){i.emit(G.mediaSourceAppendBufferEndTimeout)})),i.mseDecoder.once(G.mediaSourceDecoderConfigurationError,(function(){i.emit(G.mediaSourceDecoderConfigurationError)})),i.mseDecoder.once(G.mediaSourceTsIsMaxDiff,(function(){i.emit(G.mediaSourceTsIsMaxDiff)}))),i.enableWakeLock(),i.checkLoadingTimeout(),i.stream?(i.stream.once(G.fetchError,(function(e){i.emit(G.fetchError,e),a(e)})),i.stream.once(G.websocketError,(function(e){i.emit(G.websocketError,e),a(e)})),i.stream.once(U.streamEnd,(function(){a("stream end")})),i.stream.once(G.hlsError,(function(e){a(e)})),i.stream.once(G.webrtcError,(function(e){a(e)})),i.stream.once(U.streamSuccess,(function(){r(),i._times.streamResponse=Ue(),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){a(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,a){i.recorder||a("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){a(e)}))):a("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===s}},{key:"useWasmDecode",value:function(){return Lt(this._opt.useMSE)&&Lt(this._opt.useWCS)}},{key:"canVideoTrackWritter",value:function(){var e=this._opt;return Lt(e.isHls)&&Lt(e.isWebrtc)&&Lt(e.useMSE)&&(e.useWCS&&Lt(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(){Lt(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):Lt(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(U.timeout,U.delayTimeout),e.emit(U.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(U.timeout,U.loadingTimeout),e.emit(U.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(U.start),this.loading=!1),this.playing||(this.playing=!0),this.checkHeart())}},{key:"updateStats",value:function(e){e=e||{},this._startBpsTime||(this._startBpsTime=Ue()),st(e.ts)&&(this._stats.ts=e.ts,null===this._playingStartTimestamp)&&0<e.ts&&(this._playingStartTimestamp=e.ts),st(e.dts)&&(this._stats.dts=e.dts),st(e.mseTs)&&(this._stats.mseTs=e.mseTs),st(e.buf)&&(this._stats.buf=e.buf),st(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=Ue();if(!(t-this._startBpsTime<1e3)){null!==this._playingStartTimestamp&&(this._stats.pTs+=1);var i=0,r=0,a=0,n=(this._opt.useMSE&&this.mseDecoder&&(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),r=this.mseDecoder.getDecodeDiffTimes(),a=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),a=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,n=this._tempWorkerStats.flvBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,l=this._tempWorkerStats.isDropping,u=this._tempWorkerStats.pushLatestDelay,c=this._tempWorkerStats.isStreamTsMoreThanLocal):this.demux&&(n=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:n,mseDelay:i,mseDecodeDiffTimes:r,mseDecodePlaybackRate:a,wcsDecodeDiffTimes:r,hlsDelay:i,hlsDecodePlaybackRate:a,delayTs:e,totalDelayTs:g,isDropping:l,isStreamTsMoreThanLocal:c}),this.emit(U.stats,this._allStatsData),1048576<this._allStatsData.flvBuffer&&this.emit(G.flvDemuxBufferSizeTooLarge,this._allStatsData.flvBuffer),this._opt.hasVideo&&this.emit(U.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(U.beforeDestroy)}},{key:"handlePlayToRenderTimes",value:function(){var e=this.getPlayToRenderTimes();this.emit(U.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===n}},{key:"isPlayback",value:function(){return this._opt.playType===s}},{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(U.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(U.viewResizeChange,e)}},{key:"startVisibilityHiddenTimeout",value:function(){var e=this;this.clearVisibilityHiddenTimeout(),0<this._opt.pageVisibilityHiddenTimeout&&(this.visibilityHiddenTimeout=setTimeout((function(){e.emit(U.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 r=this.getStreamType();r===t||r===i+" "+t?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}}])}(It),_a=function(){function e(t){A(this,e);var i=t,r=(t=i.fromSampleRate,i.toSampleRate),a=i.channels,n=i.inputBufferSize;if(!t||!r||!a)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=t,this.toSampleRate=r,this.channels=a||0,this.inputBufferSize=n,this.initialize()}return m(e,[{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(e){try{return this.outputBuffer.subarray(0,e)}catch(It){try{return this.outputBuffer.length=e,this.outputBuffer}catch(It){return this.outputBuffer.slice(0,e)}}}},{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(It){this.outputBuffer=[],this.lastOutput=[]}}},{key:"linearInterpolation",value:function(){var e=this;this.resampler=function(t){var i,r,a,n,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,a=e.lastWeight,n=0,s=0,o=0,l=0,c=e.outputBuffer;a<1;a+=r)for(s=a%1,n=1-s,e.lastWeight=a%1,u=0;u<e.channels;++u)c[l++]=e.lastOutput[u]*n+t[u]*s;for(--a,d-=h,o=Math.floor(a)*h;l<i&&o<d;){for(s=a%1,n=1-s,u=0;u<e.channels;++u)c[l++]=t[o+(0<u?u:0)]*n+t[o+(h+u)]*s;a+=r,o=Math.floor(a)*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,a,n,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=[],a=e.ratioWeight,n=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(n=a,s=0;s<p;++s)r[s]=0;else{for(n=e.lastWeight,s=0;s<p;++s)r[s]=e.lastOutput[s];c=!0}for(;0<n&&o<f;){if(l=1+o-h,!(n>=l)){for(s=0;s<p;++s)r[s]+=t[o+(0<s?s:0)]*n;h+=n,n=0;break}for(s=0;s<p;++s)r[s]+=t[o++]*l;h=o,n-=l}if(0!==n){for(e.lastWeight=n,s=0;s<p;++s)e.lastOutput[s]=r[s];e.tailExists=!0;break}for(s=0;s<p;++s)u[d++]=r[s]/a}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)}}])}(),Ra=[255,511,1023,2047,4095,8191,16383,32767];function Ca(e,t,i){for(var r=0;r<i;r++)if(e<=t[r])return r;return i}var Da=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=St(Se);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=H,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 xt(i),i._initTalk(),i.player||(i.debug=new xe(i)),i.log(i.tag,"init",i._opt),i}return g(t,e),m(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),a=1;a<i;a++)r[a-1]=arguments[a];(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(U.talkStreamStart),r(e.socket,"open",(function(){e.socketStatus=V,e.log(e.tag,"websocket open -> do talk"),e.emit(U.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(U.talkStreamClose),i(t)})),r(e.socket,"error",(function(t){e.socketStatus="error",e.error(e.tag,"websocket error",t),e.emit(U.talkStreamError,t),i(t)}))}))}},{key:"_sendClose",value:function(){}},{key:"_initTalk",value:function(){this._initMethods(),this._opt.engine===we?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 _a({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(Et((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),m(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===pe?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=Ca(e,Ra,8))?127^t:(r=i<<4,(r|=i<2?e>>4&15:e>>i+3&15)^t)}(e)})),t}(i):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=0;t=e<0?(e=132-e,127):(e+=132,255);var i=Ca(e,Ra,8);return 8<=i?127^t:(i<<4|e>>i+3&15)^t}(e)})),t}(i));for(var a=Uint8Array.from(r),n=0;n<a.length;n++){var s=this.audioBufferList.length;this.audioBufferList[+s]=a[n],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!==pe&&this._opt.encType!==ge?"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=[],a=0,n=this._opt.rtpSsrc,s=e.length,o=(s=(this._opt.encType===pe?a=8:this._opt.encType===ge&&(a=0),this.startTimestamp||(this.startTimestamp=Ue()),i=Ue()-this.startTimestamp,t=this._getSequenceId(),s+12),r[0]=255&s>>8,r[1]=255&s>>0,r[2]=128,r[3]=128+a,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]=n/65536/256,r[11]=n/65536%256,r[12]=n%65536/256,r[13]=n%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=Ue());var t=Ue(),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(G.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(U.talkGetUserMediaSuccess),null===t.oninactive&&(t.oninactive=function(t){e._handleStreamInactive(t)})})).catch((function(t){e.error(e.tag,"getUserMedia error",t.toString()),e.emit(U.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(U.talkStreamInactive))}},{key:"_startCheckGetUserMediaTimeout",value:function(){var e=this;this._stopCheckGetUserMediaTimeout(),this.checkGetUserMediaTimeout=setTimeout((function(){e.log(e.tag,"check getUserMedia timeout"),e.emit(U.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(U.talkGetUserMediaFail,(function(){r("getUserMedia fail")})),void t.once(U.talkGetUserMediaSuccess,(function(){i()})))):r("not support getUserMedia")}))}},{key:"setVolume",value:function(e){e=parseFloat(e).toFixed(2),isNaN(e)||(e=Ne(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}}])}(It),La=function(){function e(t){A(this,e),this.player=t,this.globalSetting=null,t=Ze(),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 m(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"==y(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),a=(r&&r.parentNode&&r.parentNode.removeChild(r),"string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node),n=(r=a||document.body,r.getBoundingClientRect()),s=Math.max(r.scrollWidth,r.clientWidth,n.width),o=Math.max(r.scrollHeight,r.clientHeight,n.height),l=(n=arguments[0]||{},n=((n.watermark_parent_width||n.watermark_parent_height)&&r&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0),document.getElementById(e.watermark_id)),null);n?n.shadowRoot&&(l=n.shadowRoot):((n=document.createElement("div")).id=e.watermark_id,n.setAttribute("style","pointer-events: none !important; display: block !important"),l="function"==typeof n.attachShadow?n.attachShadow({mode:"open"}):n,(u=r.children)[d=Math.floor(Math.random()*(u.length-1))]?r.insertBefore(n,u[d]):r.appendChild(n)),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=a?(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=a?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 m=a?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,A=document.createElement("div"),v=document.createTextNode(e.watermark_txt);A.appendChild(v),A.id=e.watermark_prefix+f+g,A.style.webkitTransform="rotate(-"+e.watermark_angle+"deg)",A.style.MozTransform="rotate(-"+e.watermark_angle+"deg)",A.style.msTransform="rotate(-"+e.watermark_angle+"deg)",A.style.OTransform="rotate(-"+e.watermark_angle+"deg)",A.style.transform="rotate(-"+e.watermark_angle+"deg)",A.style.visibility="",A.style.position="absolute",A.style.left=m+"px",A.style.top=p+"px",A.style.overflow="hidden",A.style.zIndex="9999999",A.style.opacity=e.watermark_alpha,A.style.fontSize=e.watermark_fontsize,A.style.fontFamily=e.watermark_font,A.style.color=e.watermark_color,A.style.textAlign="center",A.style.width=e.watermark_width+"px",A.style.height=e.watermark_height+"px",A.style.display="block",A.style["-ms-user-select"]="none",l.appendChild(A)}}},{key:"_removeMark",value:function(){var e,t=this.defaultSettings;t=document.getElementById(t.watermark_id);t&&(e=t.parentNode)&&e.removeChild(t)}}])}(),xa=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=_t();r=Object.assign({},r,i);r.url="";var a=i.container;if(!(a="string"==typeof i.container?document.querySelector(i.container):a))throw new Error("Jessibuca-pro need container option");if("CANVAS"===a.nodeName||"VIDEO"===a.nodeName)throw new Error("Jessibuca-pro container type can not be ".concat(a.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(a.classList.add("jessibuca-container"),Lt(r.isLive)){var n=document.createElement("video");n.muted=!0,n.setAttribute("controlsList","nodownload"),n.disablePictureInPicture="disablePictureInPicture",n.style.position="absolute",n.style.top=0,n.style.left=0,n.style.height="100%",n.style.width="100%",a.appendChild(n),e.$videoElement=n,e.$container=a,e._opt=r}else delete r.container,st(r.videoBuffer)&&(r.videoBuffer=1e3*Number(r.videoBuffer)),st(r.videoBufferDelay)&&(r.videoBufferDelay=1e3*Number(r.videoBufferDelay)),st(r.networkDelay)&&(r.networkDelay=1e3*Number(r.networkDelay)),st(r.timeout)&&(at(r.loadingTimeout)&&(r.loadingTimeout=r.timeout),at(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=a,e._loadingTimeoutReplayTimes=0,e._heartTimeoutReplayTimes=0,e.events=new xt(e),e.debug=new xe(e),e.watermark=new La(e),e._initPlayer(a,r),e._initWatermark();return e}return g(t,e),m(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=_t()}},{key:"_initPlayer",value:function(e,t){this.player=new Sa(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 Da(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 a=function(){e._opt.url="",e._opt.playOptions={},e._opt=Object.assign(e._opt,t),e._initPlayer(e.$container,e._opt)};e.player?e.player.destroy().then((function(){e.player=null,a(),i()})):(a(),i())}))}},{key:"_bindEvents",value:function(){var e=this;Object.keys(N).forEach((function(t){e.player.on(N[t],(function(i){e.emit(t,i)}))})),this.player.once(U.beforeDestroy,(function(){e.emit(U.close),e.destroy().then((function(){})).catch((function(e){}))})),this.player.on(U.resize,(function(){e.watermark&&e.watermark.resize(),e.player.singleWatermark&&e.player.singleWatermark.resize()})),this.player.on(U.fullscreen,(function(){e.watermark&&e.watermark.resize(),e.player.singleWatermark&&e.player.singleWatermark.resize()})),this.player.on(U.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;pt(this._opt.fullscreenWatermarkConfig)&&((e=lt(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()===S?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,a){if(t||e._opt.url)if(t=t&&(""+t).trim(),Lt(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 n,s=i.cryptoKey||e._opt.playOptions.cryptoKey,o=i.cryptoIV||e._opt.playOptions.cryptoIV;if(!s||!o)return n=t||e._opt.url,void e._cryptoPlay(n).then((function(n){var s=n,o=(n=s.cryptoIV,s.cryptoKey);e._opt.playOptions.cryptoKey=o,e._opt.playOptions.cryptoIV=n,i.cryptoIV=n,i.cryptoKey=o,e._playBefore(t,i).then((function(){r()})).catch((function(e){a(e)}))})).catch((function(e){a(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){a(e)}))}else e.emit(U.error,G.playError),a("url is null and this._opt.url is null")}))}},{key:"_playBefore",value:function(e,t){var i=this;return new Promise((function(r,a){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(U.crashLog,i.getCrashLog("this.player.play 1",e)),i.player.pause().then((function(){a(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(U.crashLog,i.getCrashLog("this.player.play 2",e)),a(e)}))})).catch((function(e){i.debug.error("Jessibuca","this.player.pause error",e),a(e)})):i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 3",e)),a(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(U.crashLog,i.getCrashLog("this.player.play 4",e)),i.player.pause().then((function(){a(e)}))})):e?i._play(e,t).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 5",e)),a(e)})):i._play(i._opt.url,i._opt.playOptions).then((function(){r()})).catch((function(e){i.debug.error("Jessibuca","_play error",e),i.emit(U.crashLog,i.getCrashLog("this.player.play 6",e)),a(e)}))}))}},{key:"_cryptoPlay",value:function(e){var t=this;return new Promise((function(i,r){var a,n=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="+n}a=o,new Promise((function(e,t){nr.get(a).then((function(t){e(t)})).catch((function(e){t(e)}))})).then((function(e){if(e){var t=e.split("."),a=wt(t[0]),n=wt(t[1]);n&&a?i({cryptoIV:n,cryptoKey:a}):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,a){if(Lt(t._opt.isLive))return a("this._opt.isLive is false, can not playback");var n=Rt();n=Object.assign({},n.playbackConfig,t._opt.playbackConfig,i);n.isUseFpsRender||n.isCacheBeforeDecodeForFpsRender&&(n.isCacheBeforeDecodeForFpsRender=!1,t.debug.error("Jessibuca","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===n.rateConfig.length&&n.showRateBtn&&(n.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:n,playType:s,openWebglAlignment:!0,useMSE:!1,useWCS:!1,useSIMD:!0}).then((function(){t.play(e).then((function(){r()})).catch((function(e){a(e)}))})).catch((function(e){a(e)}))}))}},{key:"playbackPause",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];return this._opt.playType===n?Promise.reject("playType is player, can not call playbackPause method"):new Promise((function(i,r){if(!e.player)return r("player is null");Dt(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===n?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 Lt(this._opt.isLive)||this._opt.playType===n?Promise.reject("forward() method only just for playback type"):tt(Number(e))?new Promise((function(i,r){(t.player&&t.player.playing?(e=Ne(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=Ne(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player&&this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e})}},{key:"setPlaybackStartTime",value:function(e){var t=ft(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,a){e.player||a("player is null");var n=!1;e._opt.url&&e._opt.url!==t&&(n=!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?E:c?"hls":o?"webrtc":l?k:"m7s";if(u&&!e._opt.isFlv&&(e._opt.isFlv=!0),!d||!s)return a("play protocol is ".concat(d,", demuxType is ")+s);var h=function(){e.player.once(G.webglAlignmentError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.webglContextLostError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mediaSourceH265NotSupport,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mediaSourceFull,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mediaSourceAppendBufferError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mediaSourceBufferListLarge,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mediaSourceAppendBufferEndTimeout,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mseSourceBufferError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mseAddSourceBufferError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mediaSourceDecoderConfigurationError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(G.mediaSourceTsIsMaxDiff,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.mseWidthOrHeightChange,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(G.mediaSourceUseCanvasRenderPlayFailed,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(G.webcodecsH265NotSupport,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.webcodecsDecodeError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.wcsWidthOrHeightChange,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(G.wasmDecodeError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.playFailedAndPaused,G.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(G.wasmDecodeVideoNoResponseError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(G.wasmWidthOrHeightChange,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(G.simdH264DecodeVideoWidthIsTooLarge,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.networkDelayTimeout,(function(t){if(e.player._opt.networkDelayTimeoutReplay){e.emit(U.crashLog,e.getCrashLog(U.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 a=e.screenshot("","png",.92,"base64");r.loadingBackground=a}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(G.fetchError,(function(t){e.emit(U.crashLog,e.getCrashLog(G.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(U.delayTimeout,(function(t){e.emit(U.crashLog,e.getCrashLog(U.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(U.playFailedAndPaused,U.delayTimeout),e.player&&e.player.emit(U.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(U.loadingTimeout,(function(t){e.emit(U.crashLog,e.getCrashLog(U.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(U.playFailedAndPaused,U.loadingTimeout),e.player&&e.player.emit(U.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(U.crashLog,e.getCrashLog("hasLoaded and play error",t)),e.player.pause().then((function(){a(t)})).catch((function(t){e.debug.error("Jessibuca","hasLoaded and play error and next pause error",t)}))})):e.player.once(U.decoderWorkerInit,(function(){e.player.play(t,i).then((function(){r()})).catch((function(t){e.debug.error("Jessibuca","decoderWorkerInit and play error",t),e.emit(U.crashLog,e.getCrashLog("decoderWorkerInit and play error",t)),e.player.pause().then((function(){a(t)})).catch((function(t){e.debug.error("Jessibuca","decoderWorkerInit and play error and next pause error",t)}))}))}))};c||o||n?e._resetPlayer({protocol:d,demuxType:s,isHls:c,isWebrtc:o}).then((function(){h()})).catch((function(e){a("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=Ne(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,a){if(!i.player)return a();(i.player.playing?(i.player.startRecord(e,t),r):a)()}))}},{key:"stopRecordAndSave",value:function(e,t){var i=this;return new Promise((function(r,a){i.player&&i.player.recording?i.player.stopRecordAndSave(e,t).then((function(e){r(e)})).catch((function(e){a(e)})):a("not recording")}))}},{key:"isPlaying",value:function(){var e=!1;return this.player&&(this._opt.playType===n?e=this.player.playing:this._opt.playType===s&&(e=Lt(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===n?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===s&&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===s&&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=Ne(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:n}},{key:"togglePerformancePanel",value:function(e){var t=this.player._opt.showPerformance,i=!t;(i=nt(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,a){t._initTalk(i),t.talk.startTalk(e).then((function(){r(),t.talk.once(U.talkStreamClose,(function(){t.stopTalk().catch((function(e){}))})),t.talk.once(U.talkStreamError,(function(){t.stopTalk().catch((function(e){}))})),t.talk.once(U.talkStreamInactive,(function(){t.stopTalk().catch((function(e){}))}))})).catch((function(e){a(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 a;return t.player?at(e)?r("fps is empty"):(a=Ne(a=Number(e),1,100),void t.player.updateOption({nakedFlowFps:a})):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:Ue(),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"==y(e)?JSON.stringify(e,null,2):String(e)}(t)||e};if(r.video){var a=r.video.videoInfo||{};i.videoInfo={encType:a.encType||"",width:a.width||"",height:a.height||""}}if(r.audio){var n=r.audio.audioInfo||{};i.audioInfo={encType:n.encType||"",sampleRate:n.sampleRate||"",channels:n.channels||""}}return i}}},{key:"updateDebugLevel",value:function(e){!this.player||e!==R&&e!==C||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){pt(e)&&(this._opt.fullscreenWatermarkConfig=e,(e=lt(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")}))}}])}(It);return xa.ERROR=G,xa.EVENTS=N,window.JessibucaPro=xa}))}).call(this,i("c8ba"),i("4362"))}}]);