/*
*
* EzuikitFlv.js v1.0.2-beta.5
* Copyright (c) 2024-7-24 Ezviz-OpenBiz
*
* https://github.com/Ezviz-OpenBiz/EZUIKit-flv
*
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).EzuikitFlv=t()}(this,(function(){"use strict";function e(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function t(t,i,n){return(i=e(i))in t?Object.defineProperty(t,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[i]=n,t}
/*
  *
  * @ezuikit/utils-tools v1.0.2
  * Copyright (c) 2024-5-22 Ezviz-OpenBiz
  * Released under MIT the License.
  *
  */function i(e){var t,i;return!!((null==(i=window)||null==(t=i.navigator)?void 0:t.userAgent)||"").match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)}var n={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};function r(e,t){void 0===t&&(t=["h264"]);var i=(t||["h264"]).reduce((function(e,t){return t=t.toLowerCase(),e+(n[t]||0)}),0),r=e.split("?")[0],o=e.split("?")[1];return o=(o||"").split("&").filter((function(e){return!/^vc=\d?/.test(e)})).join("&"),r+"?"+o+(o?"&":"")+"vc="+i}
/*!
   * browser-tool v1.2.2
   * Useragent analysis tool.
   * https://passer-by.com/browser/
   *
   * Copyright (c) 2017-present, HaoLe Zheng
   *
   * Released under the MIT License
   * https://github.com/mumuy/browser
   *
   * Created on: 2024-01-16
   */function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var a={name:"Safari",match:function(e){return e.indexOf("Safari")>-1},version:function(e){var t;return(null===(t=e.match(/Version\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},s={name:"Chrome",match:function(e){return e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1},version:function(e){var t,i;return(null===(t=e.match(/Chrome\/([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/CriOS\/([\d.]+)/))||void 0===i?void 0:i[1])||""}},d={name:"Edge",match:function(e){return e.indexOf("Edge")>-1||e.indexOf("Edg/")>-1||e.indexOf("EdgA")>-1||e.indexOf("EdgiOS")>-1},version:function(e){var t,i,n,r;return(null===(t=e.match(/Edge\/([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/Edg\/([\d.]+)/))||void 0===i?void 0:i[1])||(null===(n=e.match(/EdgA\/([\d.]+)/))||void 0===n?void 0:n[1])||(null===(r=e.match(/EdgiOS\/([\d.]+)/))||void 0===r?void 0:r[1])||""}},l={name:"IE",match:function(e){return e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1},version:function(e){var t,i;return(null===(t=e.match(/MSIE ([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/rv:([\d.]+)/))||void 0===i?void 0:i[1])||""}},c={name:"Firefox",match:function(e){return e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1},version:function(e){var t,i;return(null===(t=e.match(/Firefox\/([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/FxiOS\/([\d.]+)/))||void 0===i?void 0:i[1])||""}},h={name:"Firefox Focus",match:function(e){return e.indexOf("Focus")>-1},version:function(e){var t;return(null===(t=e.match(/Focus\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},u={name:"Chromium",match:function(e){return e.indexOf("Chromium")>-1},version:function(e){var t;return(null===(t=e.match(/Chromium\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},A={name:"Opera",match:function(e){return e.indexOf("Opera")>-1||e.indexOf("OPR")>-1},version:function(e){var t,i;return(null===(t=e.match(/Opera\/([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/OPR\/([\d.]+)/))||void 0===i?void 0:i[1])||""}},p={name:"Vivaldi",match:function(e){return e.indexOf("Vivaldi")>-1},version:function(e){var t;return(null===(t=e.match(/Vivaldi\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},_={name:"Yandex",match:function(e){return e.indexOf("YaBrowser")>-1},version:function(e){var t;return(null===(t=e.match(/YaBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},f={};"undefined"!=typeof globalThis?f=globalThis:"undefined"!=typeof self?f=self:"undefined"!=typeof window?f=window:"undefined"!=typeof global&&(f=global);var m=f,v={name:"Brave",match:function(e){var t;return!(null==m||null===(t=m.navigator)||void 0===t||!t.brave)},version:function(e){var t;return(null===(t=e.match(/Chrome\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},g={name:"Arora",match:function(e){return e.indexOf("Arora")>-1},version:function(e){var t;return(null===(t=e.match(/Arora\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},y={name:"Lunascape",match:function(e){return e.indexOf("Lunascape")>-1},version:function(e){var t;return(null===(t=e.match(/Lunascape[\/\s]([\d.]+)/))||void 0===t?void 0:t[1])||""}},b={name:"QupZilla",match:function(e){return e.indexOf("QupZilla")>-1},version:function(e){var t;return(null===(t=e.match(/QupZilla[\/\s]([\d.]+)/))||void 0===t?void 0:t[1])||""}},E={name:"Coc Coc",match:function(e){return e.indexOf("coc_coc_browser")>-1},version:function(e){var t;return(null===(t=e.match(/coc_coc_browser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},S={name:"Kindle",match:function(e){return e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1},version:function(e){var t;return(null===(t=e.match(/Version\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},w={name:"Iceweasel",match:function(e){return e.indexOf("Iceweasel")>-1},version:function(e){var t;return(null===(t=e.match(/Iceweasel\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},T={name:"Konqueror",match:function(e){return e.indexOf("Konqueror")>-1},version:function(e){var t;return(null===(t=e.match(/Konqueror\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},B={name:"Iceape",match:function(e){return e.indexOf("Iceape")>-1},version:function(e){var t;return(null===(t=e.match(/Iceape\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},k={name:"SeaMonkey",match:function(e){return e.indexOf("SeaMonkey")>-1},version:function(e){var t;return(null===(t=e.match(/SeaMonkey\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},C={name:"Epiphany",match:function(e){return e.indexOf("Epiphany")>-1},version:function(e){var t;return(null===(t=e.match(/Epiphany\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},R={name:"Huawei",match:function(e){return e.indexOf("HuaweiBrowser")>-1||e.indexOf("HUAWEI")>-1||e.indexOf("HONOR")>-1||e.indexOf("HBPC/")>-1},version:function(e){var t,i,n;return(null===(t=e.match(/Version\/([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/HuaweiBrowser\/([\d.]+)/))||void 0===i?void 0:i[1])||(null===(n=e.match(/HBPC\/([\d.]+)/))||void 0===n?void 0:n[1])||""}},O={name:"OPPO",match:function(e){return e.indexOf("HeyTapBrowser")>-1||e.indexOf("OPPO")>-1},version:function(e){var t;return(null===(t=e.match(/HeyTapBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},I={name:"Vivo",match:function(e){return e.indexOf("VivoBrowser")>-1},version:function(e){var t;return(null===(t=e.match(/VivoBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},x={name:"Xiaomi",match:function(e){return e.indexOf("MiuiBrowser")>-1},version:function(e){var t;return(null===(t=e.match(/MiuiBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},D={name:"Meizu",match:function(e){return e.indexOf("MZBrowser")>-1},version:function(e){var t;return(null===(t=e.match(/MZBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},L={name:"Samsung",match:function(e){return e.indexOf("SamsungBrowser")>-1},version:function(e){var t;return(null===(t=e.match(/SamsungBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}};function M(e,t){var i,n=null==m||null===(i=m.navigator)||void 0===i?void 0:i.mimeTypes;for(var r in n)if(n[r][e]&&n[r][e]==t)return n[r];return null}var P={name:"360",match:function(e){var t=!1;if(null!=m&&m.chrome){var i=e.replace(/^.*Chrome\/([\d]+).*$/,"$1");M("type","application/360softmgrplugin")||M("type","application/mozilla-npqihooquicklogin")||i>36&&null!=m&&m.showModalDialog?t=!0:i>45&&!(t=M("type","application/vnd.chromium.remoting-viewer"))&&i>=69&&(t=M("type","application/hwepass2001.installepass2001")||M("type","application/asx"))}return e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1||t},version:function(e){var t;return(null===(t=e.match(/QihooBrowser(HD)?\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},U={name:"360SE",match:function(e){var t,i=!1;return P.match(e)&&(M("type","application/gameplugin")||null!=m&&null!==(t=m.navigator)&&void 0!==t&&null!==(t=t.userAgentData)&&void 0!==t&&t.brands.filter((function(e){return"Not.A/Brand"==e.brand})).length)&&(i=!0),e.indexOf("360SE")>-1||i},version:function(e){return{114:"15.0",108:"14.0",86:"13.0",78:"12.0",69:"11.0",63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[parseInt(s.version(e))]||""}},F={name:"360EE",match:function(e){var t=!1;if(M("type","application/cenroll.cenroll.version.1")||M("type","application/hwepass2001.installepass2001"))t=!0;else if(P.match(e)){var i;null!=m&&null!==(i=m.navigator)&&void 0!==i&&null!==(i=i.userAgentData)&&void 0!==i&&i.brands.filter((function(e){return"Not A(Brand"==e.brand})).length&&(t=!0)}return e.indexOf("360EE")>-1||t},version:function(e){return{119:"(X)22.0",108:"14.0",95:"(X)21.0",86:"13.0",78:"12.0",69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[parseInt(s.version(e))]||""}},V={name:"UC",match:function(e){return e.indexOf("UCBrowser")>-1||e.indexOf(" UBrowser")>-1||e.indexOf("UCWEB")>-1},version:function(e){var t;return(null===(t=e.match(/UC?Browser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},N={name:"QQBrowser",match:function(e){return e.indexOf("QQBrowser")>-1},version:function(e){var t;return(null===(t=e.match(/QQBrowser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},G={name:"QQ",match:function(e){return e.indexOf("QQ/")>-1},version:function(e){var t;return(null===(t=e.match(/QQ\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},W={name:"Baidu",match:function(e){return e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1||e.indexOf("baidubrowser")>-1||e.indexOf("baiduboxapp")>-1||e.indexOf("BaiduD")>-1},version:function(e){var t,i;return(null===(t=e.match(/BIDUBrowser[\s\/]([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/baiduboxapp\/([\d.]+)/))||void 0===i?void 0:i[1])||""}},j={name:"Maxthon",match:function(e){return e.indexOf("Maxthon")>-1||(null==m?void 0:m.maxthon)},version:function(e){var t;return{109:"7.0",78:"6.0"}[parseInt(s.version(e))]||(null===(t=e.match(/Maxthon\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},Q={name:"Sogou",match:function(e){return e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1},version:function(e){var t,i;return{94:"12.0",80:"11.0"}[(null===(t=e.match(/Chrome\/([\d]+)/))||void 0===t?void 0:t[1])||""]||(null===(i=e.match(/SogouMobileBrowser\/([\d.]+)/))||void 0===i?void 0:i[1])||""}},z={name:"Liebao",match:function(e){return e.indexOf("LBBROWSER")>-1||e.indexOf("LieBaoFast")>-1||(null==m?void 0:m.liebao)},version:function(e){var t="";e.indexOf("LieBaoFast")>-1&&(t=e.replace(/LieBaoFast\/([\d.]+)/,"$1"));var i=parseInt(s.version(e));return t||{79:"8.0",57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[i]||""}},H={name:"2345Explorer",match:function(e){var t,i,n=(null==m?void 0:m.chrome)&&((null==m||null===(t=m.chrome)||void 0===t?void 0:t.adblock2345)||(null==m||null===(i=m.chrome)||void 0===i?void 0:i.common2345));return e.indexOf("2345Explorer")>-1||e.indexOf("Mb2345Browser")>-1||e.indexOf("2345chrome")>-1||n},version:function(e){var t,i;return{69:"10.0",55:"9.9"}[parseInt(s.version(e))]||(null===(t=e.match(/2345Explorer\/([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/Mb2345Browser\/([\d.]+)/))||void 0===i?void 0:i[1])||""}},q={name:"115Browser",match:function(e){return e.indexOf("115Browser")>-1},version:function(e){var t;return(null===(t=e.match(/115Browser\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},X={name:"TheWorld",match:function(e){return e.indexOf("TheWorld")>-1},version:function(e){var t;return(null===(t=e.match(/TheWorld ([\d.]+)/))||void 0===t?void 0:t[1])||""}},$={name:"Quark",match:function(e){return e.indexOf("Quark")>-1},version:function(e){var t;return(null===(t=e.match(/Quark\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},Y={name:"Qiyu",match:function(e){return e.indexOf("Qiyu")>-1},version:function(e){var t;return(null===(t=e.match(/Qiyu\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},Z={name:"Wechat",match:function(e){return e.indexOf("MicroMessenger")>-1},version:function(e){var t;return(null===(t=e.match(/MicroMessenger\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},K={name:"WechatWork",match:function(e){return e.indexOf("wxwork/")>-1},version:function(e){var t;return(null===(t=e.match(/wxwork\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},J={name:"Taobao",match:function(e){return e.indexOf("AliApp(TB")>-1},version:function(e){var t;return(null===(t=e.match(/AliApp\(TB\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},ee={name:"Alipay",match:function(e){return e.indexOf("AliApp(AP")>-1},version:function(e){var t;return(null===(t=e.match(/AliApp\(AP\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},te={name:"Weibo",match:function(e){return e.indexOf("Weibo")>-1},version:function(e){var t;return(null===(t=e.match(/weibo__([\d.]+)/))||void 0===t?void 0:t[1])||""}},ie={name:"Douban",match:function(e){return e.indexOf("com.douban.frodo")>-1},version:function(e){var t;return(null===(t=e.match(/com.douban.frodo\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},ne={name:"Suning",match:function(e){return e.indexOf("SNEBUY-APP")>-1},version:function(e){var t;return(null===(t=e.match(/SNEBUY-APP([\d.]+)/))||void 0===t?void 0:t[1])||""}},re={name:"iQIYI",match:function(e){return e.indexOf("IqiyiApp")>-1},version:function(e){var t;return(null===(t=e.match(/IqiyiVersion\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},oe={name:"DingTalk",match:function(e){return e.indexOf("DingTalk")>-1},version:function(e){var t;return(null===(t=e.match(/DingTalk\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},ae={name:"Douyin",match:function(e){return e.indexOf("aweme")>-1},version:function(e){var t;return(null===(t=e.match(/app_version\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},se={name:"Googlebot",match:function(e){return e.indexOf("Googlebot")>-1},version:function(e){var t;return(null===(t=e.match(/Googlebot\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},de={name:"Baiduspider",match:function(e){return e.indexOf("Baiduspider")>-1},version:function(e){var t;return(null===(t=e.match(/Baiduspider(-render)?\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},le={name:"Sogouspider",match:function(e){return e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1},version:function(e){var t;return(null===(t=e.match(/Sogou (\S+) Spider\/([\d.]+)/i))||void 0===t?void 0:t[1])||""}},ce={name:"Bingbot",match:function(e){return e.indexOf("bingbot")>-1},version:function(e){var t;return(null===(t=e.match(/bingbot\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},he={name:"360Spider",match:function(e){return e.indexOf("360Spider")>-1||e.indexOf("HaosouSpider")>-1},version:function(e){return""}},ue={name:"Bytespider",match:function(e){return e.indexOf("Bytespider")>-1},version:function(e){return""}},Ae={name:"YisouSpider",match:function(e){return e.indexOf("YisouSpider")>-1},version:function(e){var t;return(null===(t=e.match(/YisouSpider\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},pe={name:"YodaoBot",match:function(e){return e.indexOf("YodaoBot")>-1},version:function(e){var t;return(null===(t=e.match(/YodaoBot\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},_e={name:"YandexBot",match:function(e){return e.indexOf("YandexBot")>-1},version:function(e){var t;return(null===(t=e.match(/YandexBot\/([\d.]+)/))||void 0===t?void 0:t[1])||""}};function fe(e,t){var i,n=e.userAgent;e.browser="",e.browserVersion="",[a,s,d,l,c,h,u,A,p,_,v,g,y,b,E,S,w,T,B,k,C,R,O,I,x,D,L,P,F,U,V,N,G,W,j,Q,z,H,q,X,$,Y,Z,K,J,ee,te,ie,ne,re,oe,ae,se,de,le,ce,he,ue,Ae,pe,_e].forEach((function(i){i.match(n)&&(e.browser=i.name,e.browserVersion=i.version(n,t))})),"Chrome"==e.browser&&n.match(/\S+Browser/)&&(e.browser=n.match(/\S+Browser/)[0],e.browserVersion=(null===(i=n.replace(/^.*Browser\/([\d.]+).*$/))||void 0===i?void 0:i[1])||"")}var me={name:"Mobile",match:function(e){return e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1}},ve={name:"Tablet",match:function(e){var t=(null==m?void 0:m.navigator)||{};return e.indexOf("Tablet")>-1||e.indexOf("Pad")>-1||e.indexOf("Nexus 7")>-1||"MacIntel"===t.platform&&t.maxTouchPoints>1}};function ge(e){e.device="Desktop",[me,ve].forEach((function(t){t.match(e.userAgent)&&(e.device=t.name)}))}var ye={name:"WebKit",match:function(e){return e.indexOf("AppleWebKit")>-1}},be={name:"Trident",match:function(e){return e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1}},Ee={name:"Gecko",match:function(e){return e.indexOf("Gecko/")>-1}},Se={name:"Presto",match:function(e){return e.indexOf("Presto")>-1}},we={name:"KHTML",match:function(e){return e.indexOf("KHTML/")>-1}};function Te(e){e.engine="",[ye,be,Ee,Se,we].forEach((function(t){t.match(e.userAgent)&&(e.engine=t.name)})),"Edge"==e.browser?e.engine=parseInt(e.browserVersion)>75?"Blink":"EdgeHTML":(s.match(e.userAgent)&&"WebKit"==e.engine&&parseInt(s.version(e.userAgent))>27||"Opera"==e.browser&&parseInt(e.browserVersion)>12||"Yandex"==e.browser)&&(e.engine="Blink")}var Be={name:"Windows",match:function(e){return e.indexOf("Windows")>-1},version:function(e){var t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(null===(t=e.match(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/))||void 0===t?void 0:t[1])||"",r={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return i?new Promise((function(e){var t;null!=m&&null!==(t=m.navigator)&&void 0!==t&&t.userAgentData?m.navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then((function(t){var i="";"Windows"===navigator.userAgentData.platform&&(i=parseInt(t.platformVersion.split(".")[0])>=13?"11":"10"),e(i)})):e(r[n]||n)})):r[n]||n}},ke={name:"Linux",match:function(e){return e.indexOf("Linux")>-1||e.indexOf("X11")>-1},version:function(e){return""}},Ce={name:"macOS",match:function(e){return e.indexOf("Macintosh")>-1},version:function(e){var t;return(null===(t=e.match(/Mac OS X -?([\d_]+)/))||void 0===t?void 0:t[1].replace(/_/g,"."))||""}},Re={name:"Android",match:function(e){return e.indexOf("Android")>-1||e.indexOf("Adr")>-1},version:function(e){var t;return(null===(t=e.match(/Android ([\d.]+);/))||void 0===t?void 0:t[1])||""}},Oe={name:"HarmonyOS",match:function(e){return e.indexOf("HarmonyOS")>-1},version:function(e){var t,i=+(null===(t=e.match(/HMSCore (\d+.\d+)/))||void 0===t?void 0:t[1])||0;return i>=6.1?"4.0":i>=6?"3.0":i>=5?"2.0":i>=4?"1.0":""}},Ie={name:"Ubuntu",match:function(e){return e.indexOf("Ubuntu")>-1},version:function(e){return""}},xe={name:"FreeBSD",match:function(e){return e.indexOf("FreeBSD")>-1},version:function(e){return""}},De={name:"Debian",match:function(e){return e.indexOf("Debian")>-1},version:function(e){var t;return(null===(t=e.match(/Debian\/([\d.]+)/))||void 0===t?void 0:t[1])||""}},Le={name:"iOS",match:function(e){return e.indexOf("like Mac OS X")>-1},version:function(e){var t;return(null===(t=e.match(/OS ([\d_]+) like/))||void 0===t?void 0:t[1].replace(/_/g,"."))||""}},Me={name:"Windows Phone",match:function(e){return e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1},version:function(e){var t;return(null===(t=e.match(/Windows Phone( OS)? ([\d.]+);/))||void 0===t?void 0:t[2])||""}},Pe={name:"BlackBerry",match:function(e){return e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1},version:function(e){return""}},Ue={name:"MeeGo",match:function(e){return e.indexOf("MeeGo")>-1},version:function(e){return""}},Fe={name:"Symbian",match:function(e){return e.indexOf("Symbian")>-1},version:function(e){return""}},Ve={name:"Chrome OS",match:function(e){return e.indexOf("CrOS")>-1},version:function(e){var t,i;return(null===(t=e.match(/MSIE ([\d.]+)/))||void 0===t?void 0:t[1])||(null===(i=e.match(/rv:([\d.]+)/))||void 0===i?void 0:i[1])||""}},Ne={name:"WebOS",match:function(e){return e.indexOf("hpwOS")>-1},version:function(e){var t;return(null===(t=e.match(/hpwOS\/([\d.]+);/))||void 0===t?void 0:t[1])||""}};function Ge(e,t){var i,n=e.userAgent;e.system="",e.systemVersion="",[Be,ke,Ce,Re,Oe,Ie,xe,De,Le,Me,Pe,Ue,Fe,Ve,Ne].forEach((function(i){i.match(n)&&(e.system=i.name,e.systemVersion=i.version(n,t))})),e.platform="",n.match(/(Win64|x64|WOW64|x86_64)/i)?e.platform="Win64":n.match(/(Win32|x86|WOW32)/i)?e.platform="Win32":n.match(/aarch64|arm64/)?e.platform="ARM64":n.match(/arm32/)?e.platform="ARM32":null!=m&&null!==(i=m.navigator)&&void 0!==i&&i.platform&&(e.platform=m.navigator.platform),e.architecture="";var r,o=n+"|"+e.platform;o.match(/armv\d+/i)||o.match(/aarch64/)?e.architecture="arm":o.match(/loongarch64/)?e.architecture="loongarch":e.architecture="x86",e.bitness=n.match(/Win64|x64|WOW64|x86_64|aarch64|arm64|loongarch64/i)?64:32,t&&null!=m&&null!==(r=m.navigator)&&void 0!==r&&r.userAgentData&&(e.architecture=navigator.userAgentData.getHighEntropyValues(["architecture"]).then((function(e){return e.architecture})),e.bitness=navigator.userAgentData.getHighEntropyValues(["bitness"]).then((function(e){return+e.bitness})))}function We(e){if(e.gpu="",e.gpuModel="",null!=m&&m.document){var t,i,n=m.document.createElement("canvas").getContext("experimental-webgl"),r=n.getExtension("WEBGL_debug_renderer_info"),o=n.getParameter(r.UNMASKED_RENDERER_WEBGL);e.gpu=(null===(t=o.match(/ANGLE \((.+?),/))||void 0===t?void 0:t[1])||"",e.gpuModel=(null===(i=o.match(/, (.+?) (\(|vs_)/))||void 0===i?void 0:i[1])||""}}function je(e){e.language=function(e,t){var i=(null==m||null===(e=m.navigator)||void 0===e?void 0:e.browserLanguage)||(null==m||null===(t=m.navigator)||void 0===t?void 0:t.language);if("string"!=typeof i)return"Unknown language";var n=i.split("-");return n[1]&&(n[1]=n[1].toUpperCase()),n.join("_")}()}function Qe(e){var t,i,n;e.network=(i="unknown",(n=null==m||null===(t=m.navigator)||void 0===t?void 0:t.connection)&&("2"!=(i=n.type||n.effectiveType)&&"unknown"!=i||(i="wifi")),i)}function ze(e){e.isWebview=e.userAgent.indexOf("; wv)")>-1,e.isRobot=["Googlebot","Baiduspider","Sogouspider","Bingbot","360Spider","Bytespider","YandexBot"].includes(e.browser)}var He=function(e){var t,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={};return n.userAgent=e||(null==m||null===(t=m.navigator)||void 0===t?void 0:t.userAgent)||"",[fe,ge,Te,Ge,We,je,Qe,ze].forEach((function(e){return e(n,i)})),n};function qe(e){var t=He(e);for(var i in t)"object"==o(t[i])&&(t[i]="");return t}qe.getInfo=function(e){var t=He(e,!0),i=Object.keys(t),n=Object.values(t).map((function(e){return"object"==o(e)?e:Promise.resolve(e)}));return Promise.all(n).then((function(e){var t={};return e.forEach((function(e,n){t[i[n]]=e})),t}))};const Xe=0,$e=1,Ye="flv",Ze="m7s",Ke={videoBuffer:200,videoBufferDelay:1e3,scaleMode:1,debug:!1,loadingTimeout:10,heartTimeout:5,timeout:10,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,keepScreenOn:!1,isNotMute:!1,hasAudio:!0,volume:.5,hasVideo:!0,decoder:"decoder.js",staticPath:"",url:"",rotate:0,forceNoOffscreen:!0,protocol:$e,demuxType:Ye,useMSE:!1,autoWasm:!0,wasmDecodeErrorReplay:!0,openWebglAlignment:!1,wasmDecodeAudioSyncVideo:!1,useWebFullScreen:!0,loggerOptions:{level:"INFO"}},Je="init",et="initVideo",tt="render",it="playAudio",nt="initAudio",rt="audioCode",ot="videoCode",at="wasmError",st="Invalid NAL unit size",dt=1,lt=2,ct=8,ht=9,ut="init",At="decode",pt="audioDecode",_t="close",ft="updateConfig",mt={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",loadingTimeout:"loadingTimeout",stats:"stats",performance:"performance",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",streamEnd:"streamEnd",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",volumechange:"volumechange",destroy:"destroy",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceBufferError:"mseSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes"},vt={load:mt.load,timeUpdate:mt.timeUpdate,videoInfo:mt.videoInfo,audioInfo:mt.audioInfo,error:mt.error,kBps:mt.kBps,log:mt.log,start:mt.start,timeout:mt.timeout,loadingTimeout:mt.loadingTimeout,delayTimeout:mt.delayTimeout,fullscreen:"fullscreen",webFullscreen:mt.webFullscreen,play:mt.play,pause:mt.pause,mute:mt.mute,stats:mt.stats,volumechange:mt.volumechange,performance:mt.performance,playToRenderTimes:mt.playToRenderTimes},gt={playError:"playIsNotPauseOrUrlIsNull",fetchError:"NetworkError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",webcodecsWidthOrHeightChange:"webcodecsWidthOrHeightChange",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceFull:mt.mseSourceBufferFull,mseSourceBufferError:mt.mseSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",wasmDecodeError:"wasmDecodeError",webglAlignmentError:"webglAlignmentError"},yt="notConnect",bt="open",Et="close",St="error",wt={download:"download",base64:"base64",blob:"blob"},Tt={7:"H264(AVC)",12:"H265(HEVC)"},Bt={10:"AAC",7:"ALAW",8:"MULAW"},kt={full:0,auto:1,fullAuto:2},Ct="webcodecs",Rt="webgl",Ot="offscreen",It=1e3,xt="The user aborted a request",Dt="AbortError",Lt="AbortError";function Mt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pt={exports:{}};!function(e){!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},i=e.exports,n=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"]],n=0,r=i.length,o={};n<r;n++)if((e=i[n])&&e[1]in t){for(n=0;n<e.length;n++)o[i[0][n]]=e[n];return o}return!1}(),r={change:n.fullscreenchange,error:n.fullscreenerror},o={request:function(e,i){return new Promise(function(r,o){var a=function(){this.off("change",a),r()}.bind(this);this.on("change",a);var s=(e=e||t.documentElement)[n.requestFullscreen](i);s instanceof Promise&&s.then(a).catch(o)}.bind(this))},exit:function(){return new Promise(function(e,i){if(this.isFullscreen){var r=function(){this.off("change",r),e()}.bind(this);this.on("change",r);var o=t[n.exitFullscreen]();o instanceof Promise&&o.then(r).catch(i)}else 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){var n=r[e];n&&t.addEventListener(n,i,!1)},off:function(e,i){var n=r[e];n&&t.removeEventListener(n,i,!1)},raw:n};n?(Object.defineProperties(o,{isFullscreen:{get:function(){return Boolean(t[n.fullscreenElement])}},element:{enumerable:!0,get:function(){return t[n.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(t[n.fullscreenEnabled])}}}),i?e.exports=o:window.screenfull=o):i?e.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()}(Pt);var Ut=Mt(Pt.exports);function Ft(){}function Vt(e=""){const t=e.split(","),i=atob(t[1]),n=t[0].replace("data:","").replace(";base64","");let r=i.length;const o=new Uint8Array(r);for(;r--;)o[r]=i.charCodeAt(r);return new File([o],"file",{type:n})}function Nt(){return(new Date).getTime()}function Gt(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{Gt(e,i,t[i])})),e.style[t]=i,e}function Wt(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function jt(e){let t=0,i=Wt();return n=>{t+=n;const r=Wt(),o=r-i;o>=1e3&&(e(t/o*1e3),i=r,t=0)}}function Qt(){return/phone|pad|pod|iphone|ipod|ios|ipad|android|mobile|blackberry|iemobile|mqqbrowser|juc|wosbrowser|webos|symbian|windows phone|opera mini|huaweibrowser/i.test(window.navigator.userAgent.toLowerCase())}function zt(){return Ut.isFullscreen}function Ht(e){return null==e}function qt(e){return!Ht(e)}function Xt(e){const t=e||window.event;return t.target||t.srcElement}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();class $t{constructor(){}on(e,t,i){const n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const n=this;function r(...o){n.off(e,r),t.apply(i,o)}return r._=t,this.on(e,r,i)}emit(e,...t){const i=((this.e||(this.e={}))[e]||[]).slice();for(let e=0;e<i.length;e+=1)i[e].fn.apply(i[e].ctx,t);return this}off(e,t){const i=this.e||(this.e={});if(!e)return Object.keys(i).forEach((e=>{delete i[e]})),void delete this.e;const n=i[e],r=[];if(n&&t)for(let e=0,i=n.length;e<i;e+=1)n[e].fn!==t&&n[e].fn._!==t&&r.push(n[e]);return r.length?i[e]=r:delete i[e],this}}let Yt=class extends $t{constructor(){super(),this.init=!1}resetInit(){this.init=!1,this.videoInfo={width:"",height:"",encType:"",encTypeCode:""}}destroy(){var e;this.resetInit(),this.player.$container&&this.$videoElement&&(null===(e=this.player.$container)||void 0===e||e.removeChild(this.$videoElement)),this.off()}updateVideoInfo(e){e.encTypeCode&&(this.videoInfo.encType=Tt[e.encTypeCode]),e.width&&(this.videoInfo.width=e.width),e.height&&(this.videoInfo.height=e.height),this.videoInfo.encType&&this.videoInfo.height&&this.videoInfo.width&&!this.init&&(this.player.emit(mt.videoInfo,this.videoInfo),this.init=!0)}play(){}pause(){}clearView(){}};const Zt="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Kt(e,t,i){const n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){ii(n.response,t,i)},n.onerror=function(){},n.send()}function Jt(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function ei(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(t){const i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(i)}}const ti=Zt.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent);var ii="object"!=typeof window||window!==Zt?function(){}:"download"in HTMLAnchorElement.prototype&&!ti?function(e,t,i){const n=Zt.URL||Zt.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Jt(r.href)?Kt(e,t,i):ei(r,r.target="_blank"):ei(r)):(r.href=n.createObjectURL(e),setTimeout((function(){n.revokeObjectURL(r.href)}),4e4),setTimeout((function(){ei(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Jt(e))Kt(e,t,i);else{const t=document.createElement("a");t.href=e,t.target="_blank",setTimeout((function(){ei(t)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),"string"==typeof e)return Kt(e,t,i);const r="application/octet-stream"===e.type,o=/constructor/i.test(Zt.HTMLElement)||Zt.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||r&&o||ti)&&"undefined"!=typeof FileReader){const t=new FileReader;t.onloadend=function(){let e=t.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=e:location=e,n=null},t.readAsDataURL(e)}else{const t=Zt.URL||Zt.webkitURL,i=t.createObjectURL(e);n?n.location=i:location.href=i,n=null,setTimeout((function(){t.revokeObjectURL(i)}),4e4)}};class ni extends Yt{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.videoInfo={width:"",height:"",encType:""},this._initCanvasRender(),this._contextmenuEvent=e=>{e.target===this.$videoElement&&e.preventDefault()},document.addEventListener("contextmenu",this._contextmenuEvent),this.player.debug.log("CanvasVideo","init")}destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this._contextmenuEvent&&(document.removeEventListener("contextmenu",this._contextmenuEvent),this._contextmenuEvent=null),this.renderType=null,this.player.debug.log("CanvasVideoLoader","destroy")}_initContextGl(){this.contextGl=function(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let n=0;for(;!t&&n<i.length;){const r=i[n];try{const i={preserveDrawingBuffer:!0};t=e.getContext(r,i)}catch(e){t=null}t&&"function"==typeof t.getParameter||(t=null),++n}return t}(this.$videoElement);const e=((e,t)=>{var i=["attribute vec4 vertexPos;","attribute vec4 texturePos;","varying vec2 textureCoord;","void main()","{","gl_Position = vertexPos;","textureCoord = texturePos.xy;","}"].join("\n"),n=["precision highp float;","varying highp vec2 textureCoord;","uniform sampler2D ySampler;","uniform sampler2D uSampler;","uniform sampler2D vSampler;","const mat4 YUV2RGB = mat4","(","1.1643828125, 0, 1.59602734375, -.87078515625,","1.1643828125, -.39176171875, -.81296875, .52959375,","1.1643828125, 2.017234375, 0, -1.081390625,","0, 0, 0, 1",");","void main(void) {","highp float y = texture2D(ySampler,  textureCoord).r;","highp float u = texture2D(uSampler,  textureCoord).r;","highp float v = texture2D(vSampler,  textureCoord).r;","gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;","}"].join("\n");t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);var r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,i),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS);var o=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(o,n),e.compileShader(o),e.getShaderParameter(o,e.COMPILE_STATUS);var a=e.createProgram();e.attachShader(a,r),e.attachShader(a,o),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS),e.useProgram(a);var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,1,-1,1,1,-1,-1,-1]),e.STATIC_DRAW);var d=e.getAttribLocation(a,"vertexPos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0);var l=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),e.STATIC_DRAW);var c=e.getAttribLocation(a,"texturePos");function h(t,i){var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),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),e.bindTexture(e.TEXTURE_2D,null),e.uniform1i(e.getUniformLocation(a,t),i),n}e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);var u=h("ySampler",0),A=h("uSampler",1),p=h("vSampler",2);return{render:function(t,i,n,r,o){e.viewport(0,0,t,i),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t,i,0,e.LUMINANCE,e.UNSIGNED_BYTE,n),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,A),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,r),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.LUMINANCE,t/2,i/2,0,e.LUMINANCE,e.UNSIGNED_BYTE,o),e.drawArrays(e.TRIANGLE_STRIP,0,4)},destroy:function(){try{e.deleteProgram(a),e.deleteBuffer(s),e.deleteBuffer(l),e.deleteTexture(u),e.deleteTexture(A),e.deleteTexture(p)}catch(e){}}}})(this.contextGl,this.player._opt.openWebglAlignment);this.contextGlRender=e.render,this.contextGlDestroy=e.destroy}_initContext2D(){this.context2D=this.$videoElement.getContext("2d")}_initCanvasRender(){this._supportOffscreen()?(this.renderType=Ot,this._bindOffscreen()):(this.renderType=Rt,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}render(e){switch(this.player.videoTimestamp=e.ts,this.renderType){case Ot:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case Rt:this.contextGlRender(this.$videoElement.width,this.$videoElement.height,e.output[0],e.output[1],e.output[2]);break;case Ct:this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),(t=e.videoFrame).close?t.close():t.destroy&&t.destroy()}var t}screenshot(e,t,i,n){e=e||Nt(),n=n||wt.download;const r={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};let o=.92;!r[t]&&wt[t]&&(n=t,t="png",i=void 0),"string"==typeof i&&(n=i,i=void 0),void 0!==i&&(o=Number(i));const a=this.$videoElement.toDataURL(r[t]||r.png,o);if(n===wt.base64)return a;{const t=Vt(a);if(n===wt.blob)return t;n===wt.download&&ii(t,e)}}clearView(){switch(this.renderType){case Ot:(function(e,t){const i=document.createElement("canvas");return i.width=e,i.height=t,window.createImageBitmap(i,0,0,e,t)})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case Rt:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case Ct:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}resize(){this.player.debug.log("canvasVideo","resize");const e=this.player._opt,t=this.player.width,i=this.player.height;let n=this.$videoElement.width,r=this.$videoElement.height;const o=e.rotate,a=(t-n)/2,s=(i-r)/2;270!==o&&90!==o||(n=this.$videoElement.height,r=this.$videoElement.width);const d=t/n,l=i/r;let c=d>l?l:d;e.scaleMode!==kt.auto&&d!==l&&(c=d+","+l),e.scaleMode===kt.fullAuto&&(c=d>l?d:l);let h="scale("+c+")";o&&(h+=" rotate("+o+"deg)"),this.$videoElement.style.transform=h,this.$videoElement.style.left=a+"px",this.$videoElement.style.top=s+"px"}}class ri extends $t{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.hasInitScriptNode=!1,this.audioContextChannel=null,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(mt.videoSyncAudio,(e=>{this.audioSyncVideoOption=e})),this.player.debug.log("AudioContext","init")}resetInit(){this.init=!1,this.audioInfo={encType:"",channels:"",sampleRate:""}}destroy(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=Ft,this.scriptNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off(),this.player.debug.log("AudioContext","destroy")}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=Bt[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(mt.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){if(this.playing=!0,this.hasInitScriptNode)return;const e=this.audioInfo.channels,t=this.audioContext.createScriptProcessor(1024,0,e);t.onaudioprocess=t=>{const i=t.outputBuffer;if(this.bufferList.length&&this.playing){if(!this.player._opt.useWCS&&!this.player._opt.useMSE&&this.player._opt.wasmDecodeAudioSyncVideo){if(this.audioSyncVideoOption.diff>It)return void this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${this.audioSyncVideoOption.diff}, waiting`);if(this.audioSyncVideoOption.diff<-1e3){this.player.debug.warn("AudioContext",`audioSyncVideoOption less than diff :${this.audioSyncVideoOption.diff}, dropping`);let e=this.bufferList.shift();for(;e.ts-this.player.videoTimestamp<-1e3&&this.bufferList.length>0;)e=this.bufferList.shift();if(0===this.bufferList.length)return}}if(0===this.bufferList.length)return;const t=this.bufferList.shift();t&&t.ts&&(this.player.audioTimestamp=t.ts);for(let n=0;n<e;n++){const e=t.buffer[n],r=i.getChannelData(n);for(let t=0;t<1024;t++)r[t]=e[t]||0}}},t.connect(this.gainNode),this.scriptNode=t,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}mute(e){e?(this.isMute||this.player.emit(mt.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(mt.mute,e),this.setVolume(.5))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=function(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}(e,0,1),this.gainNode.gain.value=e,this.gainNode.gain.setValueAtTime(e,this.audioContext.currentTime),this.player.emit(mt.volumechange,this.player.volume))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.gainNode&&this.gainNode.disconnect(this.audioContext.destination),this.gainNode&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode)),this.clear()}audioEnabled(e){e?"suspended"===this.audioContext.state&&this.audioContext.resume():"running"===this.audioContext.state&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){this.isMute||(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.bufferList.length>20&&(this.player.debug.warn("AudioContext",`bufferList is large: ${this.bufferList.length}`),this.bufferList.length>50&&this.bufferList.shift()))}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1,this.clear()}resume(){this.playing=!0}}class oi{constructor(e){return new(oi.getLoaderFactory())(e)}static getLoaderFactory(){return ri}}class ai extends $t{constructor(e){super(),this.player=e,this.playing=!1,this.abortController=new AbortController,this.streamRate=jt((e=>{})),e.debug.log("FetchStream","init")}destroy(){this.abort(),this.off(),this.streamRate=null,this.player.debug.log("FetchStream","destroy")}fetchStream(e,t={}){const{demux:i}=this.player;this.player._times.streamStart=Nt();const n=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,n).then((e=>{const t=e.body.getReader();this.emit(mt.streamSuccess);const n=()=>{t.read().then((({done:e,value:t})=>{e?i.close():(this.streamRate&&this.streamRate(t.byteLength),i.dispatch(t),n())})).catch((e=>{i.close();const n=e.toString();-1===n.indexOf(xt)&&-1===n.indexOf(Dt)&&e.name!==Lt&&(this.abort(),t.cancel(),this.emit(gt.fetchError,e),this.player.emit(mt.error,gt.fetchError))}))};n()})).catch((e=>{"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(gt.fetchError,e),this.player.emit(mt.error,gt.fetchError))}))}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}}class si extends $t{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=yt,this.wsUrl=null,this.streamRate=jt((e=>{})),e.debug.log("WebsocketLoader","init")}destroy(){this.socket&&(this.socket.close(1e3,"Client disconnecting"),this.socket=null),this.socketStatus=yt,this.streamRate=null,this.wsUrl=null,this.off(),this.player.debug.log("websocketLoader","destroy")}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:n}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",i(this.socket,"open",(()=>{this.emit(mt.streamSuccess),t.log("websocketLoader","socket open"),this.socketStatus=bt})),i(this.socket,"message",(e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)})),i(this.socket,"close",(()=>{t.log("websocketLoader","socket close"),this.emit(mt.streamEnd),this.socketStatus=Et})),i(this.socket,"error",(e=>{t.log("websocketLoader","socket error"),this.emit(gt.websocketError,e),this.player.emit(mt.error,gt.websocketError),this.socketStatus=St,n.close(),t.log("websocketLoader","socket error:",e)}))}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("websocketLoader","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=Nt(),this.wsUrl=e,this._createWebSocket()}}class di{constructor(e){return new(di.getLoaderFactory(e._opt.protocol))(e)}static getLoaderFactory(e){return e===$e?ai:e===Xe?si:void 0}}class li{constructor(e){this.player=e,this.decoderWorker=new Worker((""===e._opt.staticPath?"":function(e,t){void 0===t&&(t="");var i=/^(https?:\/\/|^\/\/)/;return i.test(e)?e:(e=e.replace(/\/+/g,"/"),t=i.test(t||"")?t:window.location.href,new URL(e,t).href)}(e._opt.staticPath))+e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init")}destroy(){this.decoderWorker.postMessage({cmd:_t}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onmessage=t=>{var i,n,r,o,a,s;const d=t.data;switch(d.cmd){case Je:e.log("decoderWorker","onmessage:",Je),this.player.loaded||this.player.emit(mt.load),this.player.emit(mt.decoderWorkerInit),this._initWork();break;case ot:e.log("decoderWorker","onmessage:",ot,d.code),this.player._times.decodeStart||(this.player._times.decodeStart=Nt()),this.player.video.updateVideoInfo({encTypeCode:d.code});break;case rt:e.log("decoderWorker","onmessage:",rt,d.code),null===(i=this.player)||void 0===i||null===(i=i.audio)||void 0===i||null===(n=i.updateAudioInfo)||void 0===n||n.call(i,{encTypeCode:d.code});break;case et:if(e.log("decoderWorker","onmessage:",et,`width:${d.w},height:${d.h}`),null===(r=this.player)||void 0===r||null===(r=r.video)||void 0===r||null===(o=r.updateVideoInfo)||void 0===o||o.call(r,{width:d.w,height:d.h}),!this.player._opt.openWebglAlignment&&d.w/2%4!=0)return void this.player.emit(gt.webglAlignmentError);this.player.video.initCanvasViewSize();break;case nt:e.log("decoderWorker","onmessage:",nt,`channels:${d.channels},sampleRate:${d.sampleRate}`),this.player.audio&&(this.player.audio.updateAudioInfo(d),this.player.audio.initScriptNode(d));break;case tt:this.player.handleRender(),this.player.video.render(d),this.player.emit(mt.timeUpdate,d.ts),this.player.updateStats({fps:!0,ts:d.ts,buf:d.delay}),this.player._times.videoStart||(this.player._times.videoStart=Nt(),this.player.handlePlayToRenderTimes());break;case it:this.player.playing&&this.player.audio&&this.player.audio.play(d.buffer,d.ts);break;case at:d.message&&-1!==d.message.indexOf(st)&&this.player.emitError(gt.wasmDecodeError);break;default:null===(a=(s=this.player)[d.cmd])||void 0===a||a.call(s,d)}}}_initWork(){var e;const t={debug:this.player._opt.debug,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};this.decoderWorker.postMessage({cmd:ut,opt:JSON.stringify(t),sampleRate:(null===(e=this.player)||void 0===e||null===(e=e.audio)||void 0===e||null===(e=e.audioContext)||void 0===e?void 0:e.sampleRate)||0})}decodeVideo(e,t,i){const n={type:lt,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:At,buffer:e,options:n},[e.buffer])}decodeAudio(e,t){this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t)}_decodeAudio(e,t){const i={type:dt,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:At,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:pt,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker.postMessage({cmd:ft,key:e.key,value:e.value})}}class ci extends $t{constructor(e){super(),this.player=e,this.stopId=null,this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.initInterval()}destroy(){this.stopId&&(clearInterval(this.stopId),this.stopId=null),this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.bufferList=[],this.dropping=!1,this.off(),this.player.debug.log("CommonDemux","destroy")}getDelay(e){if(!e)return-1;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;this.delay=t>=i?t-i:i-t}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.delay}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}initInterval(){this.player.debug.log("common dumex","init Interval");const e=()=>{let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay;if(this.bufferList.length)if(this.dropping){for(e=this.bufferList.shift(),e.type===dt&&0===e.payload[1]&&this._doDecoderDecode(e);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift(),e.type===dt&&0===e.payload[1]&&this._doDecoderDecode(e);e.isIFrame&&this.getDelay(e.ts)<=Math.min(t,200)&&(this.dropping=!1,this._doDecoderDecode(e))}else e=this.bufferList[0],-1===this.getDelay(e.ts)?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t+i?(this.resetDelay(),this.dropping=!0):(e=this.bufferList[0],this.getDelay(e.ts)>t&&(this.bufferList.shift(),this._doDecoderDecode(e)))};e(),this.stopId=setInterval(e,10)}_doDecode(e,t,i,n,r){const o=this.player,a={ts:i,cts:r,type:t,isIFrame:!1};var s,d;if(o._opt.useWCS&&!o._opt.useOffscreen)t===lt&&(a.isIFrame=n),this.pushBuffer(e,a);else if(t===lt)null==o||null===(s=o.decoderWorker)||void 0===s||null===(d=s.decodeVideo)||void 0===d||d.call(s,e,i,n);else if(t===dt){var l,c;if(o._opt.hasAudio)null==o||null===(l=o.decoderWorker)||void 0===l||null===(c=l.decodeAudio)||void 0===c||c.call(l,e,i)}}_doDecoderDecode(e){const t=this.player;var i,n;e.type===dt?t._opt.hasAudio&&(null===(i=t.decoderWorker)||void 0===i||null===(n=i.decodeAudio)||void 0===n||n.call(i,e.payload,e.ts)):e.type}pushBuffer(e,t){t.type===dt?this.bufferList.push({ts:t.ts,payload:e,type:dt}):t.type===lt&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:lt,isIFrame:t.isIFrame})}close(){}}class hi extends ci{constructor(e){super(e),this.input=this._inputFlv(),this.flvDemux=this.dispatchFlvData(this.input),e.debug.log("FlvDemux","init")}destroy(){super.destroy(),this.input=null,this.flvDemux=null,this.player.debug.log("FlvDemux","destroy")}dispatch(e){this.flvDemux(e)}*_inputFlv(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),n=this.player;for(;;){t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const o=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8];let a=i[0];16777215===a&&(t[3]=e[11],a=i[0]);const s=yield o;switch(r){case ct:n._opt.hasAudio&&(n.updateStats({abps:s.byteLength}),s.byteLength>0&&this._doDecode(s,dt,a));break;case ht:if(n._times.demuxStart||(n._times.demuxStart=Nt()),n._opt.hasVideo){n.updateStats({vbps:s.byteLength});const e=s[0]>>4==1;if(s.byteLength>0){i[0]=s[4],i[1]=s[3],i[2]=s[2],i[3]=0;const t=i[0];this._doDecode(s,lt,a,e,t)}}}}}dispatchFlvData(e){let t=e.next(),i=null;return n=>{let r=new Uint8Array(n);if(i){const e=new Uint8Array(i.length+r.length);e.set(i),e.set(r,i.length),r=e,i=null}for(;r.length>=t.value;){const i=r.slice(t.value);t=e.next(r.slice(0,t.value)),r=i}r.length>0&&(i=r)}}close(){var e,t;null===(e=this.input)||void 0===e||null===(t=e.return)||void 0===t||t.call(e,null)}}class ui extends ci{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy"),this.player=null}dispatch(e){const t=this.player,i=new DataView(e),n=i.getUint8(0),r=i.getUint32(1,!1);switch(n){case dt:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,n,r)}break;case lt:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=Nt()),i.byteLength>5){const o=new Uint8Array(e,5),a=i.getUint8(5)>>4==1;t.updateStats({vbps:o.byteLength}),o.byteLength>0&&this._doDecode(o,n,r,a)}else this.player.debug.warn("M7sDemux","dispatch","dv byteLength is",i.byteLength)}}}class Ai{constructor(e){return new(Ai.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return e===Ze?ui:e===Ye?hi:void 0}}const pi=()=>"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,_i=()=>"wakeLock"in navigator;class fi{constructor(e){if(this.player=e,this.enabled=!1,_i()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else pi()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64, "),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64, "),this.noSleepVideo.addEventListener("loadedmetadata",(()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",(()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())}))})))}_addSourceToVideo(e,t,i){const n=document.createElement("source");n.src=i,n.type=`video/${t}`,e.appendChild(n)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(_i())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.error("wakeLock",`${t.name}, ${t.message}`),t}));if(pi())return this.disable(),this.noSleepTimer=window.setInterval((()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve();return this.noSleepVideo.play().then((e=>(this.enabled=!0,e))).catch((e=>{throw this.enabled=!1,e}))}disable(){const e=this.player.debug;_i()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):pi()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}
/*
  *
  * @ezuikit/utils-logger v1.0.1
  * Copyright (c) 2024-3-23 Ezviz-OpenBiz
  * Released under MIT the License.
  *
  */var mi={info:"",log:"background: #4096ff; color: #FFF;",warn:"background: yellow; color: #FFF;",error:"background: red; color: #FFF;"},vi=function(){function e(e){void 0===e&&(e={}),this._options={level:"INFO",showTime:!1},this._levelNum=3,this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0),this.setOptions(e)}var t=e.prototype;return t.setOptions=function(e){var t;this._options=Object.assign({},this._options,e),this._levelNum=this._matchLevel(null!=(t=this._options.level)?t:"INFO"),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0)},t._matchLevel=function(e){var t=3;switch(e){case"INFO":t=3;break;case"LOG":t=2;break;case"WARN":t=1;break;case"ERROR":t=0}return t},t._loggerFactory=function(t,i){var n=console[t];if(i&&n){var r,o=this._options.name?"%c["+this._options.name+"]%c %c["+t.toUpperCase()+"]":"%c["+t.toUpperCase()+"]",a=[this._options.name?"background: green;color: #fff":null,this._options.name?"":null,mi[t]].filter((function(e){return null!=e}));return(r=n).bind.apply(r,[].concat([console,o],a))}return e.noop},t.getOptions=function(){return this._options},t.getVersion=function(){return"1.0.1"},e}();function gi(e){return(e=+e)<10&&(e="0"+e),e+""}vi.noop=function(){};var yi=["info","log","warn","error"];function bi(e){var t=new vi(e);return new Proxy(t,{get:function(e,t){if(yi.includes(t)){var i;if(null==(i=e._options)?void 0:i.showTime){var n=(o=(r=new Date(Date.now())).getFullYear(),a=r.getMonth()+1,s=r.getDate(),d=r.getHours(),l=r.getMinutes(),c=r.getSeconds(),h=r.getMilliseconds(),o+"/"+gi(a)+"/"+gi(s)+" "+gi(d)+":"+gi(l)+":"+gi(c)+":"+h);return e[t].bind(console,"["+n+"]")}return e[t].bind(console)}var r,o,a,s,d,l,c,h;return Reflect.get(e,t)}})}class Ei{constructor(e){this.master=e,this.logger=new bi({name:"FLV",showTime:!0}),console.log(e._opt.loggerOptions)}info(e,...t){this._setLoger()>=4&&this.logger.log(e,...t)}log(e,...t){this._setLoger()>=3&&this.logger.log(e,...t)}warn(e,...t){this._setLoger()>=2&&this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}_setLoger(e){var t,i,n,r,o;if(this.master._opt.debug&&null!==(t=this.master._opt.loggerOptions)&&void 0!==t&&t.level)return"INFO"===(null===(i=this.master._opt.loggerOptions)||void 0===i?void 0:i.level)?4:"LOG"===(null===(n=this.master._opt.loggerOptions)||void 0===n?void 0:n.level)?3:"WARN"===(null===(r=this.master._opt.loggerOptions)||void 0===r?void 0:r.level)?2:"ERROR"===(null===(o=this.master._opt.loggerOptions)||void 0===o?void 0:o.level)?1:5}}class Si{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i,n={}){if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,n)));e.addEventListener(t,i,n);const r=()=>e.removeEventListener(t,i,n);return this.destroys.push(r),r}destroy(){var e;null===(e=this.master.debug)||void 0===e||e.log("Events","destroy"),this.destroys.forEach((e=>e()))}}class wi{constructor(e){this.player=e,((e,t)=>{const{events:{proxy:i}}=e,n=document.createElement("object");n.setAttribute("aria-hidden","true"),n.setAttribute("tabindex",-1),n.type="text/html",n.data="about:blank",Gt(n,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let r=e.width,o=e.height;i(n,"load",(()=>{i(n.contentDocument.defaultView,"resize",(()=>{e.width===r&&e.height===o||(r=e.width,o=e.height,e.emit(mt.resize),s())}))})),e.$container.appendChild(n),e.on(mt.destroy,(()=>{e.$container.removeChild(n)}));const a=i=>{const n=!0===(r=i)||!1===r?i:e.fullscreen;var r;Gt(t.$fullscreenExit,"display",n?"flex":"none"),Gt(t.$fullscreen,"display",n?"none":"flex")},s=()=>{Qt()&&e._opt.useWebFullScreen};try{Ut.on("change",a),e.events.destroys.push((()=>{Ut.off("change",a)}))}catch(e){}e.on(mt.webFullscreen,(e=>{a(e),s()}))})(e,this)}}class Ti extends $t{constructor(e,t,i){var n;super(),this.$container=e,this._opt=t,this.debug=new Ei(this),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0},this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,n=this,Object.defineProperty(n,"rect",{get:()=>{const e=n.$container.getBoundingClientRect();return e.width=Math.max(e.width,n.$container.clientWidth),e.height=Math.max(e.height,n.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(n,e,{get:()=>n.rect[e]})})),this.events=new Si(this),this.video=new i(this),(e=>{try{const t=t=>{Xt(t)===e.$container&&(e.emit(vt.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Ut.on("change",t),e.events.destroys.push((()=>{Ut.off("change",t)}))}catch(e){}e.on(mt.decoderWorkerInit,(()=>{e.debug.log("player","has loaded"),e.loaded=!0})),e.on(mt.play,(()=>{e.loading=!1})),e.on(mt.fullscreen,(t=>{if(t)try{Ut.request(e.$container).then((()=>{})).catch((t=>{Qt()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){Qt()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Ut.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((()=>{e.webFullscreen=!1}))}catch(t){e.webFullscreen=!1}})),Qt()&&e.on(mt.webFullscreen,(t=>{t?e.$container.classList.add("flv-fullscreen-web"):e.$container.classList.remove("flv-fullscreen-web"),e._opt.useWebFullScreen&&Gt(e.$container,t?{position:"fixed",top:"0px",left:"0px",right:"0px",bottom:"0px",height:"100%",width:"100%"}:{position:"relative",top:"",left:"",right:"",bottom:"",height:"",width:""}),e.emit(vt.fullscreen,e.fullscreen)})),e.on(mt.resize,(()=>{var t;null===(t=e.video)||void 0===t||t.resize()}));const t=[mt.timeUpdate];Object.keys(mt).forEach((i=>{e.on(mt[i],(n=>{t.includes(i)||e.debug.log("player events",mt[i],n)}))})),Object.keys(gt).forEach((t=>{e.on(gt[t],(i=>{e.debug.log("player event error",gt[t],i)}))}))})(this),(e=>{const{_opt:t,debug:i,events:{proxy:n}}=e;t.supportDblclickFullscreen&&n(e.$container,"dblclick",(t=>{const i=Xt(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),n(document,"visibilitychange",(()=>{t.hiddenAutoPause&&(i.log("visibilitychange",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),n(window,"fullscreenchange",(()=>{null!==e.keepScreenOn&&"visible"===document.visibilityState&&e.enableWakeLock&&e.enableWakeLock()}))})(this),this.control=new wi(this)}updateOption(e){this._opt=Object.assign({},this._opt,e)}}
/*
  *
  * @ezuikit/utils-collect v0.1.0-beta.1
  * Copyright (c) 2024-7-11 Ezviz-OpenBiz
  * Released under MIT the License.
  *
  */var Bi,ki,Ci,Ri,Oi=(Bi="undefined"!=typeof self?self:window,ki={navigator:void 0!==Bi.navigator?Bi.navigator:{userAgent:""},infoMap:{engine:["WebKit","Trident","Gecko","Presto"],browser:["Safari","Chrome","Edge","IE","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","360","360SE","360EE","UC","QQBrowser","QQ","Baidu","Maxthon","Sogou","LBBROWSER","2345Explorer","TheWorld","XiaoMi","Quark","Qiyu","Wechat","Taobao","Alipay","Weibo","Douban","Suning","iQiYi"],os:["Windows","Linux","Mac OS","Android","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet","iPad"]}},Ci={getMatchMap:function(e){return{Trident:e.indexOf("Trident")>-1||e.indexOf("NET CLR")>-1,Presto:e.indexOf("Presto")>-1,WebKit:e.indexOf("AppleWebKit")>-1,Gecko:e.indexOf("Gecko/")>-1,Safari:e.indexOf("Safari")>-1,Chrome:e.indexOf("Chrome")>-1||e.indexOf("CriOS")>-1,IE:e.indexOf("MSIE")>-1||e.indexOf("Trident")>-1,Edge:e.indexOf("Edge")>-1,Firefox:e.indexOf("Firefox")>-1||e.indexOf("FxiOS")>-1,"Firefox Focus":e.indexOf("Focus")>-1,Chromium:e.indexOf("Chromium")>-1,Opera:e.indexOf("Opera")>-1||e.indexOf("OPR")>-1,Vivaldi:e.indexOf("Vivaldi")>-1,Yandex:e.indexOf("YaBrowser")>-1,Arora:e.indexOf("Arora")>-1,Lunascape:e.indexOf("Lunascape")>-1,QupZilla:e.indexOf("QupZilla")>-1,"Coc Coc":e.indexOf("coc_coc_browser")>-1,Kindle:e.indexOf("Kindle")>-1||e.indexOf("Silk/")>-1,Iceweasel:e.indexOf("Iceweasel")>-1,Konqueror:e.indexOf("Konqueror")>-1,Iceape:e.indexOf("Iceape")>-1,SeaMonkey:e.indexOf("SeaMonkey")>-1,Epiphany:e.indexOf("Epiphany")>-1,360:e.indexOf("QihooBrowser")>-1||e.indexOf("QHBrowser")>-1,"360EE":e.indexOf("360EE")>-1,"360SE":e.indexOf("360SE")>-1,UC:e.indexOf("UC")>-1||e.indexOf(" UBrowser")>-1,QQBrowser:e.indexOf("QQBrowser")>-1,QQ:e.indexOf("QQ/")>-1,Baidu:e.indexOf("Baidu")>-1||e.indexOf("BIDUBrowser")>-1,Maxthon:e.indexOf("Maxthon")>-1,Sogou:e.indexOf("MetaSr")>-1||e.indexOf("Sogou")>-1,LBBROWSER:e.indexOf("LBBROWSER")>-1,"2345Explorer":e.indexOf("2345Explorer")>-1,TheWorld:e.indexOf("TheWorld")>-1,XiaoMi:e.indexOf("MiuiBrowser")>-1,Quark:e.indexOf("Quark")>-1,Qiyu:e.indexOf("Qiyu")>-1,Wechat:e.indexOf("MicroMessenger")>-1,Taobao:e.indexOf("AliApp(TB")>-1,Alipay:e.indexOf("AliApp(AP")>-1,Weibo:e.indexOf("Weibo")>-1,Douban:e.indexOf("com.douban.frodo")>-1,Suning:e.indexOf("SNEBUY-APP")>-1,iQiYi:e.indexOf("IqiyiApp")>-1,Windows:e.indexOf("Windows")>-1,Linux:e.indexOf("Linux")>-1||e.indexOf("X11")>-1,"Mac OS":e.indexOf("Macintosh")>-1,Android:e.indexOf("Android")>-1||e.indexOf("Adr")>-1,Ubuntu:e.indexOf("Ubuntu")>-1,FreeBSD:e.indexOf("FreeBSD")>-1,Debian:e.indexOf("Debian")>-1,"Windows Phone":e.indexOf("IEMobile")>-1||e.indexOf("Windows Phone")>-1,BlackBerry:e.indexOf("BlackBerry")>-1||e.indexOf("RIM")>-1,MeeGo:e.indexOf("MeeGo")>-1,Symbian:e.indexOf("Symbian")>-1,iOS:e.indexOf("like Mac OS X")>-1,"Chrome OS":e.indexOf("CrOS")>-1,WebOS:e.indexOf("hpwOS")>-1,Mobile:e.indexOf("Mobi")>-1||e.indexOf("iPh")>-1||e.indexOf("480")>-1,Tablet:e.indexOf("Tablet")>-1||e.indexOf("Nexus 7")>-1,iPad:e.indexOf("iPad")>-1}},matchInfoMap:function(e){var t,i=(null==(t=ki.navigator)?void 0:t.userAgent)||"",n=Ci.getMatchMap(i);for(var r in ki.infoMap)for(var o=0;o<ki.infoMap[r].length;o++){var a=ki.infoMap[r][o];n[a]&&(e[r]=a)}},getOS:function(){var e=this;return Ci.matchInfoMap(e),null==e?void 0:e.os},getOSVersion:function(){var e=this,t=ki.navigator.userAgent||"";e.osVersion="";var i={Windows:function(){var e=t.replace(/^.*Windows NT ([\d.]+);.*$/,"$1");return{6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"}[e]||e},Android:function(){return t.replace(/^.*Android ([\d.]+);.*$/,"$1")},iOS:function(){return t.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return t.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return t.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return t.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return t.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};return"function"==typeof i[e.os]&&(e.osVersion=i[e.os](),e.osVersion==t&&(e.osVersion="")),e.osVersion},getOrientationStatu:function(){return window.matchMedia("(orientation: portrait)").matches?"vertical":"horizontal"},getDeviceType:function(){var e=this;return e.device="PC",Ci.matchInfoMap(e),e.device},getNetwork:function(){var e,t,i,n;return null==(e=(null==(t=navigator)?void 0:t.connection)||(null==(i=navigator)?void 0:i.mozConnection)||(null==(n=navigator)?void 0:n.webkitConnection))?void 0:e.effectiveType},getLanguage:function(){var e,t,i;return this.language=((i=((null==(e=ki.navigator)?void 0:e.browserLanguage)||(null==(t=ki.navigator)?void 0:t.language)).split("-"))[1]&&(i[1]=i[1].toUpperCase()),i.join("_")),this.language},createFingerprint:function(e){var t=document.createElement("canvas"),i=t.getContext("2d"),n=e||window.location.host;i.textBaseline="top",i.font="14px 'Arial'",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",i.fillText(n,2,15),i.fillStyle="rgba(102, 204, 0, 0.7)",i.fillText(n,4,17);var r=t.toDataURL().replace("data:image/png;base64,","");return function(e){var t,i,n,r="";for(t=0,i=(e+="").length;t<i;t++)r+=(n=e.charCodeAt(t).toString(16)).length<2?"0"+n:n;return r}(atob(r).slice(-16,-12))},getBrowserInfo:function(){var e=this;Ci.matchInfoMap(e);var t=ki.navigator.userAgent||"",i=function(e,t){var i=ki.navigator.mimeTypes;for(var n in i)if(i[n][e]==t)return!0;return!1},n=Ci.getMatchMap(t),r=!1;if(Bi.chrome){var o=t.replace(/^.*Chrome\/([\d]+).*$/,"$1");+o>36&&Bi.showModalDialog?r=!0:+o>45&&(r=i("type","application/vnd.chromium.remoting-viewer"))}if(n.Baidu&&n.Opera&&(n.Baidu=!1),n.Mobile&&(n.Mobile=!t.includes("iPad")),r&&(i("type","application/gameplugin")||ki.navigator&&void 0===ki.navigator.connection.saveData?n["360SE"]=!0:n["360EE"]=!0),n.IE||n.Edge)switch(window.screenTop-window.screenY){case 71:case 74:case 99:case 75:case 105:break;case 102:n["360EE"]=!0;break;case 104:n["360SE"]=!0}var a={Safari:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return t.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return t.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return t.replace(/^.*Edge\/([\d.]+).*$/,"$1")},Firefox:function(){return t.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return t.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return t.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return t.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return t.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return t.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return t.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return t.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return t.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return t.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return t.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return t.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return t.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return t.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return t.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return t.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return t.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return{63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"}[+t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return{69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"}[+t.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return t.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return t.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return t.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return t.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1")},UC:function(){return t.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return t.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},LBBROWSER:function(){return{57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"}[+navigator.userAgent.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"2345Explorer":function(){return t.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1")},TheWorld:function(){return t.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return t.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return t.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return t.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return t.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},Taobao:function(){return t.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return t.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return t.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return t.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return t.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return t.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")}};return e.browserVersion="",a[e.browser]&&(e.browserVersion=a[e.browser](),e.browserVersion==t&&(e.browserVersion="")),"Edge"==e.browser&&(e.engine="EdgeHTML"),"Chrome"==e.browser&&parseInt(e.browserVersion)>27&&(e.engine="Blink"),"Opera"==e.browser&&parseInt(e.browserVersion)>12&&(e.engine="Blink"),"Yandex"==e.browser&&(e.engine="Blink"),e.browser+" （version: "+e.browserVersion+"; kernel: "+e.engine+"）"}},Ri={DeviceInfoObj:function(e){var t,i=function(t){var i;null==(i=e.info)||i.forEach((function(e){e.toLowerCase()===t.toLowerCase()&&(r[t]=n[t])}))};e=e||{domain:""};var n={deviceType:Ci.getDeviceType(),OS:Ci.getOS(),OSVersion:Ci.getOSVersion(),sh:Bi.screen.height,sw:Bi.screen.width,lang:Ci.getLanguage(),netWork:Ci.getNetwork(),orientation:Ci.getOrientationStatu(),browserInfo:Ci.getBrowserInfo(),fingerprint:Ci.createFingerprint(e.domain),userAgent:null==(t=ki.navigator)?void 0:t.userAgent};if(!e.info||0===e.info.length)return n;var r={};for(var o in n)i(o);return r}},{getDeviceInfo:function(e){return Ri.DeviceInfoObj(e)}}),Ii=function(){function e(){}return e.add=function(t,i){e.queues.push({url:t,data:i})},e.fire=function(){if(e.queues&&0!==e.queues.length){e.isStop=!1;var t=e.queues[0];t.url&&e.api.report(t.data),e.queues.splice(0,1),e.fire()}else e.isStop=!0},e}();Ii.isStop=!0,Ii.queues=[];var xi=function(){function e(e){this.url=e}var t=e.prototype;return t.report=function(e){this.checkUrl(this.url)&&this.sendInfo(e)},t.sendInfo=function(e){navigator.sendBeacon?this.sendBeacon(this.url,e):this.sendImage(this.url,e)},t.sendImage=function(e,t){var i=this.changeJSON2Query(t),n=new Image;n.onload=n.onerror=function(){n=null},n.src=e+"?"+i+"&random="+Math.random()},t.sendBeacon=function(e,t){try{navigator.sendBeacon(e,this.formatParamsByURLSearchParams(t))}catch(e){}},t.formatParamsByURLSearchParams=function(e){var t=new URLSearchParams;for(var i in e)"object"==typeof e[i]&&(e[i]=JSON.stringify(e[i])),t.append(i,e[i]);return t},t.changeJSON2Query=function(e){var t="";for(var i in e){""!=t&&(t+="&");var n=e[i];t+=i+"="+encodeURIComponent("object"==typeof n?JSON.stringify(n):n)}return t},t.checkUrl=function(e){return!!e&&/^[hH][tT][tT][pP]([sS]?):\/\//.test(e)},e}();function Di(){return Di=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},Di.apply(this,arguments)}var Li=function(){function e(e){this.options=e,this.extendsInfo=e.extendsInfo||{},this.clientInfo=this._getDeviceInfo(),Ii.api=new xi(e.url)}var t=e.prototype;return t.send=function(e){return this.options.forbidden||"object"!=typeof e||(this._handleRecordError(e),Ii.isStop&&Ii.fire()),this},t.setForbidden=function(e){this.options.forbidden=e},t.updateExtendsInfo=function(e){void 0===e&&(e={}),this.extendsInfo=Di({},this.extendsInfo||{},e)},t._handleRecordError=function(e){try{var t=this._handleErrorInfo(e);Ii.add(this.options.url,t)}catch(e){}},t._handleErrorInfo=function(e){var t=this._getExtendsInfo(),i=Di({st:(new Date).getTime()},t,e);return i.clientInfo=this.clientInfo,i},t._getExtendsInfo=function(){try{var e,t={},i=this.extendsInfo||{};for(var n in"function"==typeof i.getDynamic&&(e=i.getDynamic()),"[object Object]"===Object.prototype.toString.call(e)&&(i=Di({},i,e)),i)"function"!=typeof i[n]&&(t[n]=i[n]);return t}catch(e){return{}}},t._getDeviceInfo=function(){try{var e=Oi.getDeviceInfo();return JSON.stringify(e)}catch(e){return""}},e}();function Mi(e){if(/http[s]?:\/\/|ws[s]?:\/\//.test(e)){const t=e.split("?")[1],i=t?t.split("&"):[],n={};for(let e=0;e<i.length;++e){const[t,r]=i[e].split("=");n[t]=n[t]||decodeURIComponent(r)}try{const t=e.split(".flv")[0].split("/"),i=t[t.length-1].split("_");t.length>0&&i[0]&&i[1]&&i[2]&&(n.serial=i[0],n.no=i[1],n.bitstream=i[2])}catch(e){}return n}return{}}class Pi{static initMonitor(e){Pi.collect=new Li({forbidden:e,url:"https://log.ys7.com/statistics.do/opensdk_ezuikit",jsError:!1,promiseError:!1,resourceError:!1,extendsInfo:{protocol:"flv",v:"1.0.2-beta.5"}})}static report(e,t={}){Pi.collect||Pi.initMonitor();try{const i=Mi(Pi.url);Pi.collect.send({url:Pi.url,serial:i.serial,no:i.no,action:e,logInfo:t})}catch(e){}}}class Ui extends Ti{constructor(e,t){super(e,t,ni),this._opt.useMSE=!1,this._opt.hasAudio&&(this.audio=new oi(this)),this.decoderWorker=new li(this),this.stream=null,this.demux=null,this._lastVolume=null,Qt()&&(this.keepScreenOn=new fi(this)),this._opt.hasAudio&&this._opt.volume>0&&(this.volume=this._opt.volume)}destroy(){this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=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.demux&&(this.demux.destroy(),this.demux=null),this.events&&(this.events.destroy(),this.events=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}set fullscreen(e){Qt()&&this._opt.useWebFullScreen?(this.emit(mt.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(mt.fullscreen,e)}get fullscreen(){return zt()||this.webFullscreen}set webFullscreen(e){this.emit(mt.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("flv-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(mt.playing,e),this.emit(mt.volumechange,this.volume),e?this.emit(mt.play):this.emit(mt.pause))}get playing(){return this._playing}get volume(){var e;return+((null===(e=this.audio)||void 0===e?void 0:e.volume)||0).toFixed(2)||0}set volume(e){var t;e!==this.volume&&(null===(t=this.audio)||void 0===t||t.setVolume(e),this._lastVolume=e)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(mt.loading,this._loading))}get loading(){return this._loading}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(mt.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}init(){return new Promise(((e,t)=>{this.stream||(this.stream=new di(this)),this.audio||this._opt.hasAudio&&(this.audio=new oi(this)),this.demux||(this.demux=new Ai(this)),this.decoderWorker?e():(this.decoderWorker=new li(this),this.once(mt.decoderWorkerInit,(()=>{e()})))}))}play(e){return this._opt=Object.assign({},this._opt,e||{}),this.clearCheckHeartTimeout(),new Promise(((e,t)=>{if(!this._opt.url)return t();this.loading=!0,this.playing=!1,this._times.playInitStart=Nt(),this.init().then((()=>{this._times.playStart=Nt(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock();try{this.stream.fetchStream(this._opt.url,this._opt)}catch(e){}this.checkLoadingTimeout(),this.stream.once(gt.fetchError,(e=>{t(e)})),this.stream.once(gt.websocketError,(e=>{t(e)})),this.stream.once(mt.streamEnd,(()=>{t()})),this.stream.once(mt.streamSuccess,(()=>{e(),this._times.streamResponse=Nt(),this.video.play(),this.checkStatsInterval()}))})).catch((e=>{t(e)})),this._resumeAudioAfterPause()}))}close(){return new Promise((e=>{this._close().then((()=>{this.video&&this.video.clearView(),e()}))}))}_resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise((e=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.playing=!1,this.loading=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout((()=>{e()}),0)}))}pause(e=!1){return e?this.close():this._close()}mute(e){this.volume=e?0:.5,this.audio&&this.audio.mute(e)}resize(){this.$container.style.width=(this._opt.width||this.width)+"px",this.$container.style.height=(this._opt.height||this.height)+"px",this.video.resize()}_onlyMseOrWcsVideo(){return!1===this._opt.hasAudio&&(this._opt.useMSE||this._opt.useWCS&&!this._opt.useOffscreen)}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout&&this.clearCheckHeartTimeout(),this._checkHeartTimeout=setTimeout((()=>{if(this._checkHeartTimeout&&this.clearCheckHeartTimeout(),this.playing){if(0!==this._stats.fps)return;this.pause().then((()=>{this.emit(mt.timeout,mt.delayTimeout),this.emit(mt.delayTimeout)}))}}),1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||(this.clearCheckLoadingTimeout(),this.pause().then((()=>{this.emit(mt.timeout,mt.loadingTimeout),this.emit(mt.loadingTimeout)})).catch((()=>{})))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.loading&&(this.emit(mt.start),this.loading=!1),this.clearCheckLoadingTimeout(),this.playing||(this.playing=!0),this.checkHeart()}updateStats(e){e=e||{},this._startBpsTime||(this._startBpsTime=Nt()),qt(e.ts)&&(this._stats.ts=e.ts),qt(e.buf)&&(this._stats.buf=e.buf),e.fps&&(this._stats.fps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps);const t=Nt();t-this._startBpsTime<1e3||(this.emit(mt.stats,this._stats),this._stats.fps=0,this._stats.abps=0,this._stats.vbps=0,this._startBpsTime=t)}resetStats(){this._startBpsTime=null,this._stats={buf:0,fps:0,abps:0,vbps:0,ts:0}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}handlePlayToRenderTimes(){const e=this._times;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,this.emit(mt.playToRenderTimes,e)}getOption(){return this._opt}emitError(e,t=""){Pi.report(51,{event:e,value:t}),this.emit(mt.error,e,t),this.emit(e,t)}}var Fi={exports:{}};!function(e,t){!function(t,i){e.exports=i()}(globalThis,(()=>(()=>{var e={343:e=>{var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new r(n,o||e,a),d=i?i+t:t;return e._events[d]?e._events[d].fn?e._events[d]=[e._events[d],s]:e._events[d].push(s):(e._events[d]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var d,l,c=this._events[s],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){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,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,o),!0;case 6:return c.fn.call(c.context,t,n,r,o,a),!0}for(l=1,d=new Array(h-1);l<h;l++)d[l-1]=arguments[l];c.fn.apply(c.context,d)}else{var u,A=c.length;for(l=0;l<A;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!d)for(u=1,d=new Array(h-1);u<h;u++)d[u-1]=arguments[u];c[l].fn.apply(c[l].context,d)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||n&&s.context!==n||a(this,o);else{for(var d=0,l=[],c=s.length;d<c;d++)(s[d].fn!==t||r&&!s[d].once||n&&s[d].context!==n)&&l.push(s[d]);l.length?this._events[o]=1===l.length?l[0]:l:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s},825:(e,t,i)=>{i.d(t,{A:()=>n});const n=function(){function e(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return e.prototype.isComplete=function(){return!this.hasAudio||this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&this.audioChannelCount,!this.hasVideo||this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&this.sarDen,null!=this.mimeType},e.prototype.isSeekable=function(){return this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,n=e.length-1,r=0,o=0,a=n;for(t<e[0]&&(i=0,o=a+1);o<=a;){if((r=o+Math.floor((a-o)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?o=r+1:a=r-1}return i},e}()},453:(e,t,i)=>{i.d(t,{$_:()=>n,EX:()=>o,EZ:()=>r,Sc:()=>a});var n=function(e,t,i,n,r){this.dts=e,this.pts=t,this.duration=i,this.originalDts=n,this.isSyncPoint=r,this.fileposition=null},r=function(){function e(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),o=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0===this._list.length)return null;var t=this._list,i=0,n=t.length-1,r=0,o=0,a=n;for(e<t[0].dts&&(i=0,o=a+1);o<=a;){if((r=o+Math.floor((a-o)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?o=r+1:a=r-1}return this._list[i]},e}(),a=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t,i=this._list;if(0===i.length)return-2;var n=i.length-1,r=0,o=0,a=n,s=0;if(e<i[0].originalBeginDts)return-1;for(;o<=a;){if((r=o+Math.floor((a-o)/2))===n||e>((null===(t=i[r].lastSample)||void 0===t?void 0:t.originalDts)||0)&&e<i[r+1].originalBeginDts){s=r;break}i[r].originalBeginDts<e?o=r+1:a=r-1}return s},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t,i,n=this._list,r=e,o=this._lastAppendLocation,a=0;-1!==o&&o<n.length&&r.originalBeginDts>=((null===(i=null===(t=n[o])||void 0===t?void 0:t.lastSample)||void 0===i?void 0:i.originalDts)||0)&&(o===n.length-1||o<n.length-1&&r.originalBeginDts<n[o+1].originalBeginDts)?a=o+1:n.length>0&&(a=this._searchNearestSegmentBefore(r.originalBeginDts)+1),this._lastAppendLocation=a,this._list.splice(a,0,r)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},976:(e,t,i)=>{i.d(t,{A:()=>Me});var n=i(413),r=i(502),o=i(620),a=i(825);function s(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}const d=function(e){for(var t=[],i=e,n=0,r=e.length;n<r;)if(i[n]<128)t.push(String.fromCharCode(i[n])),++n;else{if(i[n]<192);else if(i[n]<224){if(s(i,n,1)&&(o=(31&i[n])<<6|63&i[n+1])>=128){t.push(String.fromCharCode(65535&o)),n+=2;continue}}else if(i[n]<240){if(s(i,n,2)&&(o=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2])>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),n+=3;continue}}else if(i[n]<248){var o;if(s(i,n,3)&&(o=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3])>65536&&o<1114112){o-=65536,t.push(String.fromCharCode(o>>>10|55296)),t.push(String.fromCharCode(1023&o|56320)),n+=4;continue}}t.push(String.fromCharCode(65533)),++n}return t.join("")};var l,c=i(713),h=(l=new ArrayBuffer(2),new DataView(l).setInt16(0,256,!0),256===new Int16Array(l)[0]);const u=function(){function e(){}return e.parseScriptData=function(t,i,n){var o={};try{var a=e.parseValue(t,i,n),s=e.parseValue(t,i+a.size,n-a.size);o[a.data]=s.data}catch(e){r.A.e("AMF",e.toString())}return o},e.parseObject=function(t,i,n){if(n<3)throw new c.j4("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),o=e.parseValue(t,i+r.size,n-r.size),a=o.objectEnd;return{data:{name:r.data,value:o.data},size:r.size+o.size,objectEnd:a}},e.parseVariable=function(t,i,n){return e.parseObject(t,i,n)},e.parseString=function(e,t,i){if(i<2)throw new c.j4("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!h);return{data:n>0?d(new Uint8Array(e,t+2,n)):"",size:2+n}},e.parseLongString=function(e,t,i){if(i<4)throw new c.j4("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!h);return{data:n>0?d(new Uint8Array(e,t+4,n)):"",size:4+n}},e.parseDate=function(e,t,i){if(i<10)throw new c.j4("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!h),o=n.getInt16(8,!h);return{data:new Date(r+=60*o*1e3),size:10}},e.parseValue=function(t,i,n){if(n<1)throw new c.j4("Data not enough when parse Value");var o,a=new DataView(t,i,n),s=1,d=a.getUint8(0),l=!1;try{switch(d){case 0:o=a.getFloat64(1,!h),s+=8;break;case 1:o=!!a.getUint8(1),s+=1;break;case 2:var u=e.parseString(t,i+1,n-1);o=u.data,s+=u.size;break;case 3:o={};var A=0;for(9==(16777215&a.getUint32(n-4,!h))&&(A=3);s<n-4;){var p=e.parseObject(t,i+s,n-s-A);if(p.objectEnd)break;o[p.data.name]=p.data.value,s+=p.size}s<=n-3&&9==(16777215&a.getUint32(s-1,!h))&&(s+=3);break;case 8:for(o={},s+=4,A=0,9==(16777215&a.getUint32(n-4,!h))&&(A=3);s<n-8;){var _=e.parseVariable(t,i+s,n-s-A);if(_.objectEnd)break;o[_.data.name]=_.data.value,s+=_.size}s<=n-3&&9==(16777215&a.getUint32(s-1,!h))&&(s+=3);break;case 9:o=void 0,s=1,l=!0;break;case 10:o=[];var f=a.getUint32(1,!h);s+=4;for(var m=0;m<f;m++){var v=e.parseValue(t,i+s,n-s);o.push(v.data),s+=v.size}break;case 11:var g=e.parseDate(t,i+1,n-1);o=g.data,s+=g.size;break;case 12:var y=e.parseString(t,i+1,n-1);o=y.data,s+=y.size;break;default:s=n,r.A.w("AMF","Unsupported AMF value type "+d.toString())}}catch(e){r.A.e("AMF",e.toString())}return{data:o,size:s,objectEnd:l}},e}(),A=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e,t=this._total_bytes-this._buffer_index;if(t<=0)throw new c.j4("ExpGolomb: _fillCurrentWord() but no bytes available");var i=Math.min(4,t),n=new Uint8Array(4);n.set(null===(e=this._buffer)||void 0===e?void 0:e.subarray(this._buffer_index,this._buffer_index+i)),this._current_word=new DataView(n.buffer).getUint32(0,!1),this._buffer_index+=i,this._current_word_bits_left=8*i},e.prototype.readBits=function(e){if(e>32)throw new c.Qn("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var n=e-this._current_word_bits_left;this._fillCurrentWord();var r=Math.min(n,this._current_word_bits_left),o=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,i<<r|o},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(this._current_word&2147483648>>>e)return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),p=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,o=0;o<i;o++)o>=2&&3===t[o]&&0===t[o-1]&&0===t[o-2]||(n[r]=t[o],r++);return new Uint8Array(n.buffer,0,r)},e.parseSPS=function(t){for(var i=t.subarray(1,4),n="avc1.",r=0;r<3;r++){var o=i[r].toString(16);o.length<2&&(o="0"+o),n+=o}var a=e._ebsp2rbsp(t),s=new A(a);s.readByte();var d=s.readByte();s.readByte();var l=s.readByte();s.readUEG();var c=e.getProfileString(d),h=e.getLevelString(l),u=1,p=420,_=8,f=8;if((100===d||110===d||122===d||244===d||44===d||83===d||86===d||118===d||128===d||138===d||144===d)&&(3===(u=s.readUEG())&&s.readBits(1),u<=3&&(p=[0,420,422,444][u]),_=s.readUEG()+8,f=s.readUEG()+8,s.readBits(1),s.readBool()))for(var m=3!==u?8:12,v=0;v<m;v++)s.readBool()&&(v<6?e._skipScalingList(s,16):e._skipScalingList(s,64));s.readUEG();var g=s.readUEG();if(0===g)s.readUEG();else if(1===g){s.readBits(1),s.readSEG(),s.readSEG();var y=s.readUEG();for(v=0;v<y;v++)s.readSEG()}var b=s.readUEG();s.readBits(1);var E=s.readUEG(),S=s.readUEG(),w=s.readBits(1);0===w&&s.readBits(1),s.readBits(1);var T=0,B=0,k=0,C=0;s.readBool()&&(T=s.readUEG(),B=s.readUEG(),k=s.readUEG(),C=s.readUEG());var R=1,O=1,I=0,x=!0,D=0,L=0;if(s.readBool()){if(s.readBool()){var M=s.readByte();M>0&&M<16?(R=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][M-1],O=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][M-1]):255===M&&(R=s.readByte()<<8|s.readByte(),O=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){var P=s.readBits(32),U=s.readBits(32);x=s.readBool(),I=(D=U)/(L=2*P)}}var F=1;1===R&&1===O||(F=R/O);var V=0,N=0;0===u?(V=1,N=2-w):(V=3===u?1:2,N=(1===u?2:1)*(2-w));var G=16*(E+1),W=16*(S+1)*(2-w);G-=(T+B)*V,W-=(k+C)*N;var j=Math.ceil(G*F);return s.destroy(),s=null,{codec_mimetype:n,profile_idc:d,level_idc:l,profile_string:c,level_string:h,chroma_format_idc:u,bit_depth:_,bit_depth_luma:_,bit_depth_chroma:f,ref_frames:b,chroma_format:p,chroma_format_string:e.getChromaFormatString(p),frame_rate:{fixed:x,fps:I,fps_den:L,fps_num:D},sar_ratio:{width:R,height:O},codec_size:{width:G,height:W},present_size:{width:j,height:W}}},e._skipScalingList=function(e,t){for(var i=8,n=8,r=0;r<t;r++)0!==n&&(n=(i+e.readSEG()+256)%256),i=0===n?i:n},e.getProfileString=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"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=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"}},e}();var _=i(465);const f=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,o=0;o<i;o++)o>=2&&3===t[o]&&0===t[o-1]&&0===t[o-2]||(n[r]=t[o],r++);return new Uint8Array(n.buffer,0,r)},e.parseVPS=function(t){var i=e._ebsp2rbsp(t),n=new A(i);return n.readByte(),n.readByte(),n.readBits(4),n.readBits(2),n.readBits(6),{num_temporal_layers:n.readBits(3)+1,temporal_id_nested:n.readBool()}},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),n=new A(i);n.readByte(),n.readByte();for(var r=0,o=0,a=0,s=0,d=(n.readBits(4),n.readBits(3)),l=(n.readBool(),n.readBits(2)),c=n.readBool(),h=n.readBits(5),u=n.readByte(),p=n.readByte(),_=n.readByte(),f=n.readByte(),m=n.readByte(),v=n.readByte(),g=n.readByte(),y=n.readByte(),b=n.readByte(),E=n.readByte(),S=n.readByte(),w=[],T=[],B=0;B<d;B++)w.push(n.readBool()),T.push(n.readBool());if(d>0)for(B=d;B<8;B++)n.readBits(2);for(B=0;B<d;B++)w[B]&&(n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte(),n.readByte()),T[B]&&n.readByte();n.readUEG();var k=n.readUEG();3===k&&n.readBits(1);var C=n.readUEG(),R=n.readUEG();n.readBool()&&(r+=n.readUEG(),o+=n.readUEG(),a+=n.readUEG(),s+=n.readUEG());var O=n.readUEG(),I=n.readUEG(),x=n.readUEG();for(B=n.readBool()?0:d;B<=d;B++)n.readUEG(),n.readUEG(),n.readUEG();if(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readBool()&&n.readBool())for(var D=0;D<4;D++)for(var L=0;L<(3===D?2:6);L++)if(n.readBool()){var M=Math.min(64,1<<4+(D<<1));for(D>1&&n.readSEG(),B=0;B<M;B++)n.readSEG()}else n.readUEG();n.readBool(),n.readBool(),n.readBool()&&(n.readByte(),n.readUEG(),n.readUEG(),n.readBool());var P=n.readUEG(),U=0;for(B=0;B<P;B++){var F=!1;if(0!==B&&(F=n.readBool()),F){B===P&&n.readUEG(),n.readBool(),n.readUEG();for(var V=0,N=0;N<=U;N++){var G=n.readBool(),W=!1;G||(W=n.readBool()),(G||W)&&V++}U=V}else{var j=n.readUEG(),Q=n.readUEG();for(U=j+Q,N=0;N<j;N++)n.readUEG(),n.readBool();for(N=0;N<Q;N++)n.readUEG(),n.readBool()}}if(n.readBool()){var z=n.readUEG();for(B=0;B<z;B++){for(N=0;N<x+4;N++)n.readBits(1);n.readBits(1)}}var H=0,q=1,X=1,$=!1,Y=1,Z=1;if(n.readBool(),n.readBool(),n.readBool()){if(n.readBool()){var K=n.readByte();K>0&&K<=16?(q=[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&&(q=n.readBits(16),X=n.readBits(16))}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(3),n.readBool(),n.readBool()&&(n.readByte(),n.readByte(),n.readByte())),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool(),n.readBool(),n.readBool(),n.readBool()&&(n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG()),n.readBool()&&(Y=n.readBits(32),Z=n.readBits(32),n.readBool()&&n.readUEG(),n.readBool())){var J,ee,te=!1;for(J=n.readBool(),ee=n.readBool(),(J||ee)&&((te=n.readBool())&&(n.readByte(),n.readBits(5),n.readBool(),n.readBits(5)),n.readBits(4),n.readBits(4),te&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5)),B=0;B<=d;B++){var ie=n.readBool();$=ie;var ne=!1,re=1;ie||(ne=n.readBool());var oe=!1;if(ne?n.readSEG():oe=n.readBool(),oe||(re=n.readUEG()+1),J)for(N=0;N<re;N++)n.readUEG(),n.readUEG(),te&&(n.readUEG(),n.readUEG());if(ee)for(N=0;N<re;N++)n.readUEG(),n.readUEG(),te&&(n.readUEG(),n.readUEG())}}n.readBool()&&(n.readBool(),n.readBool(),n.readBool(),H=n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG())}n.readBool();var ae="hvc1.".concat(h,".1.L").concat(S,".B0"),se=C-(r+o)*(1===k||2===k?2:1),de=R-(a+s)*(1===k?2:1),le=1;return 1!==q&&1!==X&&(le=q/X),n.destroy(),n=null,{codec_mimetype:ae,level_string:e.getLevelString(S),profile_idc:h,bit_depth:O+8,ref_frames:1,chroma_format:k,chroma_format_string:e.getChromaFormatString(k),general_level_idc:S,general_profile_space:l,general_tier_flag:c,general_profile_idc:h,general_profile_compatibility_flags_1:u,general_profile_compatibility_flags_2:p,general_profile_compatibility_flags_3:_,general_profile_compatibility_flags_4:f,general_constraint_indicator_flags_1:m,general_constraint_indicator_flags_2:v,general_constraint_indicator_flags_3:g,general_constraint_indicator_flags_4:y,general_constraint_indicator_flags_5:b,general_constraint_indicator_flags_6:E,min_spatial_segmentation_idc:H,constant_frame_rate:0,chroma_format_idc:k,bit_depth_luma_minus8:O,bit_depth_chroma_minus8:I,frame_rate:{fixed:$,fps:Z/Y,fps_den:Y,fps_num:Z},sar_ratio:{width:q,height:X},codec_size:{width:se,height:de},present_size:{width:se*le,height:de}}},e.parsePPS=function(t){var i=e._ebsp2rbsp(t),n=new A(i);n.readByte(),n.readByte(),n.readUEG(),n.readUEG(),n.readBool(),n.readBool(),n.readBits(3),n.readBool(),n.readBool(),n.readUEG(),n.readUEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool()&&n.readUEG(),n.readSEG(),n.readSEG(),n.readBool(),n.readBool(),n.readBool(),n.readBool();var r=n.readBool(),o=n.readBool(),a=1;return o&&r?a=0:o?a=3:r&&(a=2),{parallelismType:a}},e.getChromaFormatString=function(e){switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},e.getProfileString=function(e){switch(e){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}},e.getLevelString=function(e){return(e/30).toFixed(1)},e}();function m(e){return e.byteOffset%2==0&&e.byteLength%2==0}function v(e){return e.byteOffset%4==0&&e.byteLength%4==0}function g(e,t){for(var i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}const y=function(e,t){return e.byteLength===t.byteLength&&(v(e)&&v(t)?function(e,t){return g(new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4),new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4))}(e,t):m(e)&&m(t)?function(e,t){return g(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2))}(e,t):function(e,t){return g(e,t)}(e,t))},b=function(){function e(){}return e.parseOBUs=function(t){for(var i=null,n=0;n<t.byteLength;){t[n];var r=(120&t[n])>>3,o=!!(4&t[n]),a=!!(2&t[n]);t[n],n+=1,o&&(n+=1);var s=Number.POSITIVE_INFINITY;if(a){s=0;for(var d=0;s|=(127&t[n])<<7*d,128&t[n+=1];d++);}1===r&&(i=e.parseSeuqneceHeader(t.subarray(n,n+s))),n+=s}return i},e.parseSeuqneceHeader=function(t){var i=new A(t),n=i.readBits(3),r=(i.readBool(),i.readBool()),o=!0,a=0,s=0,d=[];if(r)d.push({operating_point_idc:0,level:i.readBits(5),tier:0});else{if(i.readBool()){var l=i.readBits(32),c=i.readBits(32),h=i.readBool();if(h){for(var u=0;0===i.readBits(1);)u+=1;u>=32||i.readBits(u)}a=c,s=l,o=h,i.readBool()&&(i.readBits(5),i.readBits(32),i.readBits(5),i.readBits(5))}for(var p=i.readBool(),_=i.readBits(5),f=0;f<=_;f++){var m=i.readBits(12),v=i.readBits(5),g=v>7?i.readBits(1):0;d.push({operating_point_idc:m,level:v,tier:g}),p&&i.readBool()&&i.readBits(4)}}var y=d[0],b=y.level,E=y.tier,S=i.readBits(4),w=i.readBits(4),T=i.readBits(S+1)+1,B=i.readBits(w+1)+1,k=!1;r||(k=i.readBool()),k&&(i.readBits(4),i.readBits(4)),i.readBool(),i.readBool(),i.readBool();var C=!1;r||(i.readBool(),i.readBool(),i.readBool(),i.readBool(),(C=i.readBool())&&(i.readBool(),i.readBool()),(i.readBool()||i.readBits(1))&&(i.readBool()||i.readBits(1)),C&&i.readBits(3)),i.readBool(),i.readBool(),i.readBool();var R=i.readBool(),O=8;O=2===n&&R?i.readBool()?12:10:R?10:8;var I=!1;1!==n&&(I=i.readBool()),i.readBool()&&(i.readBits(8),i.readBits(8),i.readBits(8));var x=1,D=1;return I?(i.readBits(1),x=1,D=1):(i.readBits(1),0===n?(x=1,D=1):1===n?(x=0,D=0):12===O?i.readBits(1)&&i.readBits(1):(x=1,D=0),x&&D&&i.readBits(2),i.readBits(1)),i.readBool(),i.destroy(),i=null,{codec_mimetype:"av01.".concat(n,".").concat(e.getLevelString(b,E),".").concat(O.toString(10).padStart(2,"0")),level:b,tier:E,level_string:e.getLevelString(b,E),profile_idc:n,profile_string:"".concat(n),bit_depth:O,ref_frames:1,chroma_format:e.getChromaFormat(I,x,D),chroma_format_string:e.getChromaFormatString(I,x,D),frame_rate:{fixed:o,fps:a/s,fps_den:s,fps_num:a},sar_ratio:{width:1,height:1},codec_size:{width:T,height:B},present_size:{width:1*T,height:B}}},e.getLevelString=function(e,t){return"".concat(e.toString(10).padStart(2,"0")).concat(0===t?"M":"H")},e.getChromaFormat=function(e,t,i){return e?0:0===t&&0===i?3:1===t&&0===i?2:1===t&&1===i?1:Number.NaN},e.getChromaFormatString=function(e,t,i){return e?"4:0:0":0===t&&0===i?"4:4:4":1===t&&0===i?"4:2:2":1===t&&1===i?"4:2:0":"Unknown"},e}();var E=function(){function e(e,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new a.A,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}()}return e.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},e.probe=function(e){var t=new Uint8Array(e);if(t.byteLength<9)return{needMoreData:!0};var i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var n,r=(4&t[4])>>>2!=0,o=!!(1&t[4]),a=(n=t)[5]<<24|n[6]<<16|n[7]<<8|n[8];return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:r,hasVideoTrack:o}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo&&(this._mediaInfo.duration=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo&&(this._mediaInfo.hasAudio=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo&&(this._mediaInfo.hasVideo=e)},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new a.A},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){var n,o;if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new c.j4("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var a=0,s=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;var d=e.probe(t);a=(null==d?void 0:d.dataOffset)||0}for(this._firstParse&&(this._firstParse=!1,i+a!==this._dataOffset&&r.A.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(l=new DataView(t,a)).getUint32(0,!s)&&r.A.w(this.TAG,"PrevTagSize0 !== 0 !!!"),a+=4);a<t.byteLength;){this._dispatch=!0;var l=new DataView(t,a);if(a+11+4>t.byteLength)break;var h=l.getUint8(0),u=16777215&l.getUint32(0,!s);if(a+11+u+4>t.byteLength)break;if(8===h||9===h||18===h){var A=l.getUint8(4),p=l.getUint8(5),_=l.getUint8(6)|p<<8|A<<16|l.getUint8(7)<<24;16777215&l.getUint32(7,!s)&&r.A.w(this.TAG,"Meet tag which has StreamID != 0!");var f=a+11;switch(h){case 8:this._parseAudioData(t,f,u,_);break;case 9:this._parseVideoData(t,f,u,_,i+a);break;case 18:this._parseScriptData(t,f,u)}var m=l.getUint32(11+u,!s);m!==11+u&&r.A.w(this.TAG,"Invalid PrevTagSize ".concat(m)),a+=11+u+4}else r.A.w(this.TAG,"Unsupported tag type ".concat(h,", skipped")),a+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&((null===(n=this._audioTrack)||void 0===n?void 0:n.length)||(null===(o=this._videoTrack)||void 0===o?void 0:o.length))&&this._onDataAvailable(this._audioTrack,this._videoTrack),a},e.prototype._parseScriptData=function(e,t,i){var n,o,a,s=u.parseScriptData(e,t,i);if(s.hasOwnProperty("onMetaData")){if(null==s.onMetaData||"object"!=typeof s.onMetaData)return void r.A.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&r.A.w(this.TAG,"Found another onMetaData tag!"),this._metadata=s;var d=null===(n=this._metadata)||void 0===n?void 0:n.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},d)),"boolean"==typeof(null==d?void 0:d.hasAudio)&&(this._hasAudioFlagOverrided||(this._hasAudio=d.hasAudio,this._mediaInfo&&(this._mediaInfo.hasAudio=this._hasAudio))),"boolean"==typeof(null==d?void 0:d.hasVideo)&&(this._hasVideoFlagOverrided||(this._hasVideo=d.hasVideo,this._mediaInfo&&(this._mediaInfo.hasVideo=this._hasVideo))),"number"==typeof(null==d?void 0:d.audiodatarate)&&this._mediaInfo&&(this._mediaInfo.audioDataRate=d.audiodatarate),"number"==typeof(null==d?void 0:d.videodatarate)&&this._mediaInfo&&(this._mediaInfo.videoDataRate=d.videodatarate),"number"==typeof(null==d?void 0:d.width)&&this._mediaInfo&&(this._mediaInfo.width=d.width),"number"==typeof(null==d?void 0:d.height)&&this._mediaInfo&&(this._mediaInfo.height=d.height),"number"==typeof(null==d?void 0:d.duration)){if(!this._durationOverrided){var l=Math.floor(d.duration*this._timescale);this._duration=l,this._mediaInfo&&(this._mediaInfo.duration=l)}}else this._mediaInfo&&(this._mediaInfo.duration=0);if("number"==typeof(null==d?void 0:d.framerate)){var c=Math.floor(1e3*d.framerate);if(c>0){var h=c/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=h,this._referenceFrameRate.fps_num=c,this._referenceFrameRate.fps_den=1e3,this._mediaInfo&&(this._mediaInfo.fps=h)}}if("object"==typeof(null==d?void 0:d.keyframes)){this._mediaInfo&&(this._mediaInfo.hasKeyframesIndex=!0);var A=d.keyframes;this._mediaInfo&&(this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(A)),d.keyframes=null}else this._mediaInfo&&(this._mediaInfo.hasKeyframesIndex=!1);this._dispatch=!1,this._mediaInfo&&(this._mediaInfo.metadata=d),r.A.v(this.TAG,"Parsed onMetaData"),(null===(o=this._mediaInfo)||void 0===o?void 0:o.isComplete())&&(null===(a=this._onMediaInfo)||void 0===a||a.call(this,this._mediaInfo))}Object.keys(s).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},s))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],n=1;n<e.times.length;n++){var r=this._timestampBase+Math.floor(1e3*e.times[n]);t.push(r),i.push(e.filepositions[n])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,n){var o,a,s,d,l,c,h,u,A,p;if(i<=1)r.A.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var f=new DataView(e,t,i).getUint8(0),m=f>>>4;if(2===m||10===m){var v=0,g=(12&f)>>>2;if(g>=0&&g<=4){v=this._flvSoundRateTable[g];var b=1&f,E=this._audioMetadata,S=this._audioTrack;if(E||(!1!==this._hasAudio||this._hasAudioFlagOverrided||(this._hasAudio=!0,this._mediaInfo&&(this._mediaInfo.hasAudio=!0)),(E=this._audioMetadata={}).type="audio",E.id=null==S?void 0:S.id,E.timescale=this._timescale,E.duration=this._duration,E.audioSampleRate=v,E.channelCount=0===b?1:2),10===m){var w=this._parseAACAudioData(e,t+1,i-1);if(void 0===w)return;if(0===(null==w?void 0:w.packetType)){if(null==E?void 0:E.config){if(y(w.data.config,null==E?void 0:E.config))return;r.A.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var T=w.data;E.audioSampleRate=null==T?void 0:T.samplingRate,E.channelCount=null==T?void 0:T.channelCount,E.codec=null==T?void 0:T.codec,E.originalCodec=null==T?void 0:T.originalCodec,E.config=null==T?void 0:T.config,E.refSampleDuration=1024/E.audioSampleRate*E.timescale,r.A.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&((null===(s=this._audioTrack)||void 0===s?void 0:s.length)||(null===(d=this._videoTrack)||void 0===d?void 0:d.length))&&(null===(l=this._onDataAvailable)||void 0===l||l.call(this,this._audioTrack,this._videoTrack)):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,null===(c=this._onTrackMetadata)||void 0===c||c.call(this,"audio",E),(C=this._mediaInfo).audioCodec=E.originalCodec||"",C.audioSampleRate=E.audioSampleRate,C.audioChannelCount=E.channelCount,C.hasVideo?null!=C.videoCodec&&(C.mimeType='video/x-flv; codecs="'+C.videoCodec+","+C.audioCodec+'"'):C.mimeType='video/x-flv; codecs="'+C.audioCodec+'"',(null==C?void 0:C.isComplete())&&(null===(h=this._onMediaInfo)||void 0===h||h.call(this,C))}else if(1===w.packetType){var B=this._timestampBase+n,k={unit:w.data,length:w.data.byteLength,dts:B,pts:B};S&&(null==S||S.samples.push(k),S.length+=(null===(u=null==w?void 0:w.data)||void 0===u?void 0:u.length)||0)}else r.A.e(this.TAG,"Flv: Unsupported AAC data type ".concat(w.packetType))}else if(2===m){if(!E.codec){var C;if(void 0===(T=this._parseMP3AudioData(e,t+1,i-1,!0)))return;E.audioSampleRate=T.samplingRate,E.channelCount=T.channelCount,E.codec=T.codec,E.originalCodec=T.originalCodec,E.refSampleDuration=1152/E.audioSampleRate*E.timescale,r.A.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,null===(A=this._onTrackMetadata)||void 0===A||A.call(this,"audio",E),(C=this._mediaInfo).audioCodec=E.codec,C.audioSampleRate=E.audioSampleRate,C.audioChannelCount=E.channelCount,C.audioDataRate=T.bitRate,(null==C?void 0:C.hasVideo)?null!=C.videoCodec&&(C.mimeType='video/x-flv; codecs="'+C.videoCodec+","+C.audioCodec+'"'):C.mimeType='video/x-flv; codecs="'+C.audioCodec+'"',C.isComplete()&&(null===(p=this._onMediaInfo)||void 0===p||p.call(this,C))}var R=this._parseMP3AudioData(e,t+1,i-1,!1);if(void 0===R)return;B=this._timestampBase+n;var O={unit:R,length:R.byteLength,dts:B,pts:B};null==S||S.samples.push(O),S&&(S.length+=R.length)}}else null===(a=this._onError)||void 0===a||a.call(this,_.A.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+g)}else null===(o=this._onError)||void 0===o||o.call(this,_.A.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+m)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var n={},o=new Uint8Array(e,t,i);return n.packetType=o[0],0===o[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=o.subarray(1),n}r.A.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var n,r,o,a,s=new Uint8Array(e,t,i),d=null,l=0,c=null;if(l=o=s[0]>>>3,(a=(7&s[0])<<1|s[1]>>>7)<0||a>=this._mpegSamplingRates.length)null===(n=this._onError)||void 0===n||n.call(this,_.A.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var h=this._mpegSamplingRates[a],u=(120&s[1])>>>3;if(!(u<0||u>=8)){5===l&&(c=(7&s[1])<<1|s[2]>>>7,s[2]);var A=self.navigator.userAgent.toLowerCase();return A.includes("firefox")?a>=6?(l=5,d=new Array(4),c=a-3):(l=2,d=new Array(2),c=a):A.includes("android")?(l=2,d=new Array(2),c=a):(l=5,c=a,d=new Array(4),a>=6?c=a-3:1===u&&(l=2,d=new Array(2),c=a)),d[0]=l<<3,d[0]|=(15&a)>>>1,d[1]=(15&a)<<7,d[1]|=(15&u)<<3,5===l&&(d[1]|=(15&c)>>>1,d[2]=(1&c)<<7,d[2]|=8,d[3]=0),{config:d,samplingRate:h,channelCount:u,codec:"mp4a.40."+l,originalCodec:"mp4a.40."+o}}null===(r=this._onError)||void 0===r||r.call(this,_.A.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,n){if(!(i<4)){this._littleEndian;var o,a=new Uint8Array(e,t,i);if(n){if(255!==a[0])return;var s=a[1]>>>3&3,d=(6&a[1])>>1,l=(240&a[2])>>>4,c=(12&a[2])>>>2,h=3&~(a[3]>>>6)?2:1,u=0,A=0;switch(s){case 0:u=this._mpegAudioV25SampleRateTable[c];break;case 2:u=this._mpegAudioV20SampleRateTable[c];break;case 3:u=this._mpegAudioV10SampleRateTable[c]}switch(d){case 1:l<this._mpegAudioL3BitRateTable.length&&(A=this._mpegAudioL3BitRateTable[l]);break;case 2:l<this._mpegAudioL2BitRateTable.length&&(A=this._mpegAudioL2BitRateTable[l]);break;case 3:l<this._mpegAudioL1BitRateTable.length&&(A=this._mpegAudioL1BitRateTable[l])}o={bitRate:A,samplingRate:u,channelCount:h,codec:"mp3",originalCodec:"mp3"}}else o=a;return o}r.A.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,n,o){var a,s;if(i<=1)r.A.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!this._hasVideoFlagOverrided||!1!==this._hasVideo){var d=new Uint8Array(e,t,i)[0],l=(112&d)>>>4;if(128&d){var c=15&d,h=String.fromCharCode.apply(String,function(e,t,i){if(2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}([],function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}(new Uint8Array(e,t,i).slice(1,5)),!1));"hvc1"===h?this._parseEnhancedHEVCVideoPacket(e,t+5,i-5,n,o,l,c):"av01"===h?this._parseEnhancedAV1VideoPacket(e,t+5,i-5,n,o,l,c):null===(s=this._onError)||void 0===s||s.call(this,_.A.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(h))}else{var u=15&d;7===u?this._parseAVCVideoPacket(e,t+1,i-1,n,o,l):12===u?this._parseHEVCVideoPacket(e,t+1,i-1,n,o,l):null===(a=this._onError)||void 0===a||a.call(this,_.A.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(u))}}},e.prototype._parseAVCVideoPacket=function(e,t,i,n,o,a){var s;if(i<4)r.A.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var d=this._littleEndian,l=new DataView(e,t,i),c=l.getUint8(0),h=(16777215&l.getUint32(0,!d))<<8>>8;0===c?this._parseAVCDecoderConfigurationRecord(e,t+4,i-4):1===c?this._parseAVCVideoData(e,t+4,i-4,n,o,a,h):2===c||null===(s=this._onError)||void 0===s||s.call(this,_.A.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(c))}},e.prototype._parseHEVCVideoPacket=function(e,t,i,n,o,a){var s;if(i<4)r.A.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var d=this._littleEndian,l=new DataView(e,t,i),c=l.getUint8(0),h=(16777215&l.getUint32(0,!d))<<8>>8;0===c?this._parseHEVCDecoderConfigurationRecord(e,t+4,i-4):1===c?this._parseHEVCVideoData(e,t+4,i-4,n,o,a,h):2===c||null===(s=this._onError)||void 0===s||s.call(this,_.A.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(c))}},e.prototype._parseEnhancedHEVCVideoPacket=function(e,t,i,n,r,o,a){var s,d=this._littleEndian,l=new DataView(e,t,i);if(0===a)this._parseHEVCDecoderConfigurationRecord(e,t,i);else if(1===a){var c=(4294967040&l.getUint32(0,!d))>>8;this._parseHEVCVideoData(e,t+3,i-3,n,r,o,c)}else 3===a?this._parseHEVCVideoData(e,t,i,n,r,o,0):2===a||null===(s=this._onError)||void 0===s||s.call(this,_.A.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(a))},e.prototype._parseEnhancedAV1VideoPacket=function(e,t,i,n,r,o,a){var s,d;this._littleEndian,0===a?this._parseAV1CodecConfigurationRecord(e,t,i):1===a?this._parseAV1VideoData(e,t,i,n,r,o,0):5===a?null===(s=this._onError)||void 0===s||s.call(this,_.A.FORMAT_ERROR,"Flv: Not Suported MP2T AV1 video packet type ".concat(a)):2===a||null===(d=this._onError)||void 0===d||d.call(this,_.A.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(a))},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){var n,o,a,s,d,l,c,h,u,A,f;if(i<7)r.A.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var m=this._videoMetadata,v=this._videoTrack,g=this._littleEndian,b=new DataView(e,t,i);if(m){if(void 0!==m.avcc){var E=new Uint8Array(e,t,i);if(y(E,m.avcc))return;r.A.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1!==this._hasVideo||this._hasVideoFlagOverrided||(this._hasVideo=!0,this._mediaInfo&&(this._mediaInfo.hasVideo=!0)),(m=this._videoMetadata={}).type="video",m.id=null==v?void 0:v.id,m.timescale=this._timescale,m.duration=this._duration;var S=b.getUint8(0),w=b.getUint8(1);if(b.getUint8(2),b.getUint8(3),1===S&&0!==w)if(this._naluLengthSize=1+(3&b.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var T=31&b.getUint8(5);if(0!==T){T>1&&r.A.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(T));for(var B=6,k=0;k<T;k++){var C=b.getUint16(B,!g);if(B+=2,0!==C){var R=new Uint8Array(e,t+B,C);B+=C;var O=p.parseSPS(R);if(0===k){m.codecWidth=O.codec_size.width,m.codecHeight=O.codec_size.height,m.presentWidth=O.present_size.width,m.presentHeight=O.present_size.height,m.profile=O.profile_string,m.level=O.level_string,m.bitDepth=O.bit_depth,m.chromaFormat=O.chroma_format,m.sarRatio=O.sar_ratio,m.frameRate=O.frame_rate,O.frame_rate.fixed&&0!==O.frame_rate.fps_num&&0!==O.frame_rate.fps_den||(m.frameRate=this._referenceFrameRate);var I=null===(s=m.frameRate)||void 0===s?void 0:s.fps_den,x=null===(d=m.frameRate)||void 0===d?void 0:d.fps_num;m.refSampleDuration=m.timescale*(I/x);for(var D=R.subarray(1,4),L="avc1.",M=0;M<3;M++){var P=D[M].toString(16);P.length<2&&(P="0"+P),L+=P}m.codec=L;var U=this._mediaInfo;U.width=m.codecWidth,U.height=m.codecHeight,U.fps=m.frameRate.fps,U.profile=m.profile,U.level=m.level,U.refFrames=O.ref_frames,U.chromaFormat=O.chroma_format_string,U.sarNum=m.sarRatio.width,U.sarDen=m.sarRatio.height,U.videoCodec=L,U.hasAudio?null!=U.audioCodec&&(U.mimeType='video/x-flv; codecs="'+U.videoCodec+","+U.audioCodec+'"'):U.mimeType='video/x-flv; codecs="'+U.videoCodec+'"',U.isComplete()&&(null===(l=this._onMediaInfo)||void 0===l||l.call(this,U))}}}var F=b.getUint8(B);if(0!==F){for(F>1&&r.A.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(F)),B++,k=0;k<F;k++)C=b.getUint16(B,!g),B+=2,0!==C&&(B+=C);m.avcc=new Uint8Array(i),m.avcc.set(new Uint8Array(e,t,i),0),r.A.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&((null===(h=this._audioTrack)||void 0===h?void 0:h.length)||(null===(u=this._videoTrack)||void 0===u?void 0:u.length))&&(null===(A=this._onDataAvailable)||void 0===A||A.call(this,this._audioTrack,this._videoTrack)):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,null===(f=this._onTrackMetadata)||void 0===f||f.call(this,"video",m)}else null===(c=this._onError)||void 0===c||c.call(this,_.A.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else null===(a=this._onError)||void 0===a||a.call(this,_.A.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else null===(o=this._onError)||void 0===o||o.call(this,_.A.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else null===(n=this._onError)||void 0===n||n.call(this,_.A.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseHEVCDecoderConfigurationRecord=function(e,t,i){var n,o,a,s,d,l,c;if(i<22)r.A.w(this.TAG,"Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!");else{var h=this._videoMetadata,u=this._videoTrack,A=this._littleEndian,p=new DataView(e,t,i);if(h){if(void 0!==h.hvcc){var m=new Uint8Array(e,t,i);if(y(m,h.hvcc))return;r.A.w(this.TAG,"HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else!1!==this._hasVideo||this._hasVideoFlagOverrided||(this._hasVideo=!0,this._mediaInfo&&(this._mediaInfo.hasVideo=!0)),(h=this._videoMetadata={}).type="video",h.id=null==u?void 0:u.id,h.timescale=this._timescale,h.duration=this._duration;var v=p.getUint8(0),g=31&p.getUint8(1);if(1===v&&0!==g)if(this._naluLengthSize=1+(3&p.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var b=p.getUint8(22),E=0,S=23;E<b;E++){var w=63&p.getUint8(S+0),T=p.getUint16(S+1,!A);S+=3;for(var B=0;B<T;B++){var k=p.getUint16(S+0,!A);if(0===B)if(33===w){S+=2;var C=new Uint8Array(e,t+S,k),R=f.parseSPS(C);h.codecWidth=R.codec_size.width,h.codecHeight=R.codec_size.height,h.presentWidth=R.present_size.width,h.presentHeight=R.present_size.height,h.profile=null==R?void 0:R.profile_string,h.level=R.level_string,h.bitDepth=R.bit_depth,h.chromaFormat=R.chroma_format,h.sarRatio=R.sar_ratio,h.frameRate=R.frame_rate,R.frame_rate.fixed&&0!==R.frame_rate.fps_num&&0!==R.frame_rate.fps_den||(h.frameRate=this._referenceFrameRate);var O=h.frameRate.fps_den,I=h.frameRate.fps_num;h.refSampleDuration=h.timescale*(O/I),h.codec=R.codec_mimetype;var x=this._mediaInfo;x.width=h.codecWidth,x.height=h.codecHeight,x.fps=h.frameRate.fps,x.profile=h.profile,x.level=h.level,x.refFrames=R.ref_frames,x.chromaFormat=R.chroma_format_string,x.sarNum=h.sarRatio.width,x.sarDen=h.sarRatio.height,x.videoCodec=R.codec_mimetype,x.hasAudio?null!=x.audioCodec&&(x.mimeType='video/x-flv; codecs="'+x.videoCodec+","+x.audioCodec+'"'):x.mimeType='video/x-flv; codecs="'+x.videoCodec+'"',x.isComplete()&&(null===(a=this._onMediaInfo)||void 0===a||a.call(this,x)),S+=k}else S+=2+k;else S+=2+k}}h.hvcc=new Uint8Array(i),h.hvcc.set(new Uint8Array(e,t,i),0),r.A.v(this.TAG,"Parsed HEVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&((null===(s=this._audioTrack)||void 0===s?void 0:s.length)||(null===(d=this._videoTrack)||void 0===d?void 0:d.length))&&(null===(l=this._onDataAvailable)||void 0===l||l.call(this,this._audioTrack,this._videoTrack)):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,null===(c=this._onTrackMetadata)||void 0===c||c.call(this,"video",h)}else null===(o=this._onError)||void 0===o||o.call(this,_.A.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else null===(n=this._onError)||void 0===n||n.call(this,_.A.FORMAT_ERROR,"Flv: Invalid HEVCDecoderConfigurationRecord")}},e.prototype._parseAV1CodecConfigurationRecord=function(e,t,i){var n,o,a,s,d,l,c,h,u,A,p;if(i<4)r.A.w(this.TAG,"Flv: Invalid AV1CodecConfigurationRecord, lack of data!");else{var f=this._videoMetadata,m=this._videoTrack,v=(this._littleEndian,new DataView(e,t,i));f?void 0!==f.av1c&&r.A.w(this.TAG,"Found another AV1CodecConfigurationRecord!"):(!1!==this._hasVideo||this._hasVideoFlagOverrided||(this._hasVideo=!0,this._mediaInfo&&(this._mediaInfo.hasVideo=!0)),(f=this._videoMetadata={}).type="video",f.id=null==m?void 0:m.id,f.timescale=this._timescale,f.duration=this._duration);var g=127&v.getUint8(0);if(v.getUint8(1),v.getUint8(1),v.getUint8(2),1===g){var y=b.parseOBUs(new Uint8Array(e,t+4,i-4));if(null!=y){f.codecWidth=null===(a=null==y?void 0:y.codec_size)||void 0===a?void 0:a.width,f.codecHeight=null===(s=null==y?void 0:y.codec_size)||void 0===s?void 0:s.height,f.presentWidth=null===(d=null==y?void 0:y.present_size)||void 0===d?void 0:d.width,f.presentHeight=null===(l=null==y?void 0:y.present_size)||void 0===l?void 0:l.height,f.profile=y.profile_string,f.level=y.level_string,f.bitDepth=y.bit_depth,f.chromaFormat=y.chroma_format,f.sarRatio=y.sar_ratio,f.frameRate=y.frame_rate,y.frame_rate.fixed&&0!==y.frame_rate.fps_num&&0!==y.frame_rate.fps_den||(f.frameRate=this._referenceFrameRate);var E=f.frameRate.fps_den,S=f.frameRate.fps_num;f.refSampleDuration=f.timescale*(E/S),f.codec=y.codec_mimetype;var w=this._mediaInfo;w.width=f.codecWidth,w.height=f.codecHeight,w.fps=f.frameRate.fps,w.profile=f.profile,w.level=f.level,w.refFrames=y.ref_frames,w.chromaFormat=y.chroma_format_string,w.sarNum=f.sarRatio.width,w.sarDen=f.sarRatio.height,w.videoCodec=y.codec_mimetype,w.hasAudio?null!=w.audioCodec&&(w.mimeType='video/x-flv; codecs="'+w.videoCodec+","+w.audioCodec+'"'):w.mimeType='video/x-flv; codecs="'+w.videoCodec+'"',w.isComplete()&&(null===(c=this._onMediaInfo)||void 0===c||c.call(this,w)),f.av1c=new Uint8Array(i),f.av1c.set(new Uint8Array(e,t,i),0),r.A.v(this.TAG,"Parsed AV1CodecConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&((null===(h=this._audioTrack)||void 0===h?void 0:h.length)||(null===(u=this._videoTrack)||void 0===u?void 0:u.length))&&(null===(A=this._onDataAvailable)||void 0===A||A.call(this,this._audioTrack,this._videoTrack)):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,null===(p=this._onTrackMetadata)||void 0===p||p.call(this,"video",f)}else null===(o=this._onError)||void 0===o||o.call(this,_.A.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}else null===(n=this._onError)||void 0===n||n.call(this,_.A.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,n,o,a,s){for(var d=this._littleEndian,l=new DataView(e,t,i),c=[],h=0,u=0,A=this._naluLengthSize,p=this._timestampBase+n,_=1===a;u<i;){if(u+4>=i){r.A.w(this.TAG,"Malformed Nalu near timestamp ".concat(p,", offset = ").concat(u,", dataSize = ").concat(i));break}var f=l.getUint32(u,!d);if(3===A&&(f>>>=8),f>i-A)return void r.A.w(this.TAG,"Malformed Nalus near timestamp ".concat(p,", NaluSize > DataSize!"));var m=31&l.getUint8(u+A);5===m&&(_=!0);var v=new Uint8Array(e,t+u,A+f),g={type:m,data:v};c.push(g),h+=v.byteLength,u+=A+f}if(c.length){var y=this._videoTrack,b={units:c,length:h,isKeyframe:_,dts:p,cts:s,pts:p+s};_&&(b.fileposition=o),y&&(y.samples.push(b),y.length+=h)}},e.prototype._parseHEVCVideoData=function(e,t,i,n,o,a,s){for(var d=this._littleEndian,l=new DataView(e,t,i),c=[],h=0,u=0,A=this._naluLengthSize,p=this._timestampBase+n,_=1===a;u<i;){if(u+4>=i){r.A.w(this.TAG,"Malformed Nalu near timestamp ".concat(p,", offset = ").concat(u,", dataSize = ").concat(i));break}var f=l.getUint32(u,!d);if(3===A&&(f>>>=8),f>i-A)return void r.A.w(this.TAG,"Malformed Nalus near timestamp ".concat(p,", NaluSize > DataSize!"));var m=31&l.getUint8(u+A);19!==m&&20!==m||(_=!0);var v=new Uint8Array(e,t+u,A+f),g={type:m,data:v};c.push(g),h+=v.byteLength,u+=A+f}if(c.length){var y=this._videoTrack,b={units:c,length:h,isKeyframe:_,dts:p,cts:s,pts:p+s};_&&(b.fileposition=o),y&&(null==y||y.samples.push(b),y.length+=h)}},e.prototype._parseAV1VideoData=function(e,t,i,n,r,o,a){this._littleEndian;var s,d=[],l=this._timestampBase+n,c=1===o;if(s=i,d.push({unitType:0,data:new Uint8Array(e,t+0,i)}),d.length){var h=this._videoTrack,u={units:d,length:s,isKeyframe:c,dts:l,cts:a,pts:l+a};c&&(u.fileposition=r),h&&(null==h||h.samples.push(u),h.length+=s)}},e}();const S=E,w=function(){function e(){}return e.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},e}();var T,B=function(){this.program_pmt_pid={}};!function(e){e[e.kMPEG1Audio=3]="kMPEG1Audio",e[e.kMPEG2Audio=4]="kMPEG2Audio",e[e.kPESPrivateData=6]="kPESPrivateData",e[e.kADTSAAC=15]="kADTSAAC",e[e.kLOASAAC=17]="kLOASAAC",e[e.kAC3=129]="kAC3",e[e.kEAC3=135]="kEAC3",e[e.kID3=21]="kID3",e[e.kSCTE35=134]="kSCTE35",e[e.kH264=27]="kH264",e[e.kH265=36]="kH265"}(T||(T={}));var k,C=function(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.scte_35_pids={},this.smpte2038_pids={}},R=function(){},O=function(){},I=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0,this.random_access_indicator=0};!function(e){e[e.kUnspecified=0]="kUnspecified",e[e.kSliceNonIDR=1]="kSliceNonIDR",e[e.kSliceDPA=2]="kSliceDPA",e[e.kSliceDPB=3]="kSliceDPB",e[e.kSliceDPC=4]="kSliceDPC",e[e.kSliceIDR=5]="kSliceIDR",e[e.kSliceSEI=6]="kSliceSEI",e[e.kSliceSPS=7]="kSliceSPS",e[e.kSlicePPS=8]="kSlicePPS",e[e.kSliceAUD=9]="kSliceAUD",e[e.kEndOfSequence=10]="kEndOfSequence",e[e.kEndOfStream=11]="kEndOfStream",e[e.kFiller=12]="kFiller",e[e.kSPSExt=13]="kSPSExt",e[e.kReserved0=14]="kReserved0"}(k||(k={}));var x,D,L=function(){},M=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},P=function(){function e(e){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.A.e(this.TAG,"Could not find H264 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var n=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===n||1===r)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,n=31&e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3],r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=o,!(n>=k.kReserved0)&&0===r){var a=e.subarray(i,o);(t=new L).type=n,t.data=a}}return t},e}(),U=function(){function e(e,t,i){var n=8+e.byteLength+1+2+t.byteLength,r=!1;66!==e[3]&&77!==e[3]&&88!==e[3]&&(r=!0,n+=4);var o=this.data=new Uint8Array(n);o[0]=1,o[1]=e[1],o[2]=e[2],o[3]=e[3],o[4]=255,o[5]=225;var a=e.byteLength;o[6]=a>>>8,o[7]=255&a;var s=8;o.set(e,8),o[s+=a]=1;var d=t.byteLength;o[s+1]=d>>>8,o[s+2]=255&d,o.set(t,s+3),s+=3+d,r&&(o[s]=252|i.chroma_format_idc,o[s+1]=248|i.bit_depth_luma-8,o[s+2]=248|i.bit_depth_chroma-8,o[s+3]=0,s+=4)}return e.prototype.getData=function(){return this.data},e}();!function(e){e[e.kNull=0]="kNull",e[e.kAACMain=1]="kAACMain",e[e.kAAC_LC=2]="kAAC_LC",e[e.kAAC_SSR=3]="kAAC_SSR",e[e.kAAC_LTP=4]="kAAC_LTP",e[e.kAAC_SBR=5]="kAAC_SBR",e[e.kAAC_Scalable=6]="kAAC_Scalable",e[e.kLayer1=32]="kLayer1",e[e.kLayer2=33]="kLayer2",e[e.kLayer3=34]="kLayer3"}(x||(x={})),function(e){e[e.k96000Hz=0]="k96000Hz",e[e.k88200Hz=1]="k88200Hz",e[e.k64000Hz=2]="k64000Hz",e[e.k48000Hz=3]="k48000Hz",e[e.k44100Hz=4]="k44100Hz",e[e.k32000Hz=5]="k32000Hz",e[e.k24000Hz=6]="k24000Hz",e[e.k22050Hz=7]="k22050Hz",e[e.k16000Hz=8]="k16000Hz",e[e.k12000Hz=9]="k12000Hz",e[e.k11025Hz=10]="k11025Hz",e[e.k8000Hz=11]="k8000Hz",e[e.k7350Hz=12]="k7350Hz"}(D||(D={}));var F,V,N=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],G=(F=function(e,t){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},F(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}F(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),W=function(){},j=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return G(t,e),t}(W),Q=function(){function e(e){this.TAG="AACADTSParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.A.e(this.TAG,"Could not found ADTS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095==(i[t+0]<<8|i[t+1])>>>4)return t;t++}},e.prototype.readNextAACFrame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,n=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,o=1&e[i+1],a=(192&e[i+2])>>>6,s=(60&e[i+2])>>>2,d=(1&e[i+2])<<2|(192&e[i+3])>>>6,l=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var c=1===o?7:9,h=l-c;i+=c;var u=this.findNextSyncwordOffset(i+h);if(this.current_syncword_offset_=u,(0===n||1===n)&&0===r){var A=e.subarray(i,i+h);(t=new W).audio_object_type=a+1,t.sampling_freq_index=s,t.sampling_frequency=N[s],t.channel_config=d,t.data=A}}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),z=function(){function e(e){this.TAG="AACLOASParser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.A.e(this.TAG,"Could not found LOAS syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695==(i[t+0]<<3|i[t+1]>>>5))return t;t++}},e.prototype.getLATMValue=function(e){for(var t=e.readBits(2),i=0,n=0;n<=t;n++)i<<=8,i|=e.readByte();return i},e.prototype.readNextAACFrame=function(e){for(var t=this.data_,i=null;null==i&&!this.eof_flag_;){var n=this.current_syncword_offset_,o=(31&t[n+1])<<8|t[n+2];if(n+3+o>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var a=new A(t.subarray(n+3,n+3+o)),s=null;if(a.readBool()){if(null==e){r.A.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(n+3+o),a.destroy();continue}s=e}else{var d=a.readBool();if(d&&a.readBool()){r.A.e(this.TAG,"audioMuxVersionA is Not Supported"),a.destroy();break}if(d&&this.getLATMValue(a),!a.readBool()){r.A.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),a.destroy();break}if(0!==a.readBits(6)){r.A.e(this.TAG,"more than 2 numSubFrames Not Supported"),a.destroy();break}if(0!==a.readBits(4)){r.A.e(this.TAG,"more than 2 numProgram Not Supported"),a.destroy();break}if(0!==a.readBits(3)){r.A.e(this.TAG,"more than 2 numLayer Not Supported"),a.destroy();break}var l=d?this.getLATMValue(a):0,c=a.readBits(5);l-=5;var h=a.readBits(4);l-=4;var u=a.readBits(4);l-=4,a.readBits(3),(l-=3)>0&&a.readBits(l);var p=a.readBits(3);if(0!==p){r.A.e(this.TAG,"frameLengthType = ".concat(p,". Only frameLengthType = 0 Supported")),a.destroy();break}a.readByte();var _=a.readBool();if(_)if(d)this.getLATMValue(a);else for(;;){8;var f=a.readBool();if(a.readByte(),!f)break}a.readBool()&&a.readByte(),(s=new j).audio_object_type=c,s.sampling_freq_index=h,s.sampling_frequency=N[s.sampling_freq_index],s.channel_config=u,s.other_data_present=_}for(var m=0;;){var v=a.readByte();if(m+=v,255!==v)break}for(var g=new Uint8Array(m),y=0;y<m;y++)g[y]=a.readByte();(i=new j).audio_object_type=s.audio_object_type,i.sampling_freq_index=s.sampling_freq_index,i.sampling_frequency=N[s.sampling_freq_index],i.channel_config=s.channel_config,i.other_data_present=s.other_data_present,i.data=g,this.current_syncword_offset_=this.findNextSyncwordOffset(n+3+o)}return i},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),H=function(e){var t=[],i=e.audio_object_type,n=e.audio_object_type,r=e.sampling_freq_index,o=e.channel_config,a=0,s=navigator.userAgent.toLowerCase();s.includes("firefox")?r>=6?(n=5,t=new Array(4),a=r-3):(n=2,t=new Array(2),a=r):s.includes("android")?(n=2,t=new Array(2),a=r):(n=5,a=r,t=new Array(4),r>=6?a=r-3:1===o&&(n=2,t=new Array(2),a=r)),t[0]=n<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&o)<<3,5===n&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=N[r],this.channel_count=o,this.codec_mimetype="mp4a.40."+n.toString(),this.original_codec_mimetype="mp4a.40."+i.toString()},q=function(){},X=function(){};!function(e){e[e.kSpliceNull=0]="kSpliceNull",e[e.kSpliceSchedule=4]="kSpliceSchedule",e[e.kSpliceInsert=5]="kSpliceInsert",e[e.kTimeSignal=6]="kTimeSignal",e[e.kBandwidthReservation=7]="kBandwidthReservation",e[e.kPrivateCommand=255]="kPrivateCommand"}(V||(V={}));var $,Y=function(e){var t=e.readBool();return t?(e.readBits(6),{time_specified_flag:t,pts_time:4*e.readBits(31)+e.readBits(2)}):(e.readBits(7),{time_specified_flag:t})},Z=function(e){var t=e.readBool();return e.readBits(6),{auto_return:t,duration:4*e.readBits(31)+e.readBits(2)}},K=function(e,t){var i=t.readBits(8);return e?{component_tag:i}:{component_tag:i,splice_time:Y(t)}},J=function(e){return{component_tag:e.readBits(8),utc_splice_time:e.readBits(32)}},ee=function(e){var t=e.readBits(32),i=e.readBool();e.readBits(7);var n={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return n;if(n.out_of_network_indicator=e.readBool(),n.program_splice_flag=e.readBool(),n.duration_flag=e.readBool(),e.readBits(5),n.program_splice_flag)n.utc_splice_time=e.readBits(32);else{n.component_count=e.readBits(8),n.components=[];for(var r=0;r<n.component_count;r++)n.components.push(J(e))}return n.duration_flag&&(n.break_duration=Z(e)),n.unique_program_id=e.readBits(16),n.avail_num=e.readBits(8),n.avails_expected=e.readBits(8),n},te=function(e,t,i,n){return{descriptor_tag:e,descriptor_length:t,identifier:i,provider_avail_id:n.readBits(32)}},ie=function(e,t,i,n){var r=n.readBits(8),o=n.readBits(3);n.readBits(5);for(var a="",s=0;s<o;s++)a+=String.fromCharCode(n.readBits(8));return{descriptor_tag:e,descriptor_length:t,identifier:i,preroll:r,dtmf_count:o,DTMF_char:a}},ne=function(e){var t=e.readBits(8);return e.readBits(7),{component_tag:t,pts_offset:4*e.readBits(31)+e.readBits(2)}},re=function(e,t,i,n){var r=n.readBits(32),o=n.readBool();n.readBits(7);var a={descriptor_tag:e,descriptor_length:t,identifier:i,segmentation_event_id:r,segmentation_event_cancel_indicator:o};if(o)return a;if(a.program_segmentation_flag=n.readBool(),a.segmentation_duration_flag=n.readBool(),a.delivery_not_restricted_flag=n.readBool(),a.delivery_not_restricted_flag?n.readBits(5):(a.web_delivery_allowed_flag=n.readBool(),a.no_regional_blackout_flag=n.readBool(),a.archive_allowed_flag=n.readBool(),a.device_restrictions=n.readBits(2)),!a.program_segmentation_flag){a.component_count=n.readBits(8),a.components=[];for(var s=0;s<a.component_count;s++)a.components.push(ne(n))}a.segmentation_duration_flag&&(a.segmentation_duration=n.readBits(40)),a.segmentation_upid_type=n.readBits(8),a.segmentation_upid_length=n.readBits(8);var d=new Uint8Array(a.segmentation_upid_length);for(s=0;s<a.segmentation_upid_length;s++)d[s]=n.readBits(8);return a.segmentation_upid=d.buffer,a.segmentation_type_id=n.readBits(8),a.segment_num=n.readBits(8),a.segments_expected=n.readBits(8),52!==a.segmentation_type_id&&54!==a.segmentation_type_id&&56!==a.segmentation_type_id&&58!==a.segmentation_type_id||(a.sub_segment_num=n.readBits(8),a.sub_segments_expected=n.readBits(8)),a},oe=function(e,t,i,n){return{descriptor_tag:e,descriptor_length:t,identifier:i,TAI_seconds:n.readBits(48),TAI_ns:n.readBits(32),UTC_offset:n.readBits(16)}},ae=function(e){return{component_tag:e.readBits(8),ISO_code:String.fromCharCode(e.readBits(8),e.readBits(8),e.readBits(8)),Bit_Stream_Mode:e.readBits(3),Num_Channels:e.readBits(4),Full_Srvc_Audio:e.readBool()}},se=function(e,t,i,n){for(var r=n.readBits(4),o=[],a=0;a<r;a++)o.push(ae(n));return{descriptor_tag:e,descriptor_length:t,identifier:i,audio_count:r,components:o}};!function(e){e[e.kSliceIDR_W_RADL=19]="kSliceIDR_W_RADL",e[e.kSliceIDR_N_LP=20]="kSliceIDR_N_LP",e[e.kSliceCRA_NUT=21]="kSliceCRA_NUT",e[e.kSliceVPS=32]="kSliceVPS",e[e.kSliceSPS=33]="kSliceSPS",e[e.kSlicePPS=34]="kSlicePPS",e[e.kSliceAUD=35]="kSliceAUD"}($||($={}));var de=function(){},le=function(e){var t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)},ce=function(){function e(e){this.TAG="H265AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=e,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&r.A.e(this.TAG,"Could not find H265 startcode until payload end!")}return e.prototype.findNextStartCodeOffset=function(e){for(var t=e,i=this.data_;;){if(t+3>=i.byteLength)return this.eof_flag_=!0,i.byteLength;var n=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],r=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===n||1===r)return t;t++}},e.prototype.readNextNaluPayload=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_startcode_offset_,n=e[i+=1==(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3]>>1&63,r=(128&e[i])>>>7,o=this.findNextStartCodeOffset(i);if(this.current_startcode_offset_=o,0===r){var a=e.subarray(i,o);(t=new de).type=n,t.data=a}}return t},e}(),he=function(){function e(e,t,i,n){var r=23+(5+e.byteLength)+(5+t.byteLength)+(5+i.byteLength),o=this.data=new Uint8Array(r);o[0]=1,o[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,o[2]=n.general_profile_compatibility_flags_1,o[3]=n.general_profile_compatibility_flags_2,o[4]=n.general_profile_compatibility_flags_3,o[5]=n.general_profile_compatibility_flags_4,o[6]=n.general_constraint_indicator_flags_1,o[7]=n.general_constraint_indicator_flags_2,o[8]=n.general_constraint_indicator_flags_3,o[9]=n.general_constraint_indicator_flags_4,o[10]=n.general_constraint_indicator_flags_5,o[11]=n.general_constraint_indicator_flags_6,o[12]=n.general_level_idc,o[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,o[14]=255&n.min_spatial_segmentation_idc,o[15]=252|3&n.parallelismType,o[16]=252|3&n.chroma_format_idc,o[17]=248|7&n.bit_depth_luma_minus8,o[18]=248|7&n.bit_depth_chroma_minus8,o[19]=0,o[20]=0,o[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,o[22]=3,o[23]=128|$.kSliceVPS,o[24]=0,o[25]=1,o[26]=(65280&e.byteLength)>>8,o[27]=255&e.byteLength,o.set(e,28),o[23+(5+e.byteLength)+0]=128|$.kSliceSPS,o[23+(5+e.byteLength)+1]=0,o[23+(5+e.byteLength)+2]=1,o[23+(5+e.byteLength)+3]=(65280&t.byteLength)>>8,o[23+(5+e.byteLength)+4]=255&t.byteLength,o.set(t,23+(5+e.byteLength)+5),o[23+(5+e.byteLength+5+t.byteLength)+0]=128|$.kSlicePPS,o[23+(5+e.byteLength+5+t.byteLength)+1]=0,o[23+(5+e.byteLength+5+t.byteLength)+2]=1,o[23+(5+e.byteLength+5+t.byteLength)+3]=(65280&i.byteLength)>>8,o[23+(5+e.byteLength+5+t.byteLength)+4]=255&i.byteLength,o.set(i,23+(5+e.byteLength+5+t.byteLength)+5)}return e.prototype.getData=function(){return this.data},e}(),ue=function(){},Ae=function(){},pe=function(){},_e=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]],fe=function(){function e(e){this.TAG="AC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.A.e(this.TAG,"Could not found AC3 syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]))return t;t++}},e.prototype.readNextAC3Frame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,n=e[i+4]>>6,r=[48e3,44200,33e3][n],o=63&e[i+4],a=2*_e[n][o];if(i+a>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var s=this.findNextSyncwordOffset(i+a);this.current_syncword_offset_=s;var d=e[i+5]>>3,l=7&e[i+5],c=e[i+6]>>5,h=0;1&c&&1!==c&&(h+=2),4&c&&(h+=2),2===c&&(h+=2);var u=(e[i+6]<<8|e[i+7])>>12-h&1,A=[2,1,2,3,3,4,4,5][c]+u;(t=new pe).sampling_frequency=r,t.channel_count=A,t.channel_mode=c,t.bit_stream_identification=d,t.low_frequency_effects_channel_on=u,t.bit_stream_mode=l,t.frame_size_code=o,t.data=e.subarray(i,i+a)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),me=function(e){var t;t=[e.sampling_rate_code<<6|e.bit_stream_identification<<1|e.bit_stream_mode>>2,(3&e.bit_stream_mode)<<6|e.channel_mode<<3|e.low_frequency_effects_channel_on<<2|e.frame_size_code>>4,e.frame_size_code<<4&224],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.bit_stream_mode=e.bit_stream_mode,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"},ve=function(){},ge=function(){function e(e){this.TAG="EAC3Parser",this.data_=e,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&r.A.e(this.TAG,"Could not found AC3 syncword until payload end")}return e.prototype.findNextSyncwordOffset=function(e){for(var t=e,i=this.data_;;){if(t+7>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(2935==(i[t+0]<<8|i[t+1]))return t;t++}},e.prototype.readNextEAC3Frame=function(){for(var e=this.data_,t=null;null==t&&!this.eof_flag_;){var i=this.current_syncword_offset_,n=new A(e.subarray(i+2)),r=(n.readBits(2),n.readBits(3),n.readBits(11)+1<<1),o=n.readBits(2),a=null,s=null;3===o?(a=[24e3,22060,16e3][o=n.readBits(2)],s=3):(a=[48e3,44100,32e3][o],s=n.readBits(2));var d=n.readBits(3),l=n.readBits(1),c=n.readBits(5);if(i+r>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var h=this.findNextSyncwordOffset(i+r);this.current_syncword_offset_=h;var u=[2,1,2,3,3,4,4,5][d]+l;n.destroy(),(t=new ve).sampling_frequency=a,t.channel_count=u,t.channel_mode=d,t.bit_stream_identification=c,t.low_frequency_effects_channel_on=l,t.frame_size=r,t.num_blks=[1,2,3,6][s],t.data=e.subarray(i,i+r)}return t},e.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},e.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},e}(),ye=function(e){var t,i=Math.floor(e.frame_size*e.sampling_frequency/(16*e.num_blks));t=[255&i,248&i,e.sampling_rate_code<<6|e.bit_stream_identification<<1,e.channel_mode<<1|e.low_frequency_effects_channel_on,0],this.config=t,this.sampling_rate=e.sampling_frequency,this.bit_stream_identification=e.bit_stream_identification,this.num_blks=e.num_blks,this.low_frequency_effects_channel_on=e.low_frequency_effects_channel_on,this.channel_count=e.channel_count,this.channel_mode=e.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"},be=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ee=function(){return Ee=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ee.apply(this,arguments)},Se=function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},we=function(e,t,i){if(2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))},Te=function(e){function t(t,i){var n=e.call(this)||this;return n.TAG="TSDemuxer",n.first_parse_=!0,n.media_info_=new a.A,n.timescale_=90,n.duration_=0,n.current_pmt_pid_=-1,n.program_pmt_map_={},n.pes_slice_queues_={},n.section_slice_queues_={},n.video_metadata_={vps:void 0,sps:void 0,pps:void 0,details:void 0},n.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},n.aac_last_sample_pts_=void 0,n.aac_last_incomplete_data_=null,n.has_video_=!1,n.has_audio_=!1,n.video_init_segment_dispatched_=!1,n.audio_init_segment_dispatched_=!1,n.video_metadata_changed_=!1,n.audio_metadata_changed_=!1,n.loas_previous_frame=null,n.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},n.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},n.ts_packet_size_=t.ts_packet_size,n.sync_offset_=t.sync_offset,n.config_=i,n}return be(t,e),t.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,e.prototype.destroy.call(this)},t.probe=function(e){var t=new Uint8Array(e),i=-1,n=188;if(t.byteLength<=3*n)return{needMoreData:!0};for(;-1===i;){for(var o=Math.min(1e3,t.byteLength-3*n),a=0;a<o;){if(71===t[a]&&71===t[a+n]&&71===t[a+2*n]){i=a;break}a++}if(-1===i)if(188===n)n=192;else{if(192!==n)break;n=204}}return-1===i?{match:!1}:(192===n&&i>=4?(r.A.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),i-=4):204===n&&r.A.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:n,sync_offset:i})},t.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},t.prototype.resetMediaInfo=function(){this.media_info_=new a.A},t.prototype.parseChunks=function(e,t){var i;if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new c.j4("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0;for(this.first_parse_&&(this.first_parse_=!1,n=this.sync_offset_);n+this.ts_packet_size_<=e.byteLength;){var o=t+n;192===this.ts_packet_size_&&(n+=4);var a=new Uint8Array(e,n,188),s=a[0];if(71!==s){r.A.e(this.TAG,"sync_byte = ".concat(s,", not 0x47"));break}var d=(64&a[1])>>>6,l=(a[1],(31&a[1])<<8|a[2]),h=(48&a[3])>>>4,u=15&a[3],A={},p=4;if(2===h||3===h){var _=a[4];if(5+_===188){n+=188,204===this.ts_packet_size_&&(n+=16);continue}_>0&&(A=this.parseAdaptationField(e,n+4,1+_)),p=5+_}if(1===h||3===h)if(0===l||l===this.current_pmt_pid_||void 0!==this.pmt_&&this.pmt_.pid_stream_type[l]===T.kSCTE35){var f=188-p;this.handleSectionSlice(e,n+p,f,{pid:l,file_position:o,payload_unit_start_indicator:d,continuity_conunter:u,random_access_indicator:A.random_access_indicator})}else if(void 0!==(null===(i=this.pmt_)||void 0===i?void 0:i.pid_stream_type[l])){f=188-p;var m=this.pmt_.pid_stream_type[l];(l===this.pmt_.common_pids.h264||l===this.pmt_.common_pids.h265||l===this.pmt_.common_pids.adts_aac||l===this.pmt_.common_pids.loas_aac||l===this.pmt_.common_pids.ac3||l===this.pmt_.common_pids.eac3||l===this.pmt_.common_pids.opus||l===this.pmt_.common_pids.mp3||this.pmt_.pes_private_data_pids[l]||this.pmt_.timed_id3_pids[l])&&this.handlePESSlice(e,n+p,f,{pid:l,stream_type:m,file_position:o,payload_unit_start_indicator:d,continuity_conunter:u,random_access_indicator:A.random_access_indicator})}n+=188,204===this.ts_packet_size_&&(n+=16)}return this.dispatchAudioVideoMediaSegment(),n},t.prototype.parseAdaptationField=function(e,t,i){var n=new Uint8Array(e,t,i),o=n[0];return o>0?o>183?(r.A.w(this.TAG,"Illegal adaptation_field_length: ".concat(o)),{}):{discontinuity_indicator:(128&n[1])>>>7,random_access_indicator:(64&n[1])>>>6,elementary_stream_priority_indicator:(32&n[1])>>>5}:{}},t.prototype.handleSectionSlice=function(e,t,i,n){var r=new Uint8Array(e,t,i),o=this.section_slice_queues_?this.section_slice_queues_[n.pid]:{};if(n.payload_unit_start_indicator){var a=r[0];if(void 0!==o&&0!==(null==o?void 0:o.total_length)){var s=new Uint8Array(e,t+1,Math.min(i,a));o.slices.push(s),o.total_length+=s.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,n):this.clearSlices(o,n)}for(var d=1+a;d<r.byteLength&&255!==r[d+0];){var l=(15&r[d+1])<<8|r[d+2];this.section_slice_queues_&&(this.section_slice_queues_[n.pid]=new I,o=this.section_slice_queues_[n.pid]),o.expected_length=l+3,o.file_position=n.file_position,o.random_access_indicator=n.random_access_indicator,s=new Uint8Array(e,t+d,Math.min(i-d,o.expected_length-o.total_length)),o.slices.push(s),o.total_length+=s.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,n):o.total_length>=o.expected_length&&this.clearSlices(o,n),d+=s.byteLength}}else void 0!==o&&0!==o.total_length&&(s=new Uint8Array(e,t,Math.min(i,o.expected_length-o.total_length)),o.slices.push(s),o.total_length+=s.byteLength,o.total_length===o.expected_length?this.emitSectionSlices(o,n):o.total_length>=o.expected_length&&this.clearSlices(o,n))},t.prototype.handlePESSlice=function(e,t,i,n){var o=new Uint8Array(e,t,i),a=o[0]<<16|o[1]<<8|o[2],s=(o[3],o[4]<<8|o[5]);if(n.payload_unit_start_indicator){if(1!==a)return void r.A.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value ".concat(a));var d=this.pes_slice_queues_[n.pid];d&&(0===d.expected_length||d.expected_length===d.total_length?this.emitPESSlices(d,n):this.clearSlices(d,n)),this.pes_slice_queues_&&(this.pes_slice_queues_[n.pid]=new I,this.pes_slice_queues_[n.pid].file_position=n.file_position,this.pes_slice_queues_[n.pid].random_access_indicator=n.random_access_indicator)}if(void 0!==this.pes_slice_queues_[n.pid]){var l=this.pes_slice_queues_[n.pid];l.slices.push(o),n.payload_unit_start_indicator&&(l.expected_length=0===s?0:s+6),l.total_length+=o.byteLength,l.expected_length>0&&l.expected_length===l.total_length?this.emitPESSlices(l,n):l.expected_length>0&&l.expected_length<l.total_length&&this.clearSlices(l,n)}},t.prototype.emitSectionSlices=function(e,t){for(var i=new Uint8Array(e.total_length),n=0,r=0;n<e.slices.length;n++){var o=e.slices[n];i.set(o,r),r+=o.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var a=new O;a.pid=t.pid,a.data=i,a.file_position=e.file_position,a.random_access_indicator=e.random_access_indicator,this.parseSection(a)},t.prototype.emitPESSlices=function(e,t){for(var i=new Uint8Array(e.total_length),n=0,r=0;n<e.slices.length;n++){var o=e.slices[n];i.set(o,r),r+=o.byteLength}e.slices=[],e.expected_length=-1,e.total_length=0;var a=new R;a.pid=t.pid,a.data=i,a.stream_type=t.stream_type,a.file_position=e.file_position,a.random_access_indicator=e.random_access_indicator,this.parsePES(a)},t.prototype.clearSlices=function(e,t){e.slices=[],e.expected_length=-1,e.total_length=0},t.prototype.parseSection=function(e){var t,i=e.data,n=e.pid;0===n?this.parsePAT(i):n===this.current_pmt_pid_?this.parsePMT(i):(null===(t=this.pmt_)||void 0===t?void 0:t.scte_35_pids[n])&&this.parseSCTE35(i)},t.prototype.parsePES=function(e){var t=e.data,i=t[0]<<16|t[1]<<8|t[2],n=t[3],o=t[4]<<8|t[5];if(1===i)if(188!==n&&190!==n&&191!==n&&240!==n&&241!==n&&255!==n&&242!==n&&248!==n){t[6];var a=(192&t[7])>>>6,s=t[8],d=void 0,l=void 0;2!==a&&3!==a||(d=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,l=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:d);var c=9+s,h=void 0;if(0!==o){if(o<3+s)return void r.A.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");h=o-3-s}else h=t.byteLength-c;var u=t.subarray(c,c+h);switch(e.stream_type){case T.kMPEG1Audio:case T.kMPEG2Audio:this.parseMP3Payload(u,d);break;case T.kPESPrivateData:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(u,d):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(u,d):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(u,d):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(u,d,l,e.pid,n):this.parsePESPrivateDataPayload(u,d,l,e.pid,n);break;case T.kADTSAAC:this.parseADTSAACPayload(u,d);break;case T.kLOASAAC:this.parseLOASAACPayload(u,d);break;case T.kAC3:this.parseAC3Payload(u,d);break;case T.kEAC3:this.parseEAC3Payload(u,d);break;case T.kID3:this.parseTimedID3MetadataPayload(u,d,l,e.pid,n);break;case T.kH264:this.parseH264Payload(u,d,l,e.file_position,e.random_access_indicator);break;case T.kH265:this.parseH265Payload(u,d,l,e.file_position,e.random_access_indicator)}}else 188!==n&&191!==n&&240!==n&&241!==n&&255!==n&&242!==n&&248!==n||e.stream_type!==T.kPESPrivateData||(c=6,h=void 0,h=0!==o?o:t.byteLength-c,u=t.subarray(c,c+h),this.parsePESPrivateDataPayload(u,void 0,void 0,e.pid,n));else r.A.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value ".concat(i))},t.prototype.parsePAT=function(e){var t=e[0];if(0===t){var i=(15&e[1])<<8|e[2],n=(e[3],e[4],(62&e[5])>>>1),o=1&e[5],a=e[6],s=(e[7],null);if(1===o&&0===a)(s=new B).version_number=n;else if(null==(s=this.pat_))return;for(var d=i-5-4,l=-1,c=-1,h=8;h<8+d;h+=4){var u=e[h]<<8|e[h+1],A=(31&e[h+2])<<8|e[h+3];0===u?s.network_pid=A:(s.program_pmt_pid[u]=A,-1===l&&(l=u),-1===c&&(c=A))}1===o&&0===a&&(void 0===this.pat_&&r.A.v(this.TAG,"Parsed first PAT: ".concat(JSON.stringify(s))),this.pat_=s,this.current_program_=l,this.current_pmt_pid_=c)}else r.A.e(this.TAG,"parsePAT: table_id ".concat(t," is not corresponded to PAT!"))},t.prototype.parsePMT=function(e){var t=e[0];if(2===t){var i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],o=(62&e[5])>>>1,a=1&e[5],s=e[6],d=(e[7],null);if(1===a&&0===s)(d=new C).program_number=n,d.version_number=o,this.program_pmt_map_[n]=d;else if(null==(d=this.program_pmt_map_[n]))return;e[8],e[9];for(var l=(15&e[10])<<8|e[11],c=12+l,h=i-9-l-4,u=c;u<c+h;){var A=e[u],p=(31&e[u+1])<<8|e[u+2],_=(15&e[u+3])<<8|e[u+4];d.pid_stream_type[p]=A;var f=d.common_pids.h264||d.common_pids.h265,m=d.common_pids.adts_aac||d.common_pids.loas_aac||d.common_pids.ac3||d.common_pids.eac3||d.common_pids.opus||d.common_pids.mp3;if(A!==T.kH264||f)if(A!==T.kH265||f)if(A!==T.kADTSAAC||m)if(A!==T.kLOASAAC||m)if(A!==T.kAC3||m)if(A!==T.kEAC3||m)if(A!==T.kMPEG1Audio&&A!==T.kMPEG2Audio||m)if(A===T.kPESPrivateData){if(d.pes_private_data_pids[p]=!0,_>0){for(var v=u+5;v<u+5+_;){var g=e[v+0],y=e[v+1];if(5===g){var b=String.fromCharCode.apply(String,we([],Se(Array.from(e.subarray(v+2,v+2+y))),!1));"VANC"===b?d.smpte2038_pids[p]=!0:"Opus"===b&&(d.common_pids.opus=p)}else if(127===g&&p===d.common_pids.opus){var E=null;if(128===e[v+2]&&(E=e[v+3]),null==E){r.A.e(this.TAG,"Not Supported Opus channel count.");continue}var S={codec:"opus",channel_count:15&E?15&E:2,channel_config_code:E,sample_rate:48e3},w={codec:"opus",meta:S};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(w)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(w)):(this.audio_metadata_=S,this.dispatchAudioInitSegment(w))}v+=2+y}var B=e.subarray(u+5,u+5+_);this.dispatchPESPrivateDataDescriptor(p,A,B)}}else A===T.kID3?d.timed_id3_pids[p]=!0:A===T.kSCTE35&&(d.scte_35_pids[p]=!0);else d.common_pids.mp3=p;else d.common_pids.eac3=p;else d.common_pids.ac3=p;else d.common_pids.loas_aac=p;else d.common_pids.adts_aac=p;else d.common_pids.h265=p;else d.common_pids.h264=p;u+=5+_}n===this.current_program_&&(void 0===this.pmt_&&r.A.v(this.TAG,"Parsed first PMT: ".concat(JSON.stringify(d))),this.pmt_=d,(d.common_pids.h264||d.common_pids.h265)&&(this.has_video_=!0),(d.common_pids.adts_aac||d.common_pids.loas_aac||d.common_pids.ac3||d.common_pids.opus||d.common_pids.mp3)&&(this.has_audio_=!0))}else r.A.e(this.TAG,"parsePMT: table_id ".concat(t," is not corresponded to PMT!"))},t.prototype.parseSCTE35=function(e){var t=function(e){var t,i,n,r,o,a,s=new A(e),d=s.readBits(8),l=s.readBool(),c=s.readBool();s.readBits(2);var h=s.readBits(12),u=s.readBits(8),p=s.readBool(),_=s.readBits(6),f=4*s.readBits(31)+s.readBits(2),m=s.readBits(8),v=s.readBits(12),g=s.readBits(12),y=s.readBits(8),b=null;y===V.kSpliceNull?b={}:y===V.kSpliceSchedule?b=function(e){for(var t=e.readBits(8),i=[],n=0;n<t;n++)i.push(ee(e));return{splice_count:t,events:i}}(s):y===V.kSpliceInsert?b=function(e){var t=e.readBits(32),i=e.readBool();e.readBits(7);var n={splice_event_id:t,splice_event_cancel_indicator:i};if(i)return n;if(n.out_of_network_indicator=e.readBool(),n.program_splice_flag=e.readBool(),n.duration_flag=e.readBool(),n.splice_immediate_flag=e.readBool(),e.readBits(4),n.program_splice_flag&&!n.splice_immediate_flag&&(n.splice_time=Y(e)),!n.program_splice_flag){n.component_count=e.readBits(8),n.components=[];for(var r=0;r<n.component_count;r++)n.components.push(K(n.splice_immediate_flag,e))}return n.duration_flag&&(n.break_duration=Z(e)),n.unique_program_id=e.readBits(16),n.avail_num=e.readBits(8),n.avails_expected=e.readBits(8),n}(s):y===V.kTimeSignal?b=function(e){return{splice_time:Y(e)}}(s):y===V.kBandwidthReservation?b={}:y===V.kPrivateCommand?b=function(e,t){for(var i=String.fromCharCode(t.readBits(8),t.readBits(8),t.readBits(8),t.readBits(8)),n=new Uint8Array(e-4),r=0;r<e-4;r++)n[r]=t.readBits(8);return{identifier:i,private_data:n.buffer}}(g,s):s.readBits(8*g);for(var E=[],S=s.readBits(16),w=0;w<S;){var T=s.readBits(8),B=s.readBits(8),k=String.fromCharCode(s.readBits(8),s.readBits(8),s.readBits(8),s.readBits(8));0===T?E.push(te(T,B,k,s)):1===T?E.push(ie(T,B,k,s)):2===T?E.push(re(T,B,k,s)):3===T?E.push(oe(T,B,k,s)):4===T?E.push(se(T,B,k,s)):s.readBits(8*(B-4)),w+=2+B}var C={table_id:d,section_syntax_indicator:l,private_indicator:c,section_length:h,protocol_version:u,encrypted_packet:p,encryption_algorithm:_,pts_adjustment:f,cw_index:m,tier:v,splice_command_length:g,splice_command_type:y,splice_command:b,descriptor_loop_length:S,splice_descriptors:E,E_CRC32:p?s.readBits(32):void 0,CRC32:s.readBits(32)};if(y===V.kSpliceInsert){var R=b;if(R.splice_event_cancel_indicator)return{splice_command_type:y,detail:C,data:e};if(R.program_splice_flag&&!R.splice_immediate_flag){var O=R.duration_flag?null===(t=null==R?void 0:R.break_duration)||void 0===t?void 0:t.auto_return:void 0,I=R.duration_flag?((null===(i=null==R?void 0:R.break_duration)||void 0===i?void 0:i.duration)||0)/90:void 0;return(null===(n=R.splice_time)||void 0===n?void 0:n.time_specified_flag)?{splice_command_type:y,pts:(f+((null===(r=null==R?void 0:R.splice_time)||void 0===r?void 0:r.pts_time)||0))%Math.pow(2,33),auto_return:O,duraiton:I,detail:C,data:e}:{splice_command_type:y,auto_return:O,duraiton:I,detail:C,data:e}}return{splice_command_type:y,auto_return:O=R.duration_flag?null===(o=R.break_duration)||void 0===o?void 0:o.auto_return:void 0,duraiton:I=R.duration_flag?((null===(a=R.break_duration)||void 0===a?void 0:a.duration)||0)/90:void 0,detail:C,data:e}}if(y===V.kTimeSignal){var x=b;return x.splice_time.time_specified_flag?{splice_command_type:y,pts:(f+(x.splice_time.pts_time||0))%Math.pow(2,33),detail:C,data:e}:{splice_command_type:y,detail:C,data:e}}return{splice_command_type:y,detail:C,data:e}}(e);if(void 0!==t.pts){var i=Math.floor(t.pts/this.timescale_);t.pts=i}else t.nearest_pts=this.aac_last_sample_pts_;this.onSCTE35Metadata&&this.onSCTE35Metadata(t)},t.prototype.parseH264Payload=function(e,t,i,n,o){for(var a,s,d=new P(e),l=null,c=[],h=0,u=!1;null!=(l=d.readNextNaluPayload());){var A=new M(l);if(A.type===k.kSliceSPS){var _=p.parseSPS(l.data);this.video_init_segment_dispatched_?this.detectVideoMetadataChange(A,_)&&(r.A.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:A,pps:void 0,details:_}):this.video_metadata_&&(this.video_metadata_.sps=A,this.video_metadata_.details=_)}else A.type===k.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_&&(this.video_metadata_.pps=A),(null===(a=this.video_metadata_)||void 0===a?void 0:a.sps)&&(null===(s=this.video_metadata_)||void 0===s?void 0:s.pps)&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(A.type===k.kSliceIDR||A.type===k.kSliceNonIDR&&1===o)&&(u=!0);this.video_init_segment_dispatched_&&(c.push(A),h+=A.data.byteLength)}var f=Math.floor(t/this.timescale_),m=Math.floor(i/this.timescale_);if(c.length){var v=this.video_track_,g={units:c,length:h,isKeyframe:u,dts:m,pts:f,cts:f-m,file_position:n};v&&(v.samples.push(g),v.length+=h)}},t.prototype.parseH265Payload=function(e,t,i,n,o){for(var a,s,d,l,c,h,u,A=new ce(e),p=null,_=[],m=0,v=!1;null!=(p=A.readNextNaluPayload());){var g=new le(p);if(g.type===$.kSliceVPS){if(!this.video_init_segment_dispatched_){var y=f.parseVPS(p.data);this.video_metadata_&&(this.video_metadata_.vps=g,this.video_metadata_.details=Ee(Ee({},null===(a=this.video_metadata_)||void 0===a?void 0:a.details),y))}}else g.type===$.kSliceSPS?(y=f.parseSPS(p.data),this.video_init_segment_dispatched_?this.detectVideoMetadataChange(g,y)&&(r.A.v(this.TAG,"H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:g,pps:void 0,details:y}):this.video_metadata_&&(this.video_metadata_.sps=g,this.video_metadata_.details=Ee(Ee({},null===(s=this.video_metadata_)||void 0===s?void 0:s.details),y))):g.type===$.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(y=f.parsePPS(p.data),this.video_metadata_&&(this.video_metadata_.pps=g,this.video_metadata_.details=Ee(Ee({},null===(d=this.video_metadata_)||void 0===d?void 0:d.details),y)),(null===(l=this.video_metadata_)||void 0===l?void 0:l.vps)&&(null===(c=this.video_metadata_)||void 0===c?void 0:c.sps)&&(null===(h=this.video_metadata_)||void 0===h?void 0:h.pps)&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):g.type!==$.kSliceIDR_W_RADL&&g.type!==$.kSliceIDR_N_LP&&g.type!==$.kSliceCRA_NUT||(v=!0);this.video_init_segment_dispatched_&&(_.push(g),m+=g.data.byteLength)}var b=Math.floor(t/this.timescale_),E=Math.floor(i/this.timescale_);if(_.length){var S=this.video_track_,w={units:_,length:m,isKeyframe:v,dts:E,pts:b,cts:b-E,file_position:n};S&&(null===(u=S.samples)||void 0===u||u.push(w),S.length+=m)}},t.prototype.detectVideoMetadataChange=function(e,t){var i,n,o,a,s,d,l,c,h,u;if(t.codec_mimetype!==(null===(n=null===(i=this.video_metadata_)||void 0===i?void 0:i.details)||void 0===n?void 0:n.codec_mimetype))return r.A.v(this.TAG,"Video: Codec mimeType changed from "+"".concat(null===(o=this.video_metadata_)||void 0===o?void 0:o.details.codec_mimetype," to ").concat(null==t?void 0:t.codec_mimetype)),!0;if(t.codec_size.width!==(null===(s=null===(a=this.video_metadata_)||void 0===a?void 0:a.details)||void 0===s?void 0:s.codec_size.width)||t.codec_size.height!==(null===(l=null===(d=this.video_metadata_)||void 0===d?void 0:d.details)||void 0===l?void 0:l.codec_size.height)){var A=null===(c=this.video_metadata_)||void 0===c?void 0:c.details.codec_size,p=t.codec_size;return r.A.v(this.TAG,"Video: Coded Resolution changed from "+"".concat(A.width,"x").concat(A.height," to ").concat(p.width,"x").concat(p.height)),!0}return t.present_size.width!==(null===(h=this.video_metadata_)||void 0===h?void 0:h.details.present_size.width)&&(r.A.v(this.TAG,"Video: Present resolution width changed from "+"".concat(null===(u=this.video_metadata_)||void 0===u?void 0:u.details.present_size.width," to ").concat(null==t?void 0:t.present_size.width)),!0)},t.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},t.prototype.dispatchVideoInitSegment=function(){var e,t,i,n,o,a,s,d,l,c,h,u,A=null===(e=this.video_metadata_)||void 0===e?void 0:e.details,p={type:"video"};p.id=null===(t=this.video_track_)||void 0===t?void 0:t.id,p.timescale=1e3,p.duration=this.duration_,p.codecWidth=A.codec_size.width,p.codecHeight=A.codec_size.height,p.presentWidth=A.present_size.width,p.presentHeight=A.present_size.height,p.profile=A.profile_string,p.level=A.level_string,p.bitDepth=A.bit_depth,p.chromaFormat=A.chroma_format,p.sarRatio=A.sar_ratio,p.frameRate=A.frame_rate;var _=p.frameRate.fps_den,f=p.frameRate.fps_num;if(p.refSampleDuration=_/f*1e3,p.codec=A.codec_mimetype,null===(i=this.video_metadata_)||void 0===i?void 0:i.vps){var m=null===(n=this.video_metadata_)||void 0===n?void 0:n.vps.data.subarray(4),v=null===(a=null===(o=this.video_metadata_)||void 0===o?void 0:o.sps)||void 0===a?void 0:a.data.subarray(4),g=null===(d=null===(s=this.video_metadata_)||void 0===s?void 0:s.pps)||void 0===d?void 0:d.data.subarray(4),y=new he(m,v,g,A);p.hvcc=y.getData(),this.video_init_segment_dispatched_||r.A.v(this.TAG,"Generated first HEVCDecoderConfigurationRecord for mimeType: ".concat(p.codec))}else{v=null===(c=null===(l=this.video_metadata_)||void 0===l?void 0:l.sps)||void 0===c?void 0:c.data.subarray(4),g=null===(u=null===(h=this.video_metadata_)||void 0===h?void 0:h.pps)||void 0===u?void 0:u.data.subarray(4);var b=new U(v,g,A);p.avcc=b.getData(),this.video_init_segment_dispatched_||r.A.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: ".concat(p.codec))}this.onTrackMetadata&&this.onTrackMetadata("video",p),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var E=this.media_info_;E.hasVideo=!0,E.width=p.codecWidth,E.height=p.codecHeight,E.fps=p.frameRate.fps,E.profile=p.profile,E.level=p.level,E.refFrames=A.ref_frames,E.chromaFormat=A.chroma_format_string,E.sarNum=p.sarRatio.width,E.sarDen=p.sarRatio.height,E.videoCodec=p.codec,E.hasAudio&&E.audioCodec?E.mimeType='video/mp2t; codecs="'.concat(E.videoCodec,",").concat(E.audioCodec,'"'):E.mimeType='video/mp2t; codecs="'.concat(E.videoCodec,'"'),E.isComplete()&&this.onMediaInfo&&this.onMediaInfo(E)},t.prototype.dispatchVideoMediaSegment=function(){var e;this.isInitSegmentDispatched()&&(null===(e=this.video_track_)||void 0===e?void 0:e.length)&&this.onDataAvailable&&this.onDataAvailable(null,this.video_track_)},t.prototype.dispatchAudioMediaSegment=function(){var e;this.isInitSegmentDispatched()&&(null===(e=this.audio_track_)||void 0===e?void 0:e.length)&&this.onDataAvailable&&this.onDataAvailable(this.audio_track_,null)},t.prototype.dispatchAudioVideoMediaSegment=function(){var e,t;this.isInitSegmentDispatched()&&((null===(e=this.audio_track_)||void 0===e?void 0:e.length)||(null===(t=this.video_track_)||void 0===t?void 0:t.length))&&this.onDataAvailable&&this.onDataAvailable(this.audio_track_,this.video_track_)},t.prototype.parseADTSAACPayload=function(e,t){var i,n,o;if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var a=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);a.set(this.aac_last_incomplete_data_,0),a.set(e,this.aac_last_incomplete_data_.byteLength),e=a}var s,d=0;if(void 0!==t&&(d=t/this.timescale_),"aac"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec)){if(void 0===t&&void 0!==this.aac_last_sample_pts_)s=1024/(null===(n=this.audio_metadata_)||void 0===n?void 0:n.sampling_frequency)*1e3,d=this.aac_last_sample_pts_+s;else if(void 0===t)return void r.A.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){s=1024/this.audio_metadata_.sampling_frequency*1e3;var l=this.aac_last_sample_pts_+s;Math.abs(l-d)>1&&(r.A.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(l,"ms, PES pts: ").concat(d,"ms")),d=l)}}for(var c=new Q(e),h=null,u=d,A=0;null!=(h=c.readNextAACFrame());){s=1024/h.sampling_frequency*1e3;var p={codec:"aac",data:h};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(p)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(p)):(this.audio_metadata_={codec:"aac",audio_object_type:h.audio_object_type,sampling_freq_index:h.sampling_freq_index,sampling_frequency:h.sampling_frequency,channel_config:h.channel_config},this.dispatchAudioInitSegment(p)),A=u;var _=Math.floor(u),f={unit:h.data,length:h.data.byteLength,pts:_,dts:_};this.audio_track_&&(null===(o=this.audio_track_)||void 0===o||o.samples.push(f),this.audio_track_.length+=h.data.byteLength),u+=s}c.hasIncompleteData()&&(this.aac_last_incomplete_data_=c.getIncompleteData()),A&&(this.aac_last_sample_pts_=A)}},t.prototype.parseLOASAACPayload=function(e,t){var i,n,o;if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var a=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);a.set(this.aac_last_incomplete_data_,0),a.set(e,this.aac_last_incomplete_data_.byteLength),e=a}var s,d=0;if(void 0!==t&&(d=t/this.timescale_),"aac"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec)){if(void 0===t&&void 0!==this.aac_last_sample_pts_)s=1024/this.audio_metadata_.sampling_frequency*1e3,d=this.aac_last_sample_pts_+s;else if(void 0===t)return void r.A.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.aac_last_sample_pts_){s=1024/this.audio_metadata_.sampling_frequency*1e3;var l=this.aac_last_sample_pts_+s;Math.abs(l-d)>1&&(r.A.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(l,"ms, PES pts: ").concat(d,"ms")),d=l)}}for(var c=new z(e),h=null,u=d,A=0;null!=(h=c.readNextAACFrame(null!==(n=this.loas_previous_frame)&&void 0!==n?n:void 0));){this.loas_previous_frame=h,s=1024/h.sampling_frequency*1e3;var p={codec:"aac",data:h};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(p)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(p)):(this.audio_metadata_={codec:"aac",audio_object_type:h.audio_object_type,sampling_freq_index:h.sampling_freq_index,sampling_frequency:h.sampling_frequency,channel_config:h.channel_config},this.dispatchAudioInitSegment(p)),A=u;var _=Math.floor(u),f={unit:h.data,length:h.data.byteLength,pts:_,dts:_};this.audio_track_&&(null===(o=this.audio_track_)||void 0===o||o.samples.push(f),this.audio_track_.length+=h.data.byteLength),u+=s}c.hasIncompleteData()&&(this.aac_last_incomplete_data_=c.getIncompleteData()),A&&(this.aac_last_sample_pts_=A)}},t.prototype.parseAC3Payload=function(e,t){var i,n;if(!this.has_video_||this.video_init_segment_dispatched_){var o,a=0;if(void 0!==t&&(a=t/this.timescale_),"ac-3"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec))if(void 0===t&&void 0!==this.aac_last_sample_pts_)o=1536/this.audio_metadata_.sampling_frequency*1e3,a=this.aac_last_sample_pts_+o;else if(void 0===t)return void r.A.w(this.TAG,"AC3: Unknown pts");for(var s=new fe(e),d=null,l=a,c=0;null!=(d=s.readNextAC3Frame());){o=1536/d.sampling_frequency*1e3;var h={codec:"ac-3",data:d};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(h)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(h)):(this.audio_metadata_={codec:"ac-3",sampling_frequency:d.sampling_frequency,bit_stream_identification:d.bit_stream_identification,bit_stream_mode:d.bit_stream_mode,low_frequency_effects_channel_on:d.low_frequency_effects_channel_on,channel_mode:d.channel_mode},this.dispatchAudioInitSegment(h)),c=l;var u=Math.floor(l),A={unit:d.data,length:d.data.byteLength,pts:u,dts:u};this.audio_track_&&(null===(n=this.audio_track_)||void 0===n||n.samples.push(A),this.audio_track_.length+=d.data.byteLength),l+=o}c&&(this.aac_last_sample_pts_=c)}},t.prototype.parseEAC3Payload=function(e,t){var i,n;if(!this.has_video_||this.video_init_segment_dispatched_){var o,a=0;if(void 0!==t&&(a=t/this.timescale_),"ec-3"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec))if(void 0===t&&void 0!==this.aac_last_sample_pts_)o=256*(this.audio_metadata_.num_blks||0)/(this.audio_metadata_.sampling_frequency||0)*1e3,a=this.aac_last_sample_pts_+o;else if(void 0===t)return void r.A.w(this.TAG,"EAC3: Unknown pts");for(var s=new ge(e),d=null,l=a,c=0;null!=(d=s.readNextEAC3Frame());){o=1536/d.sampling_frequency*1e3;var h={codec:"ec-3",data:d};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(h)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(h)):(this.audio_metadata_={codec:"ec-3",sampling_frequency:d.sampling_frequency,bit_stream_identification:d.bit_stream_identification,low_frequency_effects_channel_on:d.low_frequency_effects_channel_on,num_blks:d.num_blks,channel_mode:d.channel_mode},this.dispatchAudioInitSegment(h)),c=l;var u=Math.floor(l),A={unit:d.data,length:d.data.byteLength,pts:u,dts:u};this.audio_track_&&(null===(n=this.audio_track_)||void 0===n||n.samples.push(A),this.audio_track_.length+=d.data.byteLength),l+=o}c&&(this.aac_last_sample_pts_=c)}},t.prototype.parseOpusPayload=function(e,t){var i,n;if(!this.has_video_||this.video_init_segment_dispatched_){var o,a=0;if(void 0!==t&&(a=t/this.timescale_),"opus"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec))if(void 0===t&&void 0!==this.aac_last_sample_pts_)o=20,a=this.aac_last_sample_pts_+o;else if(void 0===t)return void r.A.w(this.TAG,"Opus: Unknown pts");for(var s=a,d=0,l=0;l<e.length;){o=20;for(var c=!!(16&e[l+1]),h=!!(8&e[l+1]),u=l+2,A=0;255===e[u];)A+=255,u+=1;A+=e[u],u+=1,u+=c?2:0,u+=h?2:0,d=s;var p=Math.floor(s),_=e.slice(u,u+A),f={unit:_,length:_.byteLength,pts:p,dts:p};this.audio_track_&&(null===(n=this.audio_track_)||void 0===n||n.samples.push(f),this.audio_track_.length+=_.byteLength),s+=o,l=u+A}d&&(this.aac_last_sample_pts_=d)}},t.prototype.parseMP3Payload=function(e,t){var i;if(!this.has_video_||this.video_init_segment_dispatched_){var n=e[1]>>>3&3,r=(6&e[1])>>1,o=(e[2],(12&e[2])>>>2),a=3&~(e[3]>>>6)?2:1,s=0,d=34;switch(n){case 0:s=[11025,12e3,8e3,0][o];break;case 2:s=[22050,24e3,16e3,0][o];break;case 3:s=[44100,48e3,32e3,0][o]}switch(r){case 1:d=34;break;case 2:d=33;break;case 3:d=32}var l=new Ae;l.object_type=d,l.sample_rate=s,l.channel_count=a,l.data=e;var c={codec:"mp3",data:l};this.audio_init_segment_dispatched_?this.detectAudioMetadataChange(c)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(c)):(this.audio_metadata_={codec:"mp3",object_type:d,sample_rate:s,channel_count:a},this.dispatchAudioInitSegment(c));var h={unit:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_};this.audio_track_&&(null===(i=this.audio_track_)||void 0===i||i.samples.push(h),this.audio_track_.length+=e.byteLength)}},t.prototype.detectAudioMetadataChange=function(e){var t,i,n,o;if(e.codec!==(null===(t=this.audio_metadata_)||void 0===t?void 0:t.codec))return r.A.v(this.TAG,"Audio: Audio Codecs changed from "+"".concat(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec," to ").concat(e.codec)),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){if((a=e.data).audio_object_type!==this.audio_metadata_.audio_object_type)return r.A.v(this.TAG,"AAC: AudioObjectType changed from "+"".concat(this.audio_metadata_.audio_object_type," to ").concat(a.audio_object_type)),!0;if(a.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return r.A.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sampling_freq_index," to ").concat(a.sampling_freq_index)),!0;if(a.channel_config!==this.audio_metadata_.channel_config)return r.A.v(this.TAG,"AAC: Channel configuration changed from "+"".concat(null===(n=this.audio_metadata_)||void 0===n?void 0:n.channel_config," to ").concat(a.channel_config)),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){var a;if((a=e.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return r.A.v(this.TAG,"AC3: Sampling Frequency changed from "+"".concat(null===(o=this.audio_metadata_)||void 0===o?void 0:o.sampling_frequency," to ").concat(a.sampling_frequency)),!0;if(a.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return r.A.v(this.TAG,"AC3: Bit Stream Identification changed from "+"".concat(this.audio_metadata_.bit_stream_identification," to ").concat(a.bit_stream_identification)),!0;if(a.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return r.A.v(this.TAG,"AC3: BitStream Mode changed from "+"".concat(this.audio_metadata_.bit_stream_mode," to ").concat(a.bit_stream_mode)),!0;if(a.channel_mode!==this.audio_metadata_.channel_mode)return r.A.v(this.TAG,"AC3: Channel Mode changed from "+"".concat(this.audio_metadata_.channel_mode," to ").concat(a.channel_mode)),!0;if(a.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return r.A.v(this.TAG,"AC3: Low Frequency Effects Channel On changed from "+"".concat(this.audio_metadata_.low_frequency_effects_channel_on," to ").concat(a.low_frequency_effects_channel_on)),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){if((s=e.meta).sample_rate!==this.audio_metadata_.sample_rate)return r.A.v(this.TAG,"Opus: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(s.sample_rate)),!0;if(s.channel_count!==this.audio_metadata_.channel_count)return r.A.v(this.TAG,"Opus: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(s.channel_count)),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){var s;if((s=e.data).object_type!==this.audio_metadata_.object_type)return r.A.v(this.TAG,"MP3: AudioObjectType changed from "+"".concat(this.audio_metadata_.object_type," to ").concat(s.object_type)),!0;if(s.sample_rate!==this.audio_metadata_.sample_rate)return r.A.v(this.TAG,"MP3: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(s.sample_rate)),!0;if(s.channel_count!==this.audio_metadata_.channel_count)return r.A.v(this.TAG,"MP3: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(s.channel_count)),!0}return!1},t.prototype.dispatchAudioInitSegment=function(e){var t,i,n,o,a,s,d={type:"audio"};if(d.id=null===(t=this.audio_track_)||void 0===t?void 0:t.id,d.timescale=1e3,d.duration=this.duration_,"aac"===(null===(i=this.audio_metadata_)||void 0===i?void 0:i.codec)){var l="aac"===e.codec?e.data:null,c=new H(l);d.audioSampleRate=c.sampling_rate,d.channelCount=c.channel_count,d.codec=c.codec_mimetype,d.originalCodec=c.original_codec_mimetype,d.config=c.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale}else if("ac-3"===(null===(n=this.audio_metadata_)||void 0===n?void 0:n.codec)){var h="ac-3"===e.codec?e.data:null,u=new me(h);d.audioSampleRate=u.sampling_rate,d.channelCount=u.channel_count,d.codec=u.codec_mimetype,d.originalCodec=u.original_codec_mimetype,d.config=u.config,d.refSampleDuration=1536/d.audioSampleRate*d.timescale}else if("ec-3"===(null===(o=this.audio_metadata_)||void 0===o?void 0:o.codec)){var A="ec-3"===e.codec?e.data:null,p=new ye(A);d.audioSampleRate=p.sampling_rate,d.channelCount=p.channel_count,d.codec=p.codec_mimetype,d.originalCodec=p.original_codec_mimetype,d.config=p.config,d.refSampleDuration=256*p.num_blks/d.audioSampleRate*d.timescale}else"opus"===(null===(a=this.audio_metadata_)||void 0===a?void 0:a.codec)?(d.audioSampleRate=this.audio_metadata_.sample_rate,d.channelCount=this.audio_metadata_.channel_count,d.channelConfigCode=this.audio_metadata_.channel_config_code,d.codec="opus",d.originalCodec="opus",d.config=void 0,d.refSampleDuration=20):"mp3"===(null===(s=this.audio_metadata_)||void 0===s?void 0:s.codec)&&(d.audioSampleRate=this.audio_metadata_.sample_rate,d.channelCount=this.audio_metadata_.channel_count,d.codec="mp3",d.originalCodec="mp3",d.config=void 0);this.audio_init_segment_dispatched_||r.A.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: ".concat(d.codec)),this.onTrackMetadata&&this.onTrackMetadata("audio",d),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var _=this.media_info_;_.hasAudio=!0,_.audioCodec=d.originalCodec,_.audioSampleRate=d.audioSampleRate,_.audioChannelCount=d.channelCount,_.hasVideo&&_.videoCodec?_.mimeType='video/mp2t; codecs="'.concat(_.videoCodec,",").concat(_.audioCodec,'"'):_.mimeType='video/mp2t; codecs="'.concat(_.audioCodec,'"'),_.isComplete()&&this.onMediaInfo&&this.onMediaInfo(_)},t.prototype.dispatchPESPrivateDataDescriptor=function(e,t,i){var n=new X;n.pid=e,n.stream_type=t,n.descriptor=i,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(n)},t.prototype.parsePESPrivateDataPayload=function(e,t,i,n,r){var o=new q;if(o.pid=n,o.stream_id=r,o.len=e.byteLength,o.data=e,void 0!==t){var a=Math.floor(t/this.timescale_);o.pts=a}else o.nearest_pts=this.aac_last_sample_pts_;if(void 0!==i){var s=Math.floor(i/this.timescale_);o.dts=s}this.onPESPrivateData&&this.onPESPrivateData(o)},t.prototype.parseTimedID3MetadataPayload=function(e,t,i,n,r){var o=new q;if(o.pid=n,o.stream_id=r,o.len=e.byteLength,o.data=e,void 0!==t){var a=Math.floor(t/this.timescale_);o.pts=a}if(void 0!==i){var s=Math.floor(i/this.timescale_);o.dts=s}this.onTimedID3Metadata&&this.onTimedID3Metadata(o)},t.prototype.parseSMPTE2038MetadataPayload=function(e,t,i,n,r){var o=new ue;if(o.pid=n,o.stream_id=r,o.len=e.byteLength,o.data=e,void 0!==t){var a=Math.floor(t/this.timescale_);o.pts=a}if(o.nearest_pts=this.aac_last_sample_pts_,void 0!==i){var s=Math.floor(i/this.timescale_);o.dts=s}o.ancillaries=function(e){for(var t=new A(e),i=0,n=[];i+=6,0===t.readBits(6);){var r=t.readBool();i+=1;var o=t.readBits(11);i+=11;var a=t.readBits(12);i+=12;var s=255&t.readBits(10);i+=10;var d=255&t.readBits(10);i+=10;var l=255&t.readBits(10);i+=10;for(var c=new Uint8Array(l),h=0;h<l;h++){var u=255&t.readBits(10);i+=10,c[h]=u}t.readBits(10),i+=10;var p="User Defined";65===s?7===d&&(p="SCTE-104"):95===s?220===d?p="ARIB STD-B37 (1SEG)":221===d?p="ARIB STD-B37 (ANALOG)":222===d?p="ARIB STD-B37 (SD)":223===d&&(p="ARIB STD-B37 (HD)"):97===s&&(1===d?p="EIA-708":2===d&&(p="EIA-608")),n.push({yc_indicator:r,line_number:o,horizontal_offset:a,did:s,sdid:d,user_data:c,description:p,information:{}}),t.readBits(8-(i-Math.floor(i/8))%8),i+=(8-(i-Math.floor(i/8)))%8}return t.destroy(),t=null,n}(e),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(o)},t}(w);const Be=Te;var ke=new Uint8Array([0,0,0,0,0,0,0,0]),Ce=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],av01:[],av1C:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)])},e.box=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=8,r=null,o=Array.prototype.slice.call(arguments,1),a=o.length,s=0;s<a;s++)n+=o[s].byteLength;(r=new Uint8Array(n))[0]=n>>>24&255,r[1]=n>>>16&255,r[2]=n>>>8&255,r[3]=255&n,r.set(e,4);var d=8;for(s=0;s<a;s++)r.set(o[s],d),d+=o[s].byteLength;return r},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),n=e.moov(t),r=new Uint8Array(i.byteLength+n.byteLength);return r.set(i,0),r.set(n,i.byteLength),r},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),n=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,i,n,r)},e.mvhd=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]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,n=t.duration,r=t.presentWidth,o=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,n>>>24&255,n>>>16&255,n>>>8&255,255&n,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,r>>>8&255,255&r,0,0,o>>>8&255,255&o,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,n=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,n>>>24&255,n>>>16&255,n>>>8&255,255&n,85,196,0,0]))},e.hdlr=function(t){var i;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=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))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):"ac-3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ac3(t)):"ec-3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.ec3(t)):"opus"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.Opus(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):"video"===t.type&&t.codec.startsWith("hvc1")?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(t)):"video"===t.type&&t.codec.startsWith("av01")?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.av01(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,n=t.audioSampleRate,r=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,n>>>8&255,255&n,0,0]);return e.box(e.types[".mp3"],r)},e.mp4a=function(t){var i=t.channelCount,n=t.audioSampleRate,r=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,n>>>8&255,255&n,0,0]);return e.box(e.types.mp4a,r,e.esds(t))},e.ac3=function(t){var i,n=t.channelCount,r=t.audioSampleRate,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types["ac-3"],o,e.box(e.types.dac3,new Uint8Array(null!==(i=t.config)&&void 0!==i?i:[])))},e.ec3=function(t){var i,n=t.channelCount,r=t.audioSampleRate,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,n,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return e.box(e.types["ec-3"],o,e.box(e.types.dec3,new Uint8Array(null!==(i=t.config)&&void 0!==i?i:[])))},e.esds=function(t){var i,n=null!==(i=t.config)&&void 0!==i?i:[],r=n.length,o=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(n).concat([6,1,2]));return e.box(e.types.esds,o)},e.Opus=function(t){var i=t.channelCount,n=t.audioSampleRate,r=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,n>>>8&255,255&n,0,0]);return e.box(e.types.Opus,r,e.dOps(t))},e.dOps=function(t){var i=t.channelCount,n=t.channelConfigCode,r=t.audioSampleRate,o=[];switch(n){case 1:case 2:o=[0];break;case 0:o=[255,1,1,0,1];break;case 128:o=[255,2,0,0,1];break;case 3:o=[1,2,1,0,2,1];break;case 4:o=[1,2,2,0,1,2,3];break;case 5:o=[1,3,2,0,4,1,2,3];break;case 6:o=[1,4,2,0,4,1,2,3,5];break;case 7:o=[1,4,2,0,4,1,2,3,5,6];break;case 8:o=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:o=[1,1,2,0,1];break;case 131:o=[1,1,3,0,1,2];break;case 132:o=[1,1,4,0,1,2,3];break;case 133:o=[1,1,5,0,1,2,3,4];break;case 134:o=[1,1,6,0,1,2,3,4,5];break;case 135:o=[1,1,7,0,1,2,3,4,5,6];break;case 136:o=[1,1,8,0,1,2,3,4,5,6,7]}var a=new Uint8Array(function(e,t,i){if(2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}([0,i,0,0,r>>>24&255,r>>>17&255,r>>>8&255,r>>>0&255,0,0],function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}(o),!1));return e.box(e.types.dOps,a)},e.avc1=function(t){var i=t.avcc,n=t.codecWidth,r=t.codecHeight,o=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,n>>>8&255,255&n,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,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,o,e.box(e.types.avcC,i))},e.hvc1=function(t){var i=t.hvcc,n=t.codecWidth,r=t.codecHeight,o=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,n>>>8&255,255&n,r>>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,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,o,e.box(e.types.hvcC,i))},e.av01=function(t){var i,n,r=t.av1c,o=null!==(i=t.codecWidth)&&void 0!==i?i:192,a=null!==(n=t.codecHeight)&&void 0!==n?n:108,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>>8&255,255&o,a>>>8&255,255&a,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,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.av01,s,e.box(e.types.av1C,r))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,n=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,n)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var n=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),o=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),a=e.sdtp(t),s=e.trun(t,a.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,o,s,a)},e.sdtp=function(t){for(var i=t.samples||[],n=i.length,r=new Uint8Array(4+n),o=0;o<n;o++){var a=i[o].flags;r[o+4]=a.isLeading<<6|a.dependsOn<<4|a.isDependedOn<<2|a.hasRedundancy}return e.box(e.types.sdtp,r)},e.trun=function(t,i){var n=t.samples||[],r=n.length,o=12+16*r,a=new Uint8Array(o);i+=8+o,a.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var s=0;s<r;s++){var d=n[s].duration,l=n[s].size,c=n[s].flags,h=n[s].cts;a.set([d>>>24&255,d>>>16&255,d>>>8&255,255&d,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,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*s)}return e.box(e.types.trun,a)},e.mdat=function(t){return e.box(e.types.mdat,t)},e.constants={FTYP:new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),STSD_PREFIX:new Uint8Array([0,0,0,0,0,0,0,1]),STTS:ke,STSC:ke,STCO:ke,STSZ:new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),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]),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]),DREF:new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),SMHD:new Uint8Array([0,0,0,0,0,0,0,0]),VMHD:new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e}();Ce.init();const Re=Ce,Oe=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},e}();var Ie=i(453);const xe=function(){function e(e){var t;this.TAG="MP4Remuxer",this._fillSilentAfterSeek=!1,this._config=e,this._isLive=!!e.isLive,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new Ie.Sc("audio"),this._videoSegmentInfoList=new Ie.Sc("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.A.chrome||!(o.A.version&&o.A.version.major<50||o.A.version&&50===o.A.version.major&&((null===(t=o.A.version)||void 0===t?void 0:t.build)||0)<2661)),this._fillSilentAfterSeek=!(!o.A.msedge&&!o.A.msie),this._mp3UseMpegAudio=!o.A.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},e.prototype.bindDataSource=function(e){var t;return e.onDataAvailable=null===(t=this.remux)||void 0===t?void 0:t.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new c.j4("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),t&&this._remuxVideo(t),e&&this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,n="mp4",r=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(n="mpeg",r="",i=new Uint8Array):i=Re.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=Re.generateInitSegment(t)}if(!this._onInitSegment)throw new c.j4("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:r,container:"".concat(e,"/").concat(n),mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){var i,n;this._dtsBaseInited||((null===(i=null==e?void 0:e.samples)||void 0===i?void 0:i.length)&&(this._audioDtsBase=e.samples[0].dts),(null===(n=null==t?void 0:t.samples)||void 0===n?void 0:n.length)&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},e.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=null==e?void 0:e.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=null==t?void 0:t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)},e.prototype._remuxAudio=function(e,t){var i,n,a,s,d,l,c;if(null!=this._audioMeta){var h,u,A=e,p=A.samples,_=-1,f=this._audioMeta.refSampleDuration,m="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,v=this._dtsBaseInited&&void 0===this._audioNextDts,g=!1;if(p&&0!==p.length&&(1!==p.length||t)){var y=0,b=null,E=0;m?(y=0,E=A.length):(y=8,E=8+A.length);var S=null;if(p.length>1&&(E-=(S=p.pop()).length),null!=this._audioStashedLastSample){var w=this._audioStashedLastSample;this._audioStashedLastSample=null,p.unshift(w),E+=w.length}null!=S&&(this._audioStashedLastSample=S);var T=p[0].dts-this._dtsBase;if(this._audioNextDts)h=T-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())h=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(g=!0);else{var B=this._audioSegmentInfoList.getLastSampleBefore(T);if(null!=B){var k=T-(B.originalDts+B.duration);k<=3&&(k=0),h=T-(B.dts+B.duration+k)}else h=0}if(g){var C=T-h,R=this._videoSegmentInfoList.getLastSegmentBefore(T);if(null!=R&&R.beginDts<C){if(N=Oe.getSilentFrame(null===(i=this._audioMeta)||void 0===i?void 0:i.originalCodec,null===(n=this._audioMeta)||void 0===n?void 0:n.channelCount)){var O=R.beginDts,I=C-R.beginDts;r.A.v(this.TAG,"InsertPrefixSilentAudio: dts: ".concat(O,", duration: ").concat(I)),p.unshift({unit:N,dts:O,pts:O}),E+=N.byteLength}}else g=!1}for(var x=[],D=0;D<p.length;D++){var L=(w=p[D]).unit,M=w.dts-this._dtsBase,P=(O=M,!1),U=null,F=0;if(!(M<-.001)){if("mp3"!==this._audioMeta.codec){var V=M;if(this._audioNextDts&&(V=this._audioNextDts),(h=M-V)<=-3*(f||0)){r.A.w(this.TAG,"Dropping 1 audio frame (originalDts: ".concat(M," ms ,curRefDts: ").concat(V," ms)  due to dtsCorrection: ").concat(h," ms overlap."));continue}if(h>=3*(f||0)&&this._fillAudioTimestampGap&&!o.A.safari){P=!0;var N,G=Math.floor(h/(f||0));r.A.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n"+"originalDts: ".concat(M," ms, curRefDts: ").concat(V," ms, ")+"dtsCorrection: ".concat(Math.round(h)," ms, generate: ").concat(G," frames")),O=Math.floor(V),F=Math.floor(V+(f||0))-O,null==(N=Oe.getSilentFrame(null===(a=this._audioMeta)||void 0===a?void 0:a.originalCodec,this._audioMeta.channelCount))&&(r.A.w(this.TAG,"Unable to generate silent frame for "+"".concat(null===(s=this._audioMeta)||void 0===s?void 0:s.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),N=L),U=[];for(var W=0;W<G;W++){V+=f||0;var j=Math.floor(V),Q=Math.floor(V+(f||0))-j,z={dts:j,pts:j,cts:0,unit:N,size:N.byteLength,duration:Q,originalDts:M,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};U.push(z),E+=z.size}this._audioNextDts=V+(f||0)}else O=Math.floor(V),F=Math.floor(V+(f||0))-O,this._audioNextDts=V+(f||0)}else O=M-h,F=D!==p.length-1?p[D+1].dts-this._dtsBase-h-O:null!=S?S.dts-this._dtsBase-h-O:x.length>=1?null===(d=x[x.length-1])||void 0===d?void 0:d.duration:Math.floor(f||0),this._audioNextDts=O+F;-1===_&&(_=O),x.push({dts:O,pts:O,cts:0,unit:w.unit,size:null===(l=w.unit)||void 0===l?void 0:l.byteLength,duration:F,originalDts:M,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),P&&x.push.apply(x,U)}}if(0===x.length)return A.samples=[],void(A.length=0);for(m?b=new Uint8Array(E):((b=new Uint8Array(E))[0]=E>>>24&255,b[1]=E>>>16&255,b[2]=E>>>8&255,b[3]=255&E,b.set(Re.types.mdat,4)),D=0;D<x.length;D++)L=x[D].unit,b.set(L,y),y+=L.byteLength||0;var H=x[x.length-1];u=H.dts+H.duration;var q=new Ie.EZ;q.beginDts=_,q.endDts=u,q.beginPts=_,q.endPts=u,q.originalBeginDts=x[0].originalDts,q.originalEndDts=H.originalDts+H.duration,q.firstSample=new Ie.$_(x[0].dts,x[0].pts,x[0].duration,x[0].originalDts,!1),q.lastSample=new Ie.$_(H.dts,H.pts,H.duration,H.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(q),A.samples=x,A.sequenceNumber++;var X;X=m?new Uint8Array:Re.moof(A,_),A.samples=[],A.length=0;var $={type:"audio",data:this._mergeBoxes(X,b).buffer,sampleCount:x.length,info:q};m&&v&&$&&($.timestampOffset=_),null===(c=this._onMediaSegment)||void 0===c||c.call(this,"audio",$)}}},e.prototype._remuxVideo=function(e,t){var i,n;if(null!=this._videoMeta){var r,o,a,s=e,d=s.samples,l=-1,c=-1;if(d&&0!==d.length&&(1!==d.length||t)){var h=8,u=null,A=8+e.length,p=null;if(d.length>1&&(A-=(p=d.pop()).length),null!=this._videoStashedLastSample){var _=this._videoStashedLastSample;this._videoStashedLastSample=null,d.unshift(_),A+=(null==_?void 0:_.length)||0}null!=p&&(this._videoStashedLastSample=p);var f=d[0].dts-this._dtsBase;if(this._videoNextDts)r=f-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())r=0;else{var m=this._videoSegmentInfoList.getLastSampleBefore(f);if(null!=m){var v=f-(m.originalDts+m.duration);v<=3&&(v=0),r=f-(m.dts+m.duration+v)}else r=0}for(var g=new Ie.EZ,y=[],b=0;b<d.length;b++){var E=(_=d[b]).dts-this._dtsBase,S=_.isKeyframe,w=E-r,T=_.cts,B=w+T;-1===l&&(l=w,c=B);var k=0;if(k=b!==d.length-1?d[b+1].dts-this._dtsBase-r-w:null!=p?p.dts-this._dtsBase-r-w:y.length>=1?y[y.length-1].duration:Math.floor((null===(i=this._videoMeta)||void 0===i?void 0:i.refSampleDuration)||0),S){var C=new Ie.$_(w,B,k,_.dts,!0);C.fileposition=_.fileposition,g.appendSyncPoint(C)}y.push({dts:w,pts:B,cts:T,units:_.units,size:_.length,isKeyframe:S,duration:k,originalDts:E,flags:{isLeading:0,dependsOn:S?2:1,isDependedOn:S?1:0,hasRedundancy:0,isNonSync:S?0:1}})}for((u=new Uint8Array(A))[0]=A>>>24&255,u[1]=A>>>16&255,u[2]=A>>>8&255,u[3]=255&A,u.set(Re.types.mdat,4),b=0;b<y.length;b++)for(var R=y[b].units;null==R?void 0:R.length;){var O=R.shift(),I=null==O?void 0:O.data;u.set(I,h),h+=I.byteLength}var x=y[y.length-1];if(o=x.dts+x.duration,a=x.pts+x.duration,this._videoNextDts=o,g.beginDts=l,g.endDts=o,g.beginPts=c,g.endPts=a,g.originalBeginDts=y[0].originalDts,g.originalEndDts=x.originalDts+x.duration,g.firstSample=new Ie.$_(y[0].dts,y[0].pts,y[0].duration,y[0].originalDts,!!y[0].isKeyframe),g.lastSample=new Ie.$_(x.dts,x.pts,x.duration,x.originalDts,!!x.isKeyframe),this._isLive||this._videoSegmentInfoList.append(g),s.samples=y,s.sequenceNumber++,this._forceFirstIDR){var D=y[0].flags;D.dependsOn=2,D.isNonSync=0}var L=Re.moof(s,l);s.samples=[],s.length=0,null===(n=this._onMediaSegment)||void 0===n||n.call(this,"video",{type:"video",data:this._mergeBoxes(L,u).buffer,sampleCount:y.length,info:g})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}();var De=i(302),Le=i(716);const Me=function(){function e(e,t){var i;this.TAG="TransmuxingController",this._emitter=new n.A,this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var r=0;null===(i=this._mediaDataSource.segments)||void 0===i||i.forEach((function(i){i.timestampBase=r,r+=i.duration,i.cors=e.cors,i.withCredentials=e.withCredentials,t.referrerPolicy&&(i.referrerPolicy=t.referrerPolicy)})),isNaN(r)||this._mediaDataSource.duration===r||(this._mediaDataSource.duration=r),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.prototype.destroy=function(){var e,t,i;this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(null===(e=this._ioctl)||void 0===e||e.destroy(),this._ioctl=null),this._demuxer&&(null===(t=this._demuxer)||void 0===t||t.destroy(),this._demuxer=null),this._remuxer&&(null===(i=this._remuxer)||void 0===i||i.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){var i,n,r;if(this._currentSegmentIndex=e,null===(i=this._mediaDataSource)||void 0===i?void 0:i.segments){var o=null===(n=this._mediaDataSource)||void 0===n?void 0:n.segments[e],a=this._ioctl=new De.A(o,this._config,e);a.onError=this._onIOException.bind(this),a.onSeeked=this._onIOSeeked.bind(this),a.onComplete=this._onIOComplete.bind(this),a.onRedirect=this._onIORedirect.bind(this),a.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?null===(r=this._demuxer)||void 0===r||r.bindDataSource(this._ioctl):a.onDataArrival=this._onInitChunkArrival.bind(this),a.open(t)}},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){var e;(null===(e=this._ioctl)||void 0===e?void 0:e.isWorking())&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){var e;(null===(e=this._ioctl)||void 0===e?void 0:e.isPaused())&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){var t,i,n,r,o,a,s,d,l,c,h,u,A,p;if(null!=this._mediaInfo&&(null===(t=this._mediaInfo)||void 0===t?void 0:t.isSeekable())){var _=this._searchSegmentIndexContains(e);if(_===this._currentSegmentIndex){var f=(null===(i=this._mediaInfo)||void 0===i?void 0:i.segments)?null===(n=this._mediaInfo)||void 0===n?void 0:n.segments[_]:{};if(void 0===f)this._pendingSeekTime=e;else{var m=null==f?void 0:f.getNearestKeyframe(e);null===(r=this._remuxer)||void 0===r||r.seek(null==m?void 0:m.milliseconds),null===(o=this._ioctl)||void 0===o||o.seek(null==m?void 0:m.fileposition),this._pendingResolveSeekPoint=null==m?void 0:m.milliseconds}}else{var v=(null===(a=this._mediaInfo)||void 0===a?void 0:a.segments)?null===(s=this._mediaInfo)||void 0===s?void 0:s.segments[_]:{};void 0===v?(this._pendingSeekTime=e,this._internalAbort(),null===(d=this._remuxer)||void 0===d||d.seek(),null===(l=this._remuxer)||void 0===l||l.insertDiscontinuity(),this._loadSegment(_)):(m=v.getNearestKeyframe(e),this._internalAbort(),null===(c=this._remuxer)||void 0===c||c.seek(e),null===(h=this._remuxer)||void 0===h||h.insertDiscontinuity(),this._demuxer&&(null===(u=this._demuxer)||void 0===u||u.resetMediaInfo(),this._demuxer.timestampBase=(null===(A=this._mediaDataSource)||void 0===A?void 0:A.segments)?null===(p=this._mediaDataSource)||void 0===p?void 0:p.segments[_].timestampBase:0),this._loadSegment(_,null==m?void 0:m.fileposition),this._pendingResolveSeekPoint=null==m?void 0:m.milliseconds,this._reportSegmentMediaInfo(_))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){var t,i=this._mediaDataSource.segments,n=((null==i?void 0:i.length)||0)-1;if(0===((null==i?void 0:i.length)||0))return n;for(var r=0;r<((null==i?void 0:i.length)||0);r++)if(i&&e<((null===(t=i[r])||void 0===t?void 0:t.timestampBase)||0)){n=r-1;break}return n},e.prototype._onInitChunkArrival=function(e,t){var i,n,o,a,s,d=this,l=0;if(t>0)null===(i=this._demuxer)||void 0===i||i.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments?null===(n=this._mediaDataSource.segments[this._currentSegmentIndex])||void 0===n?void 0:n.timestampBase:0,l=(null===(o=this._demuxer)||void 0===o?void 0:o.parseChunks(e,t))||0;else{var c=null;(c=S.probe(e)).match&&(this._setupFLVDemuxerRemuxer(c),l=(null===(a=this._demuxer)||void 0===a?void 0:a.parseChunks(e,t))||0),c.match||(null==c?void 0:c.needMoreData)||(c=Be.probe(e)).match&&(this._setupTSDemuxerRemuxer(c),l=(null===(s=this._demuxer)||void 0===s?void 0:s.parseChunks(e,t))||0),c.match||(null==c?void 0:c.needMoreData)||(c=null,r.A.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then((function(){d._internalAbort()})),this._emitter.emit(Le.A.DEMUX_ERROR,_.A.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return l},e.prototype._setupFLVDemuxerRemuxer=function(e){var t;this._demuxer=new S(e,this._config),this._remuxer||(this._remuxer=new xe(this._config));var i=this._mediaDataSource;void 0===i.duration||isNaN(i.duration)||(this._demuxer.overridedDuration=i.duration),"boolean"==typeof i.hasAudio&&(this._demuxer.overridedHasAudio=i.hasAudio),"boolean"==typeof i.hasVideo&&(this._demuxer.overridedHasVideo=i.hasVideo),i.segments&&this._demuxer&&this._remuxer&&(this._demuxer.timestampBase=null===(t=null==i?void 0:i.segments[this._currentSegmentIndex])||void 0===t?void 0:t.timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this))},e.prototype._setupTSDemuxerRemuxer=function(e){var t=this._demuxer=new Be(e,this._config);this._remuxer||(this._remuxer=new xe(this._config)),t.onError=this._onDemuxException.bind(this),t.onMediaInfo=this._onMediaInfo.bind(this),t.onMetaDataArrived=this._onMetaDataArrived.bind(this),t.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),t.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),t.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),t.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),t.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},e.prototype._onMediaInfo=function(e){var t,i,n=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=(null===(i=null===(t=this._mediaDataSource)||void 0===t?void 0:t.segments)||void 0===i?void 0:i.length)||0,Object.setPrototypeOf(this._mediaInfo,a.A.prototype));var r=Object.assign({},e);Object.setPrototypeOf(r,a.A.prototype),this._mediaInfo.segments&&(this._mediaInfo.segments[this._currentSegmentIndex]=r),this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=n._pendingSeekTime;n._pendingSeekTime=null,n.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(Le.A.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(Le.A.SCRIPTDATA_ARRIVED,e)},e.prototype._onTimedID3Metadata=function(e){var t,i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.dts&&(e.dts-=i),this._emitter.emit(Le.A.TIMED_ID3_METADATA_ARRIVED,e))},e.prototype._onSMPTE2038Metadata=function(e){var t,i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.dts&&(e.dts-=i),void 0!==e.nearest_pts&&(e.nearest_pts-=i),this._emitter.emit(Le.A.SMPTE2038_METADATA_ARRIVED,e))},e.prototype._onSCTE35Metadata=function(e){var t,i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.nearest_pts&&(e.nearest_pts-=i),this._emitter.emit(Le.A.SCTE35_METADATA_ARRIVED,e))},e.prototype._onPESPrivateDataDescriptor=function(e){this._emitter.emit(Le.A.PES_PRIVATE_DATA_DESCRIPTOR,e)},e.prototype._onPESPrivateData=function(e){var t,i=null===(t=this._remuxer)||void 0===t?void 0:t.getTimestampBase();void 0!==i&&(void 0!==e.pts&&(e.pts-=i),void 0!==e.nearest_pts&&(e.nearest_pts-=i),void 0!==e.dts&&(e.dts-=i),this._emitter.emit(Le.A.PES_PRIVATE_DATA_ARRIVED,e))},e.prototype._onIOSeeked=function(){var e;null===(e=this._remuxer)||void 0===e||e.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t,i,n=e+1;n<((null===(i=null===(t=this._mediaDataSource)||void 0===t?void 0:t.segments)||void 0===i?void 0:i.length)||0)?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(n)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(Le.A.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t,i=null===(t=this._ioctl)||void 0===t?void 0:t.extraData;this._mediaDataSource.segments&&(this._mediaDataSource.segments[i].redirectedURL=e)},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(Le.A.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){r.A.e(this.TAG,"IOException: type = ".concat(e,", code = ").concat(t.code,", msg = ").concat(t.msg)),this._emitter.emit(Le.A.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){r.A.e(this.TAG,"DemuxException: type = ".concat(e,", info = ").concat(t)),this._emitter.emit(Le.A.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(Le.A.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(Le.A.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.A.safari&&i.length>0&&i[0].originalDts===n&&(n=i[0].pts),this._emitter.emit(Le.A.RECOMMEND_SEEKPOINT,n)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&this._reportStatisticsInfo&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t,i,n,r,o=(null===(t=this._mediaInfo)||void 0===t?void 0:t.segments)?null===(i=this._mediaInfo)||void 0===i?void 0:i.segments[e]:{},a=Object.assign({},o);a.duration=null===(n=this._mediaInfo)||void 0===n?void 0:n.duration,a.segmentCount=null===(r=this._mediaInfo)||void 0===r?void 0:r.segmentCount,delete a.segments,delete a.keyframesIndex,this._emitter.emit(Le.A.MEDIA_INFO,a)},e.prototype._reportStatisticsInfo=function(){var e,t,i,n,r,o,a={};a.url=null===(e=this._ioctl)||void 0===e?void 0:e.currentURL,a.hasRedirect=null===(t=this._ioctl)||void 0===t?void 0:t.hasRedirect,a.hasRedirect&&(a.redirectedURL=null===(i=this._ioctl)||void 0===i?void 0:i.currentRedirectedURL),a.speed=null===(n=this._ioctl)||void 0===n?void 0:n.currentSpeed,a.loaderType=null===(r=this._ioctl)||void 0===r?void 0:r.loaderType,a.currentSegmentIndex=this._currentSegmentIndex,a.totalSegmentCount=null===(o=this._mediaDataSource.segments)||void 0===o?void 0:o.length,this._emitter.emit(Le.A.STATISTICS_INFO,a)},e}()},716:(e,t,i)=>{i.d(t,{A:()=>n});const n={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},291:(e,t,i)=>{var n=i(641),r=i(976),o=i(716),a=null,s=function(e,t){self.postMessage({msg:"logcat_callback",data:{type:e,logcat:t}})};function d(e,t){var i={msg:o.A.INIT_SEGMENT,data:{type:e,data:t}};self.postMessage(i,[t.data])}function l(e,t){var i={msg:o.A.MEDIA_SEGMENT,data:{type:e,data:t}};self.postMessage(i,[t.data])}function c(){var e={msg:o.A.LOADING_COMPLETE};self.postMessage(e)}function h(){var e={msg:o.A.RECOVERED_EARLY_EOF};self.postMessage(e)}function u(e){var t={msg:o.A.MEDIA_INFO,data:e};self.postMessage(t)}function A(e){var t={msg:o.A.METADATA_ARRIVED,data:e};self.postMessage(t)}function p(e){var t={msg:o.A.SCRIPTDATA_ARRIVED,data:e};self.postMessage(t)}function _(e){var t={msg:o.A.TIMED_ID3_METADATA_ARRIVED,data:e};self.postMessage(t)}function f(e){var t={msg:o.A.SMPTE2038_METADATA_ARRIVED,data:e};self.postMessage(t)}function m(e){var t={msg:o.A.SCTE35_METADATA_ARRIVED,data:e};self.postMessage(t)}function v(e){var t={msg:o.A.PES_PRIVATE_DATA_DESCRIPTOR,data:e};self.postMessage(t)}function g(e){var t={msg:o.A.PES_PRIVATE_DATA_ARRIVED,data:e};self.postMessage(t)}function y(e){var t={msg:o.A.STATISTICS_INFO,data:e};self.postMessage(t)}function b(e,t){self.postMessage({msg:o.A.IO_ERROR,data:{type:e,info:t}})}function E(e,t){self.postMessage({msg:o.A.DEMUX_ERROR,data:{type:e,info:t}})}function S(e){self.postMessage({msg:o.A.RECOMMEND_SEEKPOINT,data:e})}self.addEventListener("message",(function(e){switch(e.data.cmd){case"init":(a=new r.A(e.data.param[0],e.data.param[1])).on(o.A.IO_ERROR,b),a.on(o.A.DEMUX_ERROR,E),a.on(o.A.INIT_SEGMENT,d),a.on(o.A.MEDIA_SEGMENT,l),a.on(o.A.LOADING_COMPLETE,c),a.on(o.A.RECOVERED_EARLY_EOF,h),a.on(o.A.MEDIA_INFO,u),a.on(o.A.METADATA_ARRIVED,A),a.on(o.A.SCRIPTDATA_ARRIVED,p),a.on(o.A.TIMED_ID3_METADATA_ARRIVED,_),a.on(o.A.SMPTE2038_METADATA_ARRIVED,f),a.on(o.A.SCTE35_METADATA_ARRIVED,m),a.on(o.A.PES_PRIVATE_DATA_DESCRIPTOR,v),a.on(o.A.PES_PRIVATE_DATA_ARRIVED,g),a.on(o.A.STATISTICS_INFO,y),a.on(o.A.RECOMMEND_SEEKPOINT,S);break;case"destroy":a&&(a.destroy(),a=null),self.postMessage({msg:"destroyed"});break;case"start":null==a||a.start();break;case"stop":null==a||a.stop();break;case"seek":null==a||a.seek(e.data.param);break;case"pause":null==a||a.pause();break;case"resume":null==a||a.resume();break;case"logging_config":var t=e.data.param;n.A.applyConfig(t),!0===t.enableCallback?n.A.addLogListener(s):n.A.removeLogListener(s)}}))},465:(e,t,i)=>{i.d(t,{A:()=>n});const n={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},133:(e,t,i)=>{i.d(t,{default:()=>Q});var n={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32},r=i(302),o={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0,url:void 0,redirectedURL:void 0,cors:!1};function a(){return Object.assign({},o)}var s=function(){function e(){}return e.supportMSEH264Playback=function(){var e;return null===(e=window.MediaSource)||void 0===e?void 0:e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportMSEH265Playback=function(){var e;return null===(e=window.MediaSource)||void 0===e?void 0:e.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"')},e.supportNetworkStreamIO=function(){var e=new r.A({},a()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"===t||"xhr-moz-chunked-loader"===t},e.getNetworkLoaderTypeName=function(){var e=new r.A({},a()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){void 0===e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"===i},e.getFeatureList=function(){var t={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.msePlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName()||"",t.mseLivePlayback=t.msePlayback&&t.networkStreamIO,t.mseH265Playback=e.supportMSEH265Playback(),t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeMP4H265Playback=e.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}();const d=s;var l=i(288),c=i(413),h=i(502),u=i(620);const A={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",TIMED_ID3_METADATA_ARRIVED:"timed_id3_metadata_arrived",SMPTE2038_METADATA_ARRIVED:"smpte2038_metadata_arrived",SCTE35_METADATA_ARRIVED:"scte35_metadata_arrived",PES_PRIVATE_DATA_DESCRIPTOR:"pes_private_data_descriptor",PES_PRIVATE_DATA_ARRIVED:"pes_private_data_arrived",STATISTICS_INFO:"statistics_info",DESTROYING:"destroying"},p=function(){const e=ENTRY_MODULE,t={};function i(n){if(t[n])return t[n].exports;const r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}i.m=e,i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(const n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("[object Object]"===Object.prototype.toString.call(globalThis))return globalThis;try{return this||new Function("return this")()}catch(e){if("[object Object]"===Object.prototype.toString.call(window))return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};const n=i(ENTRY_MODULE);return n.default||n};p.toString();const _="[\\.|\\-|\\+|\\w|/|@]+",f="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+_+").*?\\)";function m(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function v(e){return!isNaN(1*e)}function g(e,t,n){const r={};r[n]=[];const o=t.toString(),a=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/)||o.match(/^\(\w+,\s*\w+,\s*(\w+)\)\s?\=\s?\>/);if(!a)return r;const s=a[1];let d,l=new RegExp("(\\\\n|\\W)"+m(s)+f,"g");for(;d=l.exec(o);)"dll-reference"!==d[3]&&r[n].push(d[3]);for(l=new RegExp("\\("+m(s)+'\\("(dll-reference\\s('+_+'))"\\)\\)'+f,"g");d=l.exec(o);)e[d[2]]||(r[n].push(d[1]),e[d[2]]=i(d[1]).m),r[d[2]]=r[d[2]]||[],r[d[2]].push(d[4]);const c=Object.keys(r);for(let e=0;e<c.length;e++)for(let t=0;t<r[c[e]].length;t++)v(r[c[e]][t])&&(r[c[e]][t]=1*r[c[e]][t]);return r}function y(e){return Object.keys(e).reduce(((t,i)=>t||e[i].length>0),!1)}function b(e,t,i,n){const r=e[n].map((e=>`"${e}": ${t[n][e].toString()}`)).join(","),o=p.toString().split("ENTRY_MODULE");return`${o[0]}{${r}}${o[1]}"${i}"${o[2]}`}function E(e,t){t=t||{};const n={main:i.m},r=t.all?{main:Object.keys(n.main)}:function(e,t){const i={main:[t]},n={main:[]},r={main:{}};for(;y(i);){const t=Object.keys(i);for(let o=0;o<t.length;o++){const a=t[o],s=i[a].pop();if(r[a]=r[a]||{},r[a][s]||!e[a][s])continue;r[a][s]=!0,n[a]=n[a]||[],n[a].push(s);const d=g(e,e[a][s],a),l=Object.keys(d);for(let e=0;e<l.length;e++)i[l[e]]=i[l[e]]||[],i[l[e]]=i[l[e]].concat(d[l[e]])}}return n}(n,e);let o="";Object.keys(r).filter((e=>"main"!==e)).forEach((e=>{let t=0;for(;r[e][t];)t++;r[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o+=`var ${e} = (${b(r,n,t,modules)})();\n`})),o+=`(${b(r,n,e,"main")})();`;const a=new window.Blob([o],{type:"text/javascript"});if(t.bare)return a;const s=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(a),d=new window.Worker(s);return d.objectURL=s,d}var S=i(641),w=i(976),T=i(716),B=i(825),k=function(){function e(e,t){if(this.TAG="Transmuxer",this._workerDestroying=!1,this._controller=null,this._emitter=new c.A,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=this._worker=E(291),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},S.A.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:S.A.getConfig()})}catch(i){h.A.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new w.A(e,t)}else this._controller=new w.A(e,t);if(this._controller){var i=this._controller;null==i||i.on(T.A.IO_ERROR,this._onIOError.bind(this)),null==i||i.on(T.A.DEMUX_ERROR,this._onDemuxError.bind(this)),null==i||i.on(T.A.INIT_SEGMENT,this._onInitSegment.bind(this)),null==i||i.on(T.A.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),null==i||i.on(T.A.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),null==i||i.on(T.A.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),null==i||i.on(T.A.MEDIA_INFO,this._onMediaInfo.bind(this)),null==i||i.on(T.A.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),null==i||i.on(T.A.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),null==i||i.on(T.A.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),null==i||i.on(T.A.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),null==i||i.on(T.A.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),null==i||i.on(T.A.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),null==i||i.on(T.A.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),null==i||i.on(T.A.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),null==i||i.on(T.A.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){var e;this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),S.A.removeListener(this.e.onLoggingConfigChanged),this.e=null):(null===(e=this._controller)||void 0===e||e.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},e.prototype.open=function(){var e;this._worker?this._worker.postMessage({cmd:"start"}):null===(e=this._controller)||void 0===e||e.start()},e.prototype.close=function(){var e;this._worker?this._worker.postMessage({cmd:"stop"}):null===(e=this._controller)||void 0===e||e.stop()},e.prototype.seek=function(e){var t;this._worker?this._worker.postMessage({cmd:"seek",param:e}):null===(t=this._controller)||void 0===t||t.seek(e)},e.prototype.pause=function(){var e;this._worker?this._worker.postMessage({cmd:"pause"}):null===(e=this._controller)||void 0===e||e.pause()},e.prototype.resume=function(){var e;this._worker?this._worker.postMessage({cmd:"resume"}):null===(e=this._controller)||void 0===e||e.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(T.A.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(T.A.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(T.A.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(T.A.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onTimedID3MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.TIMED_ID3_METADATA_ARRIVED,e)}))},e.prototype._onSMPTE2038MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.SMPTE2038_METADATA_ARRIVED,e)}))},e.prototype._onSCTE35MetadataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.SCTE35_METADATA_ARRIVED,e)}))},e.prototype._onPESPrivateDataDescriptor=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.PES_PRIVATE_DATA_DESCRIPTOR,e)}))},e.prototype._onPESPrivateDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.PES_PRIVATE_DATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(T.A.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(T.A.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(T.A.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=null==t?void 0:t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case T.A.INIT_SEGMENT:case T.A.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case T.A.LOADING_COMPLETE:case T.A.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case T.A.MEDIA_INFO:Object.setPrototypeOf(i,B.A.prototype),this._emitter.emit(t.msg,i);break;case T.A.METADATA_ARRIVED:case T.A.SCRIPTDATA_ARRIVED:case T.A.TIMED_ID3_METADATA_ARRIVED:case T.A.SMPTE2038_METADATA_ARRIVED:case T.A.SCTE35_METADATA_ARRIVED:case T.A.PES_PRIVATE_DATA_DESCRIPTOR:case T.A.PES_PRIVATE_DATA_ARRIVED:case T.A.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case T.A.IO_ERROR:case T.A.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case T.A.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":h.A.emitter.emit("log",i.type,i.logcat)}},e}();const C=k,R="error",O="source_open",I="update_end",x="buffer_full";var D=i(453),L=i(713),M=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new c.A,this._config.isLive&&void 0===this._config.autoCleanupSourceBuffer&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new D.EX}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new L.j4("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var n=this._sourceBuffers[t];if(n){if("closed"!==e.readyState){try{e.removeSourceBuffer(n)}catch(e){h.A.e(this.TAG,e.message)}null==n||n.removeEventListener("error",this.e.onSourceBufferError),null==n||n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){h.A.e(this.TAG,e.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},e.prototype.appendInitSegment=function(e,t){var i;if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var n=e,r="".concat(n.container);n.codec&&n.codec.length>0&&(r+=";codecs=".concat(n.codec));var o=!1;if(h.A.v(this.TAG,"Received Initialization Segment, mimeType: "+r),this._lastInitSegments[n.type]=n,r!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])h.A.v(this.TAG,"Notice: ".concat(n.type," mimeType changed, origin: ").concat(this._mimeTypes[n.type]||"",", target: ").concat(r));else{o=!0;try{var a=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(r);a.addEventListener("error",this.e.onSourceBufferError),a.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return h.A.e(this.TAG,e.message),void this._emitter.emit(R,{code:e.code,msg:e.message})}}this._mimeTypes[n.type]=r}t||this._pendingSegments[n.type].push(n),o||this._sourceBuffers[n.type]&&!(null===(i=this._sourceBuffers[n.type])||void 0===i?void 0:i.updating)&&this._doAppendSegments(),u.A.safari&&"audio/mpeg"===n.container&&n.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=n.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){var t,i;for(var n in this._sourceBuffers)if(this._sourceBuffers[n]){var r=this._sourceBuffers[n];if("open"===(null===(t=this._mediaSource)||void 0===t?void 0:t.readyState))try{null==r||r.abort()}catch(e){h.A.e(this.TAG,e.message)}this._idrList.clear();var o=this._pendingSegments[n];if(o.splice(0,o.length),"closed"!==(null===(i=this._mediaSource)||void 0===i?void 0:i.readyState)){if(r){for(var a=0;a<r.buffered.length;a++){var s=r.buffered.start(a),d=r.buffered.end(a);this._pendingRemoveRanges[n].push({start:s,end:d})}(null==r?void 0:r.updating)||this._doRemoveRanges()}if(u.A.safari){var l=this._lastInitSegments[n];l&&(this._pendingSegments[n].push(l),(null==r?void 0:r.updating)||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e,t,i=this._mediaSource,n=this._sourceBuffers;i&&"open"===i.readyState?(null===(e=n.video)||void 0===e?void 0:e.updating)||(null===(t=n.audio)||void 0===t?void 0:t.updating)?this._hasPendingEos=!0:(this._hasPendingEos=!1,i.endOfStream()):i&&"closed"===i.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){var e,t;if(!this._config.autoCleanupSourceBuffer)return!1;var i=null===(e=this._mediaElement)||void 0===e?void 0:e.currentTime;for(var n in this._sourceBuffers){var r=this._sourceBuffers[n];if(r){var o=r.buffered;if(o.length>=1&&i-o.start(0)>=((null===(t=this._config)||void 0===t?void 0:t.autoCleanupMaxBackwardDuration)||0))return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e,t,i,n=null===(e=this._mediaElement)||void 0===e?void 0:e.currentTime;for(var r in this._sourceBuffers){var o=this._sourceBuffers[r];if(o){for(var a=o.buffered,s=!1,d=0;d<a.length;d++){var l=a.start(d),c=a.end(d);if(l<=n&&n<c+3){if(n-l>=((null===(t=this._config)||void 0===t?void 0:t.autoCleanupMaxBackwardDuration)||0)){s=!0;var h=n-((null===(i=this._config)||void 0===i?void 0:i.autoCleanupMinBackwardDuration)||0);this._pendingRemoveRanges[r].push({start:l,end:h})}}else c<n&&(s=!0,this._pendingRemoveRanges[r].push({start:l,end:c}))}s&&!o.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e,t,i,n,r=this._sourceBuffers;if(0!==(null===(e=this._mediaElement)||void 0===e?void 0:e.readyState)&&"open"===(null===(t=this._mediaSource)||void 0===t?void 0:t.readyState)&&!(null===(i=r.video)||void 0===i?void 0:i.updating)&&!(null===(n=r.audio)||void 0===n?void 0:n.updating)){var o=this._mediaSource.duration,a=this._pendingMediaDuration;a>0&&(isNaN(o)||a>o)&&(h.A.v(this.TAG,"Update MediaSource duration from ".concat(o," to ").concat(a)),this._mediaSource.duration=a),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){var e;for(var t in this._pendingRemoveRanges)if(this._sourceBuffers[t]&&!(null===(e=this._sourceBuffers[t])||void 0===e?void 0:e.updating))for(var i=this._sourceBuffers[t],n=this._pendingRemoveRanges[t];n.length&&!(null==i?void 0:i.updating);){var r=n.shift();null==i||i.remove(r.start,r.end)}},e.prototype._doAppendSegments=function(){var e,t,i,n=this._pendingSegments;for(var r in n)if(this._sourceBuffers[r]&&!(null===(e=this._sourceBuffers[r])||void 0===e?void 0:e.updating)&&n[r].length>0){var o=n[r].shift();if(null==o?void 0:o.timestampOffset){var a=(null===(t=this._sourceBuffers[r])||void 0===t?void 0:t.timestampOffset)||0,s=o.timestampOffset/1e3;Math.abs(a-s)>.1&&(h.A.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(a," to ").concat(s)),this._sourceBuffers[r]&&(this._sourceBuffers[r].timestampOffset=s)),delete o.timestampOffset}if(!o.data||0===o.data.byteLength)continue;try{null===(i=this._sourceBuffers[r])||void 0===i||i.appendBuffer(o.data),this._isBufferFull=!1,"video"===r&&o.hasOwnProperty("info")&&this._idrList.appendArray(o.info.syncPoints)}catch(e){this._pendingSegments[r].unshift(o),22===e.code?(this._isBufferFull||this._emitter.emit(x),this._isBufferFull=!0):(h.A.e(this.TAG,e.message),this._emitter.emit(R,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){var e;if(h.A.v(this.TAG,"MediaSource onSourceOpen"),null===(e=this._mediaSource)||void 0===e||e.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var t=this._pendingSourceBufferInit;t.length;){var i=t.shift();this.appendInitSegment(i,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(O)},e.prototype._onSourceEnded=function(){h.A.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){h.A.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(I)},e.prototype._onSourceBufferError=function(e){h.A.e(this.TAG,"SourceBuffer Error: ".concat(e))},e}();const P=M;var U=i(465),F={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},V={NETWORK_EXCEPTION:l.Xv.EXCEPTION,NETWORK_STATUS_CODE_INVALID:l.Xv.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:l.Xv.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:l.Xv.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:U.A.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:U.A.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:U.A.CODEC_UNSUPPORTED},N=function(){function e(e,t){var i,n,r;this.TAG="MSEPlayer",this._type="MSEPlayer",this._emitter=new c.A,this._config=a(),"object"==typeof t&&Object.assign(this._config,t);var o=e.type.toLowerCase();if("mse"!==o&&"mpegts"!==o&&"m2ts"!==o&&"flv"!==o)throw new L.Qn("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");e.isLive&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=e,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;var s=u.A.chrome&&(u.A.version&&(null===(i=u.A.version)||void 0===i?void 0:i.major)<50||u.A.version&&50===(null===(n=null===u.A||void 0===u.A?void 0:u.A.version)||void 0===n?void 0:n.major)&&((null===(r=null===u.A||void 0===u.A?void 0:u.A.version)||void 0===r?void 0:r.build)||-1)<2661);this._alwaysSeekKeyframe=!!(s||u.A.msedge||u.A.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){this._emitter.emit(A.DESTROYING),null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===A.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(A.MEDIA_INFO,i.mediaInfo)})):e===A.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(A.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t,i,n,r,o,a=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new P(this._config),null===(t=this._msectl)||void 0===t||t.on(I,this._onmseUpdateEnd.bind(this)),null===(i=this._msectl)||void 0===i||i.on(x,this._onmseBufferFull.bind(this)),null===(n=this._msectl)||void 0===n||n.on(O,(function(){a._mseSourceOpened=!0,a._hasPendingLoad&&(a._hasPendingLoad=!1,a.load())})),null===(r=this._msectl)||void 0===r||r.on(R,(function(e){a._emitter.emit(A.ERROR,F.MEDIA_ERROR,V.MEDIA_MSE_ERROR,e)})),null===(o=this._msectl)||void 0===o||o.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){var e;this._mediaElement&&(null===(e=this._msectl)||void 0===e||e.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new L.j4("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new L.j4("MSEPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(!this._config.deferLoadAfterSourceOpen||this._mseSourceOpened?(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new C(this._mediaDataSource,this._config),this._transmuxer.on(T.A.INIT_SEGMENT,(function(t,i){var n;null===(n=e._msectl)||void 0===n||n.appendInitSegment(i)})),this._transmuxer.on(T.A.MEDIA_SEGMENT,(function(t,i){var n,r,o;if(null===(n=e._msectl)||void 0===n||n.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var a=null===(r=e._mediaElement)||void 0===r?void 0:r.currentTime;i.info.endDts>=1e3*(a+((null===(o=e._config)||void 0===o?void 0:o.lazyLoadMaxDuration)||0))&&null==e._progressChecker&&(h.A.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(T.A.LOADING_COMPLETE,(function(){var t;null===(t=e._msectl)||void 0===t||t.endOfStream(),e._emitter.emit(A.LOADING_COMPLETE)})),this._transmuxer.on(T.A.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(A.RECOVERED_EARLY_EOF)})),this._transmuxer.on(T.A.IO_ERROR,(function(t,i){e._emitter.emit(A.ERROR,F.NETWORK_ERROR,t,i)})),this._transmuxer.on(T.A.DEMUX_ERROR,(function(t,i){e._emitter.emit(A.ERROR,F.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(T.A.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(A.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(T.A.METADATA_ARRIVED,(function(t){e._emitter.emit(A.METADATA_ARRIVED,t)})),this._transmuxer.on(T.A.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(A.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(T.A.TIMED_ID3_METADATA_ARRIVED,(function(t){e._emitter.emit(A.TIMED_ID3_METADATA_ARRIVED,t)})),this._transmuxer.on(T.A.SMPTE2038_METADATA_ARRIVED,(function(t){e._emitter.emit(A.SMPTE2038_METADATA_ARRIVED,t)})),this._transmuxer.on(T.A.SCTE35_METADATA_ARRIVED,(function(t){e._emitter.emit(A.SCTE35_METADATA_ARRIVED,t)})),this._transmuxer.on(T.A.PES_PRIVATE_DATA_DESCRIPTOR,(function(t){e._emitter.emit(A.PES_PRIVATE_DATA_DESCRIPTOR,t)})),this._transmuxer.on(T.A.PES_PRIVATE_DATA_ARRIVED,(function(t){e._emitter.emit(A.PES_PRIVATE_DATA_ARRIVED,t)})),this._transmuxer.on(T.A.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(A.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(T.A.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()):this._hasPendingLoad=!0)},e.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},e.prototype.play=function(){var e;return function(e,t,i,n){return new(i||(i=Promise))((function(t,r){function o(e){try{s(n.next(e))}catch(e){r(e)}}function a(e){try{s(n.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function(){return function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(d){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}(this,(function(t){switch(t.label){case 0:return[4,null===(e=this._mediaElement)||void 0===e?void 0:e.play()];case 1:return[2,t.sent()]}}))}))},e.prototype.pause=function(){var e;null===(e=this._mediaElement)||void 0===e||e.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.volume},set:function(e){this._mediaElement&&(this._mediaElement.volume=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.muted},set:function(e){this._mediaElement&&(this._mediaElement.muted=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else void 0!==this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},e.prototype._onmseUpdateEnd=function(){var e,t,i,n,r=null===(e=this._mediaElement)||void 0===e?void 0:e.buffered,o=(null===(t=this._mediaElement)||void 0===t?void 0:t.currentTime)||0;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&(null==r?void 0:r.length)>0&&!(null===(i=this._mediaElement)||void 0===i?void 0:i.paused)){var a=r.end(r.length-1);if(a>((null===(n=this._config)||void 0===n?void 0:n.liveBufferLatencyMaxLatency)||0)&&a-o>(this._config.liveBufferLatencyMaxLatency||0)){var s=a-(this._config.liveBufferLatencyMinRemain||0);this.currentTime=s}}if(this._config.lazyLoad&&!this._config.isLive){for(var d=0,l=0;l<r.length;l++){var c=r.start(l),u=r.end(l);if(c<=o&&o<u){d=u;break}}d>=o+(this._config.lazyLoadMaxDuration||0)&&null==this._progressChecker&&(h.A.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){h.A.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},e.prototype._checkProgressAndResume=function(){for(var e,t,i,n=(null===(e=this._mediaElement)||void 0===e?void 0:e.currentTime)||0,r=null===(t=this._mediaElement)||void 0===t?void 0:t.buffered,o=!1,a=0;a<r.length;a++){var s=r.start(a),d=r.end(a);if(n>=s&&n<d){n>=d-(this._config.lazyLoadRecoverDuration||0)&&(o=!0);break}}o&&(window.clearInterval(this._progressChecker),this._progressChecker=null,o&&(h.A.v(this.TAG,"Continue loading from paused position"),null===(i=this._transmuxer)||void 0===i||i.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t,i=null===(t=this._mediaElement)||void 0===t?void 0:t.buffered,n=0;n<i.length;n++){var r=i.start(n),o=i.end(n);if(e>=r&&e<o)return!0}return!1},e.prototype._internalSeek=function(e){var t,i,n,r,o,a=this._isTimepointBuffered(e),s=!1,d=0;if(e<1&&(null===(t=this._mediaElement)||void 0===t?void 0:t.buffered).length>0){var l=(null===(i=this._mediaElement)||void 0===i?void 0:i.buffered).start(0);(l<1&&e<l||u.A.safari)&&(s=!0,d=u.A.safari?.1:l)}if(s)this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=d);else if(a){if(this._alwaysSeekKeyframe){var c=null===(n=this._msectl)||void 0===n?void 0:n.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=null!=c?c.dts/1e3:e)}else this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=e);null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),null===(r=this._msectl)||void 0===r||r.seek(e),null===(o=this._transmuxer)||void 0===o||o.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=e))},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){var e,t,i,n;if(this._seekpointRecord)if(((null===(e=this._seekpointRecord)||void 0===e?void 0:e.recordTime)||0)<=this._now()-100){var r=null===(t=this._mediaElement)||void 0===t?void 0:t.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(r)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),null===(i=this._msectl)||void 0===i||i.seek(r),null===(n=this._transmuxer)||void 0===n||n.seek(Math.floor(1e3*r)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=r)))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;i.length>0&&t.currentTime<i.start(0)&&(h.A.w(this.TAG,"Playback seems stuck at ".concat(t.currentTime,", seek to ").concat(i.start(0))),this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress)))}else this._mediaElement&&this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement&&(this._mediaElement.currentTime=this._pendingSeekTime),this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t,i,n,r=null===(t=this._mediaElement)||void 0===t?void 0:t.currentTime,o=null===(i=this._mediaElement)||void 0===i?void 0:i.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(r<1&&o.length>0){var a=o.start(0);if(a<1&&r<a||u.A.safari)return this._requestSetTime=!0,void(this._mediaElement&&(u.A.safari?this._mediaElement.currentTime=.1:this._mediaElement.currentTime=a))}if(this._isTimepointBuffered(r)){if(this._alwaysSeekKeyframe){var s=null===(n=this._msectl)||void 0===n?void 0:n.getNearestKeyframe(Math.floor(1e3*r));null!=s&&(this._requestSetTime=!0,this._mediaElement&&(this._mediaElement.currentTime=s.dts/1e3))}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:r,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){var t;this._receivedCanPlay=!0,null===(t=this._mediaElement)||void 0===t||t.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}();const G=N;const W=function(){function e(e,t){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new c.A,this._config=a(),"object"==typeof t&&Object.assign(this._config,t);var i=e.type.toLowerCase();if("mse"===i||"mpegts"===i||"m2ts"===i||"flv"===i)throw new L.Qn("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new L.Qn("NativePlayer(".concat(e.type,") doesn't support multipart playback!"));this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){var e;this._emitter.emit(A.DESTROYING),this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,null===(e=this._emitter)||void 0===e||e.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===A.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(A.MEDIA_INFO,i.mediaInfo)})):e===A.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(A.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){var e;if(!this._mediaElement)throw new L.j4("HTMLMediaElement must be attached before load()!");this._mediaElement.src=(null===(e=this._mediaDataSource)||void 0===e?void 0:e.url)||"",this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){var e;return function(e,t,i,n){return new(i||(i=Promise))((function(t,r){function o(e){try{s(n.next(e))}catch(e){r(e)}}function a(e){try{s(n.throw(e))}catch(e){r(e)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function(){return function(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(d){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,d])}}}(this,(function(t){switch(t.label){case 0:return[4,null===(e=this._mediaElement)||void 0===e?void 0:e.play()];case 1:return[2,t.sent()]}}))}))},e.prototype.pause=function(){var e;null===(e=this._mediaElement)||void 0===e||e.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.volume},set:function(e){this._mediaElement&&(this._mediaElement.volume=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){var e;return null===(e=this._mediaElement)||void 0===e?void 0:e.muted},set:function(e){this._mediaElement&&(this._mediaElement.muted=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else void 0!==this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement&&(this._mediaElement.currentTime=this._pendingSeekTime),this._pendingSeekTime=null),this._emitter.emit(A.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(A.STATISTICS_INFO,this.statisticsInfo)},e}();var j={createPlayer:function(e,t){(null==e?void 0:e.url)&&(e.url=function(e,t){void 0===t&&(t=["h264"]);var i=(t||["h264"]).reduce((function(e,t){return t=t.toLowerCase(),e+(n[t]||0)}),0),r=e.split("?")[0],o=e.split("?")[1];return o=(o||"").split("&").filter((function(e){return!/^vc=\d?/.test(e)})).join("&"),r+"?"+o+(o?"&":"")+"vc="+i}(e.url,["h264","h265"]));var i=e;if(null==i||"object"!=typeof i)throw new L.Qn("MediaDataSource must be an javascript object!");if(!Object.prototype.hasOwnProperty.call(i,"type"))throw new L.Qn("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"mse":case"mpegts":case"m2ts":case"flv":return new G(i,t);default:return new W(i,t)}},isSupported:function(){return d.supportMSEH264Playback()},getFeatureList:function(){return d.getFeatureList()},BaseLoader:l.HC,LoaderStatus:l.eO,LoaderErrors:l.Xv,version:"",Events:A,ErrorTypes:F,ErrorDetails:V,MSEPlayer:G,NativePlayer:W,LoggingControl:S.A};Object.defineProperty(j,"version",{enumerable:!0,get:function(){return"2.0.1"}});const Q=j},446:(e,t,i)=>{e.exports=i(133).default},302:(e,t,i)=>{i.d(t,{A:()=>g});var n=i(502);const r=function(){function e(){var e;this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,(null===(e=self.performance)||void 0===e?void 0:e.now)?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0===e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}();var o,a=i(288),s=i(620),d=i(713),l=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});const c=function(e){function t(t,i){var n=e.call(this,"fetch-stream-loader")||this;return n.TAG="FetchStreamLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._requestAbort=!1,n._abortController=null,n._contentLength=null,n._receivedLength=0,n}return l(t,e),t.isSupported=function(){var e;try{var t=s.A.msedge&&((null===(e=null===s.A||void 0===s.A?void 0:s.A.version)||void 0===e?void 0:e.minor)||0)>=15048&&!s.A.webkit,i=!s.A.msedge||t;return self.fetch&&self.ReadableStream&&i}catch(e){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&void 0!==e.redirectedURL&&(n=e.redirectedURL);var r=this._seekHandler.getConfig(n,t),o=new self.Headers;if("object"==typeof r.headers){var s=r.headers;for(var l in s)s.hasOwnProperty(l)&&o.append(l,s[l])}var c={method:"GET",headers:o,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)o.append(l,this._config.headers[l]);e.cors||(c.mode="same-origin"),e.withCredentials&&(c.credentials="include"),(null==e?void 0:e.referrerPolicy)&&(c.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,this._abortController&&(c.signal=this._abortController.signal)),this._status=a.eO.kConnecting,self.fetch(r.url,c).then((function(e){var t,n;if(i._requestAbort)return i._status=a.eO.kIdle,void(null===(t=e.body)||void 0===t||t.cancel());if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==r.url&&i._onURLRedirect){var o=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(o)}var s=e.headers.get("Content-Length");return null!=s&&(i._contentLength=parseInt(s),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,null===(n=e.body)||void 0===n?void 0:n.getReader())}if(i._status=a.eO.kError,!i._onError)throw new d.Al("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(a.Xv.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){var t;if(!(null===(t=i._abortController)||void 0===t?void 0:t.signal.aborted)){if(i._status=a.eO.kError,!i._onError)throw e;i._onError(a.Xv.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){var e;if(this._requestAbort=!0,(this._status!==a.eO.kBuffering||!s.A.chrome)&&this._abortController)try{null===(e=this._abortController)||void 0===e||e.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){var n,r,o,s;if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=a.eO.kError;var l=a.Xv.EARLY_EOF,c={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new d.Al(c.msg);t._onError(l,c)}else t._status=a.eO.kComplete,t._onComplete&&t._onComplete((null===(n=t._range)||void 0===n?void 0:n.from)||0,((null===(r=t._range)||void 0===r?void 0:r.from)||0)+t._receivedLength-1);else{if(null===(o=t._abortController)||void 0===o?void 0:o.signal.aborted)return void(t._status=a.eO.kComplete);if(t._requestAbort)return t._status=a.eO.kComplete,e.cancel();t._status=a.eO.kBuffering;var h=i.value.buffer,u=((null===(s=t._range)||void 0===s?void 0:s.from)||0)+t._receivedLength;t._receivedLength+=h.byteLength,t._onDataArrival&&t._onDataArrival(h,u,t._receivedLength),t._pump(e)}})).catch((function(e){var i,n;if(null===(n=null===(i=t._abortController)||void 0===i?void 0:i.signal)||void 0===n?void 0:n.aborted)t._status=a.eO.kComplete;else if(11!==e.code||!s.A.msedge){t._status=a.eO.kError;var r=0,o=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(r=a.Xv.EXCEPTION,o={code:e.code,msg:e.message}):(r=a.Xv.EARLY_EOF,o={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new d.Al(o.msg);t._onError(r,o)}}))},t}(a.HC);var h=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();const u=function(e){function t(t,i){var n=e.call(this,"xhr-moz-chunked-loader")||this;return n.TAG="MozChunkedLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._xhr=null,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return h(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch(e){return n.A.w("MozChunkedLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&void 0!==e.redirectedURL&&(i=e.redirectedURL);var n=this._seekHandler.getConfig(i,t);this._requestURL=n.url;var r=this._xhr=new XMLHttpRequest;if(r.open("GET",n.url,!0),r.responseType="moz-chunked-arraybuffer",r.onreadystatechange=this._onReadyStateChange.bind(this),r.onprogress=this._onProgress.bind(this),r.onloadend=this._onLoadEnd.bind(this),r.onerror=this._onXhrError.bind(this),e.withCredentials&&(r.withCredentials=!0),"object"==typeof n.headers){var o=n.headers;for(var s in o)o.hasOwnProperty(s)&&r.setRequestHeader(s,o[s])}if("object"==typeof this._config.headers)for(var s in o=this._config.headers)o.hasOwnProperty(s)&&r.setRequestHeader(s,o[s]);this._status=a.eO.kConnecting,r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=a.eO.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(void 0!==t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=a.eO.kError,!this._onError)throw new d.Al("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(a.Xv.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=a.eO.kBuffering}},t.prototype._onProgress=function(e){var t;if(this._status!==a.eO.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var i=e.target.response,n=((null===(t=this._range)||void 0===t?void 0:t.from)||0)+this._receivedLength;this._receivedLength+=i.byteLength,this._onDataArrival&&this._onDataArrival(i,n,this._receivedLength)}},t.prototype._onLoadEnd=function(e){this._requestAbort?this._requestAbort=!1:this._status!==a.eO.kError&&(this._status=a.eO.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))},t.prototype._onXhrError=function(e){this._status=a.eO.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=a.Xv.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=a.Xv.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new d.Al(i.msg);this._onError(t,i)},t}(a.HC);var A=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();const p=function(e){function t(t,i){var n=e.call(this,"xhr-range-loader")||this;return n.TAG="RangeLoader",n._seekHandler=t,n._config=i,n._needStash=!1,n._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],n._currentChunkSizeKB=384,n._currentSpeedNormalized=0,n._zeroSpeedChunkCount=0,n._xhr=null,n._speedSampler=new r,n._requestAbort=!1,n._waitForTotalLength=!1,n._totalLengthReceived=!1,n._currentRequestURL=null,n._currentRedirectedURL=null,n._currentRequestRange=null,n._totalLength=null,n._contentLength=null,n._receivedLength=0,n._lastTimeLoaded=0,n}return A(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return n.A.w("RangeLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=a.eO.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e,t,i=1024*this._currentChunkSizeKB,n=((null===(e=this._range)||void 0===e?void 0:e.from)||0)+this._receivedLength,r=n+i;null!=this._contentLength&&r-this._range.from>=this._contentLength&&(r=((null===(t=this._range)||void 0===t?void 0:t.from)||0)+this._contentLength-1),this._currentRequestRange={from:n,to:r},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var n=this._seekHandler.getConfig(i,t);this._currentRequestURL=n.url;var r=this._xhr=new XMLHttpRequest;if(r.open("GET",n.url,!0),r.responseType="arraybuffer",r.onreadystatechange=this._onReadyStateChange.bind(this),r.onprogress=this._onProgress.bind(this),r.onload=this._onLoad.bind(this),r.onerror=this._onXhrError.bind(this),e.withCredentials&&(r.withCredentials=!0),"object"==typeof n.headers){var o=n.headers;for(var a in o)o.hasOwnProperty(a)&&r.setRequestHeader(a,o[a])}if("object"==typeof this._config.headers)for(var a in o=this._config.headers)o.hasOwnProperty(a)&&r.setRequestHeader(a,o[a]);r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=a.eO.kComplete},t.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=a.eO.kBuffering}else{if(this._status=a.eO.kError,!this._onError)throw new d.Al("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(a.Xv.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==a.eO.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=(this._totalLength||0)-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var n=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(n)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,n=0,r=0,o=i;if(e<t[0])return t[0];for(;r<=o;){if((n=r+Math.floor((o-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:o=n-1}},t.prototype._onLoad=function(e){if(this._status!==a.eO.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var n=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength;var o=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():o=!0,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),o&&(this._status=a.eO.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=a.eO.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=a.Xv.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=a.Xv.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new d.Al(i.msg);this._onError(t,i)},t}(a.HC);var _=function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};return function(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();const f=function(e){function t(t,i){var n=e.call(this,"websocket-loader")||this;return n.TAG="WebSocketLoader",n._needStash=!0,n._ws=null,n._requestAbort=!1,n._receivedLength=0,n}return _(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=a.eO.kConnecting}catch(e){this._status=a.eO.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new d.Al(i.msg);this._onError(a.Xv.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=a.eO.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=a.eO.kBuffering},t.prototype._onWebSocketClose=function(e){this._requestAbort?this._requestAbort=!1:(this._status=a.eO.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1))},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(null==i?void 0:i.result)},i.readAsArrayBuffer(e.data)}else{this._status=a.eO.kError;var n={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new d.Al(n.msg);this._onError(a.Xv.EXCEPTION,n)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=a.eO.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new d.Al(t.msg);this._onError(a.Xv.EXCEPTION,t)},t}(a.HC),m=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var n;n=-1!==t.to?"bytes=".concat(t.from.toString(),"-").concat(t.to.toString()):"bytes=".concat(t.from.toString(),"-"),i.Range=n}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}(),v=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var n=!0;i.includes("?")||(i+="?",n=!1),n&&(i+="&"),i+="".concat(this._startName,"=").concat(t.from.toString()),-1!==t.to&&(i+="&".concat(this._endName,"=").concat(t.to.toString()))}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t,i=e.split("?")[0],n=e.indexOf("?");-1!==n&&(t=e.substring(n+1));var r="";if(void 0!==t&&t.length>0)for(var o=t.split("&"),a=0;a<o.length;a++){var s=o[a].split("="),d=a>0;s[0]!==this._startName&&s[0]!==this._endName&&(d&&(r+="&"),r+=o[a])}return 0===r.length?i:i+"?"+r},e}(),g=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=65536,void 0!==t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,t.enableStashBuffer||(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url||""),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new r,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return e.prototype.destroy=function(){var e,t,i;(null===(e=this._loader)||void 0===e?void 0:e.isWorking())&&(null===(t=this._loader)||void 0===t||t.abort()),null===(i=this._loader)||void 0===i||i.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},e.prototype.isWorking=function(){var e;return(null===(e=this._loader)||void 0===e?void 0:e.isWorking())&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){var e;return null===(e=this._loader)||void 0===e?void 0:e.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){var e;return null===(e=this._dataSource)||void 0===e?void 0:e.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){var e;return null!=this._redirectedURL||void 0!==(null===(e=this._dataSource)||void 0===e?void 0:e.redirectedURL)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){var e;return this._redirectedURL||(null===(e=this._dataSource)||void 0===e?void 0:e.redirectedURL)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){var e,t;return this._loaderClass===p?null===(e=this._loader)||void 0===e?void 0:e.currentSpeed:null===(t=this._speedSampler)||void 0===t?void 0:t.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){var e;return null===(e=this._loader)||void 0===e?void 0:e.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new m(!!this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new v(t,i)}else{if("custom"!==e.seekType)throw new d.Qn("Invalid seekType in config: ".concat((null==e?void 0:e.seekType)||""));if("function"!=typeof e.customSeekHandler)throw new d.Qn("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){var e;if(null!=this._config.customLoader)this._loaderClass=(null===(e=this._config)||void 0===e?void 0:e.customLoader)||null;else if(this._isWebSocketURL)this._loaderClass=f;else if(c.isSupported())this._loaderClass=c;else if(u.isSupported())this._loaderClass=u;else{if(!p.isSupported())throw new d.Al("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=p}},e.prototype._createLoader=function(){var e;this._loaderClass&&(this._loader=new this._loaderClass(this._seekHandler,this._config),(null===(e=this._loader)||void 0===e?void 0:e.needStashBuffer)||(this._enableStash=!1),this._loader&&(this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)))},e.prototype.open=function(e){var t,i;this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),null===(t=this._speedSampler)||void 0===t||t.reset(),e||(this._fullRequestFlag=!0),null===(i=this._loader)||void 0===i||i.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){var e;null===(e=this._loader)||void 0===e||e.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){var e,t;this.isWorking()&&(null===(e=this._loader)||void 0===e||e.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange&&(this._currentRange.to=this._stashByteStart-1)):this._resumeFrom=((null===(t=this._currentRange)||void 0===t?void 0:t.to)||0)+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){var i,n,r,o;(null===(i=this._loader)||void 0===i?void 0:i.isWorking())&&(null===(n=this._loader)||void 0===n||n.abort()),this._flushStashBuffer(t),null===(r=this._loader)||void 0===r||r.destroy(),this._loader=null;var a={from:e,to:-1};this._currentRange={from:a.from,to:-1},null===(o=this._speedSampler)||void 0===o||o.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,a),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new d.Qn("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var n=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(n,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,n=0,r=0,o=i;if(e<t[0])return t[0];for(;r<=o;){if((n=r+Math.floor((o-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:o=n-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive?e/8:e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange&&(this._currentRange.to=t+e.byteLength-1),this._onDataArrival?this._onDataArrival(e,t):0},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){var n,r;if(!this._onDataArrival)throw new d.j4("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),null===(n=this._speedSampler)||void 0===n||n.addBytes(e.byteLength);var o=null===(r=this._speedSampler)||void 0===r?void 0:r.lastSecondKBps;if(0!==o){var a=this._normalizeSpeed(o);this._speedNormalized!==a&&(this._speedNormalized=a,this._adjustStashSize(a))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(c=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(c=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var s=this._stashBuffer.slice(0,this._stashUsed);(h=this._dispatchChunks(s,this._stashByteStart))<s.byteLength?h>0&&(u=new Uint8Array(s,h),c.set(u,0),this._stashUsed=u.byteLength,this._stashByteStart+=h):(this._stashUsed=0,this._stashByteStart+=h),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),c=new Uint8Array(this._stashBuffer,0,this._bufferSize)),c.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(h=this._dispatchChunks(e,t))<e.byteLength&&((l=e.byteLength-h)>this._bufferSize&&(this._expandBuffer(l),c=new Uint8Array(this._stashBuffer,0,this._bufferSize)),c.set(new Uint8Array(e,h),0),this._stashUsed+=l,this._stashByteStart=t+h);else if(0===this._stashUsed){var l;(h=this._dispatchChunks(e,t))<e.byteLength&&((l=e.byteLength-h)>this._bufferSize&&this._expandBuffer(l),(c=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,h),0),this._stashUsed+=l,this._stashByteStart=t+h)}else{var c,h;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(c=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(h=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&h>0){var u=new Uint8Array(this._stashBuffer,h);c.set(u,0)}this._stashUsed-=h,this._stashByteStart+=h}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var o=new Uint8Array(this._stashBuffer,0,this._bufferSize),a=new Uint8Array(t,i);o.set(a,0),this._stashUsed=a.byteLength,this._stashByteStart+=i}return 0}n.A.w(this.TAG,"".concat(r," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,r}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){var i;switch(n.A.e(this.TAG,"Loader error, code = ".concat(t.code,", msg = ").concat(t.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=a.Xv.UNRECOVERABLE_EARLY_EOF),e){case a.Xv.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var r=((null===(i=this._currentRange)||void 0===i?void 0:i.to)||0)+1;return void(r<this._totalLength&&(n.A.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(r,!1)))}e=a.Xv.UNRECOVERABLE_EARLY_EOF;case a.Xv.UNRECOVERABLE_EARLY_EOF:case a.Xv.CONNECTING_TIMEOUT:case a.Xv.HTTP_STATUS_CODE_INVALID:case a.Xv.EXCEPTION:}if(!this._onError)throw new d.Al("IOException: "+t.msg);this._onError(e,t)},e}()},288:(e,t,i)=>{i.d(t,{HC:()=>a,Xv:()=>o,eO:()=>r});var n=i(713),r={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},o={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},a=function(){function e(e){this._type=e||"undefined",this._status=r.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=r.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===r.kConnecting||this._status===r.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new n.Xu("Unimplemented abstract function!")},e.prototype.abort=function(){throw new n.Xu("Unimplemented abstract function!")},e}()},620:(e,t,i)=>{i.d(t,{A:()=>r});var n={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.includes("trident")&&/(rv)(?::| )([\w.]+)/.exec(e)||!e.includes("compatible")&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},o={};if(r.browser){o[r.browser]=!0;var a=r.majorVersion.split(".");o.version={major:parseInt(r.majorVersion,10),string:r.version},a.length>1&&(o.version.minor=parseInt(a[1],10)),a.length>2&&(o.version.build=parseInt(a[2],10))}if(r.platform&&(o[r.platform]=!0),(o.chrome||o.opr||o.safari)&&(o.webkit=!0),o.rv||o.iemobile){o.rv&&delete o.rv;var s="msie";r.browser=s,o[s]=!0}if(o.edge){delete o.edge;var d="msedge";r.browser=d,o[d]=!0}if(o.opr){var l="opera";r.browser=l,o[l]=!0}if(o.safari&&o.android){var c="android";r.browser=c,o[c]=!0}for(var h in o.name=r.browser,o.platform=r.platform,n)Object.prototype.hasOwnProperty.call(n,h)&&delete n[h];Object.assign(n,o)}();const r=n},713:(e,t,i)=>{i.d(t,{Al:()=>o,Qn:()=>s,Xu:()=>d,j4:()=>a});var n,r=(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=function(){function e(e){this.name="RuntimeException",this._message=e}return Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),a=function(e){function t(t){var i=e.call(this,t)||this;return i.name="IllegalStateException",i}return r(t,e),t}(o),s=function(e){function t(t){var i=e.call(this,t)||this;return i.name="InvalidArgumentException",i}return r(t,e),t}(o),d=function(e){function t(t){var i=e.call(this,t)||this;return i.name="NotImplementedException",i}return r(t,e),t}(o)},502:(e,t,i)=>{i.d(t,{A:()=>r});var n=i(413);const r=function(){function e(){}return e.e=function(t,i){var n;t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&(null===(n=e.emitter)||void 0===n||n.emit("log","error",r)),e.ENABLE_ERROR&&(console.error||console.warn)},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&console.info},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&console.warn},e.d=function(t,i){var n;t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&(null===(n=e.emitter)||void 0===n||n.emit("log","debug",r)),e.ENABLE_DEBUG&&console.debug},e.v=function(t,i){var n;t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var r="[".concat(t,"] > ").concat(i);e.ENABLE_CALLBACK&&(null===(n=e.emitter)||void 0===n||n.emit("log","verbose",r)),e.ENABLE_VERBOSE},e.FORCE_GLOBAL_TAG=!1,e.GLOBAL_TAG="ezuikit-flv",e.ENABLE_CALLBACK=!1,e.emitter=new n.A,e.ENABLE_ERROR=!0,e.ENABLE_INFO=!0,e.ENABLE_WARN=!0,e.ENABLE_DEBUG=!0,e.ENABLE_VERBOSE=!0,e}()},641:(e,t,i)=>{i.d(t,{A:()=>o});var n=i(413),r=i(502);const o=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return r.A.FORCE_GLOBAL_TAG},set:function(t){r.A.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return r.A.GLOBAL_TAG},set:function(t){r.A.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return r.A.ENABLE_VERBOSE&&r.A.ENABLE_DEBUG&&r.A.ENABLE_INFO&&r.A.ENABLE_WARN&&r.A.ENABLE_ERROR},set:function(t){r.A.ENABLE_VERBOSE=t,r.A.ENABLE_DEBUG=t,r.A.ENABLE_INFO=t,r.A.ENABLE_WARN=t,r.A.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return r.A.ENABLE_DEBUG},set:function(t){r.A.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return r.A.ENABLE_VERBOSE},set:function(t){r.A.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return r.A.ENABLE_INFO},set:function(t){r.A.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return r.A.ENABLE_WARN},set:function(t){r.A.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return r.A.ENABLE_ERROR},set:function(t){r.A.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:r.A.GLOBAL_TAG,forceGlobalTag:r.A.FORCE_GLOBAL_TAG,enableVerbose:r.A.ENABLE_VERBOSE,enableDebug:r.A.ENABLE_DEBUG,enableInfo:r.A.ENABLE_INFO,enableWarn:r.A.ENABLE_WARN,enableError:r.A.ENABLE_ERROR,enableCallback:r.A.ENABLE_CALLBACK}},e.applyConfig=function(e){r.A.GLOBAL_TAG=e.globalTag,r.A.FORCE_GLOBAL_TAG=e.forceGlobalTag,r.A.ENABLE_VERBOSE=e.enableVerbose,r.A.ENABLE_DEBUG=e.enableDebug,r.A.ENABLE_INFO=e.enableInfo,r.A.ENABLE_WARN=e.enableWarn,r.A.ENABLE_ERROR=e.enableError,r.A.ENABLE_CALLBACK=!!e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){r.A.emitter.addListener("log",t),r.A.emitter.listenerCount("log")>0&&(r.A.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){r.A.emitter.removeListener("log",t),0===r.A.emitter.listenerCount("log")&&(r.A.ENABLE_CALLBACK=!1,e._notifyChange())},e.emitter=new n.A,e}()},413:(e,t,i)=>{i.d(t,{A:()=>n});const n=i(343)}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,i),o.exports}return i.m=e,i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i(446)})()))}(Fi);var Vi=Fi.exports;class Ni extends Yt{constructor(e){super(),this.player=e;const t=document.createElement("video"),i=document.createElement("canvas");this.$posterElement=document.createElement("img"),t.volume=0,t.oncontextmenu=e=>{e.preventDefault()},this.player._opt.hasAudio||(t.muted=!0),t.style.position="absolute",t.style.top="0px",t.style.left="0px",this._delayPlay=!1,e.$container.appendChild(t),this.videoInfo={width:"",height:"",encType:""},this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.fixChromeVideoFlashBug(),this.resize();const{proxy:n}=this.player.events;n(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video",`canplay and _delayPlay is ${this._delayPlay}`),this._delayPlay&&this._play(),this.player.$container.contains(this.$posterElement)&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement)})),n(this.$videoElement,"waiting",(()=>{this.player.emit(mt.videoWaiting)})),n(this.$videoElement,"timeupdate",(e=>{const t=parseInt(e.timeStamp,10);this.player.emit(mt.timeUpdate,t),!this.isPlaying()&&this.init&&(this.player.debug.log("Video","timeupdate and this.isPlaying is false and retry play"),this.$videoElement.play())})),this.player.debug.log("Video","init")}destroy(){super.destroy(),this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src="",this.$videoElement.removeAttribute("src"),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),this.player.$container.contains(this.$posterElement)&&this.$posterElement&&this.player.$container.removeChild(this.$posterElement),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=function(){const e=navigator.userAgent.toLowerCase(),t={},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1===e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let n in i)if(i[n]){let i="";if("IE"===n)i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2];else if("Chrome"===n){for(const e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(n="360");i=e.match(/chrome\/([\d.]+)/)[1]}else"Firefox"===n?i=e.match(/firefox\/([\d.]+)/)[1]:"Opera"===n?i=e.match(/opera\/([\d.]+)/)[1]:"Safari"===n?i=e.match(/version\/([\d.]+)/)[1]:"Edge"===n?i=e.match(/edge\/([\d.]+)/)[1]:"QQBrowser"===n&&(i=e.match(/qqbrowser\/([\d.]+)/)[1]);t.type=n,t.version=parseInt(i)}return t}(),t=e.type.toLowerCase();if("chrome"===t||"edge"===t){this.player.$container.style.backdropFilter="blur(0px)"}}play(){if(this.$videoElement){const e=this._getVideoReadyState();if(this.player.debug.log("Video",`play and readyState: ${e}`),0===e)return this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._play()}}_getVideoReadyState(){let e=0;return this.$videoElement&&(e=this.$videoElement.readyState),e}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout((()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())}),100)})).catch((e=>{this.player.debug.error("Video","_play error",e)}))}pause(e){this._poster(),e?this.$videoElement&&this.$videoElement.pause():setTimeout((()=>{this.$videoElement&&this.$videoElement.pause()}),100)}clearView(){}screenshot(e,t,i,n){var r;e=e||Nt()+"",n=n||wt.download,t=t||"png";const o={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"};"number"!=typeof i&&(i=Number(i||.92));const a=this.$videoElement,s=this.$canvasElement;s.width=a.videoWidth,s.height=a.videoHeight,null===(r=this.canvasContext)||void 0===r||r.drawImage(a,0,0,s.width,s.height);const d=s.toDataURL(o[t]||o.png,i);if(setTimeout((()=>{var e;null===(e=this.canvasContext)||void 0===e||e.clearRect(0,0,s.width,s.height),s.width=0,s.height=0}),10),n===wt.base64)return d;{const t=Vt(d);return n===wt.blob?t:(n===wt.download&&ii(t,e),"")}}initCanvasViewSize(){this.resize()}_poster(){const e=this.screenshot("poster","png",.75,wt.base64);e.length<10||(this.$posterElement.src=e,this.$posterElement.style.position="absolute",this.$posterElement.style.top="0px",this.$posterElement.style.left="0px",this.$posterElement.style.zIndex="1",this.$posterElement.style.objectFit="contain",this.$posterElement.style.pointerEvents="none",this.player.$container.appendChild(this.$posterElement),this.resize())}render(e){this.vwriter&&this.vwriter.write(e.videoFrame)}resize(){this._resizeElement(this.$videoElement),this._resizeElement(this.$posterElement)}_resizeElement(e){const t=this.player._opt,i=this.player.width,n=this.player.height,r=t.rotate;e.width=i,e.height=n,270!==r&&90!==r||(e.width=n,e.height=i);const o=(i-e.width)/2,a=(n-e.height)/2;let s="contain";t.scaleMode===kt.full&&(s="fill"),t.scaleMode===kt.fullAuto&&(s="cover"),e.style.objectFit=s,e.style.transform="rotate("+r+"deg)",e.style.left=o+"px",e.style.top=a+"px"}isPlaying(){return this.$videoElement&&!this.$videoElement.paused}}class Gi extends Ti{constructor(e,t){super(e,t,Ni),this._checkHeartTimeout=null,this._opt.useMSE=!0,this._createPlayer(t)}close(){throw new Error("Method not implemented.")}_createPlayer(e){var t;this._opt=Object.assign({},this._opt,e),this.events||(this.events=new Si(this)),this.video||(this.video=new Ni(this)),null===(t=Vi.LoggingControl)||void 0===t||t.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!this._opt.debug,enableDebug:!!this._opt.debug,enableInfo:!!this._opt.debug,enableWarn:!!this._opt.debug,enableError:!0}),this.player=Vi.createPlayer({type:"flv",url:e.url,isLive:!0},{stashInitialSize:128,enableWorker:!0,liveBufferLatencyChasing:!0}),this.player.attachMediaElement(this.video.$videoElement),this.loaded=!0,this._flvEvents()}_flvEvents(){this.player&&(this.player.on(Vi.Events.ERROR,((e,t,i)=>{"MediaError"===e&&"MediaMSEError"===t&&9===i.code&&this.emit(gt.mediaSourceH265NotSupport,i),e.indexOf("NetworkError")>-1&&this.player&&this.pause().then((()=>{this.emit(mt.timeout,mt.delayTimeout),this.emit(mt.delayTimeout)})),Pi.report(51,{event:e,value:i}),this.debug.error(`${Vi.Events.ERROR}`,e,t,i)})),this.player.on(Vi.Events.LOADING_COMPLETE,(e=>{this.debug.log(`${Vi.Events.LOADING_COMPLETE}`,e)})),this.player.on(Vi.Events.RECOVERED_EARLY_EOF,(e=>{this.debug.log(`${Vi.Events.RECOVERED_EARLY_EOF}`,e)})),this.player.on(Vi.Events.MEDIA_INFO,(e=>{this.video.updateVideoInfo({encTypeCode:(null==e?void 0:e.videoCodec.indexOf("avc"))>=0?7:12,width:e.width,height:e.height})})),this.player.on(Vi.Events.STATISTICS_INFO,(e=>{e.decodedFrames===this._decodedFrames&&null===this._checkHeartTimeout?this.checkHeartTimeout():e.decodedFrames!==this._decodedFrames&&(this.clearCheckHeartTimeout(),this._decodedFrames=e.decodedFrames)})),this.player.on(Vi.Events.DESTROYING,(e=>{this.debug.log(`${Vi.Events.DESTROYING}`,e)})),this.off(mt.videoWaiting),this.off(mt.timeUpdate),this.on(mt.videoWaiting,(()=>{this.clearCheckHeartTimeout(),null===this._checkHeartTimeout&&this.handleRender()})),this.on(mt.timeUpdate,(()=>{this.clearCheckHeartTimeout()})))}getOption(){return this._opt}emitError(e,t=""){this.emit(mt.error,e,t),this.emit(e,t)}destroy(){this.player&&this.playing&&this.player.pause(),this.player&&(this.player.unload(),this.player.detachMediaElement(),this.player.destroy(),this.player=null),this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.video&&(this.video.destroy(),this.video=null),this.events&&(this.events.destroy(),this.events=null),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this.emit("destroy"),this.off(),this.debug.log("play","destroy end")}resetStats(){}set fullscreen(e){Qt()&&this._opt.useWebFullScreen?(this.emit(mt.webFullscreen,e),setTimeout((()=>{this.updateOption({rotate:e?270:0}),this.resize()}),10)):this.emit(mt.fullscreen,e)}get fullscreen(){return zt()||this.webFullscreen}set webFullscreen(e){this.emit(mt.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("flv-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(mt.playing,e),this.emit(mt.volumechange,this.volume),e?this.emit(mt.play):this.emit(mt.pause))}get playing(){return this._playing}get volume(){var e;return(null===(e=this.video)||void 0===e?void 0:e.$videoElement.volume)||0}set volume(e){e!==this.volume&&this.video&&(this.video.$videoElement.muted=!1,this.video.$videoElement.volume=e,this._lastVolume=e),0===e?this.emit(mt.mute,!0):this.emit(mt.mute,!1)}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(mt.loading,this._loading))}get loading(){return this._loading}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e)}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!!this._opt.debug}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkHeartTimeout(){this._checkHeartTimeout=setTimeout((()=>{this.playing&&this.pause().then((()=>{this.emit(mt.timeout,mt.delayTimeout),this.emit(mt.delayTimeout)}))}),1e3*this._opt.heartTimeout)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing||this.pause().then((()=>{this.emit(mt.timeout,mt.loadingTimeout),this.emit(mt.loadingTimeout)}))}),1e3*this._opt.loadingTimeout)}handleRender(){this.loading&&(this.emit(mt.start),this.loading=!1,this.clearCheckLoadingTimeout()),this.playing||(this.playing=!0),this.checkHeart()}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}updateOption(e){var t;super.updateOption(e),null===(t=Vi.LoggingControl)||void 0===t||t.applyConfig({globalTag:"EzuikitFlv",enableVerbose:!!e.debug,enableDebug:!!e.debug,enableInfo:!!e.debug,enableWarn:!!e.debug,enableError:!0})}play(){var e;return(null===(e=this.player)||void 0===e?void 0:e.playing)?this.pause().then((()=>this._play())):this._play()}_play(){return this._pause&&this._createPlayer(this._opt),this.loading=!0,this.playing=!1,this._times.playInitStart=Nt(),this.player?(this.player.load(),this.clearCheckHeartTimeout(),new Promise(((e,t)=>{this.player.play().then((()=>{this.loading=!1,this.playing=!0,this._opt.isNotMute&&this.mute(!1),e()})).catch((e=>{t(e)}))}))):Promise.reject()}_close(){return new Promise((e=>{this._loading=!1,this._playing=!1,this._hasLoaded=!1,this._lastVolume=null,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.video&&(this.video.resetInit(),this.video.pause(!0)),this.player&&(this.player.pause(),this.player.unload(),this._pause=!0,this.loaded=!0),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,setTimeout((()=>{e()}),10)}))}pause(){return this._close()}resumeAudioAfterPause(){}mute(e){this.volume=e?0:.5}resize(){this.video.resize()}}class Wi{constructor(e,t){this._opt=Object.assign({},Ke,t),(Qt()||"360EE"===qe().browser)&&(this._opt.useMSE=!1);return new(Wi.getLoaderFactory(this._opt.useMSE))(e,this._opt)}static getLoaderFactory(e){return e?Gi:Ui}}var ji={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new r(n,o||e,a),d=i?i+t:t;return e._events[d]?e._events[d].fn?e._events[d]=[e._events[d],s]:e._events[d].push(s):(e._events[d]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var d,l,c=this._events[s],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),h){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,n),!0;case 4:return c.fn.call(c.context,t,n,r),!0;case 5:return c.fn.call(c.context,t,n,r,o),!0;case 6:return c.fn.call(c.context,t,n,r,o,a),!0}for(l=1,d=new Array(h-1);l<h;l++)d[l-1]=arguments[l];c.fn.apply(c.context,d)}else{var u,A=c.length;for(l=0;l<A;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),h){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,n);break;case 4:c[l].fn.call(c[l].context,t,n,r);break;default:if(!d)for(u=1,d=new Array(h-1);u<h;u++)d[u-1]=arguments[u];c[l].fn.apply(c[l].context,d)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,n,r){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||n&&s.context!==n||a(this,o);else{for(var d=0,l=[],c=s.length;d<c;d++)(s[d].fn!==t||r&&!s[d].once||n&&s[d].context!==n)&&l.push(s[d]);l.length?this._events[o]=1===l.length?l[0]:l:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(ji);var Qi=Mt(ji.exports);const zi=["h264","h265"];class Hi extends Qi{constructor(e){super(Hi._setOptions(e)),t(this,"event",new Qi),Pi.initMonitor(e.ignoreMonitor||e.disableColect);const i=e;let n=e.id||e.container;if("string"==typeof n&&(n=document.querySelector("#"+n.replace(/^#/,""))),!n)throw new Error("Flv required node can be a string (dom id) or dom (HTMLElement node)");if("CANVAS"===n.nodeName||"VIDEO"===n.nodeName)throw new Error(`Flv container type can not be ${n.nodeName} type`);if(!e.url)throw new Error("Flv url is empty");if(Pi.url=e.url,Pi.report(1,{name:"constructor"}),i.videoBuffer>=i.heartTimeout)throw new Error(`Flv videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);n.classList.add("ezui-player-container","ezui-flv-container"),n.style.position="relative",delete i.container,i.forceNoOffscreen=!0,qt(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),qt(i.timeout)&&(Ht(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),Ht(i.heartTimeout)&&(i.heartTimeout=i.timeout)),this._opt=i,this.$container=n,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.events=new Si(this),this._initPlayer(n,i)}static _setOptions(e){return"string"==typeof e.id?e:"string"==typeof e.container?(e.id=e.container.replace(/^#/,""),e):e}destroy(){this.events&&(this.events.destroy(),this.events=null),this.player&&(this.player.destroy(),this.player=null),this.$container&&(this.$container.classList.remove("ezui-flv-container"),this.$container=null),this.$container=null,this._opt={},this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.removeAllListeners(),Pi.report(50,{name:"destroy"})}_initPlayer(e,t){t.url&&(t.url=r(t.url,zi)),this.player=new Wi(e,t),this._bindEvents(),t.autoPlay&&this.play()}_resetPlayer(e={}){this.player.destroy(),this.player=null,this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)}_bindEvents(){Object.keys(vt).forEach((e=>{this.player.on(vt[e],(t=>{this.emit(e,t),this.event.emit(e,t)}))}))}setDebug(e){this.player.updateOption({debug:e}),Pi.report(50,{name:"setDebug"})}setLogger(e={}){this.player.updateOption({loggerOptions:{...this.player._opt.loggerOptions||{},...e}})}closeSound(){var e,t;null===(e=this.player)||void 0===e||null===(t=e.mute)||void 0===t||t.call(e,!0),Pi.report(50,{name:"closeSound"})}openSound(){var e,t;null===(e=this.player)||void 0===e||null===(t=e.mute)||void 0===t||t.call(e,!1),Pi.report(50,{name:"openSound"})}setVolume(e){this.openSound(),this.player.volume=e,Pi.report(50,{name:"setVolume",value:e})}get volume(){return this.player.volume}set volume(e){this.setVolume(e)}getVolume(){return Pi.report(50,{name:"getVolume"}),this.player.volume}audioResume(){var e,t;null===(e=this.player)||void 0===e||null===(e=e.audio)||void 0===e||null===(t=e.audioEnabled)||void 0===t||t.call(e,!0),Pi.report(50,{name:"audioResume"})}setTimeout(e){e=Number(e),this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){return new Promise(((t,i)=>{try{e=Number(e)}catch(e){return void i(e)}[kt.full,kt.auto,kt.fullAuto].includes(e)?(this.player.updateOption({scaleMode:e}),this.resize(),t(),Pi.report(50,{name:"setScaleMode"})):i("scale mode 0 | 1 | 2")}))}pause(){var e,t;return Pi.report(50,{name:"pause"}),null===(e=this.player)||void 0===e||null===(t=e.pause)||void 0===t?void 0:t.call(e)}close(){return this._opt.url="",this._opt.playOptions={},this._opt.urlQuery={},Pi.report(50,{name:"close"}),this.player.close()}clearView(){this.player.video.clearView(),Pi.report(50,{name:"clearView"})}play(e={}){var t;e.url&&(Pi.url=e.url),"string"==typeof e&&(e={url:e});const i=r(e.url||this._opt.url,zi);return i===this._opt.url&&null!==(t=this.player)&&void 0!==t&&t.playing?Promise.resolve():(this._opt=Object.assign({},this._opt,e||{},{url:i}),this._opt.urlQuery=Mi(e.url),Pi.report(50,{name:"play"}),new Promise(((e,t)=>{var i;if(!this._opt.url)return this.emit(mt.error,gt.playError),void t("play url is empty");null!==(i=this.player)&&void 0!==i&&i.playing?(this.clearView(),this.player.play(this._opt).then((()=>{e()})).catch((e=>{this.player.debug.warn("Flv","pause ->  play and play error",e),this.player.pause().then((()=>{t(e)}))}))):this._play(this._opt).then((()=>{e()})).catch((e=>{t(e)}))})))}_play(e={}){return new Promise(((t,i)=>{const n=0===e.url.indexOf("http"),r=n?$e:Xe,o=n||-1!==e.url.indexOf(".flv")||this._opt.isFlv?Ye:Ze;this.player.updateOption({protocol:r,demuxType:o}),this.player.once(gt.webglAlignmentError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","webglAlignmentError"),this._resetPlayer({openWebglAlignment:!0}),this.play(e).then((()=>{this.player.debug.log("Flv","webglAlignmentError and play success")})).catch((()=>{this.player.debug.log("Flv","webglAlignmentError and play error")}))}))})),this.player.once(gt.mediaSourceH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play"),this._resetPlayer({useMSE:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play success")})).catch((()=>{this.player.debug.log("Flv","auto wasm [mse-> wasm] reset player and play error")})))}))})),this.player.once(gt.mediaSourceFull,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source full"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source full and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source full and reset player and play error")}))}))})),this.player.once(gt.mediaSourceAppendBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer error"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source append buffer error and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source append buffer error and reset player and play error")}))}))})),this.player.once(gt.mediaSourceBufferListLarge,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source buffer list large"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source buffer list large and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source buffer list large and reset player and play error")}))}))})),this.player.once(gt.mediaSourceAppendBufferEndTimeout,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","media source append buffer end timeout"),this._resetPlayer(),this.play(e).then((()=>{this.player.debug.log("Flv","media source append buffer end timeout and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","media source append buffer end timeout and reset player and play error")}))}))})),this.player.once(gt.mseSourceBufferError,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","mseSourceBufferError close success")}))})),this.player.once(gt.webcodecsH265NotSupport,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","auto wasm [wcs-> wasm] reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","auto wasm [wcs-> wasm] reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","auto wasm [wcs-> wasm] reset player and play error")})))}))})),this.player.once(gt.webcodecsWidthOrHeightChange,(()=>{this.pause().then((()=>{this.player.debug.log("Flv","webcodecs Width Or Height Change reset player and play"),this._resetPlayer({useWCS:!0}),this.play(e).then((()=>{this.player.debug.log("Flv","webcodecs Width Or Height Change reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","webcodecs Width Or Height Change reset player and play error")}))}))})),this.player.once(gt.webcodecsDecodeError,(()=>{this.pause().then((()=>{this.player._opt.autoWasm&&(this.player.debug.log("Flv","webcodecs decode error reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","webcodecs decode error  reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","webcodecs decode error reset player and play error")})))}))})),this.player.once(gt.wasmDecodeError,(()=>{this.player._opt.wasmDecodeErrorReplay&&this.pause().then((()=>{this.player.debug.log("Flv","wasm decode error and reset player and play"),this._resetPlayer({useWCS:!1}),this.play(e).then((()=>{this.player.debug.log("Flv","wasm decode error and reset player and play success")})).catch((()=>{this.player.debug.warn("Flv","wasm decode error and reset player and play error")}))}))})),this.player.once(mt.delayTimeout,(()=>{this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes<this.player._opt.heartTimeoutReplayTimes||-1===this.player._opt.heartTimeoutReplayTimes)&&(this.player.debug.log("Flv",`delay timeout replay time is ${this._heartTimeoutReplayTimes}`),this._heartTimeoutReplayTimes+=1,this.play(e).then((()=>{this._heartTimeoutReplayTimes=0})).catch((e=>{this._heartTimeoutReplayTimes=0})))})),this.player.once(mt.loadingTimeout,(()=>{this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes<this.player._opt.loadingTimeoutReplayTimes||-1===this.player._opt.loadingTimeoutReplayTimes)&&(this.player.debug.log("Flv",`loading timeout replay time is ${this._loadingTimeoutReplayTimes}`),this._loadingTimeoutReplayTimes+=1,this.play(e).then((()=>{this._loadingTimeoutReplayTimes=0})).catch((()=>{})))})),this.hasLoaded()?this.player.play(e).then((()=>{t()})).catch((e=>{this.player&&(this.player.debug.warn("Flv","hasLoaded and play error",e),this.player.pause().then((()=>{i(e)})))})):this.player.once(mt.decoderWorkerInit,(()=>{this.player.play(e).then((()=>{t()})).catch((e=>{this.player&&(this.player.debug.warn("Flv","decoderWorkerInit and play error",e),this.player.pause().then((()=>{i(e)})))}))}))}))}resize(e,t){e>0&&t>0&&this.player.updateOption({width:e,height:t}),this.player.resize(),Pi.report(50,{name:"resize"})}setBufferTime(e){var t,i;e=Number(e),this.player.updateOption({videoBuffer:1e3*e}),null===(t=this.player)||void 0===t||null===(t=t.decoderWorker)||void 0===t||null===(i=t.updateWorkConfig)||void 0===i||i.call(t,{key:"videoBuffer",value:1e3*e})}setRotate(e){Pi.report(50,{name:"setRotate",value:e});try{e=parseInt(e,10)}catch(e){return Promise.reject("rotate 0 | 90 | 180 | 270")}const t=[0,90,180,270];return new Promise(((i,n)=>{t.includes(e)?(this.player.updateOption({rotate:e}),this.resize(),i()):n("rotate 0 | 90 | 180 | 270")}))}hasLoaded(){return this.player.loaded}setKeepScreenOn(){this.player.updateOption({keepScreenOn:!0}),Pi.report(50,{name:"setKeepScreenOn"})}_setFullscreen(e){const t=!!e;this.player.fullscreen!==t&&(this.player.fullscreen=t)}fullScreen(){return i()||this._setFullscreen(!0),Pi.report(50,{name:"fullScreen"}),Promise.resolve()}fullscreen(){return i()||this._setFullscreen(!0),Pi.report(50,{name:"fullScreen"}),Promise.resolve()}cancelFullScreen(){return Pi.report(50,{name:"cancelFullScreen"}),this._exitFullscreen()}exitFullscreen(){return this.cancelFullScreen()}_exitFullscreen(){return this._setFullscreen(!1),Pi.report(50,{name:"exitFullscreen"}),Promise.resolve()}getState(){return{playing:!!this.player&&this.player.playing,mute:!(this.player&&this.player.volume>0),fullscreen:!!this.player&&this.player.fullscreen,webFullscreen:!!this.player&&this.player.webFullscreen,loaded:!!this.player&&this.player.loaded,volume:this.player?parseFloat(this.player.volume).toFixed(2):0,isDebug:!!this.player&&this.player.isDebug}}getOptions(){return this.player?this.player._opt:{}}getVersion(){return Pi.report(50,{name:"getVersion"}),"1.0.2-beta.5"}static supportType(e){if("flv"===e.type)return!0;if(e.url){let t=e.url;t.startsWith("http://")||t.startsWith("https://")||(t=/^\/\//.test(t)?"http:"+t:location.origin+location.pathname+t);try{return/\.flv$/i.test(new URL(t).pathname)}catch(e){}}return!1}}return t(Hi,"ERROR",gt),t(Hi,"TIMEOUT",{loadingTimeout:mt.loadingTimeout,delayTimeout:mt.delayTimeout}),t(Hi,"version","1.0.2-beta.5"),Hi}));
