123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773 |
- /**
- * @license
- * Video.js 8.3.0 <http://videojs.com/>
- * Copyright Brightcove, Inc. <https://www.brightcove.com/>
- * Available under Apache License Version 2.0
- * <https://github.com/videojs/video.js/blob/main/LICENSE>
- *
- * Includes vtt.js <https://github.com/mozilla/vtt.js>
- * Available under Apache License Version 2.0
- * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
- */
- !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).videojs=t()}(this,function(){"use strict";var R="8.3.0";const U={},B=function(e,t){return U[e]=U[e]||[],t&&(U[e]=U[e].concat(t)),U[e]};function F(e,t){return!((t=B(e).indexOf(t))<=-1||(U[e]=U[e].slice(),U[e].splice(t,1),0))}const j={prefixed:!0};var H=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],q=H[0];let V;for(let e=0;e<H.length;e++)if(H[e][1]in document){V=H[e];break}if(V){for(let e=0;e<V.length;e++)j[q[e]]=V[e];j.prefixed=V[0]!==q[0]}let l=[];function $(e){return K(e)?Object.keys(e):[]}const d=function t(i){let s="info",r;function n(...e){r("log",s,e)}var a,o;return r=(a=i,(t,i,s)=>{var e,i=o.levels[i],r=new RegExp(`^(${i})$`);if("log"!==t&&s.unshift(t.toUpperCase()+":"),s.unshift(a+":"),l&&(l.push([].concat(s)),e=l.length-1e3,l.splice(0,0<e?e:0)),window.console){let e=window.console[t];(e=e||"debug"!==t?e:window.console.info||window.console.log)&&i&&r.test(t)&&e[Array.isArray(s)?"apply":"call"](window.console,s)}}),(o=n).createLogger=e=>t(i+": "+e),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:s},n.level=e=>{if("string"==typeof e){if(!n.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);s=e}return s},n.history=()=>l?[].concat(l):[],n.history.filter=t=>(l||[]).filter(e=>new RegExp(`.*${t}.*`).test(e[0])),n.history.clear=()=>{l&&(l.length=0)},n.history.disable=()=>{null!==l&&(l.length=0,l=null)},n.history.enable=()=>{null===l&&(l=[])},n.error=(...e)=>r("error",s,e),n.warn=(...e)=>r("warn",s,e),n.debug=(...e)=>r("debug",s,e),n}("VIDEOJS"),W=d.createLogger,G=Object.prototype.toString;function z(t,i){$(t).forEach(e=>i(t[e],e))}function X(i,s,e=0){return $(i).reduce((e,t)=>s(e,i[t],t),e)}function K(e){return!!e&&"object"==typeof e}function Y(e){return K(e)&&"[object Object]"===G.call(e)&&e.constructor===Object}function h(...e){const i={};return e.forEach(e=>{e&&z(e,(e,t)=>{Y(e)?(Y(i[t])||(i[t]={}),i[t]=h(i[t],e)):i[t]=e})}),i}function Q(t,i,s,e=!0){const r=e=>Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=s();return r(e),e}};return e&&(n.set=r),Object.defineProperty(t,i,n)}var J=Object.freeze({__proto__:null,each:z,reduce:X,isObject:K,isPlain:Y,merge:h,defineLazyProperty:Q});let Z=!1,ee=null,te=!1,ie,se=!1,re=!1,ne=!1,ae=!1,oe=null,le=null,de=null,he=!1,ue=!1,ce=!1,pe=!1;const me=Boolean(_e()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var ge,e=window.navigator&&window.navigator.userAgentData;if(e&&(te="Android"===e.platform,re=Boolean(e.brands.find(e=>"Microsoft Edge"===e.brand)),ne=Boolean(e.brands.find(e=>"Chromium"===e.brand)),ae=!re&&ne,oe=le=(e.brands.find(e=>"Chromium"===e.brand)||{}).version||null,ue="Windows"===e.platform),!ne){const M=window.navigator&&window.navigator.userAgent||"";Z=/iPod/i.test(M),ee=(e=M.match(/OS (\d+)_/i))&&e[1]?e[1]:null,te=/Android/i.test(M),ie=(e=M.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(mt=e[1]&&parseFloat(e[1]),ge=e[2]&&parseFloat(e[2]),mt&&ge?parseFloat(e[1]+"."+e[2]):mt||null):null,se=/Firefox/i.test(M),re=/Edg/i.test(M),ne=/Chrome/i.test(M)||/CriOS/i.test(M),ae=!re&&ne,oe=le=(ge=M.match(/(Chrome|CriOS)\/(\d+)/))&&ge[2]?parseFloat(ge[2]):null,de=function(){var e=/MSIE\s(\d+)\.\d/.exec(M);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(M)&&/rv:11.0/.test(M)?11:t}(),he=/Safari/i.test(M)&&!ae&&!te&&!re,ue=/Windows/i.test(M),ce=/iPad/i.test(M)||he&&me&&!/iPhone/i.test(M),pe=/iPhone/i.test(M)&&!ce}const u=pe||ce||Z,fe=(he||u)&&!ae;e=Object.freeze({__proto__:null,get IS_IPOD(){return Z},get IOS_VERSION(){return ee},get IS_ANDROID(){return te},get ANDROID_VERSION(){return ie},get IS_FIREFOX(){return se},get IS_EDGE(){return re},get IS_CHROMIUM(){return ne},get IS_CHROME(){return ae},get CHROMIUM_VERSION(){return oe},get CHROME_VERSION(){return le},get IE_VERSION(){return de},get IS_SAFARI(){return he},get IS_WINDOWS(){return ue},get IS_IPAD(){return ce},get IS_IPHONE(){return pe},TOUCH_ENABLED:me,IS_IOS:u,IS_ANY_SAFARI:fe});function ye(e){return"string"==typeof e&&Boolean(e.trim())}function _e(){return document===window.document}function ve(e){return K(e)&&1===e.nodeType}function be(){try{return window.parent!==window.self}catch(e){return!0}}function Te(i){return function(e,t){return ye(e)?(t=ve(t=ye(t)?document.querySelector(t):t)?t:document)[i]&&t[i](e):document[i](null)}}function o(e="div",i={},t={},s){const r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];"textContent"===e?Se(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),s&&He(r,s),r}function Se(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function we(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Ee(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function ke(e,...t){return e.classList.add(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e}function Ce(e,...t){return e?(e.classList.remove(...t.reduce((e,t)=>e.concat(t.split(/\s+/)),[])),e):(d.warn("removeClass was called with an element that doesn't exist"),null)}function Ie(t,e,i){return"boolean"!=typeof(i="function"==typeof i?i(t,e):i)&&(i=void 0),e.split(/\s+/).forEach(e=>t.classList.toggle(e,i)),t}function xe(i,s){Object.getOwnPropertyNames(s).forEach(function(e){var t=s[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function Ae(i){var s={};if(i&&i.attributes&&0<i.attributes.length){var r=i.attributes;for(let t=r.length-1;0<=t;t--){var n=r[t].name;let e=r[t].value;"boolean"!=typeof i[n]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+n+",")||(e=null!==e),s[n]=e}}return s}function Pe(e,t){return e.getAttribute(t)}function Le(e,t,i){e.setAttribute(t,i)}function Oe(e,t){e.removeAttribute(t)}function De(){document.body.focus(),document.onselectstart=function(){return!1}}function Ne(){document.onselectstart=function(){return!0}}function Me(e){if(e&&e.getBoundingClientRect&&e.parentNode){const t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(e=>{void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(Ge(e,"height"))),i.width||(i.width=parseFloat(Ge(e,"width"))),i}}function Re(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,r=0;for(;e.offsetParent&&e!==document[j.fullscreenElement];)s+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:s,top:r,width:t,height:i}}function Ue(t,e){var i={x:0,y:0};if(u){let e=t;for(;e&&"html"!==e.nodeName.toLowerCase();){var s,r=Ge(e,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),e=e.parentNode}}var n={},a=Re(e.target),t=Re(t),o=t.width,l=t.height;let d=e.offsetY-(t.top-a.top),h=e.offsetX-(t.left-a.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-t.left,d=e.changedTouches[0].pageY+t.top,u)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function Be(e){return K(e)&&3===e.nodeType}function Fe(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function je(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(e=>ve(e="function"==typeof e?e():e)||Be(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0).filter(e=>e)}function He(t,e){return je(e).forEach(e=>t.appendChild(e)),t}function qe(e,t){return He(Fe(e),t)}function Ve(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}const $e=Te("querySelector"),We=Te("querySelectorAll");function Ge(t,i){if(!t||!i)return"";if("function"!=typeof window.getComputedStyle)return"";{let e;try{e=window.getComputedStyle(t)}catch(e){return""}return e?e.getPropertyValue(i)||e[i]:""}}var ze=Object.freeze({__proto__:null,isReal:_e,isEl:ve,isInFrame:be,createEl:o,textContent:Se,prependTo:we,hasClass:Ee,addClass:ke,removeClass:Ce,toggleClass:Ie,setAttributes:xe,getAttributes:Ae,getAttribute:Pe,setAttribute:Le,removeAttribute:Oe,blockTextSelection:De,unblockTextSelection:Ne,getBoundingClientRect:Me,findPosition:Re,getPointerPosition:Ue,isTextNode:Be,emptyEl:Fe,normalizeContent:je,appendContent:He,insertContent:qe,isSingleLeftClick:Ve,$:$e,$$:We,computedStyle:Ge});let Xe=!1,Ke;function Ye(){if(!1!==Ke.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),s=e.concat(t,i);if(s&&0<s.length)for(let e=0,t=s.length;e<t;e++){var r=s[e];if(!r||!r.getAttribute){Qe(1);break}void 0===r.player&&null!==r.getAttribute("data-setup")&&Ke(r)}else Xe||Qe(1)}}function Qe(e,t){_e()&&(t&&(Ke=t),window.setTimeout(Ye,e))}function Je(){Xe=!0,window.removeEventListener("load",Je)}_e()&&("complete"===document.readyState?Je():window.addEventListener("load",Je));function Ze(e){var t=document.createElement("style");return t.className=e,t}function et(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}var c=new WeakMap;let tt=3;function it(e,t){var i;c.has(e)&&(0===(i=c.get(e)).handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length)&&c.delete(e)}function st(t,i,e,s){e.forEach(function(e){t(i,e,s)})}function rt(e){if(!e.fixed_){if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){const n=e||window.event;e={};for(const a in n)"layerX"===a||"layerY"===a||"keyLocation"===a||"webkitMovementX"===a||"webkitMovementY"===a||"path"===a||"returnValue"===a&&n.preventDefault||(e[a]=n[a]);var t,i;e.target||(e.target=e.srcElement||document),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){n.preventDefault&&n.preventDefault(),e.returnValue=!1,n.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),e.cancelBubble=!0,n.cancelBubble=!0,e.isPropagationStopped=s},e.isPropagationStopped=r,e.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),e.isImmediatePropagationStopped=s,e.stopPropagation()},e.isImmediatePropagationStopped=r,null!==e.clientX&&void 0!==e.clientX&&(t=document.documentElement,i=document.body,e.pageX=e.clientX+(t&&t.scrollLeft||i&&i.scrollLeft||0)-(t&&t.clientLeft||i&&i.clientLeft||0),e.pageY=e.clientY+(t&&t.scrollTop||i&&i.scrollTop||0)-(t&&t.clientTop||i&&i.clientTop||0)),e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}e.fixed_=!0}return e;function s(){return!0}function r(){return!1}}let nt;const at=["touchstart","touchmove"];function ot(n,t,e){if(Array.isArray(t))return st(ot,n,t,e);c.has(n)||c.set(n,{});const a=c.get(n);if(a.handlers||(a.handlers={}),a.handlers[t]||(a.handlers[t]=[]),e.guid||(e.guid=tt++),a.handlers[t].push(e),a.dispatcher||(a.disabled=!1,a.dispatcher=function(i,s){if(!a.disabled){i=rt(i);var e=a.handlers[i.type];if(e){var r=e.slice(0);for(let e=0,t=r.length;e<t&&!i.isImmediatePropagationStopped();e++)try{r[e].call(n,i,s)}catch(e){d.error(e)}}}}),1===a.handlers[t].length)if(n.addEventListener){let e=!1;(function(){if("boolean"!=typeof nt){nt=!1;try{var e=Object.defineProperty({},"passive",{get(){nt=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}return nt})()&&-1<at.indexOf(t)&&(e={passive:!0}),n.addEventListener(t,a.dispatcher,e)}else n.attachEvent&&n.attachEvent("on"+t,a.dispatcher)}function p(e,t,i){if(c.has(e)){const n=c.get(e);if(n.handlers){if(Array.isArray(t))return st(p,e,t,i);var s=function(e,t){n.handlers[t]=[],it(e,t)};if(void 0===t)for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&s(e,a);else{var r=n.handlers[t];if(r)if(i){if(i.guid)for(let e=0;e<r.length;e++)r[e].guid===i.guid&&r.splice(e--,1);it(e,t)}else s(e,t)}}}}function lt(e,t,i){var s=c.has(e)?c.get(e):{},r=e.parentNode||e.ownerDocument;return"string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=rt(t),s.dispatcher&&s.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles?lt.call(null,r,t,i):!r&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(c.has(t.target)||c.set(t.target,{}),s=c.get(t.target),t.target[t.type])&&(s.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),s.disabled=!1),!t.defaultPrevented}function dt(e,t,i){if(Array.isArray(t))return st(dt,e,t,i);function s(){p(e,t,s),i.apply(this,arguments)}s.guid=i.guid=i.guid||tt++,ot(e,t,s)}function ht(e,t,i){function s(){p(e,t,s),i.apply(this,arguments)}s.guid=i.guid=i.guid||tt++,ot(e,t,s)}var ut=Object.freeze({__proto__:null,fixEvent:rt,on:ot,off:p,trigger:lt,one:dt,any:ht});function m(e,t,i){return t.guid||(t.guid=tt++),(e=t.bind(e)).guid=i?i+"_"+t.guid:t.guid,e}function ct(i,s){let r=window.performance.now();return function(...e){var t=window.performance.now();t-r>=s&&(i(...e),r=t)}}function pt(s,r,n,a=window){let o;function e(){const e=this,t=arguments;let i=function(){o=null,i=null,n||s.apply(e,t)};!o&&n&&s.apply(e,t),a.clearTimeout(o),o=a.setTimeout(i,r)}return e.cancel=()=>{a.clearTimeout(o),o=null},e}var mt=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:m,throttle:ct,debounce:pt});let gt;class ft{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ot(this,e,t),this.addEventListener=i}off(e,t){p(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},dt(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},ht(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=rt(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),lt(this,e)}queueTrigger(e){gt=gt||new Map;const t=e.type||e;let i=gt.get(this);i||(i=new Map,gt.set(this,i));var s=i.get(t),s=(i.delete(t),window.clearTimeout(s),window.setTimeout(()=>{i.delete(t),0===i.size&&(i=null,gt.delete(this)),this.trigger(e)},0));i.set(t,s)}}ft.prototype.allowedEvents_={},ft.prototype.addEventListener=ft.prototype.on,ft.prototype.removeEventListener=ft.prototype.off,ft.prototype.dispatchEvent=ft.prototype.trigger;const yt=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),_t=t=>t instanceof ft||!!t.eventBusEl_&&["on","one","off","trigger"].every(e=>"function"==typeof t[e]),vt=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,bt=(e,t,i)=>{if(!e||!e.nodeName&&!_t(e))throw new Error(`Invalid target for ${yt(t)}#${i}; must be a DOM node or evented object.`)},Tt=(e,t,i)=>{if(!vt(e))throw new Error(`Invalid event type for ${yt(t)}#${i}; must be a non-empty string or array.`)},St=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${yt(t)}#${i}; must be a function.`)},wt=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):[r,n,a]=t,bt(r,e,i),Tt(n,e,i),St(a,e,i),a=m(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},Et=(e,t,i,s)=>{bt(e,e,t),e.nodeName?ut[t](e,i,s):e[t](i,s)},kt={on(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=wt(this,e,"on");if(Et(i,"on",s,r),!t){const n=()=>this.off(i,s,r);n.guid=r.guid;e=()=>this.off("dispose",n);e.guid=r.guid,Et(this,"on","dispose",n),Et(i,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=wt(this,e,"one");if(t)Et(i,"one",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Et(i,"one",s,n)}},any(...e){const{isTargetingSelf:t,target:i,type:s,listener:r}=wt(this,e,"any");if(t)Et(i,"any",s,r);else{const n=(...e)=>{this.off(i,s,n),r.apply(null,e)};n.guid=r.guid,Et(i,"any",s,n)}},off(e,t,i){!e||vt(e)?p(this.eventBusEl_,e,t):(e=e,t=t,bt(e,this,"off"),Tt(t,this,"off"),St(i,this,"off"),i=m(this,i),this.off("dispose",i),e.nodeName?(p(e,t,i),p(e,"dispose",i)):_t(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){bt(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(vt(i))return lt(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${yt(this)}#trigger; `+"must be a non-empty string or object with a type key that has a non-empty value.")}};function Ct(e,t={}){t=t.eventBusKey;if(t){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=o("span",{className:"vjs-event-bus"});Object.assign(e,kt),e.eventedCallbacks&&e.eventedCallbacks.forEach(e=>{e()}),e.on("dispose",()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&c.has(e)&&c.delete(e)}),window.setTimeout(()=>{e.eventBusEl_=null},0)})}const It={state:{},setState(e){"function"==typeof e&&(e=e());let i;return z(e,(e,t)=>{this.state[t]!==e&&((i=i||{})[t]={from:this.state[t],to:e}),this.state[t]=e}),i&&_t(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function xt(e,t){Object.assign(e,It),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&_t(e)&&e.on("statechanged",e.handleStateChanged)}function At(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toLowerCase())}function g(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}function Pt(e,t){return g(e)===g(t)}var Lt=Object.freeze({__proto__:null,toLowerCase:At,toTitleCase:g,titleCaseEquals:Pt}),Ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Dt(e,t){return e(t={exports:{}},t.exports),t.exports}var r=Dt(function(e,t){function i(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),s[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}i.isEventKey=function(e,t){if(e&&"object"==typeof e){e=e.which||e.keyCode||e.charCode;if(null!=e)if("string"==typeof t){var i=s[t.toLowerCase()];if(i)return i===e;if(i=r[t.toLowerCase()])return i===e}else if("number"==typeof t)return t===e;return!1}};for(var s=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},n=97;n<123;n++)s[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)s[n-48]=n;for(n=1;n<13;n++)s["f"+n]=n+111;for(n=0;n<10;n++)s["numpad "+n]=n+96;var a,o=t.names=t.title={};for(n in s)o[s[n]]=n;for(a in r)s[a]=r[a]});r.code,r.codes,r.aliases,r.names,r.title;class f{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=h({},this.options_),t=this.options_=h(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+tt++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(e=>this.addClass(e)),["on","off","one","any","trigger"].forEach(e=>{this[e]=void 0}),!1!==t.evented&&(Ct(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),xt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=h(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return o(e,t,i)}localize(e,s,t=e){var i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),n=r&&r[i],i=i&&i.split("-")[0],r=r&&r[i];let a=t;return n&&n[e]?a=n[e]:r&&r[e]&&(a=r[e]),a=s?a.replace(/\{(\d+)\}/g,function(e,t){t=s[t-1];let i="undefined"==typeof t?e:t;return i}):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...t){t=t.reduce((e,t)=>e.concat(t),[]);let i=this;for(let e=0;e<t.length;e++)if(!(i=i.getChild(t[e]))||!i.getChild)return;return i}addChild(e,t={},i=this.children_.length){let s,r;if("string"==typeof e){r=g(e);var n=t.componentClass||r,a=(t.name=r,f.getComponent(n));if(!a)throw new Error(`Component ${n} does not exist`);if("function"!=typeof a)return null;s=new a(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(i,0,s),s.parentComponent_=this,"function"==typeof s.id&&(this.childIndex_[s.id()]=s),(r=r||s.name&&g(s.name()))&&(this.childNameIndex_[r]=s,this.childNameIndex_[At(r)]=s),"function"==typeof s.el&&s.el()){let e=null;this.children_[i+1]&&(this.children_[i+1].el_?e=this.children_[i+1].el_:ve(this.children_[i+1])&&(e=this.children_[i+1])),this.contentEl().insertBefore(s.el(),e)}return s}removeChild(i){if((i="string"==typeof i?this.getChild(i):i)&&this.children_){let t=!1;for(let e=this.children_.length-1;0<=e;e--)if(this.children_[e]===i){t=!0,this.children_.splice(e,1);break}var e;t&&(i.parentComponent_=null,this.childIndex_[i.id()]=null,this.childNameIndex_[g(i.name())]=null,this.childNameIndex_[At(i.name())]=null,e=i.el())&&e.parentNode===this.contentEl()&&this.contentEl().removeChild(i.el())}}initChildren(){const s=this.options_.children;if(s){const r=this.options_;let e;const t=f.getComponent("Tech");(e=Array.isArray(s)?s:Object.keys(s)).concat(Object.keys(this.options_).filter(function(t){return!e.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(e=>{let t,i;return i="string"==typeof e?(t=e,s[t]||this.options_[t]||{}):(t=e.name,e),{name:t,opts:i}}).filter(e=>{e=f.getComponent(e.opts.componentClass||g(e.name));return e&&!t.isTech(e)}).forEach(e=>{var t=e.name;let i=e.opts;!1!==(i=void 0!==r[t]?r[t]:i)&&((i=!0===i?{}:i).playerOptions=this.options_.playerOptions,e=this.addChild(t,i))&&(this[t]=e)})}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0<e.length&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)}$(e,t){return $e(e,t||this.contentEl())}$$(e,t){return We(e,t||this.contentEl())}hasClass(e){return Ee(this.el_,e)}addClass(...e){ke(this.el_,...e)}removeClass(...e){Ce(this.el_,...e)}toggleClass(e,t){Ie(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return Pe(this.el_,e)}setAttribute(e,t){Le(this.el_,e,t)}removeAttribute(e){Oe(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){var s,r;if(void 0===t)return this.el_?-1!==(r=(s=this.el_.style[e]).indexOf("px"))?parseInt(s.slice(0,r),10):parseInt(this.el_["offset"+g(e)],10):0;-1!==(""+(t=null!==t&&t==t?t:0)).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",i||this.trigger("componentresize")}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");return t=Ge(this.el_,e),0!==(t=parseFloat(t))&&!isNaN(t)||(e="offset"+g(e),t=this.el_[e]),t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(r.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let t=0,i=null;let s;this.on("touchstart",function(e){1===e.touches.length&&(i={pageX:e.touches[0].pageX,pageY:e.touches[0].pageY},t=window.performance.now(),s=!0)}),this.on("touchmove",function(e){var t;(1<e.touches.length||i&&(t=e.touches[0].pageX-i.pageX,e=e.touches[0].pageY-i.pageY,10<Math.sqrt(t*t+e*e)))&&(s=!1)});function e(){s=!1}this.on("touchleave",e),this.on("touchcancel",e),this.on("touchend",function(e){!(i=null)===s&&window.performance.now()-t<200&&(e.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(this.player()&&this.player().reportUserActivity){const i=m(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){i(),this.clearInterval(t),t=this.setInterval(i,250)});var e=function(e){i(),this.clearInterval(t)};this.on("touchmove",i),this.on("touchend",e),this.on("touchcancel",e)}}setTimeout(e,t){var i;return e=m(this,e),this.clearTimersOnDispose_(),i=window.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){e=m(this,e),this.clearTimersOnDispose_();e=window.setInterval(e,t);return this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=m(this,e),t=window.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var i;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=m(this,t),i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}),this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,i])=>{this[e].forEach((e,t)=>this[i](t))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(t,e){if("string"!=typeof t||!t)throw new Error(`Illegal component name, "${t}"; must be a non-empty string.`);var i=f.getComponent("Tech"),i=i&&i.isTech(e),s=f===e||f.prototype.isPrototypeOf(e.prototype);if(i||!s){let e;throw e=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${t}"; ${e}.`)}t=g(t),f.components_||(f.components_={});s=f.getComponent("Player");if("Player"===t&&s&&s.players){const r=s.players;i=Object.keys(r);if(r&&0<i.length&&i.map(e=>r[e]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return f.components_[t]=e,f.components_[At(t)]=e}static getComponent(e){if(e&&f.components_)return f.components_[e]}}function Nt(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n<r)throw new Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${r}) is non-numeric or out of bounds (0-${n}).`);return i[s][t]}function Mt(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Nt.bind(null,"start",0,e),end:Nt.bind(null,"end",1,e)},window.Symbol&&window.Symbol.iterator&&(t[window.Symbol.iterator]=()=>(e||[]).values()),t}function Rt(e,t){return Array.isArray(e)?Mt(e):void 0===e||void 0===t?Mt():Mt([[e,t]])}f.registerComponent("Component",f);function Ut(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60),t=Math.floor(t/3600);return r=0<(r=!isNaN(e)&&e!==1/0?r:s=i="-")||0<t?r+":":"",s=((r||10<=n)&&s<10?"0"+s:s)+":",i=i<10?"0"+i:i,r+s+i}let Bt=Ut;function Ft(e){Bt=e}function jt(){Bt=Ut}function Ht(e,t=e){return Bt(e,t)}var qt=Object.freeze({__proto__:null,createTimeRanges:Rt,createTimeRange:Rt,setFormatTime:Ft,resetFormatTime:jt,formatTime:Ht});function Vt(t,i){let s=0;var r;let n;if(!i)return 0;t&&t.length||(t=Rt(0,0));for(let e=0;e<t.length;e++)r=t.start(e),(n=t.end(e))>i&&(n=i),s+=n-r;return s/i}function i(e){if(e instanceof i)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:K(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=i.defaultMessages[this.code]||"")}i.prototype.code=0,i.prototype.message="",i.prototype.status=null,i.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],i.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e<i.errorTypes.length;e++)i[i.errorTypes[e]]=e,i.prototype[i.errorTypes[e]]=e;var $t=function(e,t){var i,s=null;try{i=JSON.parse(e,t)}catch(e){s=e}return[s,i]};function Wt(e){return null!=e&&"function"==typeof e.then}function Gt(e){Wt(e)&&e.then(null,e=>{})}function zt(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,i)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Xt=function(e){var t=e.$$("track");const i=Array.prototype.map.call(t,e=>e.track);return Array.prototype.map.call(t,function(e){var t=zt(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===i.indexOf(e)}).map(zt))},Kt=function(e,i){return e.forEach(function(e){const t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(e=>t.addCue(e))}),i.textTracks()};zt;const Yt="vjs-modal-dialog";class Qt extends f{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=o("div",{className:Yt+"-content"},{role:"document"}),this.descEl_=o("p",{className:Yt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),Se(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Yt+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(t){if("boolean"==typeof t){var i,t=this.closeable_=!!t;let e=this.getChild("closeButton");t&&!e&&(i=this.contentEl_,this.contentEl_=this.el_,e=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(e,"close",this.close_)),!t&&e&&(this.off(e,"close",this.close_),this.removeChild(e),e.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,s=t.nextSibling,e=(this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),qe(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),this.getChild("closeButton"));e&&i.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),Fe(this.contentEl()),this.trigger("modalempty")}content(e){return"undefined"!=typeof e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),r.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(r.isEventKey(e,"Tab")){var i=this.focusableEls_(),s=this.el_.querySelector(":focus");let t;for(let e=0;e<i.length;e++)if(s===i[e]){t=e;break}document.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||t!==i.length-1||(i[0].focus(),e.preventDefault())}}focusableEls_(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,e=>(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable"))}}Qt.prototype.options_={pauseOnOpen:!0,temporary:!0},f.registerComponent("ModalDialog",Qt);class Jt extends ft{constructor(t=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let e=0;e<t.length;e++)this.addTrack(t[e])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},_t(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(i){let s;for(let e=0,t=this.length;e<t;e++)if(this[e]===i){(s=this[e]).off&&s.off(),this.tracks_.splice(e,1);break}s&&this.trigger({track:s,type:"removetrack",target:this})}getTrackById(i){let s=null;for(let e=0,t=this.length;e<t;e++){var r=this[e];if(r.id===i){s=r;break}}return s}}for(const Nu in Jt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"})Jt.prototype["on"+Nu]=null;function Zt(t,i){for(let e=0;e<t.length;e++)Object.keys(t[e]).length&&i.id!==t[e].id&&(t[e].enabled=!1)}function ei(t,i){for(let e=0;e<t.length;e++)Object.keys(t[e]).length&&i.id!==t[e].id&&(t[e].selected=!1)}class ti extends Jt{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class ii{constructor(e){ii.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;this.cues_=e,this.length_=e.length;if(t<r)for(i=t;i<r;i++)s.call(this,i)}getCueById(i){let s=null;for(let e=0,t=this.length;e<t;e++){var r=this[e];if(r.id===i){s=r;break}}return s}}const si={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},ri={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},ni={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},ai={disabled:"disabled",hidden:"hidden",showing:"showing"};class oi extends ft{constructor(e={}){super();const t={id:e.id||"vjs_track_"+tt++,kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const s in t)Object.defineProperty(this,s,{get(){return t[s]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}function li(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=document.createElement("a"),s=(i.href=e,{});for(let e=0;e<t.length;e++)s[t[e]]=i[t[e]];return"http:"===s.protocol&&(s.host=s.host.replace(/:80$/,"")),"https:"===s.protocol&&(s.host=s.host.replace(/:443$/,"")),s.protocol||(s.protocol=window.location.protocol),s.host||(s.host=window.location.host),s}function di(e){var t;return e.match(/^https?:\/\//)||((t=document.createElement("a")).href=e,e=t.href),e}function hi(e,t=window.location){return(":"===(e=li(e)).protocol?t:e).protocol+e.host!==t.protocol+t.host}const ui=function(e){if("string"==typeof e){e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(e)return e.pop().toLowerCase()}return""};var ci=Object.freeze({__proto__:null,parseUrl:li,getAbsoluteURL:di,getFileExtension:ui,isCrossOrigin:hi}),pi="undefined"!=typeof window?window:"undefined"!=typeof Ot?Ot:"undefined"!=typeof self?self:{},mi=pi,gi=Dt(function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,s=arguments[t];for(i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}),fi=(pi=gi)&&pi.__esModule&&Object.prototype.hasOwnProperty.call(pi,"default")?pi.default:pi,yi=function(e){var t;return!!e&&("[object Function]"===(t=_i.call(e))||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt))},_i=Object.prototype.toString;ki.httpHandler=function(s,r){return void 0===r&&(r=!1),function(e,t,i){if(e)s(e);else if(400<=t.statusCode&&t.statusCode<=599){e=i;if(r)if(mi.TextDecoder){t=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce(function(e,t){var t=t.split("="),i=t[0],t=t[1];return"charset"===i.trim()?t.trim():e},"utf-8")}(t.headers&&t.headers["content-type"]);try{e=new TextDecoder(t).decode(i)}catch(e){}}else e=String.fromCharCode.apply(null,new Uint8Array(i));s({cause:e})}else s(null,i)}};for(var vi=function(e){var s={};return e&&e.trim().split("\n").forEach(function(e){var t=e.indexOf(":"),i=e.slice(0,t).trim().toLowerCase(),e=e.slice(t+1).trim();"undefined"==typeof s[i]?s[i]=e:Array.isArray(s[i])?s[i].push(e):s[i]=[s[i],e]}),s},bi=ki,pi=ki,Ti=(ki.XMLHttpRequest=mi.XMLHttpRequest||function(){},ki.XDomainRequest="withCredentials"in new ki.XMLHttpRequest?ki.XMLHttpRequest:mi.XDomainRequest,["get","put","post","patch","head","delete"]),Si=function(s){ki["delete"===s?"del":s]=function(e,t,i){return(t=Ei(e,t,i)).method=s.toUpperCase(),Ci(t)}},wi=0;wi<Ti.length;wi++)Si(Ti[wi]);function Ei(e,t,i){var s=e;return yi(t)?(i=t,"string"==typeof e&&(s={uri:e})):s=gi({},t,{uri:e}),s.callback=i,s}function ki(e,t,i){return Ci(t=Ei(e,t,i))}function Ci(s){if("undefined"==typeof s.callback)throw new Error("callback argument missing");var r=!1,n=function(e,t,i){r||(r=!0,s.callback(e,t,i))};function a(){var e=void 0,e=d.response||d.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(d);if(g)try{e=JSON.parse(e)}catch(e){}return e}function t(e){return clearTimeout(l),(e=e instanceof Error?e:new Error(""+(e||"Unknown XMLHttpRequest Error"))).statusCode=0,n(e,f)}function e(){var e,t,i;if(!o)return clearTimeout(l),e=s.useXDR&&void 0===d.status?200:1223===d.status?204:d.status,t=f,i=null,0!==e?(t={body:a(),statusCode:e,method:u,headers:{},url:h,rawRequest:d},d.getAllResponseHeaders&&(t.headers=vi(d.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),n(i,t,t.body)}var i,o,l,d=s.xhr||null,h=(d=d||new(s.cors||s.useXDR?ki.XDomainRequest:ki.XMLHttpRequest)).url=s.uri||s.url,u=d.method=s.method||"GET",c=s.body||s.data,p=d.headers=s.headers||{},m=!!s.sync,g=!1,f={body:void 0,headers:{},statusCode:0,method:u,url:h,rawRequest:d};if("json"in s&&!1!==s.json&&(g=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==u)&&"HEAD"!==u&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),c=JSON.stringify(!0===s.json?c:s.json)),d.onreadystatechange=function(){4===d.readyState&&setTimeout(e,0)},d.onload=e,d.onerror=t,d.onprogress=function(){},d.onabort=function(){o=!0},d.ontimeout=t,d.open(u,h,!m,s.username,s.password),m||(d.withCredentials=!!s.withCredentials),!m&&0<s.timeout&&(l=setTimeout(function(){var e;o||(o=!0,d.abort("timeout"),(e=new Error("XMLHttpRequest timeout")).code="ETIMEDOUT",t(e))},s.timeout)),d.setRequestHeader)for(i in p)p.hasOwnProperty(i)&&d.setRequestHeader(i,p[i]);else if(s.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return;return 1}(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(d.responseType=s.responseType),"beforeSend"in s&&"function"==typeof s.beforeSend&&s.beforeSend(d),d.send(c||null),d}bi.default=pi;function Ii(e,t){var i=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder());const s=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){s.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),0<s.length&&(window.console&&window.console.groupCollapsed&&window.console.groupCollapsed("Text Track parsing errors for "+t.src),s.forEach(e=>d.error(e)),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function xi(e,s){var t={uri:e};(e=hi(e))&&(t.cors=e),(e="use-credentials"===s.tech_.crossOrigin())&&(t.withCredentials=e),bi(t,m(this,function(e,t,i){if(e)return d.error(e,t);s.loaded_=!0,"function"!=typeof window.WebVTT?s.tech_&&s.tech_.any(["vttjsloaded","vttjserror"],e=>{if("vttjserror"!==e.type)return Ii(i,s);d.error("vttjs failed to load, stopping trying to process "+s.src)}):Ii(i,s)}))}class Ai extends oi{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=h(e,{kind:ni[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=ai[e.mode]||"disabled";const i=e.default,s=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new ii(this.cues_)),n=new ii(this.activeCues_);let a=!1;this.timeupdateHandler=m(this,function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,a)&&(this.trigger("cuechange"),a=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});this.tech_.one("dispose",()=>{this.stopTracking()}),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get(){return i},set(){}},mode:{get(){return t},set(e){ai[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||xi(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var i=this.tech_.currentTime(),s=[];for(let e=0,t=this.cues.length;e<t;e++){var r=this.cues[e];r.startTime<=i&&r.endTime>=i&&s.push(r)}if(a=!1,s.length!==this.activeCues_.length)a=!0;else for(let e=0;e<s.length;e++)-1===this.activeCues_.indexOf(s[e])&&(a=!0);this.activeCues_=s,n.setCues_(this.activeCues_)}return n},set(){}}}),e.src?(this.src=e.src,this.preload_||(this.loaded_=!0),(this.preload_||"subtitles"!==e.kind&&"captions"!==e.kind)&&xi(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(window.vttjs&&!(e instanceof window.vttjs.VTTCue)){t=new window.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const s in e)s in t||(t[s]=e[s]);t.id=e.id,t.originalCue_=e}var i=this.tech_.textTracks();for(let e=0;e<i.length;e++)i[e]!==this&&i[e].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}Ai.prototype.allowedEvents_={cuechange:"cuechange"};class Pi extends oi{constructor(e={}){e=h(e,{kind:ri[e.kind]||""});super(e);let t=!1;Object.defineProperty(this,"enabled",{get(){return t},set(e){"boolean"==typeof e&&e!==t&&(t=e,this.trigger("enabledchange"))}}),e.enabled&&(this.enabled=e.enabled),this.loaded_=!0}}class Li extends oi{constructor(e={}){e=h(e,{kind:si[e.kind]||""});super(e);let t=!1;Object.defineProperty(this,"selected",{get(){return t},set(e){"boolean"==typeof e&&e!==t&&(t=e,this.trigger("selectedchange"))}}),e.selected&&(this.selected=e.selected)}}class Oi extends ft{constructor(e={}){super();let t;const i=new Ai(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=Oi.NONE,i.addEventListener("loadeddata",()=>{t=Oi.LOADED,this.trigger({type:"load",target:this})})}}Oi.prototype.allowedEvents_={load:"load"},Oi.NONE=0,Oi.LOADING=1,Oi.LOADED=2,Oi.ERROR=3;const Di={audio:{ListClass:class extends Jt{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].enabled){Zt(t,t[e]);break}super(t),this.changing_=!1}addTrack(e){e.enabled&&Zt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Zt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:Pi,capitalName:"Audio"},video:{ListClass:class extends Jt{constructor(t=[]){for(let e=t.length-1;0<=e;e--)if(t[e].selected){ei(t,t[e]);break}super(t),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set(){}})}addTrack(e){e.selected&&ei(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,ei(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:Li,capitalName:"Video"},text:{ListClass:ti,TrackClass:Ai,capitalName:"Text"}},Ni=(Object.keys(Di).forEach(function(e){Di[e].getterName=e+"Tracks",Di[e].privateName=e+"Tracks_"}),{remoteText:{ListClass:ti,TrackClass:Ai,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(i=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let e=0,t=i.length;e<t;e++)this.addTrackElement_(i[e])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}getTrackElementByTrack_(i){let s;for(let e=0,t=this.trackElements_.length;e<t;e++)if(i===this.trackElements_[e].track){s=this.trackElements_[e];break}return s}removeTrackElement_(i){for(let e=0,t=this.trackElements_.length;e<t;e++)if(i===this.trackElements_[e]){this.trackElements_[e].track&&"function"==typeof this.trackElements_[e].track.off&&this.trackElements_[e].track.off(),"function"==typeof this.trackElements_[e].off&&this.trackElements_[e].off(),this.trackElements_.splice(e,1);break}}},TrackClass:Oi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}}),a=Object.assign({},Di,Ni);Ni.names=Object.keys(Ni),Di.names=Object.keys(Di),a.names=[].concat(Ni.names).concat(Di.names);var pi="undefined"!=typeof Ot?Ot:"undefined"!=typeof window?window:{},Mi="undefined"!=typeof document?document:(Mi=pi["__GLOBAL_DOCUMENT_CACHE@4"])||(pi["__GLOBAL_DOCUMENT_CACHE@4"]={}),Ot=Mi,Ri=Object.create||function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return Ui.prototype=e,new Ui};function Ui(){}function Bi(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function Fi(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+(0|s)/1e3}e=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return e?e[3]?t(e[1],e[2],e[3].replace(":",""),e[4]):59<e[1]?t(e[1],e[2],0,e[4]):t(0,e[1],e[2],e[4]):null}function ji(){this.values=Ri(null)}function Hi(e,t,i,s){var r,n,a=s?e.split(s):[e];for(r in a)"string"==typeof a[r]&&2===(n=a[r].split(i)).length&&t(n[0].trim(),n[1].trim())}((Bi.prototype=Ri(Error.prototype)).constructor=Bi).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},ji.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var s=0;s<i.length;++s)if(t===i[s]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(t=parseFloat(t))&&t<=100)&&(this.set(e,t),!0)}};var qi=Ot.createElement&&Ot.createElement("textarea"),Vi={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},$i={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},Wi={v:"title",lang:"lang"},Gi={rt:"ruby"};function zi(e,t){for(var i,s,r,n,a,o,l=e.document.createElement("div"),d=l,h=[];null!==(o=void 0,o=t?(o=(o=t.match(/^([^<]*)(<[^>]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?h.length&&h[h.length-1]===o.substr(2).replace(">","")&&(h.pop(),d=d.parentNode):(s=Fi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",s),d.appendChild(i)):(s=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=s[1],n=s[3],a=void 0,a=Vi[r],i=a?(a=e.document.createElement(a),(r=Wi[r])&&n&&(a[r]=n.trim()),a):null)&&(r=d,Gi[(n=i).localName]&&Gi[n.localName]!==r.localName||(s[2]&&((a=s[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;$i.hasOwnProperty(e)&&(e=$i[e],i.style[t?"background-color":"color"]=e)}),i.className=a.join(" ")),h.push(s[1]),d.appendChild(i),d=i)):d.appendChild(e.document.createTextNode((n=o,qi.innerHTML=n,n=qi.textContent,qi.textContent="",n)));return l}var Xi=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Ki(e){var t=[],i="";if(e&&e.childNodes)for(n(t,e);i=function e(t){var i,s,r;return t&&t.length?(s=(i=t.pop()).textContent||i.innerText)?(r=s.match(/^.*(\n|\r)/))?r[t.length=0]:s:"ruby"===i.tagName?e(t):i.childNodes?(n(t,i),e(t)):void 0:null}(t);)for(var s=0;s<i.length;s++)if(function(e){for(var t=0;t<Xi.length;t++){var i=Xi[t];if(e>=i[0]&&e<=i[1])return 1}}(i.charCodeAt(s)))return"rtl";return"ltr";function n(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function Yi(){}function Qi(e,t,i){Yi.call(this),this.cue=t,this.cueDiv=zi(e,t.text);var s={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},r=(this.applyStyles(s,this.cueDiv),this.div=e.document.createElement("div"),s={direction:Ki(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(s),this.div.appendChild(this.cueDiv),0);switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function y(e){var t,i,s,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,s=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||s,this.height=e.height||t,this.bottom=e.bottom||s+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function Ji(e,t,o,l){var i,s=new y(t),r=t.cue,n=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,s=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&s++;return-1*++s}(r),a=[];if(r.snapToLines){switch(r.vertical){case"":a=["+y","-y"],i="height";break;case"rl":a=["+x","-x"],i="width";break;case"lr":a=["-x","+x"],i="width"}var d=s.lineHeight,h=d*Math.round(n),u=o[i]+d,c=a[0];Math.abs(h)>u&&(h=h<0?-1:1,h*=Math.ceil(u/d)*d),n<0&&(h+=""===r.vertical?o.height:o.width,a=a.reverse()),s.move(c,h)}else{var p=s.lineHeight/o.height*100;switch(r.lineAlign){case"center":n-=p/2;break;case"end":n-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(n,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(n,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(n,"%")})}a=["+y","-x","+x","-y"],s=new y(t)}u=function(e,t){for(var i,s=new y(e),r=1,n=0;n<t.length;n++){for(;e.overlapsOppositeAxis(o,t[n])||e.within(o)&&e.overlapsAny(l);)e.move(t[n]);if(e.within(o))return e;var a=e.intersectPercentage(o);a<r&&(i=new y(e),r=a),e=new y(s)}return i||s}(s,a);t.move(u.toCSSCompatValues(o))}function Zi(){}Yi.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Yi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},(Qi.prototype=Ri(Yi.prototype)).constructor=Qi,y.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},y.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},y.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},y.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},y.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},y.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},y.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},y.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,s=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},Zi.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Zi.convertCueToDOMTree=function(e,t){return e&&t?zi(e,t):null};Zi.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return 1}(t))for(var r,n,a=[],o=y.getSimpleBoxPosition(s),l={font:Math.round(.05*o.height*100)/100+"px sans-serif"},d=0;d<t.length;d++)n=t[d],r=new Qi(e,n,l),s.appendChild(r.div),Ji(0,r,o,a),n.displayState=r.div,a.push(y.getSimpleBoxPosition(r));else for(var h=0;h<t.length;h++)s.appendChild(t[h].displayState)},(Zi.Parser=function(e,t,i){i||(i=t,t={}),t=t||{},this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]}).prototype={reportOrThrowError:function(e){if(!(e instanceof Bi))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var s=this;function t(){for(var e=s.buffer,t=0;t<e.length&&"\r"!==e[t]&&"\n"!==e[t];)++t;var i=e.substr(0,t);return"\r"===e[t]&&++t,"\n"===e[t]&&++t,s.buffer=e.substr(t),i}function i(e){e.match(/X-TIMESTAMP-MAP/)?Hi(e,function(e,t){var i;"X-TIMESTAMP-MAP"===e&&(e=t,i=new ji,Hi(e,function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",Fi(t))}},/[^\d]:/,/,/),s.ontimestampmap)&&s.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})},/=/):Hi(e,function(e,t){var r;"Region"===e&&(e=t,r=new ji,Hi(e,function(e,t){switch(e){case"id":r.set(e,t);break;case"width":r.percent(e,t);break;case"lines":r.integer(e,t);break;case"regionanchor":case"viewportanchor":var i,s=t.split(",");2===s.length&&((i=new ji).percent("x",s[0]),i.percent("y",s[1]),i.has("x")&&i.has("y"))&&(r.set(e+"X",i.get("x")),r.set(e+"Y",i.get("y")));break;case"scroll":r.alt(e,t,["up"])}},/=/,/\s/),r.has("id"))&&((e=new(s.vttjs.VTTRegion||s.window.VTTRegion)).width=r.get("width",100),e.lines=r.get("lines",3),e.regionAnchorX=r.get("regionanchorX",0),e.regionAnchorY=r.get("regionanchorY",100),e.viewportAnchorX=r.get("viewportanchorX",0),e.viewportAnchorY=r.get("viewportanchorY",100),e.scroll=r.get("scroll",""),s.onregion&&s.onregion(e),s.regionList.push({id:r.get("id"),region:e}))},/:/)}e&&(s.buffer+=s.decoder.decode(e,{stream:!0}));try{if("INITIAL"===s.state){if(!/\r\n|\n/.test(s.buffer))return this;var r,n=(r=t()).match(/^WEBVTT([ \t].*)?$/);if(!n||!n[0])throw new Bi(Bi.Errors.BadSignature);s.state="HEADER"}for(var a=!1;s.buffer;){if(!/\r\n|\n/.test(s.buffer))return this;switch(a?a=!1:r=t(),s.state){case"HEADER":/:/.test(r)?i(r):r||(s.state="ID");continue;case"NOTE":r||(s.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){s.state="NOTE";break}if(!r)continue;s.cue=new(s.vttjs.VTTCue||s.window.VTTCue)(0,0,"");try{s.cue.align="center"}catch(e){s.cue.align="middle"}if(s.state="CUE",-1===r.indexOf("--\x3e")){s.cue.id=r;continue}case"CUE":try{!function(t,i,n){var s=t;function e(){var e=Fi(t);if(null===e)throw new Bi(Bi.Errors.BadTimeStamp,"Malformed timestamp: "+s);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function r(){t=t.replace(/^\s+/,"")}if(r(),i.startTime=e(),r(),"--\x3e"!==t.substr(0,3))throw new Bi(Bi.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);t=t.substr(3),r(),i.endTime=e(),r();var a=t,o=new ji;Hi(a,function(e,t){switch(e){case"region":for(var i=n.length-1;0<=i;i--)if(n[i].id===t){o.set(e,n[i].region);break}break;case"vertical":o.alt(e,t,["rl","lr"]);break;case"line":var s=t.split(","),r=s[0];o.integer(e,r),o.percent(e,r)&&o.set("snapToLines",!1),o.alt(e,r,["auto"]),2===s.length&&o.alt("lineAlign",s[1],["start","center","end"]);break;case"position":s=t.split(","),o.percent(e,s[0]),2===s.length&&o.alt("positionAlign",s[1],["start","center","end"]);break;case"size":o.percent(e,t);break;case"align":o.alt(e,t,["start","center","end","left","right"])}},/:/,/\s/),i.region=o.get("region",null),i.vertical=o.get("vertical","");try{i.line=o.get("line","auto")}catch(e){}i.lineAlign=o.get("lineAlign","start"),i.snapToLines=o.get("snapToLines",!0),i.size=o.get("size",100);try{i.align=o.get("align","center")}catch(e){i.align=o.get("align","middle")}try{i.position=o.get("position","auto")}catch(e){i.position=o.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},i.align)}i.positionAlign=o.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},i.align)}(r,s.cue,s.regionList)}catch(e){s.reportOrThrowError(e),s.cue=null,s.state="BADCUE";continue}s.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){s.oncue&&s.oncue(s.cue),s.cue=null,s.state="ID";continue}s.cue.text&&(s.cue.text+="\n"),s.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(s.state="ID");continue}}}catch(e){s.reportOrThrowError(e),"CUETEXT"===s.state&&s.cue&&s.oncue&&s.oncue(s.cue),s.cue=null,s.state="INITIAL"===s.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var t=this;try{if(t.buffer+=t.decoder.decode(),!t.cue&&"HEADER"!==t.state||(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state)throw new Bi(Bi.Errors.BadSignature)}catch(e){t.reportOrThrowError(e)}return t.onflush&&t.onflush(),this}};var es=Zi,ts={"":1,lr:1,rl:1},is={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function ss(e){return"string"==typeof e&&!!is[e.toLowerCase()]&&e.toLowerCase()}function rs(e,t,i){this.hasBeenReset=!1;var s="",r=!1,n=e,a=t,o=i,l=null,d="",h=!0,u="auto",c="start",p="auto",m="auto",g=100,f="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return s},set:function(e){s=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return n},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");n=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");a=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(e){l=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return d},set:function(e){e="string"==typeof(e=e)&&!!ts[e.toLowerCase()]&&e.toLowerCase();if(!1===e)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");d=e,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return h},set:function(e){h=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");u=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){e=ss(e);e&&(c=e,this.hasBeenReset=!0)}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||100<e)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return m},set:function(e){e=ss(e);e&&(m=e,this.hasBeenReset=!0)}},size:{enumerable:!0,get:function(){return g},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");g=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return f},set:function(e){e=ss(e);if(!e)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");f=e,this.hasBeenReset=!0}}}),this.displayState=void 0}rs.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var ns=rs,as={"":!0,up:!0};function os(e){return"number"==typeof e&&0<=e&&e<=100}function ls(){var t=100,i=3,s=0,r=100,n=0,a=100,o="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(e){if(!os(e))throw new Error("Width must be between 0 and 100.");t=e}},lines:{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");i=e}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(e){if(!os(e))throw new Error("RegionAnchorX must be between 0 and 100.");r=e}},regionAnchorX:{enumerable:!0,get:function(){return s},set:function(e){if(!os(e))throw new Error("RegionAnchorY must be between 0 and 100.");s=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!os(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!os(e))throw new Error("ViewportAnchorX must be between 0 and 100.");n=e}},scroll:{enumerable:!0,get:function(){return o},set:function(e){e="string"==typeof(e=e)&&!!as[e.toLowerCase()]&&e.toLowerCase();!1!==e&&(o=e)}}})}var ds=Dt(function(e){var e=e.exports={WebVTT:es,VTTCue:ns,VTTRegion:ls},t=(mi.vttjs=e,mi.WebVTT=e.WebVTT,e.VTTCue),i=e.VTTRegion,s=mi.VTTCue,r=mi.VTTRegion;e.shim=function(){mi.VTTCue=t,mi.VTTRegion=i},e.restore=function(){mi.VTTCue=s,mi.VTTRegion=r},mi.VTTCue||e.shim()});ds.WebVTT,ds.VTTCue,ds.VTTRegion;class _ extends f{constructor(t={},e=function(){}){t.reportTouchActivity=!1,super(null,t,e),this.onDurationChange_=e=>this.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),a.names.forEach(e=>{e=a[e];t&&t[e.getterName]&&(this[e.privateName]=t[e.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(e=>{!1===t[`native${e}Tracks`]&&(this[`featuresNative${e}Tracks`]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==t.preloadTextTracks,this.autoRemoteTextTracks_=new a.text.ListClass,this.initTrackListeners(),t.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(m(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Rt(0,0)}bufferedPercent(){return Vt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Di.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach(e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}})}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new i(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Rt(0,0):Rt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Di.names.forEach(e=>{var t=Di[e];const i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&Y(ds)&&0<Object.keys(ds).length)this.trigger("vttjsloaded");else{const e=document.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const i=this.textTracks(),e=this.remoteTextTracks(),t=e=>i.addTrack(e.track),s=e=>i.removeTrack(e.track),r=(e.on("addtrack",t),e.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let e=0;e<i.length;e++){var t=i[e];t.removeEventListener("cuechange",r),"showing"===t.mode&&t.addEventListener("cuechange",r)}};n(),i.addEventListener("change",n),i.addEventListener("addtrack",n),i.addEventListener("removetrack",n),this.on("dispose",function(){e.off("addtrack",t),e.off("removetrack",s),i.removeEventListener("change",n),i.removeEventListener("addtrack",n),i.removeEventListener("removetrack",n);for(let e=0;e<i.length;e++)i[e].removeEventListener("cuechange",r)})}addTextTrack(e,t,i){if(e)return e=e,t=t,i=i,r={},n=(s=this).textTracks(),r.kind=e,t&&(r.label=t),i&&(r.language=i),r.tech=s,e=new a.text.TrackClass(r),n.addTrack(e),e;throw new Error("TextTrack kind is required but was not provided");var s,r,n}createRemoteTextTrack(e){e=h(e,{tech:this});return new Ni.remoteTextEl.TrackClass(e)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return"boolean"!=typeof t&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!1===t&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=tt++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return _.canPlayType(e.type)}static isTech(e){return e.prototype instanceof _||e instanceof _||e===_}static registerTech(e,t){if(_.techs_||(_.techs_={}),!_.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!_.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(_.canPlaySource)return e=g(e),_.techs_[e]=t,_.techs_[At(e)]=t,"Tech"!==e&&_.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return _.techs_&&_.techs_[e]?_.techs_[e]:(e=g(e),window&&window.videojs&&window.videojs[e]?(d.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}a.names.forEach(function(e){const t=a[e];_.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),_.prototype.featuresVolumeControl=!0,_.prototype.featuresMuteControl=!0,_.prototype.featuresFullscreenResize=!1,_.prototype.featuresPlaybackRate=!1,_.prototype.featuresProgressEvents=!1,_.prototype.featuresSourceset=!1,_.prototype.featuresTimeupdateEvents=!1,_.prototype.featuresNativeTextTracks=!1,_.prototype.featuresVideoFrameCallback=!1,_.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){let i=r.sourceHandlers;i=i||(r.sourceHandlers=[]),void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(t){var i,s=r.sourceHandlers||[];for(let e=0;e<s.length;e++)if(i=s[e].canPlayType(t))return i;return""},r.selectSourceHandler=function(t,i){var s=r.sourceHandlers||[];for(let e=0;e<s.length;e++)if(s[e].canHandleSource(t,i))return s[e];return null},r.canPlaySource=function(e,t){var i=r.selectSourceHandler(e,t);return i?i.canHandleSource(e,t):""};["seekable","seeking","duration"].forEach(function(e){const t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},r.prototype),r.prototype.setSource=function(e){let t=r.selectSourceHandler(e,this.options_);t||(r.nativeSourceHandler?t=r.nativeSourceHandler:d.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==r.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},r.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},f.registerComponent("Tech",_),_.registerTech("Tech",_),_.defaultTechOrder_=[];const hs={},us={},cs={};function ps(e,t,i){e.setTimeout(()=>function i(s={},e=[],r,n,a=[],o=!1){const[t,...l]=e;if("string"==typeof t)i(s,hs[t],r,n,a,o);else if(t){const d=vs(n,t);if(!d.setSource)return a.push(d),i(s,l,r,n,a,o);d.setSource(Object.assign({},s),function(e,t){if(e)return i(s,l,r,n,a,o);a.push(d),i(t,s.type===t.type?l:hs[t.type],r,n,a,o)})}else l.length?i(s,l,r,n,a,o):o?r(s,a):i(s,hs["*"],r,n,a,!0)}(t,hs[t.type],i,e),1)}function ms(e,t,i,s=null){var r="call"+g(i),r=e.reduce(_s(r),s),s=r===cs,t=s?null:t[i](r),n=e,a=i,o=t,l=s;for(let e=n.length-1;0<=e;e--){var d=n[e];d[a]&&d[a](l,o)}return t}const gs={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},fs={setCurrentTime:1,setMuted:1,setVolume:1},ys={play:1,pause:1};function _s(i){return(e,t)=>e===cs?cs:t[i]?t[i](e):e}function vs(e,t){var i=us[e.id()];let s=null;if(null==i)s=t(e),us[e.id()]=[[t,s]];else{for(let e=0;e<i.length;e++){var[r,n]=i[e];r===t&&(s=n)}null===s&&(s=t(e),i.push([t,s]))}return s}function bs(e){if(Array.isArray(e)){let t=[];e.forEach(function(e){e=bs(e),Array.isArray(e)?t=t.concat(e):K(e)&&t.push(e)}),e=t}else e="string"==typeof e&&e.trim()?[ws({src:e})]:K(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[ws(e)]:[];return e}const Ts={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Ss=function(e=""){e=ui(e);return Ts[e.toLowerCase()]||""};function ws(e){var t;return e.type||(t=Ss(e.src))&&(e.type=t),e}class Es extends f{constructor(s,e,t){if(super(s,h({createEl:!1},e),t),e.playerOptions.sources&&0!==e.playerOptions.sources.length)s.src(e.playerOptions.sources);else for(let t=0,i=e.playerOptions.techOrder;t<i.length;t++){var r=g(i[t]);let e=_.getTech(r);if((e=r?e:f.getComponent(r))&&e.isSupported()){s.loadTech_(r);break}}}}f.registerComponent("MediaLoader",Es);class ks extends f{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=e=>this.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&d.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;e=o(e,t,i);return e.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=o("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Se(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),"undefined"!=typeof this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),"undefined"!=typeof this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}f.registerComponent("ClickableComponent",ks);class Cs extends ks{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return o("div",{className:"vjs-poster"})}crossOrigin(e){if("undefined"==typeof e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(o("picture",{className:"vjs-poster",tabIndex:-1},{},o("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Gt(this.player_.play()):this.player_.pause())}}Cs.prototype.crossorigin=Cs.prototype.crossOrigin,f.registerComponent("PosterImage",Cs);const Is={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function xs(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function As(e,t,i){try{e.style[t]=i}catch(e){}}class Ps extends f{constructor(s,e,t){super(s,e,t);const r=e=>this.updateDisplay(e);s.on("loadstart",e=>this.toggleDisplay(e)),s.on("texttrackchange",r),s.on("loadedmetadata",e=>this.preselectTrack(e)),s.ready(m(this,function(){if(s.tech_&&s.tech_.featuresNativeTextTracks)this.hide();else{s.on("fullscreenchange",r),s.on("playerresize",r);const e=window.screen.orientation||window,i=window.screen.orientation?"change":"orientationchange";e.addEventListener(i,r),s.on("dispose",()=>e.removeEventListener(i,r));var t=this.options_.playerOptions.tracks||[];for(let e=0;e<t.length;e++)this.player_.addRemoteTextTrack(t[e],!0);this.preselectTrack()}}))}preselectTrack(){var t={captions:1,subtitles:1},i=this.player_.textTracks(),s=this.player_.cache_.selectedLanguage;let r,n,a;for(let e=0;e<i.length;e++){var o=i[e];s&&s.enabled&&s.language&&s.language===o.language&&o.kind in t?a=o.kind!==s.kind&&a||o:s&&!s.enabled?(a=null,r=null,n=null):o.default&&("descriptions"!==o.kind||r?o.kind in t&&!n&&(n=o):r=o)}a?a.mode="showing":n?n.mode="showing":r&&(r.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){"function"==typeof window.WebVTT&&window.WebVTT.processCues(window,[],this.el_)}updateDisplay(){var s=this.player_.textTracks(),e=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),e){var t=[];for(let e=0;e<s.length;++e){var i=s[e];"showing"===i.mode&&t.push(i)}this.updateForTrack(t)}else{let e=null,t=null,i=s.length;for(;i--;){var r=s[i];"showing"===r.mode&&("descriptions"===r.kind?e=r:t=r)}t?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(t)):e&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(e))}}updateDisplayState(e){var t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let s=i.length;for(;s--;){var r,n=i[s];n&&(n=n.displayState,t.color&&(n.firstChild.style.color=t.color),t.textOpacity&&As(n.firstChild,"color",xs(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(n.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&As(n.firstChild,"backgroundColor",xs(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?As(n,"backgroundColor",xs(t.windowColor,t.windowOpacity)):n.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?n.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===t.edgeStyle?n.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===t.edgeStyle?n.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===t.edgeStyle&&(n.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),t.fontPercent&&1!==t.fontPercent&&(r=window.parseFloat(n.style.fontSize),n.style.fontSize=r*t.fontPercent+"px",n.style.height="auto",n.style.top="auto"),t.fontFamily)&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?n.firstChild.style.fontVariant="small-caps":n.firstChild.style.fontFamily=Is[t.fontFamily])}}updateForTrack(i){if(Array.isArray(i)||(i=[i]),"function"==typeof window.WebVTT&&!i.every(e=>!e.activeCues)){var t=[];for(let e=0;e<i.length;++e){var s=i[e];for(let e=0;e<s.activeCues.length;++e)t.push(s.activeCues[e])}window.WebVTT.processCues(window,t,this.el_);for(let t=0;t<i.length;++t){var r=i[t];for(let e=0;e<r.activeCues.length;++e){var n=r.activeCues[e].displayState;ke(n,"vjs-text-track-cue","vjs-text-track-cue-"+(r.language||t)),r.language&&Le(n,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}}f.registerComponent("TextTrackDisplay",Ps);class Ls extends f{createEl(){var e=this.player_.isAudio(),e=this.localize(e?"Audio Player":"Video Player"),e=o("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[e])}),t=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return t.appendChild(e),t}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}f.registerComponent("LoadingSpinner",Ls);class s extends ks{createEl(e,t={},i={}){t=o("button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i));return t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(t),t}addChild(e,t={}){var i=this.constructor.name;return d.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),f.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?e.stopPropagation():super.handleKeyDown(e)}}f.registerComponent("Button",s);class Os extends s{constructor(e,t){super(e,t),this.mouseused_=!1,this.on("mousedown",e=>this.handleMouseDown(e))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)Gt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{var e=this.player_.getChild("controlBar");const i=e&&e.getChild("playToggle");i?(e=()=>i.focus(),Wt(t)?t.then(e,()=>{}):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Os.prototype.controlText_="Play Video",f.registerComponent("BigPlayButton",Os);s;f.registerComponent("CloseButton",class extends s{constructor(e,t){super(e,t),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){r.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class Ds extends s{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.on(e,"play",e=>this.handlePlay(e)),this.on(e,"pause",e=>this.handlePause(e)),t.replay&&this.on(e,"ended",e=>this.handleEnded(e))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?Gt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",e=>this.handleSeeked(e))}}Ds.prototype.controlText_="Play",f.registerComponent("PlayToggle",Ds);class Ns extends f{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],e=>this.updateContent(e)),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=o("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=o("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Ht(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,d.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}}))}updateContent(e){}}Ns.prototype.labelText_="Time",Ns.prototype.controlText_="Time",f.registerComponent("TimeDisplay",Ns);class Ms extends Ns{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Ms.prototype.labelText_="Current Time",Ms.prototype.controlText_="Current Time",f.registerComponent("CurrentTimeDisplay",Ms);class Rs extends Ns{constructor(e,t){super(e,t);t=e=>this.updateContent(e);this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}Rs.prototype.labelText_="Duration",Rs.prototype.controlText_="Duration",f.registerComponent("DurationDisplay",Rs);class Us extends f{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}f.registerComponent("TimeDivider",Us);class Bs extends Ns{constructor(e,t){super(e,t),this.on(e,"durationchange",e=>this.updateContent(e))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(o("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}Bs.prototype.labelText_="Remaining Time",Bs.prototype.controlText_="Remaining Time",f.registerComponent("RemainingTimeDisplay",Bs);class Fs extends f{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",e=>this.updateShowing(e))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=o("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(o("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}f.registerComponent("LiveDisplay",Fs);class js extends s{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=o("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function Hs(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}js.prototype.controlText_="Seek to live, currently playing live",f.registerComponent("SeekToLive",js);pi=Object.freeze({__proto__:null,clamp:Hs});class qs extends f{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||ae||e.preventDefault(),De(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;Ne(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const t=this.getProgress();return t!==this.progress_&&(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",()=>{var e=this.vertical()?"height":"width";this.bar.el().style[e]=(100*t).toFixed(2)+"%"})),t}}getProgress(){return Number(Hs(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){e=Ue(this.el_,e);return this.vertical()?e.y:e.x}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r.isEventKey(e,"Right")||r.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}f.registerComponent("Slider",qs);const Vs=(e,t)=>Hs(e/t*100,0,100).toFixed(2)+"%";class $s extends f{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",e=>this.update(e))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=o("span",{className:"vjs-control-text"}),i=o("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=o("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{var e=this.player_.liveTracker,i=this.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),r=this.partEls_,e=Vs(s,e);this.percent_!==e&&(this.el_.style.width=e,Se(this.percentageEl_,e),this.percent_=e);for(let t=0;t<i.length;t++){var n=i.start(t),a=i.end(t);let e=r[t];e||(e=this.el_.appendChild(o()),r[t]=e),e.dataset.start===n&&e.dataset.end===a||(e.dataset.start=n,e.dataset.end=a,e.style.left=Vs(n,s),e.style.width=Vs(a-n,s))}for(let e=r.length;e>i.length;e--)this.el_.removeChild(r[e-1]);r.length=i.length})}}f.registerComponent("LoadProgressBar",$s);class Ws extends f{constructor(e,t){super(e,t),this.update=ct(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(t,i,s){var r=Re(this.el_),n=Me(this.player_.el()),i=t.width*i;if(n&&r){var a=t.left-n.left+i,i=t.width-i+(n.right-t.right);let e=r.width/2;a<e?e+=e-a:i<e&&(e=i),e<0?e=0:e>r.width&&(e=r.width),e=Math.round(e),this.el_.style.right=`-${e}px`,this.write(s)}}write(e){Se(this.el_,e)}updateTime(r,n,a,o){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let e;var t,i,s=this.player_.duration();e=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((i=(t=this.player_.liveTracker.liveWindow())-n*t)<1?"":"-")+Ht(i,t):Ht(a,s),this.update(r,n,e),o&&o()})}}f.registerComponent("TimeTooltip",Ws);class Gs extends f{constructor(e,t){super(e,t),this.update=ct(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}Gs.prototype.options_={children:[]},u||te||Gs.prototype.options_.children.push("timeTooltip"),f.registerComponent("PlayProgressBar",Gs);class zs extends f{constructor(e,t){super(e,t),this.update=ct(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=e.width*t+"px"})}}zs.prototype.options_={children:["timeTooltip"]},f.registerComponent("MouseTimeDisplay",zs);class Xs extends qs{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=m(this,this.update),this.update=ct(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const s=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{var e=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),t=this.player_.liveTracker;let i=this.player_.duration();t&&t.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==s&&(this.el_.setAttribute("aria-valuenow",(100*s).toFixed(2)),this.percent_=s),this.currentTime_===e&&this.duration_===i||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ht(e,i),Ht(i,i)],"{1} of {2}")),this.currentTime_=e,this.duration_=i),this.bar&&this.bar.update(Me(this.el()),this.getProgress())}),s}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Ve(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(t,i=!1){if(Ve(t)){i||this.player_.scrubbing()||this.player_.scrubbing(!0);let e;i=this.calculateDistance(t),t=this.player_.liveTracker;if(t&&t.isLive()){if(.99<=i)return void t.seekToLiveEdge();var s=t.seekableStart(),r=t.liveCurrentTime();if((e=(e=(e=s+i*t.liveWindow())>=r?r:e)<=s?s+.1:e)===1/0)return}else(e=i*this.player_.duration())===this.player_.duration()&&(e-=.1);this.userSeek_(e)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Gt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;r.isEventKey(e,"Space")||r.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):r.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):r.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(r(e))?(e.preventDefault(),e.stopPropagation(),t=10*(r.codes[r(e)]-r.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):r.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):r.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}Xs.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},u||te||Xs.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),f.registerComponent("SeekBar",Xs);class Ks extends f{constructor(e,t){super(e,t),this.handleMouseMove=ct(m(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=ct(m(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=Re(r=n.el()),r=Hs(r=Ue(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach(e=>e.disable&&e.disable()),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&Gt(this.player_.play())}enable(){this.children().forEach(e=>e.enable&&e.enable()),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Ks.prototype.options_={children:["seekBar"]},f.registerComponent("ProgressControl",Ks);class Ys extends s{constructor(e,t){super(e,t),this.on(e,["enterpictureinpicture","leavepictureinpicture"],e=>this.handlePictureInPictureChange(e)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],e=>this.handlePictureInPictureEnabledChange(e)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>{"audio"===e.currentType().substring(0,5)||e.audioPosterMode()||e.audioOnlyMode()?(e.isInPictureInPicture()&&e.exitPictureInPicture(),this.hide()):this.show()}),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control "+super.buildCSSClass()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}}Ys.prototype.controlText_="Picture-in-Picture",f.registerComponent("PictureInPictureToggle",Ys);class Qs extends s{constructor(e,t){super(e,t),this.on(e,"fullscreenchange",e=>this.handleFullscreenChange(e)),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?this.controlText("Exit Fullscreen"):this.controlText("Fullscreen")}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Qs.prototype.controlText_="Fullscreen",f.registerComponent("FullscreenToggle",Qs);class Js extends f{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}f.registerComponent("VolumeLevel",Js);class Zs extends f{constructor(e,t){super(e,t),this.update=ct(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(t,i,s,e){if(!s){var s=Me(this.el_),r=Me(this.player_.el()),i=t.width*i;if(!r||!s)return;var n=t.left-r.left+i,i=t.width-i+(r.right-t.right);let e=s.width/2;n<e?e+=e-n:i<e&&(e=i),e<0?e=0:e>s.width&&(e=s.width),this.el_.style.right=`-${e}px`}this.write(e+"%")}write(e){Se(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),r&&r()})}}f.registerComponent("VolumeLevelTooltip",Zs);class er extends f{constructor(e,t){super(e,t),this.update=ct(m(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"})}}er.prototype.options_={children:["volumeLevelTooltip"]},f.registerComponent("MouseVolumeLevelDisplay",er);class tr extends qs{constructor(e,t){super(e,t),this.on("slideractive",e=>this.updateLastVolume_(e)),this.on(e,"volumechange",e=>this.updateARIAAttributes(e)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Ve(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=Me(s=this.el()),i=this.vertical(),s=Ue(s,e),s=Hs(s=i?s.y:s.x,0,1),r.update(t,s,i)),Ve(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)})}}tr.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},u||te||tr.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),tr.prototype.playerEvent="volumechange",f.registerComponent("VolumeBar",tr);class ir extends f{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!Y(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.throttledHandleMouseMove=ct(m(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",e=>this.handleMouseDown(e)),this.on("touchstart",e=>this.handleMouseDown(e)),this.on("mousemove",e=>this.handleMouseMove(e)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}ir.prototype.options_={children:["volumeBar"]},f.registerComponent("VolumeControl",ir);class sr extends s{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",function(){s.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),this.on(e,["loadstart","volumechange"],e=>this.update(e))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;u&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),Ce(this.el_,[0,1,2,3].reduce((e,t)=>e+`${t?" ":""}vjs-vol-`+t,"")),ke(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}sr.prototype.controlText_="Mute",f.registerComponent("MuteToggle",sr);class rr extends f{constructor(e,t={}){"undefined"!=typeof t.inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!Y(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],e=>this.volumePanelState_(e)),this.on(this.muteToggle,"keyup",e=>this.handleKeyPress(e)),this.on(this.volumeControl,"keyup",e=>this.handleVolumeControlKeyUp(e)),this.on("keydown",e=>this.handleKeyPress(e)),this.on("mouseover",e=>this.handleMouseOver(e)),this.on("mouseout",e=>this.handleMouseOut(e)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){r.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),ot(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),p(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){r.isEventKey(e,"Esc")&&this.handleMouseOut()}}rr.prototype.options_={children:["muteToggle","volumeControl"]},f.registerComponent("VolumePanel",rr);s;f.registerComponent("SkipForward",class extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()?i.seekableEnd():this.player_.duration();let s;s=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class nr extends s{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=this.player_.liveTracker,i=i&&i.isLive()&&i.seekableStart();let s;s=i&&t-this.skipTime<=i?i:t>=this.skipTime?t-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}nr.prototype.controlText_="Skip Backward",f.registerComponent("SkipBackward",nr);class ar extends f{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",e=>this.handleKeyDown(e)),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof f&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof f&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul",e=(this.contentEl_=o(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),super.createEl("div",{append:this.contentEl_,className:"vjs-menu"}));return e.appendChild(this.contentEl_),ot(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some(e=>e.el()===t)||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),Array.isArray(e))&&(e=e.filter(e=>e.el()===t.target)[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus()}handleKeyDown(e){r.isEventKey(e,"Left")||r.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(r.isEventKey(e,"Right")||r.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0<t.length&&(e<0?e=0:e>=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}f.registerComponent("Menu",ar);class or extends f{constructor(e,t={}){super(e,t),this.menuButton_=new s(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");e=s.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e);this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",e=>this.handleKeyDown(e)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),ot(document,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",e=>this.handleMouseLeave(e)),this.on("keydown",e=>this.handleSubmenuKeyDown(e))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new ar(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=o("li",{className:"vjs-menu-title",textContent:g(this.options_.title),tabIndex:-1}),e=new f(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;e<this.items.length;e++)t.addItem(this.items[e]);return t}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}buildWrapperCSSClass(){let e="vjs-menu-button";!0===this.options_.inline?e+="-inline":e+="-popup";var t=s.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} `+super.buildCSSClass()}buildCSSClass(){let e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup",`vjs-menu-button ${e} `+super.buildCSSClass()}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),p(document,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){r.isEventKey(e,"Esc")||r.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),r.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):!r.isEventKey(e,"Up")&&!r.isEventKey(e,"Down")||this.buttonPressed_||(e.preventDefault(),this.pressButton())}handleMenuKeyUp(e){(r.isEventKey(e,"Esc")||r.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(r.isEventKey(e,"Esc")||r.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),r.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))}pressButton(){this.enabled_&&(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),u&&be()||this.menu.focus())}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}f.registerComponent("MenuButton",or);class lr extends or{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),i){const s=m(this,this.update);i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),i.addEventListener("labelchange",s),this.player_.on("ready",s),this.player_.on("dispose",function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s),i.removeEventListener("labelchange",s)})}}}f.registerComponent("TrackButton",lr);const dr=["Tab","Esc","Up","Down","Right","Left"];class hr extends ks{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;t=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i);return t.replaceChild(o("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),t.querySelector(".vjs-icon-placeholder")),t}handleKeyDown(t){dr.some(e=>r.isEventKey(t,e))||super.handleKeyDown(t)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}f.registerComponent("MenuItem",hr);class ur extends hr{constructor(e,t){var i=t.track;const s=e.textTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)}),void 0===s.onchange){let e;this.on(["tap","click"],function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),s.dispatchEvent(e)})}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e<i.length;e++){var s=i[e];-1!==this.kinds.indexOf(s.kind)&&(s===t?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled"))}}handleTracksChange(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){var t;"showing"!==this.track.mode||(t=this.player_.cache_.selectedLanguage)&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind||(this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind})}dispose(){this.track=null,super.dispose()}}f.registerComponent("TextTrackMenuItem",ur);class cr extends ur{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){var i=this.player().textTracks();let s=!0;for(let e=0,t=i.length;e<t;e++){var r=i[e];if(-1<this.options_.kinds.indexOf(r.kind)&&"showing"===r.mode){s=!1;break}}s!==this.isSelected_&&this.selected(s)}handleSelectedLanguageChange(e){var i=this.player().textTracks();let s=!0;for(let e=0,t=i.length;e<t;e++){var r=i[e];if(-1<["captions","descriptions","subtitles"].indexOf(r.kind)&&"showing"===r.mode){s=!1;break}}s&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}f.registerComponent("OffTextTrackMenuItem",cr);class pr extends lr{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(t=[],i=ur){let e;this.label_&&(e=this.label_+" off"),t.push(new cr(this.player_,{kinds:this.kinds_,kind:this.kind_,label:e})),this.hideThreshold_+=1;var s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let e=0;e<s.length;e++){var r,n=s[e];-1<this.kinds_.indexOf(n.kind)&&((r=new i(this.player_,{track:n,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1})).addClass(`vjs-${n.kind}-menu-item`),t.push(r))}return t}}f.registerComponent("TextTrackButton",pr);class mr extends hr{constructor(e,t){var i=t.track,s=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=r&&r<s.endTime,super(e,t),this.track=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}f.registerComponent("ChaptersTrackMenuItem",mr);class gr extends pr{constructor(e,t,i){super(e,t,i),this.selectCurrentItem_=()=>{this.items.forEach(e=>{e.selected(this.track_.activeCues[0]===e.cue)})}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var t=this.player_.textTracks()||[];for(let e=t.length-1;0<=e;e--){var i=t[e];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(g(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var i=[];if(this.track_){var s=this.track_.cues;if(s)for(let e=0,t=s.length;e<t;e++){var r=s[e],r=new mr(this.player_,{track:this.track_,cue:r});i.push(r)}}return i}}gr.prototype.kind_="chapters",gr.prototype.controlText_="Chapters",f.registerComponent("ChaptersButton",gr);class fr extends pr{constructor(e,t,i){super(e,t,i);const s=e.textTracks(),r=m(this,this.handleTracksChange);s.addEventListener("change",r),this.on("dispose",function(){s.removeEventListener("change",r)})}handleTracksChange(e){var i=this.player().textTracks();let s=!1;for(let e=0,t=i.length;e<t;e++){var r=i[e];if(r.kind!==this.kind_&&"showing"===r.mode){s=!0;break}}s?this.disable():this.enable()}buildCSSClass(){return"vjs-descriptions-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-descriptions-button "+super.buildWrapperCSSClass()}}fr.prototype.kind_="descriptions",fr.prototype.controlText_="Descriptions",f.registerComponent("DescriptionsButton",fr);class yr extends pr{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return"vjs-subtitles-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-subtitles-button "+super.buildWrapperCSSClass()}}yr.prototype.kind_="subtitles",yr.prototype.controlText_="Subtitles",f.registerComponent("SubtitlesButton",yr);class _r extends ur{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}f.registerComponent("CaptionSettingsMenuItem",_r);class vr extends pr{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return"vjs-captions-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-captions-button "+super.buildWrapperCSSClass()}createItems(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new _r(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}vr.prototype.kind_="captions",vr.prototype.controlText_="Captions",f.registerComponent("CaptionsButton",vr);class br extends ur{createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(o("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),e}}f.registerComponent("SubsCapsMenuItem",br);class Tr extends pr{constructor(e,t={}){super(e,t),this.label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)&&(this.label_="captions"),this.menuButton_.controlText(g(this.label_))}buildCSSClass(){return"vjs-subs-caps-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-subs-caps-button "+super.buildWrapperCSSClass()}createItems(){let e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new _r(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,br)}}Tr.prototype.kinds_=["captions","subtitles"],Tr.prototype.controlText_="Subtitles",f.registerComponent("SubsCapsButton",Tr);class Sr extends hr{constructor(e,t){var i=t.track;const s=e.audioTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`),(...e)=>{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",()=>{s.removeEventListener("change",r)})}createEl(e,t,i){e=super.createEl(e,t,i),t=e.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(t.appendChild(o("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(o("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;e<t.length;e++){var i=t[e];i!==this.track&&(i.enabled=i===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}f.registerComponent("AudioTrackMenuItem",Sr);class wr extends lr{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t)}buildCSSClass(){return"vjs-audio-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-audio-button "+super.buildWrapperCSSClass()}createItems(t=[]){this.hideThreshold_=1;var i=this.player_.audioTracks();for(let e=0;e<i.length;e++){var s=i[e];t.push(new Sr(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return t}}wr.prototype.controlText_="Audio Track",f.registerComponent("AudioTrackButton",wr);class Er extends hr{constructor(e,t){var i=t.rate,s=parseFloat(i,10);t.label=i,t.selected=s===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=s,this.on(e,"ratechange",e=>this.update(e))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Er.prototype.contentElType="button",f.registerComponent("PlaybackRateMenuItem",Er);class kr extends or{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",e=>this.updateVisibility(e)),this.on(e,"ratechange",e=>this.updateLabel(e)),this.on(e,"playbackrateschange",e=>this.handlePlaybackRateschange(e))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=o("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var t=this.playbackRates(),i=[];for(let e=t.length-1;0<=e;e--)i.push(new Er(this.player(),{rate:t[e]+"x"}));return i}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}kr.prototype.controlText_="Playback Rate",f.registerComponent("PlaybackRateMenuButton",kr);class Cr extends f{buildCSSClass(){return"vjs-spacer "+super.buildCSSClass()}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}f.registerComponent("Spacer",Cr);f.registerComponent("CustomControlSpacer",class extends Cr{buildCSSClass(){return"vjs-custom-control-spacer "+super.buildCSSClass()}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class Ir extends f{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Ir.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in document&&Ir.prototype.options_.children.splice(Ir.prototype.options_.children.length-1,0,"pictureInPictureToggle"),f.registerComponent("ControlBar",Ir);class xr extends Qt{constructor(e,t){super(e,t),this.on(e,"error",e=>this.open(e))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}xr.prototype.options_=Object.assign({},Qt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),f.registerComponent("ErrorDisplay",xr);const Ar="vjs-text-track-settings";var Mi=["#000","Black"],Ot=["#00F","Blue"],Pr=["#0FF","Cyan"],Lr=["#0F0","Green"],t=["#F0F","Magenta"],Or=["#F00","Red"],Dr=["#FFF","White"],n=["#FF0","Yellow"],Nr=["1","Opaque"],Mr=["0.5","Semi-Transparent"],Rr=["0","Transparent"];const Ur={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Mi,Dr,Or,Lr,Ot,n,t,Pr]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Nr,Mr,Rr]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Dr,Mi,Or,Lr,Ot,n,t,Pr]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Nr,Mr]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Rr,Mr,Nr]}};function Br(e,t){if((e=t?t(e):e)&&"none"!==e)return e}Ur.windowColor.options=Ur.backgroundColor.options;class Fr extends Qt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=o("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),z(Ur,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){e=Ur[e];const s=e.id.replace("%s",this.id_),r=[t,s].join(" ").trim();return[`<${i} id="${s}" class="${"label"===i?"vjs-label":""}">`,this.localize(e.label),`</${i}>`,`<select aria-labelledby="${r}">`].concat(e.options.map(e=>{var t=s+"-"+e[1].replace(/\W+/g,"");return[`<option id="${t}" value="${e[0]}" `,`aria-labelledby="${r} ${t}">`,this.localize(e[1]),"</option>"].join("")})).concat("</select>").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text"),"</legend>",'<span class="vjs-text-color">',this.createElSelect_("color",e),"</span>",'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text Background"),"</legend>",'<span class="vjs-bg-color">',this.createElSelect_("backgroundColor",e),"</span>",'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window vjs-track-setting">',`<legend id="${e}">`,this.localize("Caption Area Background"),"</legend>",'<span class="vjs-window-color">',this.createElSelect_("windowColor",e),"</span>",'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")}createElColors_(){return o("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return o("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return o("div",{className:"vjs-track-settings-controls",innerHTML:[`<button type="button" class="vjs-default-button" title="${e}">`,this.localize("Reset"),`<span class="vjs-control-text"> ${e}</span>`,"</button>",`<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return X(Ur,(e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=Br(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e},{})}setValues(n){z(Ur,(e,t)=>{var i=this.$(e.selector),s=n[t],r=e.parser;if(s)for(let e=0;e<i.options.length;e++)if(Br(i.options[e].value,r)===s){i.selectedIndex=e;break}})}setDefaults(){z(Ur,e=>{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Ar))}catch(e){d.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Ar,JSON.stringify(e)):window.localStorage.removeItem(Ar)}catch(e){d.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()}handleLanguagechange(){this.fill()}}f.registerComponent("TextTrackSettings",Fr);class jr extends f{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,h({createEl:!(i=null===t.ResizeObserver?!1:i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=pt(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const t=this.debouncedHandler_;let e=this.unloadListener_=function(){p(this,"resize",t),p(this,"unload",e),e=null};ot(this.el_.contentWindow,"unload",e),ot(this.el_.contentWindow,"resize",t)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}f.registerComponent("ResizeManager",jr);const Hr={trackingThreshold:20,liveTolerance:15};class qr extends f{constructor(e,t){super(e,h(Hr,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",e=>this.handleDurationchange(e)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){var t=this.player_.seekable();if(t&&t.length){var t=Number(window.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3,t=(this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i,this.liveCurrentTime()),i=this.player_.currentTime();let e=this.player_.paused()||this.seekedBehindLive_||Math.abs(t-i)>this.options_.liveTolerance;(e=this.timeupdateSeen_&&t!==1/0?e:!1)!==this.behindLiveEdge_&&(this.behindLiveEdge_=e,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2<e,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){var e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){var e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}f.registerComponent("LiveTracker",qr);class Vr extends f{constructor(e,t){super(e,t),this.on("statechanged",e=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:o("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+tt++}),description:o("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+tt++})},o("div",{className:"vjs-title-bar"},{},Object.values(this.els))}updateDom_(){var e=this.player_.tech_;const s=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(e=>{var t=this.state[e],i=this.els[e],e=r[e];Fe(i),t&&Se(i,t),s&&(s.removeAttribute(e),t)&&s.setAttribute(e,i.id)}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e=this.player_.tech_,e=e&&e.el_;e&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}f.registerComponent("TitleBar",Vr);function $r(i){const s=i.el();if(!s.resetSourceWatch_){const t={},e=Kr(i),r=t=>(...e)=>{e=t.apply(s,e);return Gr(i),e};["append","appendChild","insertAdjacentHTML"].forEach(e=>{s[e]&&(t[e]=s[e],s[e]=r(t[e]))}),Object.defineProperty(s,"innerHTML",h(e,{set:r(e.set)})),s.resetSourceWatch_=()=>{s.resetSourceWatch_=null,Object.keys(t).forEach(e=>{s[e]=t[e]}),Object.defineProperty(s,"innerHTML",e)},i.one("sourceset",s.resetSourceWatch_)}}function Wr(i){if(i.featuresSourceset){const s=i.el();if(!s.resetSourceset_){e=i;const t=Xr([e.el(),window.HTMLMediaElement.prototype,Yr],"src");var e;const r=s.setAttribute,n=s.load;Object.defineProperty(s,"src",h(t,{set:e=>{e=t.set.call(s,e);return i.triggerSourceset(s.src),e}})),s.setAttribute=(e,t)=>{t=r.call(s,e,t);return/src/i.test(e)&&i.triggerSourceset(s.src),t},s.load=()=>{var e=n.call(s);return Gr(i)||(i.triggerSourceset(""),$r(i)),e},s.currentSrc?i.triggerSourceset(s.currentSrc):Gr(i)||$r(i),s.resetSourceset_=()=>{s.resetSourceset_=null,s.load=n,s.setAttribute=r,Object.defineProperty(s,"src",t),s.resetSourceWatch_&&s.resetSourceWatch_()}}}}const Gr=t=>{var e=t.el();if(e.hasAttribute("src"))t.triggerSourceset(e.src);else{var i=t.$$("source"),s=[];let e="";if(!i.length)return!1;for(let e=0;e<i.length;e++){var r=i[e].src;r&&-1===s.indexOf(r)&&s.push(r)}if(!s.length)return!1;1===s.length&&(e=s[0]),t.triggerSourceset(e)}return!0},zr=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){for(var t=document.createElement(this.nodeName.toLowerCase()),i=(t.innerHTML=e,document.createDocumentFragment());t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",window.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Xr=(t,i)=>{let s={};for(let e=0;e<t.length&&!((s=Object.getOwnPropertyDescriptor(t[e],i))&&s.set&&s.get);e++);return s.enumerable=!0,s.configurable=!0,s},Kr=e=>Xr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,zr],"innerHTML"),Yr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?di(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class v extends _{constructor(e,t){super(e,t);t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!hi(n.src)||(i=!0)):r.push(n))}for(let e=0;e<r.length;e++)this.el_.removeChild(r[e])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&i&&d.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),this.restoreMetadataTracksInIOSNativePlayer_(),(me||pe)&&!0===e.nativeControlsForTouch&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),v.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Wr(this)}restoreMetadataTracksInIOSNativePlayer_(){const i=this.textTracks();let s;const e=()=>{s=[];for(let e=0;e<i.length;e++){var t=i[e];"metadata"===t.kind&&s.push({track:t,storedMode:t.mode})}},r=(e(),i.addEventListener("change",e),this.on("dispose",()=>i.removeEventListener("change",e)),()=>{for(let e=0;e<s.length;e++){var t=s[e];"disabled"===t.track.mode&&t.track.mode!==t.storedMode&&(t.track.mode=t.storedMode)}i.removeEventListener("change",r)});this.on("webkitbeginfullscreen",()=>{i.removeEventListener("change",e),i.removeEventListener("change",r),i.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{i.removeEventListener("change",e),i.addEventListener("change",e),i.removeEventListener("change",r)})}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(e=>{this.el()[i+"Tracks"].removeEventListener(e,this[i+"TracksListeners_"][e])}),this[`featuresNative${e}Tracks`]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(i){var e=Di[i];const s=this.el()[e.getterName],r=this[e.getterName]();if(this[`featuresNative${e.capitalName}Tracks`]&&s&&s.addEventListener){const n={change:e=>{var t={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(t),"text"===i&&this[Ni.remoteText.getterName]().trigger(t)},addtrack(e){r.addTrack(e.track)},removetrack(e){r.removeTrack(e.track)}},t=function(){var e=[];for(let i=0;i<r.length;i++){let t=!1;for(let e=0;e<s.length;e++)if(s[e]===r[i]){t=!0;break}t||e.push(r[i])}for(;e.length;)r.removeTrack(e.shift())};this[e.getterName+"Listeners_"]=n,Object.keys(n).forEach(t=>{const i=n[t];s.addEventListener(t,i),this.on("dispose",e=>s.removeEventListener(t,i))}),this.on("loadstart",t),this.on("dispose",e=>this.off("loadstart",t))}}proxyNativeTracks_(){Di.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),v.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=h({},this.options_.tag&&Ae(this.options_.tag)),me&&!0===this.options_.nativeControlsForTouch||delete e.controls,xe(t,Object.assign(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&Le(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);var e,i=["loop","muted","playsinline","autoplay"];for(let e=0;e<i.length;e++){var s=i[e],r=this.options_[s];"undefined"!=typeof r&&(r?Le(t,s,s):Oe(t,s),t[s]=r)}return t}handleLateInit_(e){if(0!==e.networkState&&3!==e.networkState)if(0===e.readyState){let e=!1;const t=function(){e=!0},i=(this.on("loadstart",t),function(){e||this.trigger("loadstart")});this.on("loadedmetadata",i),void this.ready(function(){this.off("loadstart",t),this.off("loadedmetadata",i),e||this.trigger("loadstart")})}else{const s=["loadstart"];s.push("loadedmetadata"),2<=e.readyState&&s.push("loadeddata"),3<=e.readyState&&s.push("canplay"),4<=e.readyState&&s.push("canplaythrough"),this.ready(function(){s.forEach(function(e){this.trigger(e)},this)})}}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&fe?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){d(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&te&&ae&&0===this.el_.currentTime){const e=()=>{0<this.el_.currentTime&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if("webkitDisplayingFullscreen"in this.el_){const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Gt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){v.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){e=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(t){if(super.removeRemoteTextTrack(t),this.featuresNativeTextTracks){var i=this.$$("track");let e=i.length;for(;e--;)t!==i[e]&&t!==i[e].track||this.el().removeChild(i[e])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}Q(v,"TEST_VID",function(){var e,t;if(_e())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}),v.isSupported=function(){try{v.TEST_VID.volume=.5}catch(e){return!1}return!(!v.TEST_VID||!v.TEST_VID.canPlayType)},v.canPlayType=function(e){return v.TEST_VID.canPlayType(e)},v.canPlaySource=function(e,t){return v.canPlayType(e.type)},v.canControlVolume=function(){try{const t=v.TEST_VID.volume;v.TEST_VID.volume=t/2+.1;var e=t!==v.TEST_VID.volume;return e&&u?(window.setTimeout(()=>{v&&v.prototype&&(v.prototype.featuresVolumeControl=t!==v.TEST_VID.volume)}),!1):e}catch(e){return!1}},v.canMuteVolume=function(){try{var e=v.TEST_VID.muted;return v.TEST_VID.muted=!e,v.TEST_VID.muted?Le(v.TEST_VID,"muted","muted"):Oe(v.TEST_VID,"muted"),e!==v.TEST_VID.muted}catch(e){return!1}},v.canControlPlaybackRate=function(){if(te&&ae&&le<58)return!1;try{var e=v.TEST_VID.playbackRate;return v.TEST_VID.playbackRate=e/2+.1,e!==v.TEST_VID.playbackRate}catch(e){return!1}},v.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},v.supportsNativeTextTracks=function(){return fe||u&&ae},v.supportsNativeVideoTracks=function(){return!(!v.TEST_VID||!v.TEST_VID.videoTracks)},v.supportsNativeAudioTracks=function(){return!(!v.TEST_VID||!v.TEST_VID.audioTracks)},v.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([e,t]){Q(v.prototype,e,()=>v[t](),!0)}),v.prototype.featuresVolumeControl=v.canControlVolume(),v.prototype.movingMediaElementInDOM=!u,v.prototype.featuresFullscreenResize=!0,v.prototype.featuresProgressEvents=!0,v.prototype.featuresTimeupdateEvents=!0,v.prototype.featuresVideoFrameCallback=!(!v.TEST_VID||!v.TEST_VID.requestVideoFrameCallback),v.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},v.resetMediaElement=function(t){if(t){var i=t.querySelectorAll("source");let e=i.length;for(;e--;)t.removeChild(i[e]);if(t.removeAttribute("src"),"function"==typeof t.load)try{t.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){v.prototype["set"+g(t)]=function(e){(this.el_[t]=e)?this.el_.setAttribute(t,t):this.el_.removeAttribute(t)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){v.prototype["set"+g(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){v.prototype[e]=function(){return this.el_[e]()}}),_.withSourceHandlers(v),v.nativeSourceHandler={},v.nativeSourceHandler.canPlayType=function(e){try{return v.TEST_VID.canPlayType(e)}catch(e){return""}},v.nativeSourceHandler.canHandleSource=function(e,t){return e.type?v.nativeSourceHandler.canPlayType(e.type):e.src?(e=ui(e.src),v.nativeSourceHandler.canPlayType("video/"+e)):""},v.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},v.nativeSourceHandler.dispose=function(){},v.registerSourceHandler(v.nativeSourceHandler),_.registerTech("Html5",v);const Qr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Jr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Zr=["tiny","xsmall","small","medium","large","xlarge","huge"],en={},tn=(Zr.forEach(e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;en[e]="vjs-layout-"+t}),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class b extends f{constructor(e,t,i){if(e.id=e.id||t.id||"vjs_video_"+tt++,(t=Object.assign(b.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,t.language||(s=e.closest("[lang]"))&&(t.language=s.getAttribute("lang")),super(null,t,i),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=W(this.id_),this.fsApi_=j,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Ae(e),this.language(this.options_.language),t.languages){const r={};Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),this.languages_=r}else this.languages_=b.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Ct(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(ot(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=h(this.options_),i=(t.plugins&&Object.keys(t.plugins).forEach(e=>{this[e](t.plugins[e])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),this.initChildren(),this.isAudio("audio"===e.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),me&&this.addClass("vjs-touch-enabled"),u||this.addClass("vjs-workinghover"),b.players[this.id_]=this,R.split(".")[0]);this.addClass("vjs-v"+i),this.userActive(!0),this.reportUserActivity(),this.one("play",e=>this.listenForUserActivity_(e)),this.on("keydown",e=>this.handleKeyDown(e)),this.on("languagechange",e=>this.handleLanguagechange(e)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){var e;this.trigger("dispose"),this.off("dispose"),p(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),p(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),b.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),e=this,us[e.id()]=null,a.names.forEach(e=>{e=this[a[e].getterName]();e&&e.off&&e.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let t=this.tag,i,e=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const s="video-js"===this.tag.tagName.toLowerCase(),r=(e?i=this.el_=t.parentNode:s||(i=this.el_=super.createEl("div")),Ae(t));if(s){for(i=this.el_=t,t=this.tag=document.createElement("video");i.children.length;)t.appendChild(i.firstChild);Ee(i,"video-js")||ke(i,"video-js"),i.appendChild(t),e=this.playerElIngest_=i,Object.keys(i).forEach(e=>{try{t[e]=i[e]}catch(e){}})}t.setAttribute("tabindex","-1"),r.tabindex="-1",ae&&ue&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(e){s&&"class"===e||i.setAttribute(e,r[e]),s&&t.setAttribute(e,r[e])}),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=i.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=Ze("vjs-styles-dimensions"),n=$e(".vjs-styles-defaults"),(a=$e("head")).insertBefore(this.styleEl_,n?n.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var n,a,o=t.getElementsByTagName("a");for(let e=0;e<o.length;e++){var l=o.item(e);ke(l,"vjs-hidden"),l.setAttribute("hidden","hidden")}return t.initNetworkState_=t.networkState,t.parentNode&&!e&&t.parentNode.insertBefore(i,t),we(t,i),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=i}crossOrigin(e){if("undefined"==typeof e)return this.techGet_("crossOrigin");null!==e&&"anonymous"!==e&&"use-credentials"!==e?d.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e))}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){var i,s=e+"_";if(void 0===t)return this[s]||0;""===t||"auto"===t?(this[s]=void 0,this.updateStyleEl_()):(i=parseFloat(t),isNaN(i)?d.error(`Improper value "${t}" supplied for for `+e):(this[s]=i,this.updateStyleEl_()))}fluid(e){if(void 0===e)return!!this.fluid_;var t;this.fluid_=!!e,_t(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),e=this,t=()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},_t(e)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const e="number"==typeof this.width_?this.width_:this.options_.width,t="number"==typeof this.height_?this.height_:this.options_.height;var r=this.tech_&&this.tech_.el();void(r&&(0<=e&&(r.width=e),0<=t)&&(r.height=t))}else{let e,t,i,s;r=(i=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=r[1]/r[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,s=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(s),et(this.styleEl_,`
- .${s} {
- width: ${e}px;
- height: ${t}px;
- }
- .${s}.vjs-fluid:not(.vjs-audio-only-mode) {
- padding-top: ${100*r}%;
- }
- `)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var i=g(e),s=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(_.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();const n={source:t,autoplay:r="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};a.names.forEach(e=>{e=a[e];n[e.getterName]=this[e.privateName]}),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(n.startTime=this.cache_.currentTime);s=_.getTech(e);if(!s)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new s(n),this.tech_.ready(m(this,this.handleTechReady_),!0),Kt(this.textTracksJson_||[],this.tech_),Qr.forEach(t=>{this.on(this.tech_,t,e=>this[`handleTech${g(t)}_`](e))}),Object.keys(Jr).forEach(t=>{this.on(this.tech_,t,e=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Jr[t]}_`].bind(this),event:e}):this[`handleTech${Jr[t]}_`](e)})}),this.on(this.tech_,"loadstart",e=>this.handleTechLoadStart_(e)),this.on(this.tech_,"sourceset",e=>this.handleTechSourceset_(e)),this.on(this.tech_,"waiting",e=>this.handleTechWaiting_(e)),this.on(this.tech_,"ended",e=>this.handleTechEnded_(e)),this.on(this.tech_,"seeking",e=>this.handleTechSeeking_(e)),this.on(this.tech_,"play",e=>this.handleTechPlay_(e)),this.on(this.tech_,"pause",e=>this.handleTechPause_(e)),this.on(this.tech_,"durationchange",e=>this.handleTechDurationChange_(e)),this.on(this.tech_,"fullscreenchange",(e,t)=>this.handleTechFullscreenChange_(e,t)),this.on(this.tech_,"fullscreenerror",(e,t)=>this.handleTechFullscreenError_(e,t)),this.on(this.tech_,"enterpictureinpicture",e=>this.handleTechEnterPictureInPicture_(e)),this.on(this.tech_,"leavepictureinpicture",e=>this.handleTechLeavePictureInPicture_(e)),this.on(this.tech_,"error",e=>this.handleTechError_(e)),this.on(this.tech_,"posterchange",e=>this.handleTechPosterChange_(e)),this.on(this.tech_,"textdata",e=>this.handleTechTextData_(e)),this.on(this.tech_,"ratechange",e=>this.handleTechRateChange_(e)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||we(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){a.names.forEach(e=>{e=a[e];this[e.privateName]=this[e.getterName]()}),this.textTracksJson_=Xt(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&d.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(t){if(this.tech_&&"string"==typeof t){var i=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Wt(i))return i.catch(e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};let e;if("any"!==t||this.muted()?e="muted"!==t||this.muted()?this.play():i():Wt(e=this.play())&&(e=e.catch(i)),Wt(e))return e.then(()=>{this.trigger({type:"autoplay-success",autoplay:t})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:t})})}}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter(e=>e.src===t);if(i.length)return i[0].type;var s=e.$$("source");for(let e=0;e<s.length;e++){var r=s[e];if(r.type&&r.src&&r.src===t)return r.type}return Ss(t)})(this,t)),this.cache_.source=h({},e,{src:t,type:i});var e=this.cache_.sources.filter(e=>e.src&&e.src===t),s=[],r=this.$$("source"),n=[];for(let e=0;e<r.length;e++){var a=Ae(r[e]);s.push(a),a.src&&a.src===t&&n.push(a.src)}n.length&&!e.length?this.cache_.sources=s:e.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(t){if(!this.changingSrc_){let e=e=>this.updateSourceCaches_(e);var i=this.currentSource().src,s=t.src;(e=!i||/^blob:/.test(i)||!/^blob:/.test(s)||this.lastSource_&&(this.lastSource_.tech===s||this.lastSource_.player===i)?e:()=>{})(s),t.src||this.tech_.any(["sourceset","loadstart"],e=>{"sourceset"!==e.type&&(e=this.techGet("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))})}this.lastSource_={player:this.currentSource().src,tech:t.src},this.trigger({src:t.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0<this.tech_.playbackRate()&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Gt(this.play()):this.pause())}handleTechDoubleClick_(t){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),e=>e.contains(t.target))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,t):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(t){t=t.target.player;if(!t||t===this){t=this.el();let e=document[this.fsApi_.fullscreenElement]===t;!e&&t.matches?e=t.matches(":"+this.fsApi_.fullscreen):!e&&t.msMatchesSelector&&(e=t.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(e)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=1<arguments.length?arguments[1]:null;this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(t,i){this.ready(function(){if(t in fs)return e=this.middleware_,this.tech_[t](e.reduce(_s(t),i));if(t in ys)return ms(this.middleware_,this.tech_,t,i);var e;try{this.tech_&&this.tech_[t](i)}catch(e){throw d(e),e}},!0)}techGet_(t){if(this.tech_&&this.tech_.isReady_){if(t in gs)return e=this.middleware_,i=this.tech_,e.reduceRight(_s(t),i[t]());if(t in ys)return ms(this.middleware_,this.tech_,t);var e,i;try{return this.tech_[t]()}catch(e){throw void 0===this.tech_[t]?d(`Video.js: ${t} method not defined for ${this.techName_} playback technology.`,e):"TypeError"===e.name?(d(`Video.js: ${t} unavailable on ${this.techName_} playback technology element.`,e),this.tech_.isReady_=!1):d(e),e}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Gt){this.playCallbacks_.push(e);var t,e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(fe||u);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}runPlayCallbacks_(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||Rt(0,0)}scrubbing(e){if("undefined"==typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){return"undefined"!=typeof e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e=e&&e.length?e:Rt(0,0)}bufferedPercent(){return Vt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i=i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),0<t&&this.lastVolume_(t)}muted(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}defaultMuted(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){var t;if(void 0===e)return this.isFullscreen_;t=this.isFullscreen_,this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_()}requestFullscreen(a){this.isInPictureInPicture()&&this.exitPictureInPicture();const o=this;return new Promise((e,i)=>{function s(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var n=o.requestFullscreenHelper_(a);n&&(n.then(s,s),n.then(e,i))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const a=this;return new Promise((e,i)=>{function s(){a.off("fullscreenerror",r),a.off("fullscreenchange",t)}function t(){s(),e()}function r(e,t){s(),i(t)}a.one("fullscreenchange",t),a.one("fullscreenerror",r);var n=a.exitFullscreenHelper_();n&&(n.then(s,s),n.then(e,i))})}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Gt(e.then(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,ot(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",ke(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){r.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,p(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,Ce(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const t=document.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(o("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({initialAspectRatio:this.videoWidth()/this.videoHeight(),copyStyleSheets:!0}).then(e=>(this.el_.parentNode.insertBefore(t,this.el_),e.document.body.append(this.el_),e.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),e.addEventListener("unload",e=>{e=e.target.querySelector(".video-js");t.replaceWith(e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),e))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,s=this.options_["userActions"];s&&s.hotkeys&&(t=this.el_.ownerDocument.activeElement,i=t.tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>r.isEventKey(e,"f"),muteKey:i=e=>r.isEventKey(e,"m"),playPauseKey:s=e=>r.isEventKey(e,"k")||r.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=f.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),f.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),f.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(s){var r;for(let t=0,i=this.options_.techOrder;t<i.length;t++){var n=i[t];let e=_.getTech(n);if(e=e||f.getComponent(n)){if(e.isSupported()&&(r=e.canPlayType(s)))return r}else d.error(`The "${n}" tech is undefined. Skipped browser support check for that tech.`)}return""}selectSource(e){function t(e,i,s){let r;return e.some(t=>i.some(e=>{if(r=s(t,e))return!0})),r}var i=this.options_.techOrder.map(e=>[e,_.getTech(e)]).filter(([e,t])=>t?t.isSupported():(d.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,s){if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=bs(e);if(r.length){if(this.changingSrc_=!0,s||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),ps(this,r[0],(e,t)=>{var i;if(this.middleware_=t,s||(this.cache_.sources=r),this.updateSourceCaches_(e),this.src_(e))return 1<r.length?this.handleSrc_(r.slice(1)):(this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void this.triggerReady());i=this.tech_,t.forEach(e=>e.setTech&&e.setTech(i))}),1<r.length){const t=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},i=()=>{this.off("error",t)};this.one("error",t),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",t),this.off("playing",i)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(Pt(t.tech,this.techName_)?this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1})),!1)}load(){this.techCall_("load")}reset(){this.paused()?this.doReset_():Gt(this.play().then(()=>this.doReset_()))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),_t(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{})["seekBar"];e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"==typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(t){if(void 0===t)return this.error_||null;if(B("beforeerror").forEach(e=>{e=e(this,t);K(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:this.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){const e=function(){this.error(t)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}else null===t?(this.error_=t,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new i(t),this.addClass("vjs-error"),d.error(`(CODE:${this.error_.code} ${i.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),B("error").forEach(e=>e(this,this.error_)))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let t,i,s;const r=m(this,this.reportUserActivity);function e(e){r(),this.clearInterval(t)}this.on("mousedown",function(){r(),this.clearInterval(t),t=this.setInterval(r,250)}),this.on("mousemove",function(e){e.screenX===i&&e.screenY===s||(i=e.screenX,s=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var n=this.getChild("controlBar");!n||u||te||(n.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),n.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let a;this.setInterval(function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e)))},250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach(e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then(()=>this.enableAudioOnlyUI_())):Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()})}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e["track"];if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),_t(this))&&this.trigger("languagechange")}languages(){return h(b.prototype.options_.languages,this.languages_)}toJSON(){var t=h(this.options_),i=t.tracks;t.tracks=[];for(let e=0;e<i.length;e++){var s=i[e];(s=h(s)).player=void 0,t.tracks[e]=s}return t}createModal(e,t){(t=t||{}).content=e||"";const i=new Qt(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var t=this.currentBreakpoint(),i=this.currentWidth();for(let e=0;e<Zr.length;e++){var s=Zr[e];if(i<=this.breakpoints_[s]){if(t===s)return;t&&this.removeClass(en[t]),this.addClass(en[s]),this.breakpoint_=s;break}}}}removeCurrentBreakpoint_(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0!==e&&(this.breakpoint_="",this.breakpoints_=Object.assign({},tn,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=e)?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return en[this.breakpoint_]||""}loadMedia(e,t){var i,s,r,n,a,o;e&&"object"==typeof e&&(this.reset(),this.cache_.media=h(e),{artist:e,artwork:i,description:s,poster:r,src:n,textTracks:a,title:o}=this.cache_.media,!i&&r&&(this.cache_.media.artwork=[{src:r,type:Ss(r)}]),n&&this.src(n),r&&this.poster(r),Array.isArray(a)&&a.forEach(e=>this.addRemoteTextTrack(e,!1)),this.titleBar&&this.titleBar.update({title:o,description:s||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?h(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),e=>({kind:e.kind,label:e.label,language:e.language,src:e.src}))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Ss(t.poster)}]),t)}static getTagSettings(e){var t,i={sources:[],tracks:[]},s=Ae(e),r=s["data-setup"];if(Ee(e,"vjs-fill")&&(s.fill=!0),Ee(e,"vjs-fluid")&&(s.fluid=!0),null!==r&&([r,t]=$t(r||"{}"),r&&d.error(r),Object.assign(s,t)),Object.assign(i,s),e.hasChildNodes()){var n=e.childNodes;for(let e=0,t=n.length;e<t;e++){var a=n[e],o=a.nodeName.toLowerCase();"source"===o?i.sources.push(Ae(a)):"track"===o&&i.tracks.push(Ae(a))}}return i}debug(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every(e=>"number"==typeof e)&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}a.names.forEach(function(e){const t=a[e];b.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),b.prototype.crossorigin=b.prototype.crossOrigin,b.players={};Dr=window.navigator;b.prototype.options_={techOrder:_.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Dr&&(Dr.languages&&Dr.languages[0]||Dr.userLanguage||Dr.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach(function(e){b.prototype[e]=function(){return this.techGet_(e)}}),Qr.forEach(function(e){b.prototype[`handleTech${g(e)}_`]=function(){return this.trigger(e)}}),f.registerComponent("Player",b);function sn(t,i){function s(){hn(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return dn(this,t),hn(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){s[e]=i[e]}),s}const rn="plugin",nn="activePlugins_",an={},on=e=>an.hasOwnProperty(e),ln=e=>on(e)?an[e]:void 0,dn=(e,t)=>{e[nn]=e[nn]||{},e[nn][t]=!0},hn=(e,t,i)=>{i=(i?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},un=(i,s)=>(s.prototype.name=i,function(...e){hn(this,{name:i,plugin:s,instance:null},!0);const t=new s(this,...e);return this[i]=()=>t,hn(this,t.getEventHash()),t});class cn{constructor(e){if(this.constructor===cn)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ct(this),delete this.trigger,xt(this,this.constructor.defaultState),dn(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return lt(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[nn][e]=!1,this.player=this.state=null,t[e]=un(e,an[e])}static isBasic(e){e="string"==typeof e?ln(e):e;return"function"==typeof e&&!cn.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(on(e))d.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(b.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return an[e]=t,e!==rn&&(cn.isBasic(t)?b.prototype[e]=sn(e,t):b.prototype[e]=un(e,t)),t}static deregisterPlugin(e){if(e===rn)throw new Error("Cannot de-register base plugin.");on(e)&&(delete an[e],delete b.prototype[e])}static getPlugins(e=Object.keys(an)){let i;return e.forEach(e=>{var t=ln(e);t&&((i=i||{})[e]=t)}),i}static getPluginVersion(e){e=ln(e);return e&&e.VERSION||""}}function pn(e,i,s,r){{var n=i+` is deprecated and will be removed in ${e}.0; please use ${s} instead.`,a=r;let t=!1;return function(...e){return t||d.warn(n),t=!0,a.apply(this,e)}}}cn.getPlugin=ln,cn.BASE_PLUGIN_NAME=rn,cn.registerPlugin(rn,cn),b.prototype.usingPlugin=function(e){return!!this[nn]&&!0===this[nn][e]},b.prototype.hasPlugin=function(e){return!!on(e)};const mn=e=>0===e.indexOf("#")?e.slice(1):e;function T(e,t,i){let s=T.getPlayer(e);if(s)t&&d.warn(`Player "${e}" is already initialised. Options will not be applied.`),i&&s.ready(i);else{const r="string"==typeof e?$e("#"+mn(e)):e;if(!ve(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||d.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),B("beforesetup").forEach(e=>{e=e(r,h(t));!K(e)||Array.isArray(e)?d.error("please return an object in beforesetup hooks"):t=h(t,e)});e=f.getComponent("Player");s=new e(r,t,i),B("setup").forEach(e=>e(s))}return s}T.hooks_=U,T.hooks=B,T.hook=function(e,t){B(e,t)},T.hookOnce=function(s,e){B(s,[].concat(e).map(t=>{const i=(...e)=>(F(s,i),t(...e));return i}))},T.removeHook=F,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&_e()&&!(Mi=$e(".vjs-styles-defaults"))&&(Mi=Ze("vjs-styles-defaults"),(Or=$e("head"))&&Or.insertBefore(Mi,Or.firstChild),et(Mi,`
- .video-js {
- width: 300px;
- height: 150px;
- }
- .vjs-fluid:not(.vjs-audio-only-mode) {
- padding-top: 56.25%
- }
- `)),Qe(1,T),T.VERSION=R,T.options=b.prototype.options_,T.getPlayers=()=>b.players,T.getPlayer=e=>{var t=b.players;let i;if("string"==typeof e){var s=mn(e),r=t[s];if(r)return r;i=$e("#"+s)}else i=e;if(ve(i)){var{player:r,playerId:s}=i;if(r||t[s])return r||t[s]}},T.getAllPlayers=()=>Object.keys(b.players).map(e=>b.players[e]).filter(Boolean),T.players=b.players,T.getComponent=f.getComponent,T.registerComponent=(e,t)=>{_.isTech(t)&&d.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),f.registerComponent.call(f,e,t)},T.getTech=_.getTech,T.registerTech=_.registerTech,T.use=function(e,t){hs[e]=hs[e]||[],hs[e].push(t)},Object.defineProperty(T,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(T.middleware,"TERMINATOR",{value:cs,writeable:!1,enumerable:!0}),T.browser=e,T.obj=J,T.mergeOptions=pn(9,"videojs.mergeOptions","videojs.obj.merge",h),T.defineLazyProperty=pn(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Q),T.bind=pn(9,"videojs.bind","native Function.prototype.bind",m),T.registerPlugin=cn.registerPlugin,T.deregisterPlugin=cn.deregisterPlugin,T.plugin=(e,t)=>(d.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),cn.registerPlugin(e,t)),T.getPlugins=cn.getPlugins,T.getPlugin=cn.getPlugin,T.getPluginVersion=cn.getPluginVersion,T.addLanguage=function(e,t){return e=(""+e).toLowerCase(),T.options.languages=h(T.options.languages,{[e]:t}),T.options.languages[e]},T.log=d,T.createLogger=W,T.time=qt,T.createTimeRange=pn(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Rt),T.createTimeRanges=pn(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Rt),T.formatTime=pn(9,"videojs.formatTime","videojs.time.formatTime",Ht),T.setFormatTime=pn(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ft),T.resetFormatTime=pn(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",jt),T.parseUrl=pn(9,"videojs.parseUrl","videojs.url.parseUrl",li),T.isCrossOrigin=pn(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",hi),T.EventTarget=ft,T.any=ht,T.on=ot,T.one=dt,T.off=p,T.trigger=lt,T.xhr=bi,T.TextTrack=Ai,T.AudioTrack=Pi,T.VideoTrack=Li,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(e=>{T[e]=function(){return d.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),ze[e].apply(null,arguments)}}),T.computedStyle=pn(9,"videojs.computedStyle","videojs.dom.computedStyle",Ge),T.dom=ze,T.fn=mt,T.num=pi,T.str=Lt,T.url=ci,Dt(function(e,t){
- /*! @name videojs-contrib-quality-levels @version 3.0.0 @license Apache-2.0 */
- e.exports=function(e){function t(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var i=t(e);class s{constructor(e){let t=this;t.id=e.id;t.label=t.id;t.width=e.width;t.height=e.height;t.bitrate=e.bandwidth;t.frameRate=e.frameRate;t.enabled_=e.enabled;Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(e){t.enabled_(e)}});return t}}class n extends i["default"].EventTarget{constructor(){super();let e=this;e.levels_=[];e.selectedIndex_=-1;Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}});Object.defineProperty(e,"length",{get(){return e.levels_.length}});return e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;t=new s(e);if(!(""+i in this))Object.defineProperty(this,i,{get(){return this.levels_[i]}});this.levels_.push(t);this.trigger({qualityLevel:t,type:"addqualitylevel"});return t}removeQualityLevel(i){let s=null;for(let e=0,t=this.length;e<t;e++)if(this[e]===i){s=this.levels_.splice(e,1)[0];if(this.selectedIndex_===e)this.selectedIndex_=-1;else if(this.selectedIndex_>e)this.selectedIndex_--;break}if(s)this.trigger({qualityLevel:i,type:"removequalitylevel"});return s}getQualityLevelById(i){for(let e=0,t=this.length;e<t;e++){const s=this[e];if(s.id===i)return s}return null}dispose(){this.selectedIndex_=-1;this.levels_.length=0}}n.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const d in n.prototype.allowedEvents_)n.prototype["on"+d]=null;var a="3.0.0";const r=i["default"].registerPlugin||i["default"].plugin,o=function(e,t){const i=e.qualityLevels;const s=new n;const r=function(){s.dispose();e.qualityLevels=i;e.off("dispose",r)};e.on("dispose",r);e.qualityLevels=()=>s;e.qualityLevels.VERSION=a;return s},l=function(e){return o(this,i["default"].mergeOptions({},e))};return r("qualityLevels",l),l.VERSION=a,l}(T)});var gn=Dt(function(e,t){var i,n,s,r,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var s=a.parseURL(e);if(s)return s.path=a.normalizePath(s.path),a.buildURLFromParts(s);throw new Error("Error trying to parse base URL.")}s=a.parseURL(t);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return i.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):t;t=a.parseURL(e);if(!t)throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=n.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/");var r,e={scheme:t.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};return s.netLoc||(e.netLoc=t.netLoc,"/"!==s.path[0]&&(s.path?(r=(r=t.path).substring(0,r.lastIndexOf("/")+1)+s.path,e.path=a.normalizePath(r)):(e.path=t.path,s.params||(e.params=t.params,s.query)||(e.query=t.query)))),null===e.path&&(e.path=i.alwaysNormalize?a.normalizePath(s.path):s.path),a.buildURLFromParts(e)},parseURL:function(e){e=i.exec(e);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}),fn="http://example.com",Lr=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(t){this.on("data",function(e){t.push(e)})},e}();function yn(e){e=e;for(var t=window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}
- /*! @name m3u8-parser @version 6.0.0 @license Apache-2.0 */class _n extends Lr{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}function vn(e){var e=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t}function bn(t){var i={};if(t){var s,r=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let e=r.length;for(;e--;)""!==r[e]&&((s=/([^=]*)=(.*)/.exec(r[e]).slice(1))[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),i[s[0]]=s[1])}return i}const Tn=String.fromCharCode(9);class Sn extends Lr{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(i){let s,r;0!==(i=i.trim()).length&&("#"!==i[0]?this.trigger("data",{type:"uri",uri:i}):this.tagMappers.reduce((e,t)=>{t=t(i);return t===i?e:e.concat([t])},[i]).forEach(t=>{for(let e=0;e<this.customParsers.length;e++)if(this.customParsers[e].call(this,t))return;var e,i;0!==t.indexOf("#EXT")?this.trigger("data",{type:"comment",text:t.slice(1)}):(t=t.replace("\r",""),(s=/^#EXTM3U/.exec(t))?this.trigger("data",{type:"tag",tagType:"m3u"}):(s=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(t))?(r={type:"tag",tagType:"inf"},s[1]&&(r.duration=parseFloat(s[1])),s[2]&&(r.title=s[2]),this.trigger("data",r)):(s=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"targetduration"},s[1]&&(r.duration=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-VERSION:([0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"version"},s[1]&&(r.version=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"media-sequence"},s[1]&&(r.number=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(t))?(r={type:"tag",tagType:"discontinuity-sequence"},s[1]&&(r.number=parseInt(s[1],10)),this.trigger("data",r)):(s=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(t))?(r={type:"tag",tagType:"playlist-type"},s[1]&&(r.playlistType=s[1]),this.trigger("data",r)):(s=/^#EXT-X-BYTERANGE:(.*)?$/.exec(t))?(r=fi(vn(s[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",r)):(s=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(t))?(r={type:"tag",tagType:"allow-cache"},s[1]&&(r.allowed=!/NO/.test(s[1])),this.trigger("data",r)):(s=/^#EXT-X-MAP:(.*)$/.exec(t))?(r={type:"tag",tagType:"map"},s[1]&&((i=bn(s[1])).URI&&(r.uri=i.URI),i.BYTERANGE)&&(r.byterange=vn(i.BYTERANGE)),this.trigger("data",r)):(s=/^#EXT-X-STREAM-INF:(.*)$/.exec(t))?(r={type:"tag",tagType:"stream-inf"},s[1]&&(r.attributes=bn(s[1]),r.attributes.RESOLUTION&&(i={},(e=r.attributes.RESOLUTION.split("x"))[0]&&(i.width=parseInt(e[0],10)),e[1]&&(i.height=parseInt(e[1],10)),r.attributes.RESOLUTION=i),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),r.attributes["PROGRAM-ID"])&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10)),this.trigger("data",r)):(s=/^#EXT-X-MEDIA:(.*)$/.exec(t))?(r={type:"tag",tagType:"media"},s[1]&&(r.attributes=bn(s[1])),this.trigger("data",r)):(s=/^#EXT-X-ENDLIST/.exec(t))?this.trigger("data",{type:"tag",tagType:"endlist"}):(s=/^#EXT-X-DISCONTINUITY/.exec(t))?this.trigger("data",{type:"tag",tagType:"discontinuity"}):(s=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(t))?(r={type:"tag",tagType:"program-date-time"},s[1]&&(r.dateTimeString=s[1],r.dateTimeObject=new Date(s[1])),this.trigger("data",r)):(s=/^#EXT-X-KEY:(.*)$/.exec(t))?(r={type:"tag",tagType:"key"},s[1]&&(r.attributes=bn(s[1]),r.attributes.IV)&&("0x"===r.attributes.IV.substring(0,2).toLowerCase()&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=parseInt(r.attributes.IV[3],16),r.attributes.IV=new Uint32Array(r.attributes.IV)),this.trigger("data",r)):(s=/^#EXT-X-START:(.*)$/.exec(t))?(r={type:"tag",tagType:"start"},s[1]&&(r.attributes=bn(s[1]),r.attributes["TIME-OFFSET"]=parseFloat(r.attributes["TIME-OFFSET"]),r.attributes.PRECISE=/YES/.test(r.attributes.PRECISE)),this.trigger("data",r)):(s=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(t))?(r={type:"tag",tagType:"cue-out-cont"},s[1]?r.data=s[1]:r.data="",this.trigger("data",r)):(s=/^#EXT-X-CUE-OUT:(.*)?$/.exec(t))?(r={type:"tag",tagType:"cue-out"},s[1]?r.data=s[1]:r.data="",this.trigger("data",r)):(s=/^#EXT-X-CUE-IN:(.*)?$/.exec(t))?(r={type:"tag",tagType:"cue-in"},s[1]?r.data=s[1]:r.data="",this.trigger("data",r)):(s=/^#EXT-X-SKIP:(.*)$/.exec(t))&&s[1]?((r={type:"tag",tagType:"skip"}).attributes=bn(s[1]),r.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(r.attributes["SKIPPED-SEGMENTS"]=parseInt(r.attributes["SKIPPED-SEGMENTS"],10)),r.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(r.attributes["RECENTLY-REMOVED-DATERANGES"]=r.attributes["RECENTLY-REMOVED-DATERANGES"].split(Tn)),this.trigger("data",r)):(s=/^#EXT-X-PART:(.*)$/.exec(t))&&s[1]?((r={type:"tag",tagType:"part"}).attributes=bn(s[1]),["DURATION"].forEach(function(e){r.attributes.hasOwnProperty(e)&&(r.attributes[e]=parseFloat(r.attributes[e]))}),["INDEPENDENT","GAP"].forEach(function(e){r.attributes.hasOwnProperty(e)&&(r.attributes[e]=/YES/.test(r.attributes[e]))}),r.attributes.hasOwnProperty("BYTERANGE")&&(r.attributes.byterange=vn(r.attributes.BYTERANGE)),this.trigger("data",r)):(s=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(t))&&s[1]?((r={type:"tag",tagType:"server-control"}).attributes=bn(s[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(e){r.attributes.hasOwnProperty(e)&&(r.attributes[e]=parseFloat(r.attributes[e]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(e){r.attributes.hasOwnProperty(e)&&(r.attributes[e]=/YES/.test(r.attributes[e]))}),this.trigger("data",r)):(s=/^#EXT-X-PART-INF:(.*)$/.exec(t))&&s[1]?((r={type:"tag",tagType:"part-inf"}).attributes=bn(s[1]),["PART-TARGET"].forEach(function(e){r.attributes.hasOwnProperty(e)&&(r.attributes[e]=parseFloat(r.attributes[e]))}),this.trigger("data",r)):(s=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(t))&&s[1]?((r={type:"tag",tagType:"preload-hint"}).attributes=bn(s[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(e){var t;r.attributes.hasOwnProperty(e)&&(r.attributes[e]=parseInt(r.attributes[e],10),t="BYTERANGE-LENGTH"===e?"length":"offset",r.attributes.byterange=r.attributes.byterange||{},r.attributes.byterange[t]=r.attributes[e],delete r.attributes[e])}),this.trigger("data",r)):(s=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(t))&&s[1]?((r={type:"tag",tagType:"rendition-report"}).attributes=bn(s[1]),["LAST-MSN","LAST-PART"].forEach(function(e){r.attributes.hasOwnProperty(e)&&(r.attributes[e]=parseInt(r.attributes[e],10))}),this.trigger("data",r)):this.trigger("data",{type:"tag",data:t.slice(4)}))}))}addParser({expression:t,customType:i,dataParser:s,segment:r}){"function"!=typeof s&&(s=e=>e),this.customParsers.push(e=>{if(t.exec(e))return this.trigger("data",{type:"custom",data:s(e),customType:i,segment:r}),!0})}addTagMapper({expression:t,map:i}){this.tagMappers.push(e=>t.test(e)?i(e):e)}}function wn(t){const i={};return Object.keys(t).forEach(function(e){i[e.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase())]=t[e]}),i}function En(e){var t,i,s,r,n,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",s="partHoldBack",r=a&&3*a,n=o&&2*o,a&&!e.hasOwnProperty(i)&&(e[i]=r,this.trigger("info",{message:t+` defaulting HOLD-BACK to targetDuration * 3 (${r}).`})),r&&e[i]<r&&(this.trigger("warn",{message:t+` clamping HOLD-BACK (${e[i]}) to targetDuration * 3 (${r})`}),e[i]=r),o&&!e.hasOwnProperty(s)&&(e[s]=3*o,this.trigger("info",{message:t+` defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[s]}).`})),o)&&e[s]<n&&(this.trigger("warn",{message:t+` clamping PART-HOLD-BACK (${e[s]}) to partTargetDuration * 2 (${n}).`}),e[s]=n)}class kn extends Lr{constructor(){super(),this.lineStream=new _n,this.parseStream=new Sn,this.lineStream.pipe(this.parseStream);const e=this,s=[];let a={},r,o,l=!1;const d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}};let h=0,u=(this.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},0),c=0;this.on("end",()=>{a.uri||!a.parts&&!a.preloadHints||(!a.map&&r&&(a.map=r),!a.key&&o&&(a.key=o),a.timeline||"number"!=typeof h||(a.timeline=h),this.manifest.preloadSegment=a)}),this.parseStream.on("data",function(n){let t,i;({tag(){({version(){n.version&&(this.manifest.version=n.version)},"allow-cache"(){this.manifest.allowCache=n.allowed,"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var e={};"length"in n&&((a.byterange=e).length=n.length,"offset"in n||(n.offset=u)),"offset"in n&&((a.byterange=e).offset=n.offset),u=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),0<n.duration&&(a.duration=n.duration),0===n.duration&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key(){if(n.attributes)if("NONE"===n.attributes.METHOD)o=null;else if(n.attributes.URI)if("com.apple.streamingkeydelivery"===n.attributes.KEYFORMAT)this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:n.attributes};else if("com.microsoft.playready"===n.attributes.KEYFORMAT)this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:n.attributes.URI};else{if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===n.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(n.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===n.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==n.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):n.attributes.KEYID&&"0x"===n.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:n.attributes.KEYFORMAT,keyId:n.attributes.KEYID.substring(2)},pssh:yn(n.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));n.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),o={method:n.attributes.METHOD||"AES-128",uri:n.attributes.URI},"undefined"!=typeof n.attributes.IV&&(o.iv=n.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(n.number)?this.manifest.mediaSequence=n.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+n.number})},"discontinuity-sequence"(){isFinite(n.number)?(this.manifest.discontinuitySequence=n.number,h=n.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+n.number})},"playlist-type"(){/VOD|EVENT/.test(n.playlistType)?this.manifest.playlistType=n.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+n.playlist})},map(){r={},n.uri&&(r.uri=n.uri),n.byterange&&(r.byterange=n.byterange),o&&(r.key=o)},"stream-inf"(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||d,n.attributes?(a.attributes||(a.attributes={}),fi(a.attributes,n.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){var e;this.manifest.mediaGroups=this.manifest.mediaGroups||d,n.attributes&&n.attributes.TYPE&&n.attributes["GROUP-ID"]&&n.attributes.NAME?((e=this.manifest.mediaGroups[n.attributes.TYPE])[n.attributes["GROUP-ID"]]=e[n.attributes["GROUP-ID"]]||{},t=e[n.attributes["GROUP-ID"]],(i={default:/yes/i.test(n.attributes.DEFAULT)}).default?i.autoselect=!0:i.autoselect=/yes/i.test(n.attributes.AUTOSELECT),n.attributes.LANGUAGE&&(i.language=n.attributes.LANGUAGE),n.attributes.URI&&(i.uri=n.attributes.URI),n.attributes["INSTREAM-ID"]&&(i.instreamId=n.attributes["INSTREAM-ID"]),n.attributes.CHARACTERISTICS&&(i.characteristics=n.attributes.CHARACTERISTICS),n.attributes.FORCED&&(i.forced=/yes/i.test(n.attributes.FORCED)),t[n.attributes.NAME]=i):this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity(){h+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time"(){"undefined"==typeof this.manifest.dateTimeString&&(this.manifest.dateTimeString=n.dateTimeString,this.manifest.dateTimeObject=n.dateTimeObject),a.dateTimeString=n.dateTimeString,a.dateTimeObject=n.dateTimeObject},targetduration(){!isFinite(n.duration)||n.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration}):(this.manifest.targetDuration=n.duration,En.call(this,this.manifest))},start(){!n.attributes||isNaN(n.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}},"cue-out"(){a.cueOut=n.data},"cue-out-cont"(){a.cueOutCont=n.data},"cue-in"(){a.cueIn=n.data},skip(){this.manifest.skip=wn(n.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",n.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;var e=this.manifest.segments.length,t=wn(n.attributes),t=(a.parts=a.parts||[],a.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=c),c=t.byterange.offset+t.byterange.length),a.parts.length-1);this.warnOnMissingAttributes_(`#EXT-X-PART #${t} for segment #`+e,n.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})})},"server-control"(){var e=this.manifest.serverControl=wn(n.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),En.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){var t=this.manifest.segments.length,i=wn(n.attributes),e=i.type&&"PART"===i.type,s=(a.preloadHints=a.preloadHints||[],a.preloadHints.push(i),!i.byterange||i.byterange.hasOwnProperty("offset")||(i.byterange.offset=e?c:0,e&&(c=i.byterange.offset+i.byterange.length)),a.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${s} for segment #`+t,n.attributes,["TYPE","URI"]),i.type)for(let e=0;e<a.preloadHints.length-1;e++){var r=a.preloadHints[e];r.type&&r.type===i.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${s} for segment #${t} has the same TYPE ${i.type} as preload hint #`+e})}},"rendition-report"(){var e=wn(n.attributes),e=(this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(e),this.manifest.renditionReports.length-1),t=["LAST-MSN","URI"];l&&t.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+e,n.attributes,t)},"part-inf"(){this.manifest.partInf=wn(n.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",n.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),En.call(this,this.manifest)}}[n.tagType]||function(){}).call(e)},uri(){a.uri=n.uri,s.push(a),!this.manifest.targetDuration||"duration"in a||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),o&&(a.key=o),a.timeline=h,r&&(a.map=r),c=0,a={}},comment(){},custom(){n.segment?(a.custom=a.custom||{},a.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(e)})}warnOnMissingAttributes_(e,t,i){const s=[];i.forEach(function(e){t.hasOwnProperty(e)||s.push(e)}),s.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+s.join(", ")})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}function Cn(e){return Dn.audio.test((e=void 0===e?"":e).trim().toLowerCase())}function In(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(Bn(e))||!1}function xn(e){return(e=void 0===e?"":e).toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<Mn.length;t++){var i=Mn[t];if(Dn["muxer"+i].test(e))return!0}return!1})}function An(e){return jn.test(e)?"hls":Hn.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null}function Pn(e,t){for(var i=void 0!==(t=(void 0===t?{}:t).le)&&t,s=(e=w(e="bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e?0:e),t=e,Math.ceil(t.toString(2).length/8)),r=new Uint8Array(new ArrayBuffer(s)),n=0;n<s;n++){var a=i?n:Math.abs(n+1-r.length);r[a]=Number(e/Vn[n]&w(255)),e<0&&(r[a]=Math.abs(~r[a]),r[a]-=0===n?1:2)}return r}function Ln(e,t){if("string"!=typeof(e="string"!=typeof e&&e&&"function"==typeof e.toString?e.toString():e))return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i}function On(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,s=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||Wn):/\/\//i.test(e)||(e=gn.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(Wn.length):s?i.href.slice(i.protocol.length):i.href):gn.buildAbsoluteURL(e,t)}var Dn={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},Nn=["video","audio","text"],Mn=["Video","Audio","Text"],Rn=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})},Un=function(e){var e=(e=void 0===e?"":e).split(","),n=[];return e.forEach(function(s){var r;s=s.trim(),Nn.forEach(function(e){var t,i=Dn[e].exec(s.toLowerCase());!i||i.length<=1||(r=e,i=s.substring(0,i[1].length),t=s.replace(i,""),n.push({type:i,details:t,mediaType:e}))}),r||n.push({type:s,details:"",mediaType:"unknown"})}),n},Bn=function(e){var t,i,s;if(e&&"string"==typeof e)return i="video",1===(t=e.toLowerCase().split(",").map(function(e){return Rn(e.trim())})).length&&Cn(t[0])?i="audio":1===t.length&&(s=t[0],Dn.text.test((s=void 0===s?"":s).trim().toLowerCase()))&&(i="application"),s="mp4",t.every(function(e){return Dn.mp4.test(e)})?s="mp4":t.every(function(e){return Dn.webm.test(e)})?s="webm":t.every(function(e){return Dn.ogg.test(e)})&&(s="ogg"),i+"/"+s+';codecs="'+e+'"'},Fn="mp4a.40.2",jn=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Hn=/^application\/dash\+xml/i,qn=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},S=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||qn(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},w=window.BigInt||Number,Vn=[w("0x1"),w("0x100"),w("0x10000"),w("0x1000000"),w("0x100000000"),w("0x10000000000"),w("0x1000000000000"),w("0x100000000000000"),w("0x10000000000000000")],$n=(Ot=new Uint16Array([65484]),255!==(Ot=new Uint8Array(Ot.buffer,Ot.byteOffset,Ot.byteLength))[0]&&Ot[0],function(s,e){var e=void 0===e?{}:e,t=e.signed,t=void 0!==t&&t,e=e.le,r=void 0!==e&&e,e=(s=S(s),r?"reduce":"reduceRight"),e=(s[e]||Array.prototype[e]).call(s,function(e,t,i){i=r?i:Math.abs(i+1-s.length);return e+w(t)*Vn[i]},w(0));return t&&(t=Vn[s.length]/w(2)-w(1))<(e=w(e))&&(e=(e=e-t-t)-w(2)),Number(e)}),E=function(i,e,t){var t=void 0===t?{}:t,s=t.offset,r=void 0===s?0:s,s=t.mask,n=void 0===s?[]:s,t=(i=S(i),(e=S(e)).every||Array.prototype.every);return e.length&&i.length-r>=e.length&&t.call(e,function(e,t){return e===(n[t]?n[t]&i[r+t]:i[r+t])})},Wn="http://example.com";function Gn(e){e=e;for(var t=window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return i}function zn(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var Xn=zn({HTML:"text/html",isHTML:function(e){return e===Xn.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Kn=zn({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Kn.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),Yn={assign:function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},find:function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var s=0;s<e.length;s++)if(Object.prototype.hasOwnProperty.call(e,s)){var r=e[s];if(t.call(void 0,r,s,e))return r}},freeze:zn,MIME_TYPE:Xn,NAMESPACE:Kn},Qn=Yn.find,Jn=Yn.NAMESPACE;function Zn(e){return""!==e}function ea(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function ta(e){return e?(e=(e=e)?e.split(/[\t\n\f\r ]+/).filter(Zn):[],Object.keys(e.reduce(ea,{}))):[]}function ia(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function sa(e,t){var i=e.prototype;function s(){}i instanceof t||(s.prototype=t.prototype,ia(i,s=new s),e.prototype=i=s),i.constructor!=e&&(i.constructor=e)}var n={},t=(n.ELEMENT_NODE=1,n.ATTRIBUTE_NODE=2,n.TEXT_NODE=3,n.CDATA_SECTION_NODE=4,n.ENTITY_REFERENCE_NODE=5,n.ENTITY_NODE=6,n.PROCESSING_INSTRUCTION_NODE=7,n.COMMENT_NODE=8,n.DOCUMENT_NODE=9,n.DOCUMENT_TYPE_NODE=10,n.DOCUMENT_FRAGMENT_NODE=11,n.NOTATION_NODE=12,{}),k={},ra=(t.INDEX_SIZE_ERR=(k[1]="Index size error",1),t.DOMSTRING_SIZE_ERR=(k[2]="DOMString size error",2),t.HIERARCHY_REQUEST_ERR=(k[3]="Hierarchy request error",3)),na=(t.WRONG_DOCUMENT_ERR=(k[4]="Wrong document",4),t.INVALID_CHARACTER_ERR=(k[5]="Invalid character",5),t.NO_DATA_ALLOWED_ERR=(k[6]="No data allowed",6),t.NO_MODIFICATION_ALLOWED_ERR=(k[7]="No modification allowed",7),t.NOT_FOUND_ERR=(k[8]="Not found",8));t.NOT_SUPPORTED_ERR=(k[9]="Not supported",9),t.INUSE_ATTRIBUTE_ERR=(k[10]="Attribute in use",10);function C(e,t){var i;return t instanceof Error?i=t:(i=this,Error.call(this,k[e]),this.message=k[e],Error.captureStackTrace&&Error.captureStackTrace(this,C)),i.code=e,t&&(this.message=this.message+": "+t),i}function aa(){}function oa(e,t){this._node=e,this._refresh=t,la(this)}function la(e){var t,i=e._node._inc||e._node.ownerDocument._inc;e._inc!=i&&(t=e._refresh(e._node),Ga(e,"length",t.length),ia(t,e),e._inc=i)}function da(){}function ha(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function ua(e,t,i,s){s?t[ha(t,s)]=i:t[t.length++]=i,e&&(t=(i.ownerElement=e).ownerDocument)&&(s&&ya(t,e,s),s=e,e=i,(i=t)&&i._inc++,e.namespaceURI===Jn.XMLNS)&&(s._nsMap[e.prefix?e.localName:""]=e.value)}function ca(e,t,i){var s=ha(t,i);if(!(0<=s))throw new C(na,new Error(e.tagName+"@"+i));for(var r,n=t.length-1;s<n;)t[s]=t[++s];t.length=n,e&&(r=e.ownerDocument)&&(ya(r,e,i),i.ownerElement=null)}function pa(){}function I(){}function ma(e){return("<"==e?"<":">"==e&&">")||("&"==e?"&":'"'==e&&""")||"&#"+e.charCodeAt()+";"}function ga(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(ga(e,t))return 1}while(e=e.nextSibling)}function fa(){this.ownerDocument=this}function ya(e,t,i){e&&e._inc++,i.namespaceURI===Jn.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function _a(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)r=(s[n++]=r).nextSibling;s.length=n,delete s[s.length]}}}function va(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,_a(e.ownerDocument,e),t}function ba(e){return e&&e.nodeType===I.DOCUMENT_TYPE_NODE}function Ta(e){return e&&e.nodeType===I.ELEMENT_NODE}function Sa(e){return e&&e.nodeType===I.TEXT_NODE}function wa(e,t){var i,e=e.childNodes||[];if(!Qn(e,Ta)&&!ba(t))return i=Qn(e,ba),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Ea(e,t){var i,e=e.childNodes||[];if(!Qn(e,function(e){return Ta(e)&&e!==t}))return i=Qn(e,ba),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function ka(e,t,i){if(!(s=e)||s.nodeType!==I.DOCUMENT_NODE&&s.nodeType!==I.DOCUMENT_FRAGMENT_NODE&&s.nodeType!==I.ELEMENT_NODE)throw new C(ra,"Unexpected parent node type "+e.nodeType);var s;if(i&&i.parentNode!==e)throw new C(na,"child not in parent");if(!(s=t)||!(Ta(s)||Sa(s)||ba(s)||s.nodeType===I.DOCUMENT_FRAGMENT_NODE||s.nodeType===I.COMMENT_NODE||s.nodeType===I.PROCESSING_INSTRUCTION_NODE)||ba(t)&&e.nodeType!==I.DOCUMENT_NODE)throw new C(ra,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Ca(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===I.DOCUMENT_FRAGMENT_NODE){var n=r.filter(Ta);if(1<n.length||Qn(r,Sa))throw new C(ra,"More than one element or text in fragment");if(1===n.length&&!wa(e,i))throw new C(ra,"Element in fragment can not be inserted before doctype")}if(Ta(t)&&!wa(e,i))throw new C(ra,"Only one element can be added and only after doctype");if(ba(t)){if(Qn(s,ba))throw new C(ra,"Only one doctype is allowed");r=Qn(s,Ta);if(i&&s.indexOf(r)<s.indexOf(i))throw new C(ra,"Doctype can only be inserted before an element");if(!i&&r)throw new C(ra,"Doctype can not be appended since element is present")}}function Ia(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===I.DOCUMENT_FRAGMENT_NODE){var n=r.filter(Ta);if(1<n.length||Qn(r,Sa))throw new C(ra,"More than one element or text in fragment");if(1===n.length&&!Ea(e,i))throw new C(ra,"Element in fragment can not be inserted before doctype")}if(Ta(t)&&!Ea(e,i))throw new C(ra,"Only one element can be added and only after doctype");if(ba(t)){if(Qn(s,function(e){return ba(e)&&e!==i}))throw new C(ra,"Only one doctype is allowed");r=Qn(s,Ta);if(i&&s.indexOf(r)<s.indexOf(i))throw new C(ra,"Doctype can only be inserted before an element")}}function xa(e,t,i,s){ka(e,t,i),e.nodeType===I.DOCUMENT_NODE&&(s||Ca)(e,t,i);s=t.parentNode;if(s&&s.removeChild(t),11===t.nodeType){var r=t.firstChild;if(null==r)return t;var n=t.lastChild}else r=n=t;s=i?i.previousSibling:e.lastChild;for(r.previousSibling=s,n.nextSibling=i,s?s.nextSibling=r:e.firstChild=r,null==i?e.lastChild=n:i.previousSibling=n;r.parentNode=e,r!==n&&(r=r.nextSibling););return _a(e.ownerDocument||e,e),11==t.nodeType&&(t.firstChild=t.lastChild=null),t}function Aa(){this._nsMap={}}function Pa(){}function La(){}function Oa(){}function Da(){}function Na(){}function Ma(){}function Ra(){}function Ua(){}function Ba(){}function Fa(){}function ja(){}function Ha(){}function qa(e,t){var i,s=[],r=9==this.nodeType&&this.documentElement||this,n=r.prefix,a=r.namespaceURI;return Wa(this,s,e,t,i=a&&null==n&&null==r.lookupPrefix(a)?[{namespace:a,prefix:null}]:i),s.join("")}function Va(e,t,i){var s=e.prefix||"",r=e.namespaceURI;if(r&&("xml"!==s||r!==Jn.XML)&&r!==Jn.XMLNS){for(var n=i.length;n--;){var a=i[n];if(a.prefix===s)return a.namespace!==r}return 1}}function $a(e,t,i){e.push(" ",t,'="',i.replace(/[<>&"\t\n\r]/g,ma),'"')}function Wa(e,t,i,s,r){if(r=r||[],s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case 1:var n=e.attributes,a=n.length,o=e.firstChild,l=e.tagName,d=l;if(!(i=Jn.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var h,u=0;u<n.length;u++)if("xmlns"===n.item(u).name){h=n.item(u).value;break}if(!h)for(var c=r.length-1;0<=c;c--)if(""===(p=r[c]).prefix&&p.namespace===e.namespaceURI){h=p.namespace;break}if(h!==e.namespaceURI)for(var p,c=r.length-1;0<=c;c--)if((p=r[c]).namespace===e.namespaceURI){p.prefix&&(d=p.prefix+":"+l);break}}t.push("<",d);for(var m=0;m<a;m++)"xmlns"==(g=n.item(m)).prefix?r.push({prefix:g.localName,namespace:g.value}):"xmlns"==g.nodeName&&r.push({prefix:"",namespace:g.value});for(var g,f,y,m=0;m<a;m++)Va(g=n.item(m),0,r)&&($a(t,(f=g.prefix||"")?"xmlns:"+f:"xmlns",y=g.namespaceURI),r.push({prefix:f,namespace:y})),Wa(g,t,i,s,r);if(l===d&&Va(e,0,r)&&($a(t,(f=e.prefix||"")?"xmlns:"+f:"xmlns",y=e.namespaceURI),r.push({prefix:f,namespace:y})),o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),i&&/^script$/i.test(l))for(;o;)o.data?t.push(o.data):Wa(o,t,i,s,r.slice()),o=o.nextSibling;else for(;o;)Wa(o,t,i,s,r.slice()),o=o.nextSibling;t.push("</",d,">")}else t.push("/>");return;case 9:case 11:for(o=e.firstChild;o;)Wa(o,t,i,s,r.slice()),o=o.nextSibling;return;case 2:return $a(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,ma));case 4:return t.push("<![CDATA[",e.data,"]]>");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("<!DOCTYPE ",e.name),void(_?(t.push(" PUBLIC ",_),v&&"."!=v&&t.push(" ",v),t.push(">")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("<?",e.target," ",e.data,"?>");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ga(e,t,i){e[t]=i}t.INVALID_STATE_ERR=(k[11]="Invalid state",11),t.SYNTAX_ERR=(k[12]="Syntax error",12),t.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),t.NAMESPACE_ERR=(k[14]="Invalid namespace",14),t.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),C.prototype=Error.prototype,ia(t,C),aa.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],s=0;s<this.length;s++)Wa(this[s],i,e,t);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},oa.prototype.item=function(e){return la(this),this[e]},sa(oa,aa),da.prototype={length:0,item:aa.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new C(10);t=this.getNamedItem(e.nodeName);return ua(this._ownerElement,this,e,t),t},setNamedItemNS:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new C(10);return t=this.getNamedItemNS(e.namespaceURI,e.localName),ua(this._ownerElement,this,e,t),t},removeNamedItem:function(e){e=this.getNamedItem(e);return ca(this._ownerElement,this,e),e},removeNamedItemNS:function(e,t){e=this.getNamedItemNS(e,t);return ca(this._ownerElement,this,e),e},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var s=this[i];if(s.localName==t&&s.namespaceURI==e)return s}return null}},pa.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var s=new fa;return s.implementation=this,s.childNodes=new aa,s.doctype=i||null,i&&s.appendChild(i),t&&(i=s.createElementNS(e,t),s.appendChild(i)),s},createDocumentType:function(e,t,i){var s=new Ma;return s.name=e,s.nodeName=e,s.publicId=t||"",s.systemId=i||"",s}},I.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return xa(this,e,t)},replaceChild:function(e,t){xa(this,e,t,Ia),t&&this.removeChild(t)},removeChild:function(e){return va(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,i,s){var r=new i.constructor;for(var n in i){var a;Object.prototype.hasOwnProperty.call(i,n)&&"object"!=typeof(a=i[n])&&a!=r[n]&&(r[n]=a)}i.childNodes&&(r.childNodes=new aa);r.ownerDocument=t;switch(r.nodeType){case 1:var o=i.attributes,l=r.attributes=new da,d=o.length;l._ownerElement=r;for(var h=0;h<d;h++)r.setAttributeNode(e(t,o.item(h),!0));break;case 2:s=!0}if(s)for(var u=i.firstChild;u;)r.appendChild(e(t,u,s)),u=u.nextSibling;return r}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&3==t.nodeType&&3==e.nodeType?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return 0<this.attributes.length},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&i[s]===e)return s;t=2==t.nodeType?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=2==t.nodeType?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},ia(n,I),ia(n,I.prototype),fa.prototype={nodeName:"#document",nodeType:9,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(11==e.nodeType)for(var i=e.firstChild;i;){var s=i.nextSibling;this.insertBefore(i,t),i=s}else xa(this,e,t),null===(e.ownerDocument=this).documentElement&&1===e.nodeType&&(this.documentElement=e);return e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),va(this,e)},replaceChild:function(e,t){xa(this,e,t,Ia),e.ownerDocument=this,t&&this.removeChild(t),Ta(e)&&(this.documentElement=e)},importNode:function(e,t){return function e(t,i,s){var r;switch(i.nodeType){case 1:(r=i.cloneNode(!1)).ownerDocument=t;case 11:break;case 2:s=!0}r=r||i.cloneNode(!1);r.ownerDocument=t;r.parentNode=null;if(s)for(var n=i.firstChild;n;)r.appendChild(e(t,n,s)),n=n.nextSibling;return r}(this,e,t)},getElementById:function(t){var i=null;return ga(this.documentElement,function(e){if(1==e.nodeType&&e.getAttribute("id")==t)return i=e,!0}),i},getElementsByClassName:function(a){var o=ta(a);return new oa(this,function(r){var n=[];return 0<o.length&&ga(r.documentElement,function(e){var t,i,s;e!==r&&1===e.nodeType&&(t=e.getAttribute("class"))&&((i=a===t)||(t=ta(t),i=o.every((s=t,function(e){return s&&-1!==s.indexOf(e)}))),i)&&n.push(e)}),n})},createElement:function(e){var t=new Aa;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new aa,(t.attributes=new da)._ownerElement=t},createDocumentFragment:function(){var e=new Fa;return e.ownerDocument=this,e.childNodes=new aa,e},createTextNode:function(e){var t=new Oa;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Da;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Na;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new ja;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Pa;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Ba;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Aa,s=t.split(":"),r=i.attributes=new da;return i.childNodes=new aa,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,r._ownerElement=i},createAttributeNS:function(e,t){var i=new Pa,s=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==s.length?(i.prefix=s[0],i.localName=s[1]):i.localName=t,i}},sa(fa,I),fa.prototype.getElementsByTagName=(Aa.prototype={nodeType:1,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){e=this.getAttributeNode(e);return e&&e.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){e=this.ownerDocument.createAttribute(e);e.value=e.nodeValue=""+t,this.setAttributeNode(e)},removeAttribute:function(e){e=this.getAttributeNode(e);e&&this.removeAttributeNode(e)},appendChild:function(e){return 11===e.nodeType?this.insertBefore(e,null):(t=this,(e=e).parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,_a(t.ownerDocument,t,e),e);var t},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){e=this.getAttributeNodeNS(e,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){e=this.getAttributeNodeNS(e,t);return e&&e.value||""},setAttributeNS:function(e,t,i){e=this.ownerDocument.createAttributeNS(e,t);e.value=e.nodeValue=""+i,this.setAttributeNode(e)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(s){return new oa(this,function(t){var i=[];return ga(t,function(e){e===t||1!=e.nodeType||"*"!==s&&e.tagName!=s||i.push(e)}),i})},getElementsByTagNameNS:function(s,r){return new oa(this,function(t){var i=[];return ga(t,function(e){e===t||1!==e.nodeType||"*"!==s&&e.namespaceURI!==s||"*"!==r&&e.localName!=r||i.push(e)}),i})}}).getElementsByTagName,fa.prototype.getElementsByTagNameNS=Aa.prototype.getElementsByTagNameNS,sa(Aa,I),Pa.prototype.nodeType=2,sa(Pa,I),La.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(k[ra])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){var s=this.data.substring(0,e),e=this.data.substring(e+t);this.nodeValue=this.data=i=s+i+e,this.length=i.length}},sa(La,I),Oa.prototype={nodeName:"#text",nodeType:3,splitText:function(e){var t=(i=this.data).substring(e),i=i.substring(0,e),e=(this.data=this.nodeValue=i,this.length=i.length,this.ownerDocument.createTextNode(t));return this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling),e}},sa(Oa,La),Da.prototype={nodeName:"#comment",nodeType:8},sa(Da,La),Na.prototype={nodeName:"#cdata-section",nodeType:4},sa(Na,La),Ma.prototype.nodeType=10,sa(Ma,I),Ra.prototype.nodeType=12,sa(Ra,I),Ua.prototype.nodeType=6,sa(Ua,I),Ba.prototype.nodeType=5,sa(Ba,I),Fa.prototype.nodeName="#document-fragment",Fa.prototype.nodeType=11,sa(Fa,I),ja.prototype.nodeType=7,sa(ja,I),Ha.prototype.serializeToString=function(e,t,i){return qa.call(e,t,i)},I.prototype.toString=qa;try{Object.defineProperty&&(Object.defineProperty(oa.prototype,"length",{get:function(){return la(this),this.$$length}}),Object.defineProperty(I.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case 1:case 11:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case 1:case 11:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ga=function(e,t,i){e["$$"+t]=i})}catch(e){}var Pr={DocumentType:Ma,DOMException:C,DOMImplementation:pa,Element:Aa,Node:I,NodeList:aa,XMLSerializer:Ha},za=Dt(function(e,t){var i=Yn.freeze;t.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES}),Xa=(za.XML_ENTITIES,za.HTML_ENTITIES,za.entityMap,Yn.NAMESPACE),Rr=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Mr=new RegExp("[\\-\\.0-9"+Rr.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Ka=new RegExp("^"+Rr.source+Mr.source+"*(?::"+Rr.source+Mr.source+"*)?$"),Ya=0,Qa=1,Ja=2,Za=3,eo=4,to=5,io=6,so=7;function ro(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,ro)}function no(){}function ao(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function oo(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value,o=0<(h=o.indexOf(":"))?(d=a.prefix=o.slice(0,h),u=o.slice(h+1),"xmlns"===d&&u):(d=null,"xmlns"===(u=o)&&"");a.localName=u,!1!==o&&(null==r&&(r={},lo(i,i={})),i[o]=r[o]=l,a.uri=Xa.XMLNS,t.startPrefixMapping(o,l))}for(var d,n=e.length;n--;)(d=(a=e[n]).prefix)&&("xml"===d&&(a.uri=Xa.XML),"xmlns"!==d)&&(a.uri=i[d||""]);var h,u=0<(h=s.indexOf(":"))?(d=e.prefix=s.slice(0,h),e.localName=s.slice(h+1)):(d=null,e.localName=s),c=e.uri=i[d||""];if(t.startElement(c,u,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,u,s),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function lo(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function ho(){this.attributeNames={}}(ro.prototype=new Error).name=ro.name,no.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),lo(t,t={}),function(i,e,s,r,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(s,t)?s[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(n.error("entity not found:"+e),e)}function t(e){var t;m<e&&(t=i.substring(m,e).replace(/&#?\w+;/g,a),u&&o(m),r.characters(t,0,e-m),m=e)}function o(e,t){for(;d<=e&&(t=h.exec(i));)l=t.index,d=l+t[0].length,u.lineNumber++;u.columnNumber=e-l+1}var l=0,d=0,h=/.*(?:\r\n?|\n)|.*$/g,u=r.locator,c=[{currentNSMap:e}],p={},m=0;for(;;){try{var g,f,y=i.indexOf("<",m);if(y<0)return i.substr(m).match(/^\s*$/)||(g=r.doc,f=g.createTextNode(i.substr(m)),g.appendChild(f),r.currentElement=f);switch(m<y&&t(y),i.charAt(y+1)){case"/":var _=i.indexOf(">",y+3),v=i.substring(y+2,_).replace(/[ \t\n\r]+$/g,""),b=c.pop(),T=(_<0?(v=i.substring(y+2).replace(/[\s<].*/,""),n.error("end tag name: "+v+" is not complete:"+b.tagName),_=y+1+v.length):v.match(/\s</)&&(v=v.replace(/[\s<].*/,""),n.error("end tag name: "+v+" maybe not complete"),_=y+1+v.length),b.localNSMap),S=b.tagName==v;if(S||b.tagName&&b.tagName.toLowerCase()==v.toLowerCase()){if(r.endElement(b.uri,b.localName,v),T)for(var w in T)Object.prototype.hasOwnProperty.call(T,w)&&r.endPrefixMapping(w);S||n.fatalError("end tag name: "+v+" is not match the current start tagName:"+b.tagName)}else c.push(b);_++;break;case"?":u&&o(y),_=function(e,t,i){var s=e.indexOf("?>",t);if(s){e=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(e)return e[0].length,i.processingInstruction(e[1],e[2]),s+2}return-1}(i,y,r);break;case"!":u&&o(y),_=function(e,t,i,s){{if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4),t<n?(i.comment(e,t+4,n-t-4),n+3):(s.error("Unclosed comment"),-1)):-1;if("CDATA["==e.substr(t+3,6))return n=e.indexOf("]]>",t+9),i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3;var r,s=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(s.push(i),i[1])return s}(e,t),n=s.length;if(1<n&&/!doctype/i.test(s[0][0]))return e=s[1][0],r=t=!1,3<n&&(/^public$/i.test(s[2][0])?(t=s[3][0],r=4<n&&s[4][0]):/^system$/i.test(s[2][0])&&(r=s[3][0])),s=s[n-1],i.startDTD(e,t,r),i.endDTD(),s.index+s[0].length}return-1}(i,y,r,n);break;default:u&&o(y);var E=new ho,k=c[c.length-1].currentNSMap,_=function(e,t,s,i,r,n){function a(e,t,i){s.attributeNames.hasOwnProperty(e)&&n.fatalError("Attribute "+e+" redefined"),s.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),i)}var o,l=++t,d=Ya;for(;;){var h=e.charAt(l);switch(h){case"=":if(d===Qa)o=e.slice(t,l);else if(d!==Ja)throw new Error("attribute equal must after attrName");d=Za;break;case"'":case'"':if(d===Za||d===Qa){if(d===Qa&&(n.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!(0<(l=e.indexOf(h,t))))throw new Error("attribute value no end '"+h+"' match");u=e.slice(t,l),a(o,u,t-1)}else{if(d!=eo)throw new Error('attribute value must after "="');u=e.slice(t,l),a(o,u,t),n.warning('attribute "'+o+'" missed start quot('+h+")!!"),t=l+1}d=to;break;case"/":switch(d){case Ya:s.setTagName(e.slice(t,l));case to:case io:case so:d=so,s.closed=!0;case eo:case Qa:case Ja:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),d==Ya&&s.setTagName(e.slice(t,l)),l;case">":switch(d){case Ya:s.setTagName(e.slice(t,l));case to:case io:case so:break;case eo:case Qa:"/"===(u=e.slice(t,l)).slice(-1)&&(s.closed=!0,u=u.slice(0,-1));case Ja:d===Ja&&(u=o),d==eo?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):(Xa.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case Za:throw new Error("attribute value missed!!")}return l;case"":h=" ";default:if(h<=" ")switch(d){case Ya:s.setTagName(e.slice(t,l)),d=io;break;case Qa:o=e.slice(t,l),d=Ja;break;case eo:var u=e.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case to:d=io}else switch(d){case Ja:s.tagName,Xa.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,d=Qa;break;case to:n.warning('attribute space is required"'+o+'"!!');case io:d=Qa,t=l;break;case Za:d=eo,t=l;break;case so:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(i,y,E,k,a,n),C=E.length;if(!E.closed&&function(e,t,i,s){var r=s[i];null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),s[i]=r);return r<t}(i,_,E.tagName,p)&&(E.closed=!0,s.nbsp||n.warning("unclosed xml attribute")),u&&C){for(var I=ao(u,{}),x=0;x<C;x++){var A=E[x];o(A.offset),A.locator=ao(u,{})}r.locator=I,oo(E,r,k)&&c.push(E),r.locator=u}else oo(E,r,k)&&c.push(E);Xa.isHTML(E.uri)&&!E.closed?_=function(e,t,i,s,r){if(/^(?:script|textarea)$/i.test(i)){var n=e.indexOf("</"+i+">",t),e=e.substring(t+1,n);if(/[&<]/.test(e))return/^script$/i.test(i)?r.characters(e,0,e.length):(e=e.replace(/&#?\w+;/g,s),r.characters(e,0,e.length)),n}return t+1}(i,_,E.tagName,a,r):_++}}catch(e){if(e instanceof ro)throw e;n.error("element parse error: "+e),_=-1}m<_?m=_:t(Math.max(y,m)+1)}}(e,t,i,s,this.errorHandler),s.endDocument()}},ho.prototype={setTagName:function(e){if(!Ka.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Ka.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Nr={XMLReader:no,ParseError:ro},uo=Pr.DOMImplementation,co=Yn.NAMESPACE,po=Nr.ParseError,mo=Nr.XMLReader;function go(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function fo(e){this.options=e||{locator:{}}}function yo(){this.cdata=!1}function _o(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function vo(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function bo(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function To(e,t){(e.currentElement||e.doc).appendChild(t)}fo.prototype.parseFromString=function(e,t){var i=this.options,s=new mo,r=i.domBuilder||new yo,n=i.errorHandler,a=i.locator,o=i.xmlns||{},t=/\/x?html?$/.test(t),l=t?za.HTML_ENTITIES:za.XML_ENTITIES,n=(a&&r.setDocumentLocator(a),s.errorHandler=function(s,e,r){if(!s){if(e instanceof yo)return e;s=e}var n={},a=s instanceof Function;function t(t){var i=s[t];!i&&a&&(i=2==s.length?function(e){s(t,e)}:s),n[t]=i?function(e){i("[xmldom "+t+"]\t"+e+vo(r))}:function(){}}return r=r||{},t("warning"),t("error"),t("fatalError"),n}(n,r,a),s.domBuilder=i.domBuilder||r,t&&(o[""]=co.HTML),o.xml=o.xml||co.XML,i.normalizeLineEndings||go);return e&&"string"==typeof e?s.parse(n(e),o,l):s.errorHandler.error("invalid doc source"),r.doc},yo.prototype={startDocument:function(){this.doc=(new uo).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;To(this,n),this.currentElement=n,this.locator&&_o(this.locator,n);for(var o=0;o<a;o++){var e=s.getURI(o),l=s.getValue(o),i=s.getQName(o),d=r.createAttributeNS(e,i);this.locator&&_o(s.getLocator(o),d),d.value=d.nodeValue=l,n.setAttributeNode(d)}},endElement:function(e,t,i){var s=this.currentElement;s.tagName,this.currentElement=s.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){e=this.doc.createProcessingInstruction(e,t);this.locator&&_o(this.locator,e),To(this,e)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){var s;(e=bo.apply(this,arguments))&&(s=this.cdata?this.doc.createCDATASection(e):this.doc.createTextNode(e),this.currentElement?this.currentElement.appendChild(s):/^\s*$/.test(e)&&this.doc.appendChild(s),this.locator)&&_o(this.locator,s)},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=bo.apply(this,arguments);e=this.doc.createComment(e);this.locator&&_o(this.locator,e),To(this,e)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var s=this.doc.implementation;s&&s.createDocumentType&&(s=s.createDocumentType(e,t,i),this.locator&&_o(this.locator,s),To(this,s),this.doc.doctype=s)},warning:function(e){},error:function(e){},fatalError:function(e){throw new po(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){yo.prototype[e]=function(){return null}});var So={__DOMHandler:yo,normalizeLineEndings:go,DOMParser:fo}.DOMParser;
- /*! @name mpd-parser @version 1.0.1 @license Apache-2.0 */
- const wo=e=>!!e&&"object"==typeof e,x=(...e)=>e.reduce((t,i)=>("object"==typeof i&&Object.keys(i).forEach(e=>{Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):wo(t[e])&&wo(i[e])?t[e]=x(t[e],i[e]):t[e]=i[e]}),t),{}),Eo=t=>Object.keys(t).map(e=>t[e]),ko=e=>e.reduce((e,t)=>e.concat(t),[]),Co=t=>{if(!t.length)return[];var i=[];for(let e=0;e<t.length;e++)i.push(t[e]);return i};var Io={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const xo=({baseUrl:s="",source:r="",range:n="",indexRange:a=""})=>{s={uri:r,resolvedUri:On(s||"",r)};if(n||a){r=(n||a).split("-");let e=window.BigInt?window.BigInt(r[0]):parseInt(r[0],10),t=window.BigInt?window.BigInt(r[1]):parseInt(r[1],10);e<Number.MAX_SAFE_INTEGER&&"bigint"==typeof e&&(e=Number(e)),t<Number.MAX_SAFE_INTEGER&&"bigint"==typeof t&&(t=Number(t));let i;"bigint"==typeof(i="bigint"==typeof t||"bigint"==typeof e?window.BigInt(t)-window.BigInt(e)+window.BigInt(1):t-e+1)&&i<Number.MAX_SAFE_INTEGER&&(i=Number(i)),s.byterange={length:i,offset:e}}return s},Ao=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),Po={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,e=Ao(e.endNumber),t=t/i;return"number"==typeof e?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,e=Ao(e.endNumber),t=(t+i)/1e3,i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},Lo=e=>{var n,{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:a}=e,{start:o,end:l}=Po[t](e),o=((t,i)=>{var s=[];for(let e=t;e<i;e++)s.push(e);return s})(o,l).map((n=e,e=>{var{duration:t,timescale:i=1,periodStart:s,startNumber:r=1}=n;return{number:r+e,duration:t/i,timeline:s,time:e*t}}));return"static"===t&&(o[l=o.length-1].duration=("number"==typeof r?r:a)-i/s*l),o},Oo=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=xo({baseUrl:t,source:i.sourceURL,range:i.range}),(t=xo({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=Lo(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error(Io.NO_BASE_URL)},Do=(e,i,s)=>{var r=e.sidx.map||null,n=e.sidx.duration,a=e.timeline||0,t=e.sidx.byterange,t=t.offset+t.length,o=i.timescale,l=i.references.filter(e=>1!==e.referenceType),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c=u,p=e.mediaSequence||0,m;m="bigint"==typeof i.firstOffset?window.BigInt(t)+i.firstOffset:t+i.firstOffset;for(let t=0;t<l.length;t++){var g=i.references[t],f=g.referencedSize,g=g.subsegmentDuration;let e;e="bigint"==typeof m?m+window.BigInt(f)-window.BigInt(1):m+f-1;var y=m+"-"+e,y={baseUrl:s,timescale:o,timeline:a,periodStart:u,presentationTime:c,number:p,duration:g,sourceDuration:n,indexRange:y,type:h},y=Oo(y)[0];r&&(y.map=r),d.push(y),"bigint"==typeof m?m+=window.BigInt(f):m+=f,c+=g/o,p++}return e.segments=d,e},No=["AUDIO","SUBTITLES"],Mo=e=>{return e=e,i=({timeline:e})=>e,Eo(e.reduce((t,e)=>(e.forEach(e=>{t[i(e)]=e}),t),{})).sort((e,t)=>e.timeline>t.timeline?1:-1);var i},Ro=e=>{let r=[];var n,a;return n=e,e=No,a=(e,t,i,s)=>{r=r.concat(e.playlists||[])},e.forEach(function(e){for(var t in n.mediaGroups[e])for(var i in n.mediaGroups[e][t]){var s=n.mediaGroups[e][t][i];a(s,e,t,i)}}),r},Uo=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((e,t)=>{e.number=i.mediaSequence+t})},Bo=({oldManifest:e,newManifest:t})=>{var r,n,i=e.playlists.concat(Ro(e)),s=t.playlists.concat(Ro(t));return t.timelineStarts=Mo([e.timelineStarts,t.timelineStarts]),{oldPlaylists:r,newPlaylists:e,timelineStarts:n}=[{oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}][0],e.forEach(t=>{t.discontinuitySequence=n.findIndex(function({timeline:e}){return e===t.timeline});var e=((t,i)=>{for(let e=0;e<t.length;e++)if(t[e].attributes.NAME===i)return t[e];return null})(r,t.attributes.NAME);if(e&&!t.sidx){const s=t.segments[0];var i=e.segments.findIndex(function(e){return Math.abs(e.presentationTime-s.presentationTime)<1/60});-1===i?(Uo({playlist:t,mediaSequence:e.mediaSequence+e.segments.length}),t.segments[0].discontinuity=!0,t.discontinuityStarts.unshift(0),(!e.segments.length&&t.timeline>e.timeline||e.segments.length&&t.timeline>e.segments[e.segments.length-1].timeline)&&t.discontinuitySequence--):(e.segments[i].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),Uo({playlist:t,mediaSequence:e.segments[i].number}))}}),t},Fo=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t})(e.byterange),jo=e=>{return Eo(e.reduce((e,t)=>{var i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{})).map(e=>{var t,s;return e.discontinuityStarts=(t=e.segments||[],s="discontinuity",t.reduce((e,t,i)=>(t[s]&&e.push(i),e),[])),e})},Ho=(e,t)=>{var i=Fo(e.sidx),t=i&&t[i]&&t[i].sidx;return t&&Do(e,t,e.sidx.resolvedUri),e},qo=(e,o={})=>e.reduce((e,t)=>{var i,s,r,n,a=t.attributes.lang||"text";return e[a]||(e[a]={language:a,default:!1,autoselect:!1,playlists:[],uri:""}),e[a].playlists.push(Ho(({attributes:a,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r}=[t][0],"undefined"==typeof t&&(t=[{uri:a.baseUrl,timeline:a.periodStart,resolvedUri:a.baseUrl||"",duration:a.sourceDuration,number:0}],a.duration=a.sourceDuration),n={NAME:a.id,BANDWIDTH:a.bandwidth,"PROGRAM-ID":1},a.codecs&&(n.CODECS=a.codecs),{attributes:n,uri:"",endList:"static"===a.type,timeline:a.periodStart,resolvedUri:a.baseUrl||"",targetDuration:a.duration,timelineStarts:a.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t}),o)),e},{}),Vo=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>{s={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t};return e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),i&&(s.sidx=i),s},$o=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,Wo=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,Go=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,zo=i=>i?Object.keys(i).reduce((e,t)=>{t=i[t];return e.concat(t.playlists)},[]):[],Xo=({dashPlaylists:e,locations:t,sidxMapping:i={},previousManifest:s})=>{var r,n,a,o,l,d,h,u;return e.length?({sourceDuration:a,type:l,suggestedPresentationDelay:d,minimumUpdatePeriod:o}=e[0].attributes,r=jo(e.filter($o)).map(Vo),h=jo(e.filter(Wo)),n=jo(e.filter(Go)),e=e.map(e=>e.attributes.captionServices).filter(Boolean),a={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:((e,t={})=>{if(Object.keys(t).length)for(const i in e)e[i]=Ho(e[i],t);return e})(r,i)},0<=o&&(a.minimumUpdatePeriod=1e3*o),t&&(a.locations=t),"dynamic"===l&&(a.suggestedPresentationDelay=d),o=0===a.playlists.length,t=h.length?((e,n={},a)=>{let o;e=e.reduce((e,t)=>{var i=t.attributes.role&&t.attributes.role.value||"",s=t.attributes.lang||"";let r=t.attributes.label||"main";e[r=s&&!t.attributes.label?t.attributes.lang+(i?` (${i})`:""):r]||(e[r]={language:s,autoselect:!0,default:"main"===i,playlists:[],uri:""});s=Ho((({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>{r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t};return e.contentProtection&&(r.contentProtection=e.contentProtection),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r})(t,a),n);return e[r].playlists.push(s),"undefined"==typeof o&&"main"===i&&((o=t).default=!0),e},{});return o||(e[Object.keys(e)[0]].default=!0),e})(h,i,o):null,l=n.length?qo(n,i):null,h=(d=r.concat(zo(t),zo(l))).map(({timelineStarts:e})=>e),a.timelineStarts=Mo(h),u=a.timelineStarts,d.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=u.findIndex(function({timeline:e}){return e===t.timeline}),t.segments&&t.segments.forEach((e,t)=>{e.number=t})}),t&&(a.mediaGroups.AUDIO.audio=t),l&&(a.mediaGroups.SUBTITLES.subs=l),e.length&&(a.mediaGroups["CLOSED-CAPTIONS"].cc=e.reduce((s,e)=>(e&&e.forEach(e=>{var{channel:t,language:i}=e;s[i]={autoselect:!1,default:!1,instreamId:t,language:i},e.hasOwnProperty("aspectRatio")&&(s[i].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(s[i].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(s[i]["3D"]=e["3D"])}),s),{})),s?Bo({oldManifest:s,newManifest:a}):a):{}},Ko=(s,r)=>{var{type:n,minimumUpdatePeriod:a=0,media:o="",sourceDuration:l,timescale:d=1,startNumber:h=1,periodStart:u}=s,c=[];let p=-1;for(let i=0;i<r.length;i++){var m=r[i],g=m.d,f=m.r||0,m=m.t||0;p<0&&(p=m),m&&m>p&&(p=m);let e;e=f<0?(m=i+1)===r.length?"dynamic"===n&&0<a&&0<o.indexOf("$Number$")?((e,t,i)=>{var{NOW:e,clientOffset:s,availabilityStartTime:r,timescale:n=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+s)/1e3+o-(r+a))*n-t)/i)})(s,p,g):(l*d-p)/g:(r[m].t-p)/g:f+1;var y=h+c.length+e;let t=h+c.length;for(;t<y;)c.push({number:t,duration:g/d,time:p,timeline:u}),p+=g,t++}return c},Yo=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Qo=(e,t)=>{return e.replace(Yo,(r=t,(e,t,i,s)=>{return"$$"===e?"$":"undefined"==typeof r[t]?e:(e=""+r[t],"RepresentationID"===t||(s=i?parseInt(s,10):1)<=e.length?e:new Array(s-e.length+1).join("0")+e)}));var r},Jo=(r,e)=>{const n={RepresentationID:r.id,Bandwidth:r.bandwidth||0};var{initialization:t={sourceURL:"",range:""}}=r;const a=xo({baseUrl:r.baseUrl,source:Qo(t.sourceURL,n),range:t.range});return t=e,((e=r).duration||t?e.duration?Lo(e):Ko(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]).map(e=>{n.Number=e.number,n.Time=e.time;var t=Qo(r.media||"",n),i=r.timescale||1,s=r.presentationTimeOffset||0,s=r.periodStart+(e.time-s)/i;return{uri:t,timeline:e.timeline,duration:e.duration,resolvedUri:On(r.baseUrl||"",t),map:a,number:e.number,presentationTime:s}})},Zo=(r,e)=>{const{duration:t,segmentUrls:i=[],periodStart:n}=r;if(!t&&!e||t&&e)throw new Error(Io.SEGMENT_TIME_UNSPECIFIED);const a=i.map(e=>{var{baseUrl:t,initialization:i={}}=t=r,i=xo({baseUrl:t,source:i.sourceURL,range:i.range});return(t=xo({baseUrl:t,source:e.media,range:e.mediaRange})).map=i,t});let s;return t&&(s=Lo(r)),(s=e?Ko(r,e):s).map((e,t)=>{var i,s;if(a[t])return t=a[t],i=r.timescale||1,s=r.presentationTimeOffset||0,t.timeline=e.timeline,t.duration=e.duration,t.number=e.number,t.presentationTime=n+(e.time-s)/i,t}).filter(e=>e)},el=({attributes:e,segmentInfo:t})=>{let i,s;t.template?(s=Jo,i=x(e,t.template)):t.base?(s=Oo,i=x(e,t.base)):t.list&&(s=Zo,i=x(e,t.list));var r,n,a,e={attributes:e};return s&&(r=s(i,t.segmentTimeline),i.duration?({duration:n,timescale:a=1}=i,i.duration=n/a):r.length?i.duration=r.reduce((e,t)=>Math.max(e,Math.ceil(t.duration)),0):i.duration=0,e.attributes=i,e.segments=r,t.base)&&i.indexRange&&(e.sidx=r[0],e.segments=[]),e},tl=e=>e.map(el),A=(e,t)=>Co(e.childNodes).filter(({tagName:e})=>e===t),il=e=>e.textContent.trim(),sl=e=>{var t,i,s,r,n,e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);return e?([e,t,i,s,r,n]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(s||0)+60*parseFloat(r||0)+parseFloat(n||0)):0},rl={mediaPresentationDuration(e){return sl(e)},availabilityStartTime(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod(e){return sl(e)},suggestedPresentationDelay(e){return sl(e)},type(e){return e},timeShiftBufferDepth(e){return sl(e)},start(e){return sl(e)},width(e){return parseInt(e,10)},height(e){return parseInt(e,10)},bandwidth(e){return parseInt(e,10)},frameRate(e){return parseFloat(e.split("/").reduce((e,t)=>e/t))},startNumber(e){return parseInt(e,10)},timescale(e){return parseInt(e,10)},presentationTimeOffset(e){return parseInt(e,10)},duration(e){var t=parseInt(e,10);return isNaN(t)?sl(e):t},d(e){return parseInt(e,10)},t(e){return parseInt(e,10)},r(e){return parseInt(e,10)},DEFAULT(e){return e}},P=e=>e&&e.attributes?Co(e.attributes).reduce((e,t)=>{var i=rl[t.name]||rl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},nl={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},al=(e,i)=>i.length?ko(e.map(function(t){return i.map(function(e){return On(t,il(e))})})):e,ol=e=>{var t=A(e,"SegmentTemplate")[0],i=A(e,"SegmentList")[0],s=i&&A(i,"SegmentURL").map(e=>x({tag:"SegmentURL"},P(e))),e=A(e,"SegmentBase")[0],r=i||t,r=r&&A(r,"SegmentTimeline")[0],n=i||e||t,n=n&&A(n,"Initialization")[0],t=t&&P(t);t&&n?t.initialization=n&&P(n):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});const a={template:t,segmentTimeline:r&&A(r,"S").map(e=>P(e)),list:i&&x(P(i),{segmentUrls:s,initialization:P(n)}),base:e&&x(P(e),{initialization:P(n)})};return Object.keys(a).forEach(e=>{a[e]||delete a[e]}),a},ll=(l,d,h)=>e=>{var t=P(e),i=al(d,A(e,"BaseURL")),s=A(e,"Role")[0],s={role:P(s)};let r=x(l,t,s);var n,a,o,t=A(e,"Accessibility")[0],t="urn:scte:dash:cc:cea-608:2015"===(s=P(t)).schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map(e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}}):"urn:scte:dash:cc:cea-708:2015"===s.schemeIdUri?("string"!=typeof s.value?[]:s.value.split(";")).map(e=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var t,s;return/=/.test(e)?([t,s=""]=e.split("="),i.channel=t,i.language=e,s.split(",").forEach(e=>{var[e,t]=e.split(":");"lang"===e?i.language=t:"er"===e?i.easyReader=Number(t):"war"===e?i.aspectRatio=Number(t):"3D"===e&&(i["3D"]=Number(t))})):i.language=e,i.channel&&(i.channel="SERVICE"+i.channel),i}):void 0,s=(t&&(r=x(r,{captionServices:t})),A(e,"Label")[0]),s=(s&&s.childNodes.length&&(t=s.childNodes[0].nodeValue.trim(),r=x(r,{label:t})),A(e,"ContentProtection").reduce((e,t)=>{var i=P(t),s=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),nl[i.schemeIdUri]);return s&&(e[s]={attributes:i},i=A(t,"cenc:pssh")[0])&&(t=il(i),e[s].pssh=t&&Gn(t)),e},{})),t=(Object.keys(s).length&&(r=x(r,{contentProtection:s})),ol(e)),s=A(e,"Representation"),e=x(h,t);return ko(s.map((n=r,a=i,o=e,e=>{var t=A(e,"BaseURL"),t=al(a,t);const i=x(n,P(e)),s=ol(e);return t.map(e=>({segmentInfo:x(o,s),attributes:x(i,{baseUrl:e})}))})))},dl=(e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0}=t,r=A(e,"Period");if(!r.length)throw new Error(Io.INVALID_NUMBER_OF_PERIOD);var n=A(e,"Location");const a=P(e);var o,l,t=al([t],A(e,"BaseURL"));a.type=a.type||"static",a.sourceDuration=a.mediaPresentationDuration||0,a.NOW=i,a.clientOffset=s,n.length&&(a.locations=n.map(il));const d=[];return r.forEach((e,t)=>{var i,s,r=P(e),t=d[t-1];r.start=({attributes:t,priorPeriodAttributes:i,mpdType:s}=[{attributes:r,priorPeriodAttributes:t?t.attributes:null,mpdType:a.type}][0],"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==s?null:0),d.push({node:e,attributes:r})}),{locations:a.locations,representationInfo:ko(d.map((o=a,l=t,(e,t)=>{var i=al(l,A(e.node,"BaseURL")),s=x(o,{periodStart:e.attributes.start}),r=("number"==typeof e.attributes.duration&&(s.periodDuration=e.attributes.duration),A(e.node,"AdaptationSet")),e=ol(e.node);return ko(r.map(ll(s,i,e)))})))}},hl=e=>{if(""===e)throw new Error(Io.DASH_EMPTY_MANIFEST);var t,i=new So;let s;try{t=i.parseFromString(e,"application/xml"),s=t&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!s||s&&0<s.getElementsByTagName("parsererror").length)throw new Error(Io.DASH_INVALID_XML);return s},ul=e=>{e=hl(e);if(!(e=A(e,"UTCTiming")[0]))return null;var t=P(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Io.UNSUPPORTED_UTC_TIMING_SCHEME)}return t};function cl(e,t){var i,s,r;return void 0===t&&(t=0),(e=S(e)).length-t<10||!E(e,Sl,{offset:t})?t:(t+=(void 0===(s=t)&&(s=0),r=(i=S(i=e))[s+5],i=i[s+6]<<21|i[s+7]<<14|i[s+8]<<7|i[s+9],(16&r)>>4?20+i:10+i),cl(e,t))}function pl(e){return"string"==typeof e?Ln(e):e}function ml(e,t,i){void 0===i&&(i=!1),s=t,t=Array.isArray(s)?s.map(pl):[pl(s)],e=S(e);var s,r=[];if(t.length)for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,o=e.subarray(n+4,n+8);if(0==a)break;a=n+a;if(a>e.length){if(i)break;a=e.length}var l=e.subarray(n+8,a);E(o,t[0])&&(1===t.length?r.push(l):r.push.apply(r,ml(l,t.slice(1),i))),n=a}return r}function gl(e,t,i){var s;return i>=t.length?t.length:(s=Cl(t,i,!1),E(e.bytes,s.bytes)?i:gl(e,t,i+(e=Cl(t,i+s.length)).length+e.value+s.length))}function fl(e,t){i=t,t=Array.isArray(i)?i.map(function(e){return Il(e)}):[Il(i)],e=S(e);var i,s=[];if(t.length)for(var r=0;r<e.length;){var n=Cl(e,r,!1),a=Cl(e,r+n.length),o=r+n.length+a.length,l=(127===a.value&&(a.value=gl(n,e,o),a.value!==e.length)&&(a.value-=o),o+a.value>e.length?e.length:o+a.value),o=e.subarray(o,l);E(t[0],n.bytes)&&(1===t.length?s.push(o):s=s.concat(fl(o,t.slice(1)))),r+=n.length+a.length+o.length}return s}function yl(e,t,i,s){void 0===s&&(s=1/0),e=S(e),i=[].concat(i);for(var r,n=0,a=0;n<e.length&&(a<s||r);){var o=void 0;if(E(e.subarray(n),xl)?o=4:E(e.subarray(n),Al)&&(o=3),o){if(a++,r)return Ll(e.subarray(r,n));var l=void 0;"h264"===t?l=31&e[n+o]:"h265"===t&&(l=e[n+o]>>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)}function _l(e){e=S(e);for(var t=0;t<Dl.length;t++){var i=Dl[t];if(Nl[i](e))return i}return""}var vl=Math.pow(2,32),bl=function(e){var t,e=new DataView(e.buffer,e.byteOffset,e.byteLength);return e.getBigUint64?(t=e.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:e.getUint32(0)*vl+e.getUint32(4)},Tl=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},s=12,r=(0===i.version?(i.earliestPresentationTime=t.getUint32(s),i.firstOffset=t.getUint32(s+4),s+=8):(i.earliestPresentationTime=bl(e.subarray(s)),i.firstOffset=bl(e.subarray(s+8)),s+=16),t.getUint16(s+=2));for(s+=2;0<r;s+=12,r--)i.references.push({referenceType:(128&e[s])>>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i},Sl=S([73,68,51]),wl={EBML:S([26,69,223,163]),DocType:S([66,130]),Segment:S([24,83,128,103]),SegmentInfo:S([21,73,169,102]),Tracks:S([22,84,174,107]),Track:S([174]),TrackNumber:S([215]),DefaultDuration:S([35,227,131]),TrackEntry:S([174]),TrackType:S([131]),FlagDefault:S([136]),CodecID:S([134]),CodecPrivate:S([99,162]),VideoTrack:S([224]),AudioTrack:S([225]),Cluster:S([31,67,182,117]),Timestamp:S([231]),TimestampScale:S([42,215,177]),BlockGroup:S([160]),BlockDuration:S([155]),Block:S([161]),SimpleBlock:S([163])},El=[128,64,32,16,8,4,2,1],kl=function(e){for(var t=1,i=0;i<El.length&&!(e&El[i]);i++)t++;return t},Cl=function(e,t,i,s){void 0===i&&(i=!0),void 0===s&&(s=!1);var r=kl(e[t]),n=e.subarray(t,t+r);return i&&((n=Array.prototype.slice.call(e,t,t+r))[0]^=El[r-1]),{length:r,value:$n(n,{signed:s}),bytes:n}},Il=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map(e):"number"==typeof t?Pn(t):t},xl=S([0,0,0,1]),Al=S([0,0,1]),Pl=S([0,0,3]),Ll=function(e){for(var t=[],i=1;i<e.length-2;)E(e.subarray(i,i+3),Pl)&&(t.push(i+2),i++),i++;if(0===t.length)return e;for(var s=e.length-t.length,r=new Uint8Array(s),n=0,i=0;i<s;n++,i++)n===t[0]&&(n++,t.shift()),r[i]=e[n];return r},L={webm:S([119,101,98,109]),matroska:S([109,97,116,114,111,115,107,97]),flac:S([102,76,97,67]),ogg:S([79,103,103,83]),ac3:S([11,119]),riff:S([82,73,70,70]),avi:S([65,86,73]),wav:S([87,65,86,69]),"3gp":S([102,116,121,112,51,103]),mp4:S([102,116,121,112]),fmp4:S([115,116,121,112]),mov:S([102,116,121,112,113,116]),moov:S([109,111,111,118]),moof:S([109,111,111,102])},Ol={aac:function(e){var t=cl(e);return E(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=cl(e);return E(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){e=fl(e,[wl.EBML,wl.DocType])[0];return E(e,L.webm)},mkv:function(e){e=fl(e,[wl.EBML,wl.DocType])[0];return E(e,L.matroska)},mp4:function(e){return!Ol["3gp"](e)&&!Ol.mov(e)&&(!!(E(e,L.mp4,{offset:4})||E(e,L.fmp4,{offset:4})||E(e,L.moof,{offset:4})||E(e,L.moov,{offset:4}))||void 0)},mov:function(e){return E(e,L.mov,{offset:4})},"3gp":function(e){return E(e,L["3gp"],{offset:4})},ac3:function(e){var t=cl(e);return E(e,L.ac3,{offset:t})},ts:function(e){if(e.length<189&&1<=e.length)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=cl(e);return E(e,L.flac,{offset:t})},ogg:function(e){return E(e,L.ogg)},avi:function(e){return E(e,L.riff)&&E(e,L.avi,{offset:8})},wav:function(e){return E(e,L.riff)&&E(e,L.wav,{offset:8})},h264:function(e){return yl(e,"h264",7,3).length},h265:function(e){return yl(e,"h265",[32,33],3).length}},Dl=Object.keys(Ol).filter(function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e}).concat(["ts","h264","h265"]),Nl=(Dl.forEach(function(e){var t=Ol[e];Ol[e]=function(e){return t(S(e))}}),Ol),Ml=9e4;
- /*! @name @videojs/http-streaming @version 3.0.2 @license Apache-2.0 */
- const Rl=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,s=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||fn):/\/\//i.test(e)||(e=gn.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(fn.length):s?i.href.slice(i.protocol.length):i.href):gn.buildAbsoluteURL(e,t)},Ul=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Bl=e=>T.log.debug?T.log.debug.bind(T,"VHS:",e+" >"):function(){};function O(...e){var t=T.obj||T;return(t.merge||t.mergeOptions).apply(t,e)}function Fl(...e){var t=T.time||T;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function jl(e,i){return Xl(e,function(e,t){return e-zl<=i&&t+zl>=i})}function Hl(e,t){return Xl(e,function(e){return e-Gl>=t})}function ql(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function Vl(t,i){let s=0;if(t&&t.length)for(let e=0;e<t.length;e++){var r=t.start(e),n=t.end(e);n<i||(s+=r<i&&i<=n?n-i:n-r)}return s}function $l({defaultDuration:t,durationList:i,startIndex:s,endIndex:r}){let n=0;if(r<s&&([s,r]=[r,s]),s<0){for(let e=s;e<Math.min(0,r);e++)n+=t;s=0}for(let e=s;e<r;e++)n+=i[e].duration;return n}function Wl(e,t,i,s){if(!e||!e.segments)return null;if(e.endList)return nd(e);if(null===t)return null;t=t||0;let r=rd(e,e.mediaSequence+e.segments.length,t);return i&&(s="number"==typeof s?s:td(null,e),r-=s),Math.max(0,r)}const Gl=1/30,zl=3*Gl,Xl=function(e,t){var i=[];let s;if(e&&e.length)for(s=0;s<e.length;s++)t(e.start(s),e.end(s))&&i.push([e.start(s),e.end(s)]);return Fl(i)},Kl=t=>{var i=[];if(!t||!t.length)return"";for(let e=0;e<t.length;e++)i.push(t.start(e)+" => "+t.end(e));return i.join(", ")},Yl=t=>{var i=[];for(let e=0;e<t.length;e++)i.push({start:t.start(e),end:t.end(e)});return i},Ql=(t,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i},Jl=e=>(e.segments||[]).reduce((i,s,r)=>(s.parts?s.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:s})}):i.push({duration:s.duration,segmentIndex:r,partIndex:null,segment:s,part:null}),i),[]),Zl=e=>{e=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return e&&e.parts||[]},ed=({preloadSegment:e})=>{var t;if(e)return{parts:e,preloadHints:t}=e,(t||[]).reduce((e,t)=>e+("PART"===t.type?1:0),0)+(e&&e.length?e.length:0)},td=(e,t)=>{return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<Zl(t).length)&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:e&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},id=function(e,t){let i=0,s=t-e.mediaSequence,r=e.segments[s];if(r){if("undefined"!=typeof r.start)return{result:r.start,precise:!0};if("undefined"!=typeof r.end)return{result:r.end-r.duration,precise:!0}}for(;s--;){if("undefined"!=typeof(r=e.segments[s]).end)return{result:i+r.end,precise:!0};if(i+=Ql(e,r),"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}},sd=function(e,t){let i=0;var s;let r=t-e.mediaSequence;for(;r<e.segments.length;r++){if("undefined"!=typeof(s=e.segments[r]).start)return{result:s.start-i,precise:!0};if(i+=Ql(e,s),"undefined"!=typeof s.end)return{result:s.end-i,precise:!0}}return{result:-1,precise:!1}},rd=function(e,t,i){var s;return(t="undefined"==typeof t?e.mediaSequence+e.segments.length:t)<e.mediaSequence?0:(s=id(e,t)).precise?s.result:(e=sd(e,t)).precise?e.result:s.result+i},nd=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),"undefined"==typeof t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return window.Infinity}return rd(e,t,i)};function ad(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function od(e){return e.excludeUntil&&e.excludeUntil===1/0}function ld(e){var t=ad(e);return!e.disabled&&!t}function dd(e,t){return t.attributes&&t.attributes[e]}function hd(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let s=!1;for(const r in i){for(const n in i[r])if(s=t(i[r][n]))break;if(s)break}return!!s}const ud=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(e=>!!ld(e)&&(e.attributes.BANDWIDTH||0)<i).length},cd=(e,t)=>!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),pd=t=>{if(!t||!t.playlists||!t.playlists.length)return hd(t,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<t.playlists.length;e++){const s=t.playlists[e];var i=s.attributes&&s.attributes.CODECS;if(!i||!i.split(",").every(e=>Cn(e))){i=hd(t,e=>cd(s,e));if(!i)return!1}}return!0};var md={liveEdgeDelay:td,duration:nd,seekable:function(e,t,i){var s=t||0,e=Wl(e,t,!0,i);return null===e?Fl():Fl(s,e)},getMediaInfoForTime:function({playlist:t,currentTime:i,startingSegmentIndex:s,startingPartIndex:r,startTime:n,exactManifestTimings:a}){let o=i-n;var l=Jl(t);let d=0;for(let e=0;e<l.length;e++){var h=l[e];if(s===h.segmentIndex&&("number"!=typeof r||"number"!=typeof h.partIndex||r===h.partIndex)){d=e;break}}if(o<0){if(0<d)for(let e=d-1;0<=e;e--){var u=l[e];if(o+=u.duration,a){if(o<0)continue}else if(o+Gl<=0)continue;return{partIndex:u.partIndex,segmentIndex:u.segmentIndex,startTime:n-$l({defaultDuration:t.targetDuration,durationList:l,startIndex:d,endIndex:e})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i}}if(d<0){for(let e=d;e<0;e++)if((o-=t.targetDuration)<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i};d=0}for(let e=d;e<l.length;e++){var c=l[e];if(o-=c.duration,a){if(0<o)continue}else if(0<=o-Gl)continue;return{partIndex:c.partIndex,segmentIndex:c.segmentIndex,startTime:n+$l({defaultDuration:t.targetDuration,durationList:l,startIndex:d,endIndex:e})}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:i}},isEnabled:ld,isDisabled:function(e){return e.disabled},isExcluded:ad,isIncompatible:od,playlistEnd:Wl,isAes:function(t){for(let e=0;e<t.segments.length;e++)if(t.segments[e].key)return!0;return!1},hasAttribute:dd,estimateSegmentRequestTime:function(e,t,i,s=0){return dd("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*s)/t:NaN},isLowestEnabledRendition:ud,isAudioOnly:pd,playlistMatch:cd,segmentDurationWithParts:Ql};const gd=T["log"],fd=(e,t)=>e+"-"+t,yd=(r,n)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(e=>{if(r.mediaGroups[e])for(const i in r.mediaGroups[e])for(const s in r.mediaGroups[e][i]){var t=r.mediaGroups[e][i][s];n(t,e,i,s)}})},_d=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},vd=(o,e,l=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i)=>{o.uri=e;for(let e=0;e<o.playlists.length;e++){var t;o.playlists[e].uri||(t="placeholder-uri-"+e,o.playlists[e].uri=t)}const i=pd(o);yd(o,(e,r,n,a)=>{if(!e.playlists||!e.playlists.length){if(i&&"AUDIO"===r&&!e.uri)for(let e=0;e<o.playlists.length;e++){var t=o.playlists[e];if(t.attributes&&t.attributes.AUDIO&&t.attributes.AUDIO===n)return}e.playlists=[fi({},e)]}e.playlists.forEach(function(e,t){var i=l(r,n,a,e),s=fd(t,i);e.uri?e.resolvedUri=e.resolvedUri||Rl(o.uri,e.uri):(e.uri=0===t?i:s,e.resolvedUri=e.uri),e.id=e.id||s,e.attributes=e.attributes||{},o.playlists[e.id]=e,o.playlists[e.uri]=e})});{var s=o;let e=s.playlists.length;for(;e--;){var r=s.playlists[e];_d({playlist:r,id:fd(e,r.uri)}),r.resolvedUri=Rl(s.uri,r.uri),s.playlists[r.id]=r,(s.playlists[r.uri]=r).attributes.BANDWIDTH||gd.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}var n;n=o,yd(n,e=>{e.uri&&(e.resolvedUri=Rl(n.uri,e.uri))})};Dr=T.EventTarget;function bd(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(let e=0;e<i.preloadHints.length;e++)if("MAP"===i.preloadHints[e].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t}const Td=(t,i)=>{if(!t)return i;var s=O(t,i);if(t.preloadHints&&!i.preloadHints&&delete s.preloadHints,t.parts&&!i.parts)delete s.parts;else if(t.parts&&i.parts)for(let e=0;e<i.parts.length;e++)t.parts&&t.parts[e]&&(s.parts[e]=O(t.parts[e],i.parts[e]));return!t.skipped&&i.skipped&&(s.skipped=!1),t.preload&&!i.preload&&(s.preload=!1),s},Sd=(e,t)=>{!e.resolvedUri&&e.uri&&(e.resolvedUri=Rl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Rl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Rl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Rl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(e=>{e.resolvedUri||(e.resolvedUri=Rl(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(e=>{e.resolvedUri||(e.resolvedUri=Rl(t,e.uri))})},wd=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,Ed=(e,r,t=wd)=>{var i=O(e,{}),s=i.playlists[r.id];if(!s)return null;if(t(s,r))return null;r.segments=bd(r);const n=O(s,r);if(n.preloadSegment&&!r.preloadSegment&&delete n.preloadSegment,s.segments){if(r.skip){r.segments=r.segments||[];for(let e=0;e<r.skip.skippedSegments;e++)r.segments.unshift({skipped:!0})}n.segments=((e,t,i)=>{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e<r.length;e++){var o=s[e+i],l=r[e];o?(a=o.map||a,n.push(Td(o,l))):(a&&!l.map&&(l.map=a),n.push(l))}return n})(s.segments,r.segments,r.mediaSequence-s.mediaSequence)}n.segments.forEach(e=>{Sd(e,n.resolvedUri)});for(let e=0;e<i.playlists.length;e++)i.playlists[e].id===r.id&&(i.playlists[e]=n);return i.playlists[r.id]=n,i.playlists[r.uri]=n,yd(e,(t,e,i,s)=>{if(t.playlists)for(let e=0;e<t.playlists.length;e++)r.id===t.playlists[e].id&&(t.playlists[e]=n)}),i},kd=(e,t)=>{var i=e.segments||[],i=i[i.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],s=s&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)};class Cd extends Dr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Bl("PlaylistLoader");var{withCredentials:i=!1}=i,e=(this.src=e,this.vhs_=t,this.withCredentials=i,t.options_);this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var t=this.media();let e=Rl(this.main.uri,t.uri);this.llhls&&(e=((e,t)=>{if(!t.endList&&t.serverControl){const r={};if(t.serverControl.canBlockReload){var i,s=t["preloadSegment"];let e=t.mediaSequence+t.segments.length;s&&(s=s.parts||[],-1<(i=ed(t)-1)&&i!=s.length-1&&(r._HLS_part=i),-1<i||s.length)&&e--,r._HLS_msn=e}if(t.serverControl&&t.serverControl.canSkipUntil&&(r._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(r).length){const n=new window.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){r.hasOwnProperty(e)&&n.searchParams.set(e,r[e])}),e=n.toString()}}return e})(e,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:e,withCredentials:this.withCredentials},(e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})})}}playlistRequestError(e,t,i){var{uri:t,id:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}parseManifest_({url:t,manifestString:i}){{var[{onwarn:i,oninfo:e,manifestString:s,customTagParsers:r=[],customTagMappers:n=[],llhls:a}]=[{onwarn:({message:e})=>this.logger_(`m3u8-parser warn for ${t}: `+e),oninfo:({message:e})=>this.logger_(`m3u8-parser info for ${t}: `+e),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls}];const o=new kn,l=(i&&o.on("warn",i),e&&o.on("info",e),r.forEach(e=>o.addParser(e)),n.forEach(e=>o.addTagMapper(e)),o.push(s),o.end(),o.manifest);if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){l.hasOwnProperty(e)&&delete l[e]}),l.segments&&l.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),!l.targetDuration){let e=10;l.segments&&l.segments.length&&(e=l.segments.reduce((e,t)=>Math.max(e,t.duration),0)),i&&i("manifest has no targetDuration defaulting to "+e),l.targetDuration=e}return(e=Zl(l)).length&&!l.partTargetDuration&&(r=e.reduce((e,t)=>Math.max(e,t.duration),0),i&&(i("manifest has no partTargetDuration defaulting to "+r),gd.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=r),l}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";t=t||this.parseManifest_({url:i,manifestString:e}),t.lastRequest=Date.now(),_d({playlist:t,uri:i,id:s}),e=Ed(this.main,t);this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(kd(this.media(),!!e)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(i,e){if(!i)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof i){if(!this.main.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.main.playlists[i]}if(window.clearTimeout(this.finalRenditionTimeout),e)e=(i.partTargetDuration||i.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,i,!1),e);else{const s=this.state;var e=!this.media_||i.id!==this.media_.id,t=this.main.playlists[i.id];if(t&&t.endList||i.endList&&i.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,e&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(kd(i,!0)),e){if(this.state="SWITCHING_MEDIA",this.request){if(i.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=i,this.request=this.vhs_.xhr({uri:i.resolvedUri,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(i.lastRequest=Date.now(),i.resolvedUri=Ul(i.resolvedUri,t),e)return this.playlistRequestError(this.request,i,s);this.haveMetadata({playlistString:t.responseText,url:i.uri,id:i.id}),"HAVE_MAIN_MANIFEST"===s?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){this.started=!0,"object"==typeof this.src?(this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0)):this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=Ul(this.src,t);e=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(e)}})}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,vd(this.main,this.srcUri()),e.playlists.forEach(t=>{t.segments=bd(t),t.segments.forEach(e=>{Sd(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(i=t,s=fd(0,i),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}}function Id(e,t,i,s){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),s(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function xd(){function n(e,i){e=O({timeout:45e3},e);var t=n.beforeRequest||T.Vhs.xhr.beforeRequest;t&&"function"==typeof t&&(t=t(e))&&(e=t);const s=(!0===T.Vhs.xhr.original?Md:T.Vhs.xhr)(e,function(e,t){return Id(s,e,t,i)}),r=s.abort;return s.abort=function(){return s.aborted=!0,r.apply(s,arguments)},s.uri=e.uri,s.requestTime=Date.now(),s}return n.original=!0,n}function Ad(e){var t={};return e.byterange&&(t.Range=function(e){let t;return"bytes="+e.offset+"-"+(t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function Pd(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Ld(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function Od(i){const s={};return Object.keys(i).forEach(e=>{var t=i[e];qn(t)?s[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:s[e]=t}),s}function Dd(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Nd(e){return e.resolvedUri}const Md=T["xhr"],Rd=e=>{var t,i,s=Array.prototype.slice.call(e);let r="";for(let e=0;e<s.length/16;e++)t=s.slice(16*e,16*e+16).map(Pd).join(""),i=s.slice(16*e,16*e+16).map(Ld).join(""),r+=t+" "+i+"\n";return r};Or=Object.freeze({__proto__:null,createTransferableMessage:Od,initSegmentId:Dd,segmentKeyId:Nd,hexDump:Rd,tagDump:({bytes:e})=>Rd(e),textRanges:e=>{let t="",i;for(i=0;i<e.length;i++)t+=(s=e,r=i,s.start(r)+"-"+s.end(r)+" ");var s,r;return t}});const Ud=.25,Bd=e=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds,Fd=({playlist:e,time:t=void 0,callback:i})=>{var s,r;if(i)return e&&void 0!==t?(e=((t,i)=>{if(!i||!i.segments||0===i.segments.length)return null;let s=0,r;for(let e=0;e<i.segments.length&&(r=i.segments[e],!(t<=(s=r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:s+r.duration)));e++);var e=i.segments[i.segments.length-1];if(e.videoTimingInfo&&e.videoTimingInfo.transmuxedPresentationEnd<t)return null;if(t>s){if(t>s+e.duration*Ud)return null;r=e}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:s-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t=t-(e.videoTimingInfo.transmuxedPresentationStart+r),new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")},jd=({programTime:e,playlist:t,retryCount:i=2,seekTo:s,pauseAfterSeek:r=!0,tech:n,callback:a})=>{var o,l,d;if(a)return"undefined"!=typeof e&&t&&s?t.endList||n.hasStarted_?(t=>{if(!t.segments||0===t.segments.length)return!1;for(let e=0;e<t.segments.length;e++)if(!t.segments[e].dateTimeObject)return!1;return!0})(t)?(d=((e,t)=>{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(i<s.dateTimeObject)return null;for(let e=0;e<t.segments.length-1;e++){s=t.segments[e];var r=t.segments[e+1].dateTimeObject;if(i<r)break}var e=t.segments[t.segments.length-1],n=e.dateTimeObject,a=e.videoTimingInfo?Bd(e.videoTimingInfo):e.duration+e.duration*Ud,a=new Date(n.getTime()+1e3*a);return i>a?null:{segment:s=i>n?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:md.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}e=i.getTime();return(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",()=>{jd({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})})):(d=o.start+l,n.one("seeked",()=>a(null,n.currentTime())),r&&n.pause(),void s(d))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")},Hd=(e,t)=>{if(4===e.readyState)return t()},qd=(e,t,r)=>{let s=[],n,a=!1;function o(e,t,i,s){return t.abort(),a=!0,r(e,t,i,s)}function i(e,t){var i;if(!a)return e?o(e,t,"",s):(i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length),s=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;n<s;n++)r[n]=arguments[n];return(r=r.filter(function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e})).length<=1?S(r[0]):(e=r.reduce(function(e,t,i){return e+(t.byteLength||t.length)},0),t=new Uint8Array(e),i=0,r.forEach(function(e){e=S(e),t.set(e,i),i+=e.byteLength}),t)}(s,Ln(i,!0)),n=n||cl(s),s.length<10||n&&s.length<n+2||"ts"===(i=_l(s))&&s.length<188||!i&&s.length<376?Hd(t,()=>o(e,t,"",s)):o(null,t,i,s))}const l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function({}){return Id(e,null,{statusCode:e.status},i)})}},function(e,t){return Id(l,e,t,i)});return l};Mi=T.EventTarget;function Vd(t,i){if(!wd(t,i))return!1;if(t.sidx&&i.sidx&&(t.sidx.offset!==i.sidx.offset||t.sidx.length!==i.sidx.length))return!1;if(!t.sidx&&i.sidx||t.sidx&&!i.sidx)return!1;if(t.segments&&!i.segments||!t.segments&&i.segments)return!1;if(t.segments||i.segments)for(let e=0;e<t.segments.length;e++){var s=t.segments[e],r=i.segments[e];if(s.uri!==r.uri)return!1;if(s.byterange||r.byterange){s=s.byterange,r=r.byterange;if(s&&!r||!s&&r)return!1;if(s.offset!==r.offset||s.length!==r.length)return!1}}return!0}const $d=(e,t,i,s)=>{return`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i)},Wd=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>{e=e,i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},e=dl(hl(e),i),s=tl(e.representationInfo);r=Xo({dashPlaylists:s,locations:e.locations,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest});return vd(r,t,$d),r},Gd=(e,t,i)=>{let a=!0,o=O(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e<t.playlists.length;e++){var s=t.playlists[e],r=(s.sidx&&(r=Fo(s.sidx),i)&&i[r]&&i[r].sidx&&Do(s,i[r].sidx,s.sidx.resolvedUri),Ed(o,s,Vd));r&&(o=r,a=!1)}var n,l;return yd(t,(e,t,i,s)=>{var r,n;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,n=Ed(o,e.playlists[0],Vd))&&(s in(o=n).mediaGroups[t][i]||(o.mediaGroups[t][i][s]=e),o.mediaGroups[t][i][s].playlists[0]=o.playlists[r],a=!1)}),n=o,l=t,yd(n,(e,t,i,s)=>{s in l.mediaGroups[t][i]||delete n.mediaGroups[t][i][s]}),(a=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&a)?null:o},zd=(e,t)=>{return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},Xd=(e,t)=>{var i={};for(const a in e){var s=e[a].sidx;if(s){var r=Fo(s);if(!t[r])break;var n=t[r].sidxInfo;zd(n,s)&&(i[r]=t[r])}}return i};class Kd extends Mi{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Bl("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(a,s,r){const n=a.sidx&&Fo(a.sidx);if(a.sidx&&n&&!this.mainPlaylistLoader_.sidxMapping_[n]){const o=Ul(a.sidx.resolvedUri),l=(t,i)=>{if(!this.requestErrored_(t,i,s)){t=this.mainPlaylistLoader_.sidxMapping_;let e;try{e=Tl(S(i.response).subarray(8))}catch(e){return void this.requestErrored_(e,i,s)}return t[n]={sidxInfo:a.sidx,sidx:e},Do(a,e,a.sidx.resolvedUri),r(!0)}};this.request=qd(o,this.vhs_.xhr,(e,t,i,s)=>{var r,n;return e?l(e,t):i&&"mp4"===i?({offset:r,length:n}=a.sidx.byterange,s.length>=n+r?l(e,{response:s.subarray(r,r+n),status:t.status,uri:t.uri}):void(this.request=this.vhs_.xhr({uri:o,responseType:"arraybuffer",headers:Ad({byterange:a.sidx.byterange})},l))):l({status:t.status,message:`Unsupported ${i||"unknown"} container type for sidx segment at URL: `+o,response:"",playlist:a,internal:!0,playlistExclusionDuration:1/0,code:2},t)})}else this.mediaRequest_=window.setTimeout(()=>r(!1),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(t){if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if("string"==typeof t){if(!this.mainPlaylistLoader_.main.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.mainPlaylistLoader_.main.playlists[t]}var e=!this.media_||t.id!==this.media_.id;e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList?(this.state="HAVE_METADATA",this.media_=t,e&&(this.trigger("mediachanging"),this.trigger("mediachange"))):e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,i,e=>{this.haveMetadata({startingState:i,playlist:t})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(()=>this.load(),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])}):this.mediaRequest_=window.setTimeout(()=>this.haveMain_(),0)}requestMain_(s){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(e,t)=>{if(this.requestErrored_(e,t))"HAVE_NOTHING"===this.state&&(this.started=!1);else{const i=t.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?this.mainLoaded_=Date.parse(t.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Ul(this.mainPlaylistLoader_.srcUrl,t),!i)return s(t,i);this.handleMain_(),this.syncClientServerClock_(()=>s(t,i))}})}syncClientServerClock_(s){const r=ul(this.mainPlaylistLoader_.mainXml_);return null===r?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s()):"DIRECT"===r.method?(this.mainPlaylistLoader_.clientOffset_=r.value-Date.now(),s()):void(this.request=this.vhs_.xhr({uri:Rl(this.mainPlaylistLoader_.srcUrl,r.value),method:r.method,withCredentials:this.withCredentials},(t,i)=>{if(this.request){if(t)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),s();let e;e="HEAD"===r.method?i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):this.mainLoaded_:Date.parse(i.responseText),this.mainPlaylistLoader_.clientOffset_=e-Date.now(),s()}}))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main;let t=Wd({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=Gd(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;var i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,r)=>{let n=Xd(e.playlists,r);return yd(e,(e,t,i,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,n=O(n,Xd(e,r)))}),n})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,e=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;const i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},kd(this.media(),Boolean(i))))};s()}this.trigger("loadedplaylist")}}var D={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};function Yd(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}const Qd=t=>{var i=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i.buffer};function Jd(s){return function(){const e=function(t){try{return URL.createObjectURL(new Blob([t],{type:"application/javascript"}))}catch(e){var i=new BlobBuilder;return i.append(t),URL.createObjectURL(i.getBlob())}}(s);var t=Yd(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}}function Zd(e){return`var browserWorkerPolyFill = ${Yd.toString()};
- `+"browserWorkerPolyFill(self);\n"+e}function eh(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)}var th=Jd(Zd(eh(function(){function e(){this.init=function(){var n={};this.on=function(e,t){n[e]||(n[e]=[]),n[e]=n[e].concat(t)},this.off=function(e,t){return!!n[e]&&(t=n[e].indexOf(t),n[e]=n[e].slice(),n[e].splice(t,1),-1<t)},this.trigger=function(e){var t,i,s,r=n[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else{for(s=[],t=arguments.length,t=1;t<arguments.length;++t)s.push(arguments[t]);for(i=r.length,t=0;t<i;++t)r[t].apply(this,s)}},this.dispose=function(){n={}}}}var l,R,U,B,F,j,H,q,V,$,W,G,z,X,K,Y,Q,J,Z,ee,d,te,ie,se,re,ne,ae,oe,t,le,de,he,ue,ce,pe,me,ge,fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i=(e.prototype.pipe=function(t){return this.on("data",function(e){t.push(e)}),this.on("done",function(e){t.flush(e)}),this.on("partialdone",function(e){t.partialFlush(e)}),this.on("endedtimeline",function(e){t.endTimeline(e)}),this.on("reset",function(e){t.reset(e)}),t},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)},e),ye=Math.pow(2,32),_e={getUint64:function(e){var t,e=new DataView(e.buffer,e.byteOffset,e.byteLength);return e.getBigUint64?(t=e.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:e.getUint32(0)*ye+e.getUint32(4)},MAX_UINT32:ye},ve=_e.MAX_UINT32;if(d={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(var s in d)d.hasOwnProperty(s)&&(d[s]=[s.charCodeAt(0),s.charCodeAt(1),s.charCodeAt(2),s.charCodeAt(3)]);te=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),se=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),ie=new Uint8Array([0,0,0,1]),Ce=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]),xe=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]),re={video:Ce,audio:xe},oe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ae=new Uint8Array([0,0,0,0,0,0,0,0]),t=new Uint8Array([0,0,0,0,0,0,0,0]),le=t,de=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),he=t,ne=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}l=function(e){for(var t,i=[],s=0,r=1;r<arguments.length;r++)i.push(arguments[r]);for(r=i.length;r--;)s+=i[r].byteLength;for(t=new Uint8Array(s+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),r=0,s=8;r<i.length;r++)t.set(i[r],s),s+=i[r].byteLength;return t},R=function(){return l(d.dinf,l(d.dref,oe))},U=function(e){return l(d.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},X=function(e){return l(d.hdlr,re[e])},z=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),l(d.mdhd,t)},G=function(e){return l(d.mdia,z(e),X(e.type),j(e))},F=function(e){return l(d.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},j=function(e){return l(d.minf,"video"===e.type?l(d.vmhd,ne):l(d.smhd,ae),R(),Y(e))},q=function(e){for(var t=e.length,i=[];t--;)i[t]=Z(e[t]);return l.apply(null,[d.mvex].concat(i))},V=function(e){e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(d.mvhd,e)},K=function(e){for(var t,i=e.samples||[],s=new Uint8Array(4+i.length),r=0;r<i.length;r++)t=i[r].flags,s[r+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return l(d.sdtp,s)},Y=function(e){return l(d.stbl,Q(e),l(d.stts,he),l(d.stsc,le),l(d.stsz,de),l(d.stco,t))},Q=function(e){return l(d.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),("video"===e.type?ue:ce)(e))},ue=function(e){for(var t,i,s=e.sps||[],r=e.pps||[],n=[],a=[],o=0;o<s.length;o++)n.push((65280&s[o].byteLength)>>>8),n.push(255&s[o].byteLength),n=n.concat(Array.prototype.slice.call(s[o]));for(o=0;o<r.length;o++)a.push((65280&r[o].byteLength)>>>8),a.push(255&r[o].byteLength),a=a.concat(Array.prototype.slice.call(r[o]));return t=[d.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(d.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([s.length],n,[r.length],a))),l(d.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(i=e.sarRatio[0],e=e.sarRatio[1],t.push(l(d.pasp,new Uint8Array([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),l.apply(null,t)},ce=function(e){return l(d.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),U(e))},W=function(e){e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return l(d.tkhd,e)},J=function(e){var t,i=l(d.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/ve),r=Math.floor(e.baseMediaDecodeTime%ve),s=l(d.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=ee(e,92),l(d.traf,i,s,t)):(r=K(e),t=ee(e,r.length+92),l(d.traf,i,s,t,r))},$=function(e){return e.duration=e.duration||4294967295,l(d.trak,W(e),G(e))},Z=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),l(d.trex,t)},pe=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},me=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+16*a.length,e=pe(a,t),(s=new Uint8Array(e.length+16*a.length)).set(e),i=e.length,n=0;n<a.length;n++)r=a[n],s[i++]=(4278190080&r.duration)>>>24,s[i++]=(16711680&r.duration)>>>16,s[i++]=(65280&r.duration)>>>8,s[i++]=255&r.duration,s[i++]=(4278190080&r.size)>>>24,s[i++]=(16711680&r.size)>>>16,s[i++]=(65280&r.size)>>>8,s[i++]=255&r.size,s[i++]=r.flags.isLeading<<2|r.flags.dependsOn,s[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,s[i++]=61440&r.flags.degradationPriority,s[i++]=15&r.flags.degradationPriority,s[i++]=(4278190080&r.compositionTimeOffset)>>>24,s[i++]=(16711680&r.compositionTimeOffset)>>>16,s[i++]=(65280&r.compositionTimeOffset)>>>8,s[i++]=255&r.compositionTimeOffset;return l(d.trun,s)},ge=function(e,t){var i,s,r,n,a=e.samples||[];for(t+=20+8*a.length,e=pe(a,t),(i=new Uint8Array(e.length+8*a.length)).set(e),s=e.length,n=0;n<a.length;n++)r=a[n],i[s++]=(4278190080&r.duration)>>>24,i[s++]=(16711680&r.duration)>>>16,i[s++]=(65280&r.duration)>>>8,i[s++]=255&r.duration,i[s++]=(4278190080&r.size)>>>24,i[s++]=(16711680&r.size)>>>16,i[s++]=(65280&r.size)>>>8,i[s++]=255&r.size;return l(d.trun,i)},ee=function(e,t){return("audio"===e.type?ge:me)(e,t)};function be(e,t){var i=Ie();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function r(e){for(var t=[];e--;)t.push(0);return t}function n(e){e=e||{},n.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new g(0,0),new g(0,1),new g(1,0),new g(1,1)],this.parse708captions_&&(this.cc708Stream_=new m({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function o(e){return 32<=e&&e<=127||160<=e&&e<=255}function a(e){this.windowNum=e,this.reset()}function Te(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new a(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function Se(e){return null===e?"":(e=Fe[e]||e,String.fromCharCode(e))}function h(){for(var e=[],t=je+1;t--;)e.push("");return e}function we(e,t){var i=1;for(t<e&&(i=-1);Math.abs(t-e)>We;)e+=i*$e;return e}function Ee(e){var t,i;Ee.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=we(e.dts,i),e.pts=we(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}var ke,Ce={ftyp:B=function(){return l(d.ftyp,te,ie,te,se)},mdat:function(e){return l(d.mdat,e)},moof:function(e,t){for(var i=[],s=t.length;s--;)i[s]=J(t[s]);return l.apply(null,[d.moof,F(e)].concat(i))},moov:H=function(e){for(var t=e.length,i=[];t--;)i[t]=$(e[t]);return l.apply(null,[d.moov,V(4294967295)].concat(i).concat(q(e)))},initSegment:function(e){var t=B(),e=H(e),i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t),i.set(e,t.byteLength),i}},Ie=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},xe={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(s.length&&(s.duration=i.dts-s.dts,r.byteLength+=s.byteLength,r.nalCount+=s.length,r.duration+=s.duration,r.push(s)),(s=[i]).byteLength=i.data.byteLength,s.pts=i.pts,s.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(s.keyFrame=!0),s.duration=i.dts-s.dts,s.byteLength+=i.data.byteLength,s.push(i));return r.length&&(!s.duration||s.duration<=0)&&(s.duration=r[r.length-1].duration),r.byteLength+=s.byteLength,r.nalCount+=s.length,r.duration+=s.duration,r.push(s),r},groupFramesIntoGops:function(e){var t,i,s=[],r=[];for(s.byteLength=0,s.nalCount=0,s.duration=0,s.pts=e[0].pts,s.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(s.length&&(r.push(s),r.byteLength+=s.byteLength,r.nalCount+=s.nalCount,r.duration+=s.duration),(s=[i]).nalCount=i.length,s.byteLength=i.byteLength,s.pts=i.pts,s.dts=i.dts,s.duration=i.duration):(s.duration+=i.duration,s.nalCount+=i.length,s.byteLength+=i.byteLength,s.push(i));return r.length&&s.duration<=0&&(s.duration=r[r.length-1].duration),r.byteLength+=s.byteLength,r.nalCount+=s.nalCount,r.duration+=s.duration,r.push(s),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&1<e.length&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){for(var i,s,r,n=t||0,a=[],o=0;o<e.length;o++)for(s=e[o],i=0;i<s.length;i++)r=s[i],n+=(r=be(r,n)).size,a.push(r);return a},concatenateNalData:function(e){for(var t,i,s,r,n,a=0,o=e.byteLength,l=e.nalCount,d=new Uint8Array(o+4*l),h=new DataView(d.buffer),u=0;u<e.length;u++)for(s=e[u],t=0;t<s.length;t++)for(r=s[t],i=0;i<r.length;i++)n=r[i],h.setUint32(a,n.data.byteLength),d.set(n.data,a+=4),a+=n.data.byteLength;return d},generateSampleTableForFrame:function(e,t){var i=[],e=be(e,t||0);return i.push(e),i},concatenateNalDataForFrame:function(e){for(var t,i=0,s=e.byteLength,r=e.length,n=new Uint8Array(s+4*r),a=new DataView(n.buffer),o=0;o<e.length;o++)t=e[o],a.setUint32(i,t.data.byteLength),n.set(t.data,i+=4),i+=t.data.byteLength;return n}},u=[33,16,5,32,164,27],Ae=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Pe=function(e){return 9e4*e},Le=function(e,t){return e*t},Oe=function(e){return e/9e4},De=function(e,t){return e/t},c={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:Pe,secondsToAudioTs:Le,videoTsToSeconds:Oe,audioTsToSeconds:De,audioTsToVideoTs:function(e,t){return e/t*9e4},videoTsToAudioTs:function(e,t){return e/9e4*t},metadataTsToSeconds:function(e,t,i){return Oe(i?e:e-t)}},Ne=function(){var e,i;return ke||(e={96e3:[u,[227,64],r(154),[56]],88200:[u,[231],r(170),[56]],64e3:[u,[248,192],r(240),[56]],48e3:[u,[255,192],r(268),[55,148,128],r(54),[112]],44100:[u,[255,192],r(268),[55,163,128],r(84),[112]],32e3:[u,[255,192],r(268),[55,234],r(226),[112]],24e3:[u,[255,192],r(268),[55,255,128],r(268),[111,112],r(126),[224]],16e3:[u,[255,192],r(268),[55,255,128],r(268),[111,255],r(269),[223,108],r(195),[1,192]],12e3:[Ae,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,253,128],r(259),[56]],11025:[Ae,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,255,192],r(268),[55,175,128],r(108),[112]],8e3:[Ae,r(268),[3,121,16],r(47),[7]]},i=e,ke=Object.keys(i).reduce(function(e,t){return e[t]=new Uint8Array(i[t].reduce(function(e,t){return e.concat(t)},[])),e},{})),ke},Me=c,Pe={prefixWithSilence:function(e,t,i,s){var r,n,a,o,l,d=0,h=0;if(t.length&&(n=Me.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),r=Math.ceil(Me.ONE_SECOND_IN_TS/(e.samplerate/1024)),i&&s&&(n=n-Math.max(i,s),h=(d=Math.floor(n/r))*r),!(d<1||h>Me.ONE_SECOND_IN_TS/2))){for(a=(a=Ne()[e.samplerate])||t[0].data,o=0;o<d;o++)l=t[0],t.splice(0,0,{data:a,dts:l.dts-r,pts:l.pts-r});return e.baseMediaDecodeTime-=Math.floor(Me.videoTsToAudioTs(h,e.samplerate)),h}},trimAdtsFramesByEarliestDts:function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){for(var t,i=[],s=0;s<e.length;s++)t=e[s],i.push({size:t.data.byteLength,duration:1024});return i},concatenateFrameData:function(e){for(var t,i=0,s=new Uint8Array(function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].data.byteLength;return t}(e)),r=0;r<e.length;r++)t=e[r],s.set(t.data,i),i+=t.data.byteLength;return s}},Re=c.ONE_SECOND_IN_TS,Le={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),t=e.timelineStartInfo.baseMediaDecodeTime,t+=i,t=Math.max(0,t),"audio"===e.type&&(t*=e.samplerate/Re,t=Math.floor(t)),t},collectDtsInfo:function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}},De={parseSei:function(e){for(var t=0,i={payloadType:-1,payloadSize:0},s=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)s+=255,t++;for(s+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===s){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=s,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,r=s=0}return i},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var i,s,r,n,a=[];if(64&t[0])for(s=31&t[0],i=0;i<s;i++)n={type:3&t[2+(r=3*i)],pts:e},4&t[2+r]&&(n.ccData=t[3+r]<<8|t[4+r],a.push(n));return a},discardEmulationPreventionBytes:function(e){for(var t=e.byteLength,i=[],s=1;s<t-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(i.push(s+2),s+=2):s++;if(0===i.length)return e;for(var r=t-i.length,n=new Uint8Array(r),a=0,s=0;s<r;a++,s++)a===i[0]&&(a++,i.shift()),n[s]=e[a];return n},USER_DATA_REGISTERED_ITU_T_T35:4},p=i,Ue=De,Be=((n.prototype=new p).push=function(e){var t;"sei_rbsp"===e.nalUnitType&&(t=Ue.parseSei(e.escapedRBSP)).payload&&t.payloadType===Ue.USER_DATA_REGISTERED_ITU_T_T35&&(t=Ue.parseUserData(t))&&(e.dts<this.latestDts_?this.ignoreNextEqualDts_=!0:e.dts===this.latestDts_&&this.ignoreNextEqualDts_?(this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1)):(t=Ue.parseCaptionPackets(e.pts,t),this.captionPackets_=this.captionPackets_.concat(t),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts))},n.prototype.flushCCStreams=function(t){this.ccStreams_.forEach(function(e){return"flush"===t?e.flush():e.partialFlush()},this)},n.prototype.flushStream=function(e){this.captionPackets_.length&&(this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)},this),this.captionPackets_.length=0),this.flushCCStreams(e)},n.prototype.flush=function(){return this.flushStream("flush")},n.prototype.partialFlush=function(){return this.flushStream("partialFlush")},n.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},n.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},n.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},n.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},n.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},n.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)},{127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600}),m=(a.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},a.prototype.getText=function(){return this.rows.join("\n")},a.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},a.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0<this.rows.length&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},a.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},a.prototype.addText=function(e){this.rows[this.rowIdx]+=e},a.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},Te.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new a(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Te.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Te.prototype.createTextDecoder=function(t){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(t)}catch(e){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+t+" encoding. "+e})}},function(e){e=e||{},m.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach(e=>{t=s[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),Fe=(m.prototype=new p,m.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},m.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,t=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(t)},m.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r<i.length;r++)e=31&(n=i[r++]),7===(s=n>>5)&&0<e&&(s=i[r++]),this.pushServiceBlock(s,r,e),0<e&&(r+=e-1)},m.prototype.pushServiceBlock=function(e,t,i){for(var s,r=t,n=this.current708Packet.data,a=(a=this.services[e])||this.initService(e,r);r<t+i&&r<n.length;r++)s=n[r],o(s)?r=this.handleText(r,a):24===s?r=this.multiByteCharacter(r,a):16===s?r=this.extendedCommands(r,a):128<=s&&s<=135?r=this.setCurrentWindow(r,a):152<=s&&s<=159?r=this.defineWindow(r,a):136===s?r=this.clearWindows(r,a):140===s?r=this.deleteWindows(r,a):137===s?r=this.displayWindows(r,a):138===s?r=this.hideWindows(r,a):139===s?r=this.toggleWindows(r,a):151===s?r=this.setWindowAttributes(r,a):144===s?r=this.setPenAttributes(r,a):145===s?r=this.setPenColor(r,a):146===s?r=this.setPenLocation(r,a):143===s?a=this.reset(r,a):8===s?a.currentWindow.backspace():12===s?a.currentWindow.clearText():13===s?a.currentWindow.pendingNewLine=!0:14===s?a.currentWindow.clearText():141===s&&r++},m.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return e=o(i)?this.handleText(e,t,{isExtended:!0}):e},m.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},m.prototype.initService=function(t,e){var i,s="SERVICE"+t,r=this;return s in this.serviceEncodings&&(i=this.serviceEncodings[s]),this.services[t]=new Te(t,i,r),this.services[t].init(this.getPts(e),function(e){r.flushDisplayed(e,r.services[t])}),this.services[t]},m.prototype.handleText=function(e,t,i){var s,r=i&&i.isExtended,i=i&&i.isMultiByte,n=this.current708Packet.data,a=r?4096:0,o=n[e],n=n[e+1],l=t.currentWindow,n=t.textDecoder_&&!r?(i?(s=[o,n],e++):s=[o],t.textDecoder_.decode(new Uint8Array(s))):(i=Be[r=a|o]||r,4096&r&&r===i?"":String.fromCharCode(i));return l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(n),e},m.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,s=i[e+1],i=i[e+2];return e=o(s)&&o(i)?this.handleText(++e,t,{isMultiByte:!0}):e},m.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},m.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e],t=(t.setCurrentWindow(7&s),t.currentWindow),s=i[++e];return t.visible=(32&s)>>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},m.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.winAttr),s=i[++e];return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},m.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},m.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},m.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},m.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},m.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},m.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},m.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},m.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penAttr),s=i[++e];return t.textTag=(240&s)>>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},m.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,t=(i[e],t.currentWindow.penColor),s=i[++e];return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},m.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},m.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496}),je=14,He=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],g=function(e,t){g.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=h()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=h():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=h()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=Se((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),s=Se((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?this.column_+=3&i:this.isPAC(t,i)?(r=He.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*((14&n)>>1)),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=Se(t),s+=Se(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},p=(g.prototype=new p,g.prototype.flushDisplayed=function(e){var t=this.displayed_.map(function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}},this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},g.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=h(),this.nonDisplayed_=h(),this.lastControlCode_=null,this.column_=0,this.row_=je,this.rollUpRows_=2,this.formatting_=[]},g.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},g.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},g.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},g.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},g.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},g.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},g.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},g.prototype.isNormalChar=function(e){return 32<=e&&e<=127},g.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=je,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=h(),this.displayed_=h()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},g.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);t=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,t)},g.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},""),this.formatting_=[],this[this.mode_](e,t))},g.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];this.nonDisplayed_[this.row_]=i+=t},g.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t},g.prototype.shiftRowsUp_=function(){for(var e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<je+1;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},g.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t},{CaptionStream:n,Cea608Stream:g,Cea708Stream:m}),qe={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ve=i,$e=8589934592,We=4294967296;Ee.prototype=new Ve;function Ge(e,t,i){for(var s="",r=t;r<i;r++)s+="%"+("00"+e[r].toString(16)).slice(-2);return s}function f(e,t,i){return decodeURIComponent(Ge(e,t,i))}function y(e,t,i){return unescape(Ge(e,t,i))}function _(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}var ze,Xe,Ke,Ve=Ee,Ye=we,Qe=(e,t,i)=>{if(e)for(var s=i;s<e.length;s++)if(e[s]===t)return s;return-1},Je=3,v={APIC:function(e){var t,i=1;e.data[0]!==Je||(t=Qe(e.data,0,1))<0||(e.mimeType=y(e.data,1,t),e.pictureType=e.data[i=t+1],(t=Qe(e.data,0,++i))<0)||(e.description=f(e.data,i,t),i=t+1,"--\x3e"===e.mimeType?e.url=y(e.data,i,e.data.length):e.pictureData=e.data.subarray(i,e.data.length))},"T*":function(e){e.data[0]===Je&&(e.value=f(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===Je&&-1!==(t=Qe(e.data,0,1))&&(e.description=f(e.data,1,t),e.value=f(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=y(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===Je&&-1!==(t=Qe(e.data,0,1))&&(e.description=f(e.data,1,t),e.url=y(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){for(var t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=y(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},b={parseId3Frames:function(e){var t,i=10,s=0,r=[];if(!(e.length<10||e[0]!=="I".charCodeAt(0)||e[1]!=="D".charCodeAt(0)||e[2]!=="3".charCodeAt(0))){s=_(e.subarray(6,10));s+=10,64&e[5]&&(i=(i+=4)+_(e.subarray(10,14)),s-=_(e.subarray(16,20)));do{if((t=_(e.subarray(i+4,i+8)))<1)break;var n={id:String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]),data:e.subarray(i+10,i+t+10)}}while(n.key=n.id,v[n.id]?v[n.id](n):"T"===n.id[0]?v["T*"](n):"W"===n.id[0]&&v["W*"](n),r.push(n),(i=i+10+t)<s);return r}},parseSyncSafeInteger:_,frameParsers:v},T=i,Ze=qe,S=b,et=function(e){var t,i={descriptor:e&&e.descriptor},l=0,d=[],h=0;if(et.prototype.init.call(this),this.dispatchType=Ze.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,s,r,n,a,o;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(h=0,d.length=0),0===d.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(d.push(e),h+=e.data.byteLength,1===d.length&&(l=S.parseSyncSafeInteger(e.data.subarray(6,10)),l+=10),!(h<l)){for(t={data:new Uint8Array(l),frames:[],pts:d[0].pts,dts:d[0].dts},r=0;r<l;)t.data.set(d[0].data.subarray(0,l-r),r),r+=d[0].data.byteLength,h-=d[0].data.byteLength,d.shift();i=10,64&t.data[5]&&(i=(i+=4)+S.parseSyncSafeInteger(t.data.subarray(10,14)),l-=S.parseSyncSafeInteger(t.data.subarray(16,20)));do{if((s=S.parseSyncSafeInteger(t.data.subarray(i+4,i+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}}while((o={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+s+10)}).key=o.id,S.frameParsers[o.id]?S.frameParsers[o.id](o):"T"===o.id[0]?S.frameParsers["T*"](o):"W"===o.id[0]&&S.frameParsers["W*"](o),"com.apple.streaming.transportStreamTimestamp"===o.owner&&(a=(1&(n=o.data)[3])<<30|n[4]<<22|n[5]<<14|n[6]<<6|n[7]>>>2,a=(a*=4)+(3&n[7]),o.timeStamp=a,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)),t.frames.push(o),(i=i+10+s)<l);this.trigger("data",t)}}},b=(et.prototype=new T,et),T=i,tt=p,w=qe,it=function(){var r=new Uint8Array(188),n=0;it.prototype.init.call(this),this.push=function(e){var t,i=0,s=188;for(n?((t=new Uint8Array(e.byteLength+n)).set(r.subarray(0,n)),t.set(e,n),n=0):t=e;s<t.byteLength;)71===t[i]&&71===t[s]?(this.trigger("data",t.subarray(i,s)),i+=188,s+=188):(i++,s++);i<t.byteLength&&(r.set(t.subarray(i),0),n=t.byteLength-i)},this.flush=function(){188===n&&71===r[0]&&(this.trigger("data",r),n=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){n=0,this.trigger("reset")}},st=(it.prototype=new T,(ze=function(){var s,r,n,a;ze.prototype.init.call(this),(a=this).packetsWaitingForPmt=[],this.programMapTable=void 0,s=function(e,t){var i=0;t.payloadUnitStartIndicator&&(i+=e[i]+1),("pat"===t.type?r:n)(e.subarray(i),t)},r=function(e,t){t.section_number=e[7],t.last_section_number=e[8],a.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=a.pmtPid},n=function(e,t){var i,s;if(1&e[5]){for(a.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,s=12+((15&e[10])<<8|e[11]);s<i;){var r=e[s],n=(31&e[s+1])<<8|e[s+2];r===w.H264_STREAM_TYPE&&null===a.programMapTable.video?a.programMapTable.video=n:r===w.ADTS_STREAM_TYPE&&null===a.programMapTable.audio?a.programMapTable.audio=n:r===w.METADATA_STREAM_TYPE&&(a.programMapTable["timed-metadata"][n]=r),s+=5+((15&e[s+3])<<8|e[s+4])}t.programMapTable=a.programMapTable}},this.push=function(e){var t={},i=4;if(t.payloadUnitStartIndicator=!!(64&e[1]),t.pid=31&e[1],t.pid<<=8,t.pid|=e[2],1<(48&e[3])>>>4&&(i+=e[i]+1),0===t.pid)t.type="pat",s(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",s(e.subarray(i),t),this.trigger("data",t);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([e,i,t]):this.processPes_(e,i,t)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=w.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=w.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new T,ze.STREAM_TYPES={h264:27,adts:15},(Xe=function(){function s(e,t,i){var s,r=new Uint8Array(e.size),n={type:t},a=0,o=0;if(e.data.length&&!(e.size<9)){for(n.trackId=e.data[0].pid,a=0;a<e.data.length;a++)s=e.data[a],r.set(s.data,o),o+=s.data.byteLength;d(r,n),t="video"===t||n.packetLength<=e.size,(i||t)&&(e.size=0,e.data.length=0),t&&l.trigger("data",n)}}var t,l=this,r=!1,n={data:[],size:0},a={data:[],size:0},o={data:[],size:0},d=function(e,t){var i=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1==i&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=0!=(4&e[6]),192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Xe.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case w.H264_STREAM_TYPE:e=n,t="video";break;case w.ADTS_STREAM_TYPE:e=a,t="audio";break;case w.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(i),e.size+=i.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=i.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),r=!0,l.trigger("data",e)}})[i.type]()},this.reset=function(){n.size=0,n.data.length=0,a.size=0,a.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(a,"audio"),s(o,"timed-metadata")},this.flush=function(){var e;!r&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),l.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new T,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:it,TransportParseStream:ze,ElementaryStream:Xe,TimestampRolloverStream:Ve,CaptionStream:tt.CaptionStream,Cea608Stream:tt.Cea608Stream,Cea708Stream:tt.Cea708Stream,MetadataStream:b});for(Ke in w)w.hasOwnProperty(Ke)&&(st[Ke]=w[Ke]);var rt,nt,T=st,Ve=i,at=c.ONE_SECOND_IN_TS,ot=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],lt=function(l){var d,h=0;lt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${h} outside syncword`})},this.push=function(e){var t,i,s,r,n,a,o=0;if(l||(h=0),"audio"===e.type){for(d&&d.length?(s=d,(d=new Uint8Array(s.byteLength+e.data.byteLength)).set(s),d.set(e.data,s.byteLength)):d=e.data;o+7<d.length;)if(255!==d[o]||240!=(246&d[o+1]))"number"!=typeof a&&(a=o),o++;else{if("number"==typeof a&&(this.skipWarn_(a,o),a=null),i=2*(1&~d[o+1]),t=(3&d[o+3])<<11|d[o+4]<<3|(224&d[o+5])>>5,n=(r=1024*(1+(3&d[o+6])))*at/ot[(60&d[o+2])>>>2],d.byteLength-o<t)break;this.trigger("data",{pts:e.pts+h*n,dts:e.dts+h*n,sampleCount:r,audioobjecttype:1+(d[o+2]>>>6&3),channelcount:(1&d[o+2])<<2|(192&d[o+3])>>>6,samplerate:ot[(60&d[o+2])>>>2],samplingfrequencyindex:(60&d[o+2])>>>2,samplesize:16,data:d.subarray(o+7+i,o+t)}),h++,o+=t}"number"==typeof a&&(this.skipWarn_(a,o),a=null),d=d.subarray(o)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},tt=(lt.prototype=new Ve,lt),b=i,dt=function(s){var r=s.byteLength,n=0,a=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+a},this.loadWord=function(){var e=s.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(s.subarray(e,e+i)),n=new DataView(t.buffer).getUint32(0),a=8*i,r-=i},this.skipBits=function(e){var t;e<a||(e=(e-=a)-8*(t=Math.floor(e/8)),r-=t,this.loadWord()),n<<=e,a-=e},this.readBits=function(e){var t=Math.min(a,e),i=n>>>32-t;return 0<(a-=t)?n<<=t:0<r&&this.loadWord(),0<(t=e-t)?i<<t|this.readBits(t):i},this.skipLeadingZeros=function(){for(var e=0;e<a;++e)if(0!=(n&2147483648>>>e))return n<<=e,a-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()},ht=function(){var s,r,n=0;ht.prototype.init.call(this),this.push=function(e){for(var t,i=(r=r?((t=new Uint8Array(r.byteLength+e.data.byteLength)).set(r),t.set(e.data,r.byteLength),t):e.data).byteLength;n<i-3;n++)if(1===r[n+2]){s=n+5;break}for(;s<i;)switch(r[s]){case 0:if(0!==r[s-1])s+=2;else if(0!==r[s-2])s++;else{for(n+3!==s-2&&this.trigger("data",r.subarray(n+3,s-2));1!==r[++s]&&s<i;);n=s-2,s+=3}break;case 1:0!==r[s-1]||0!==r[s-2]?s+=3:(this.trigger("data",r.subarray(n+3,s-2)),n=s-2,s+=3);break;default:s+=3}r=r.subarray(n),s-=n,n=0},this.reset=function(){r=null,n=0,this.trigger("reset")},this.flush=function(){r&&3<r.byteLength&&this.trigger("data",r.subarray(n+3)),r=null,n=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}};ht.prototype=new b,nt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(rt=function(){var i,s,r,n,a,o,g,t=new ht;rt.prototype.init.call(this),(i=this).push=function(e){"video"===e.type&&(s=e.trackId,r=e.pts,n=e.dts,t.push(e))},t.on("data",function(e){var t={trackId:s,pts:r,dts:n,data:e,nalUnitTypeCode:31&e[0]};switch(t.nalUnitTypeCode){case 5:t.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:t.nalUnitType="sei_rbsp",t.escapedRBSP=a(e.subarray(1));break;case 7:t.nalUnitType="seq_parameter_set_rbsp",t.escapedRBSP=a(e.subarray(1)),t.config=o(t.escapedRBSP);break;case 8:t.nalUnitType="pic_parameter_set_rbsp";break;case 9:t.nalUnitType="access_unit_delimiter_rbsp"}i.trigger("data",t)}),t.on("done",function(){i.trigger("done")}),t.on("partialdone",function(){i.trigger("partialdone")}),t.on("reset",function(){i.trigger("reset")}),t.on("endedtimeline",function(){i.trigger("endedtimeline")}),this.flush=function(){t.flush()},this.partialFlush=function(){t.partialFlush()},this.reset=function(){t.reset()},this.endTimeline=function(){t.endTimeline()},g=function(e,t){for(var i=8,s=8,r=0;r<e;r++)i=0===(s=0!==s?(i+t.readExpGolomb()+256)%256:s)?i:s},a=function(e){for(var t=e.byteLength,i=[],s=1;s<t-2;)0===e[s]&&0===e[s+1]&&3===e[s+2]?(i.push(s+2),s+=2):s++;if(0===i.length)return e;for(var r=t-i.length,n=new Uint8Array(r),a=0,s=0;s<r;a++,s++)a===i[0]&&(a++,i.shift()),n[s]=e[a];return n},o=function(e){var t,i,s,r,n,a,o=0,l=0,d=0,h=0,u=[1,1],c=new dt(e),e=c.readUnsignedByte(),p=c.readUnsignedByte(),m=c.readUnsignedByte();if(c.skipUnsignedExpGolomb(),nt[e]&&(3===(i=c.readUnsignedExpGolomb())&&c.skipBits(1),c.skipUnsignedExpGolomb(),c.skipUnsignedExpGolomb(),c.skipBits(1),c.readBoolean()))for(n=3!==i?8:12,a=0;a<n;a++)c.readBoolean()&&g(a<6?16:64,c);if(c.skipUnsignedExpGolomb(),0===(i=c.readUnsignedExpGolomb()))c.readUnsignedExpGolomb();else if(1===i)for(c.skipBits(1),c.skipExpGolomb(),c.skipExpGolomb(),t=c.readUnsignedExpGolomb(),a=0;a<t;a++)c.skipExpGolomb();if(c.skipUnsignedExpGolomb(),c.skipBits(1),i=c.readUnsignedExpGolomb(),s=c.readUnsignedExpGolomb(),0===(r=c.readBits(1))&&c.skipBits(1),c.skipBits(1),c.readBoolean()&&(o=c.readUnsignedExpGolomb(),l=c.readUnsignedExpGolomb(),d=c.readUnsignedExpGolomb(),h=c.readUnsignedExpGolomb()),c.readBoolean()&&c.readBoolean()){switch(c.readUnsignedByte()){case 1:u=[1,1];break;case 2:u=[12,11];break;case 3:u=[10,11];break;case 4:u=[16,11];break;case 5:u=[40,33];break;case 6:u=[24,11];break;case 7:u=[20,11];break;case 8:u=[32,11];break;case 9:u=[80,33];break;case 10:u=[18,11];break;case 11:u=[15,11];break;case 12:u=[64,33];break;case 13:u=[160,99];break;case 14:u=[4,3];break;case 15:u=[3,2];break;case 16:u=[2,1];break;case 255:u=[c.readUnsignedByte()<<8|c.readUnsignedByte(),c.readUnsignedByte()<<8|c.readUnsignedByte()]}u&&(u[0],u[1])}return{profileIdc:e,levelIdc:m,profileCompatibility:p,width:16*(i+1)-2*o-2*l,height:(2-r)*(s+1)*16-2*d-2*h,sarRatio:u}}}).prototype=new b;function ut(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}var Ve=rt,ct=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],pt=function(e,t){var i=0<=(i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9])?i:0;return(16&e[t+5])>>4?20+i:10+i},mt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=pt(e,t),mt(e,t))},gt=function(e,t,i){for(var s="",r=t;r<i;r++)s+="%"+("00"+e[r].toString(16)).slice(-2);return s},b={isLikelyAacData:function(e){var t=mt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:pt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,s=e[t+4]<<3;return 6144&e[t+3]|s|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return ct[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+ut(e.subarray(10,14)));do{if((t=ut(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var s,r,n=e.subarray(i+10,i+t+10),a=0;a<n.byteLength;a++)if(0===n[a]){if("com.apple.streaming.transportStreamTimestamp"===unescape(gt(n,0,a)))return r=(1&(s=n.subarray(a+1))[3])<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)<e.byteLength);return null}},E=i,ft=b,yt=function(){var n=new Uint8Array,a=0;yt.prototype.init.call(this),this.setTimestamp=function(e){a=e},this.push=function(e){var t,i,s=0,r=0;for(n.length?(i=n.length,(n=new Uint8Array(e.byteLength+i)).set(n.subarray(0,i)),n.set(e,i)):n=e;3<=n.length-r;)if(n[r]==="I".charCodeAt(0)&&n[r+1]==="D".charCodeAt(0)&&n[r+2]==="3".charCodeAt(0)){if(n.length-r<10)break;if(r+(s=ft.parseId3TagSize(n,r))>n.length)break;t={type:"timed-metadata",data:n.subarray(r,r+s)},this.trigger("data",t),r+=s}else if(255==(255&n[r])&&240==(240&n[r+1])){if(n.length-r<7)break;if(r+(s=ft.parseAdtsSize(n,r))>n.length)break;t={type:"audio",data:n.subarray(r,r+s),pts:a,dts:a},this.trigger("data",t),r+=s}else r++;i=n.length-r,n=0<i?n.subarray(r):new Uint8Array},this.reset=function(){n=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){n=new Uint8Array,this.trigger("endedtimeline")}};yt.prototype=new E;function _t(e,t){for(var i=Object.keys(t),s=0;s<i.length;s++){var r=i[s];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Ot.bind(e,r))}}function vt(e,t){var i;if(e.length===t.length){for(i=0;i<e.length;i++)if(e[i]!==t[i])return;return 1}}function bt(e,t,i,s,r,n){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(s-t),pts:e+(r-i)},prependedContentDuration:n,baseMediaDecodeTime:e}}var Tt,St,k,E=i,C=Ce,I=xe,wt=Pe,x=Le,A=T,Et=c,kt=tt,Ct=Ve,It=yt,xt=b.isLikelyAacData,At=c.ONE_SECOND_IN_TS,Pt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Lt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ot=function(e,t){t.stream=e,this.trigger("log",t)},Dt=function(n,a){var o=[],l=0,d=0,h=1/0,u=(a=a||{}).firstSequenceNumber||0;Dt.prototype.init.call(this),this.push=function(t){x.collectDtsInfo(n,t),n&&Pt.forEach(function(e){n[e]=t[e]}),o.push(t)},this.setEarliestDts=function(e){l=e},this.setVideoBaseMediaDecodeTime=function(e){h=e},this.setAudioAppendStart=function(e){d=e},this.flush=function(){var e,t,i,s,r;0!==o.length&&(e=wt.trimAdtsFramesByEarliestDts(o,n,l),n.baseMediaDecodeTime=x.calculateTrackBaseMediaDecodeTime(n,a.keepOriginalTimestamps),r=wt.prefixWithSilence(n,e,d,h),n.samples=wt.generateSampleTable(e),i=C.mdat(wt.concatenateFrameData(e)),o=[],s=C.moof(u,[n]),t=new Uint8Array(s.byteLength+i.byteLength),u++,t.set(s),t.set(i,s.byteLength),x.clearDtsInfo(n),i=Math.ceil(1024*At/n.samplerate),e.length&&(s=e.length*i,this.trigger("segmentTimingInfo",bt(Et.audioTsToVideoTs(n.baseMediaDecodeTime,n.samplerate),e[0].dts,e[0].pts,e[0].dts+s,e[0].pts+s,r||0)),this.trigger("timingInfo",{start:e[0].pts,end:e[0].pts+s})),this.trigger("data",{track:n,boxes:t})),this.trigger("done","AudioSegmentStream")},this.reset=function(){x.clearDtsInfo(n),o=[],this.trigger("reset")}};Dt.prototype=new E,(Tt=function(a,n){var t,i,o=[],d=[],l=(n=n||{}).firstSequenceNumber||0;Tt.prototype.init.call(this),delete a.minPTS,this.gopCache_=[],this.push=function(e){x.collectDtsInfo(a,e),"seq_parameter_set_rbsp"!==e.nalUnitType||t||(t=e.config,a.sps=[e.data],Lt.forEach(function(e){a[e]=t[e]},this)),"pic_parameter_set_rbsp"!==e.nalUnitType||i||(i=e.data,a.pps=[e.data]),o.push(e)},this.flush=function(){for(var e,t,i,s=0;o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0!==o.length){if(e=I.groupNalsIntoFrames(o),(e=I.groupFramesIntoGops(e))[0][0].keyFrame||((r=this.getGopForFusion_(o[0],a))?(s=r.duration,e.unshift(r),e.byteLength+=r.byteLength,e.nalCount+=r.nalCount,e.pts=r.pts,e.dts=r.dts,e.duration+=r.duration):e=I.extendFirstKeyFrame(e)),d.length){var r=n.alignGopsAtEnd?this.alignGopsAtEnd_(e):this.alignGopsAtStart_(e);if(!r)return this.gopCache_.unshift({gop:e.pop(),pps:a.pps,sps:a.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");x.clearDtsInfo(a),e=r}x.collectDtsInfo(a,e),a.samples=I.generateSampleTable(e),r=C.mdat(I.concatenateNalData(e)),a.baseMediaDecodeTime=x.calculateTrackBaseMediaDecodeTime(a,n.keepOriginalTimestamps),this.trigger("processedGopsInfo",e.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),t=e[0],i=e[e.length-1],this.trigger("segmentTimingInfo",bt(a.baseMediaDecodeTime,t.dts,t.pts,i.dts+i.duration,i.pts+i.duration,s)),this.trigger("timingInfo",{start:e[0].pts,end:e[e.length-1].pts+e[e.length-1].duration}),this.gopCache_.unshift({gop:e.pop(),pps:a.pps,sps:a.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.trigger("baseMediaDecodeTime",a.baseMediaDecodeTime),this.trigger("timelineStartInfo",a.timelineStartInfo),t=C.moof(l,[a]),i=new Uint8Array(t.byteLength+r.byteLength),l++,i.set(t),i.set(r,t.byteLength),this.trigger("data",{track:a,boxes:i})}this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),o=[],this.gopCache_.length=0,d.length=0,this.trigger("reset")},this.resetStream_=function(){x.clearDtsInfo(a),i=t=void 0},this.getGopForFusion_=function(e){for(var t,i,s,r=1/0,n=0;n<this.gopCache_.length;n++)i=(s=this.gopCache_[n]).gop,a.pps&&vt(a.pps[0],s.pps[0])&&a.sps&&vt(a.sps[0],s.sps[0])&&(i.dts<a.timelineStartInfo.dts||-1e4<=(i=e.dts-i.dts-i.duration)&&i<=45e3&&(!t||i<r)&&(t=s,r=i));return t?t.gop:null},this.alignGopsAtStart_=function(e){for(var t,i,s,r,n=e.byteLength,a=e.nalCount,o=e.duration,l=t=0;l<d.length&&t<e.length&&(i=d[l],s=e[t],i.pts!==s.pts);)s.pts>i.pts?l++:(t++,n-=s.byteLength,a-=s.nalCount,o-=s.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=n,r.duration=o,r.nalCount=a,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,s,r,n=d.length-1,a=e.length-1,o=null,l=!1;0<=n&&0<=a;){if(t=d[n],i=e[a],t.pts===i.pts){l=!0;break}t.pts>i.pts?n--:(n===d.length-1&&(o=a),a--)}return l||null!==o?0===(s=l?a:o)?e:(r=(s=e.slice(s)).reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0}),s.byteLength=r.byteLength,s.duration=r.duration,s.nalCount=r.nalCount,s.pts=s[0].pts,s.dts=s[0].dts,s):null},this.alignGopsWith=function(e){d=e}}).prototype=new E,((k=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!=typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,k.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new E).flush=function(e){var t,i,s,r=0,n={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Lt.forEach(function(e){n.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Pt.forEach(function(e){n.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=C.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s<this.pendingBoxes.length;s++)n.data.set(this.pendingBoxes[s],r),r+=this.pendingBoxes[s].byteLength;for(s=0;s<this.pendingCaptions.length;s++)(t=this.pendingCaptions[s]).startTime=Et.metadataTsToSeconds(t.startPts,a,this.keepOriginalTimestamps),t.endTime=Et.metadataTsToSeconds(t.endPts,a,this.keepOriginalTimestamps),n.captionStreams[t.stream]=!0,n.captions.push(t);for(s=0;s<this.pendingMetadata.length;s++)(i=this.pendingMetadata[s]).cueTime=Et.metadataTsToSeconds(i.pts,a,this.keepOriginalTimestamps),n.metadata.push(i);for(n.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",n),s=0;s<n.captions.length;s++)t=n.captions[s],this.trigger("caption",t);for(s=0;s<n.metadata.length;s++)i=n.metadata[s],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},k.prototype.setRemux=function(e){this.remuxTracks=e},(St=function(s){var r,n,a=this,i=!0;St.prototype.init.call(this),s=s||{},this.baseMediaDecodeTime=s.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new A.MetadataStream,t.aacStream=new It,t.audioTimestampRolloverStream=new A.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new A.TimestampRolloverStream("timed-metadata"),t.adtsStream=new kt,t.coalesceStream=new k(s,t.metadataStream),t.headOfPipeline=t.aacStream,t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream),t.aacStream.pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),t.metadataStream.on("timestamp",function(e){t.aacStream.setTimestamp(e.timeStamp)}),t.aacStream.on("data",function(e){"timed-metadata"!==e.type&&"audio"!==e.type||t.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:a.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Dt(n,s),t.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),_t(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new A.MetadataStream,i.packetStream=new A.TransportPacketStream,i.parseStream=new A.TransportParseStream,i.elementaryStream=new A.ElementaryStream,i.timestampRolloverStream=new A.TimestampRolloverStream,i.adtsStream=new kt,i.h264Stream=new Ct,i.captionStream=new A.CaptionStream(s),i.coalesceStream=new k(s,i.metadataStream),i.headOfPipeline=i.packetStream,i.packetStream.pipe(i.parseStream).pipe(i.elementaryStream).pipe(i.timestampRolloverStream),i.timestampRolloverStream.pipe(i.h264Stream),i.timestampRolloverStream.pipe(i.adtsStream),i.timestampRolloverStream.pipe(i.metadataStream).pipe(i.coalesceStream),i.h264Stream.pipe(i.captionStream).pipe(i.coalesceStream),i.elementaryStream.on("data",function(e){var t;if("metadata"===e.type){for(t=e.tracks.length;t--;)r||"video"!==e.tracks[t].type?n||"audio"!==e.tracks[t].type||((n=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=a.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new Tt(r,s),i.videoSegmentStream.on("log",a.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){n&&!s.keepOriginalTimestamps&&(n.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-a.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",a.trigger.bind(a,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",a.trigger.bind(a,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),n&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Dt(n,s),i.audioSegmentStream.on("log",a.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",a.trigger.bind(a,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",a.trigger.bind(a,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),a.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,a.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),_t(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;s.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,x.clearDtsInfo(n),t.audioTimestampRolloverStream)&&t.audioTimestampRolloverStream.discontinuity(),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,x.clearDtsInfo(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;s.remux=e,t&&t.coalesceStream&&t.coalesceStream.setRemux(e)},this.alignGopsWith=function(e){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(t){var i=this;return function(e){e.stream=t,i.trigger("log",e)}},this.push=function(e){var t;i&&((t=xt(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),i=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){i=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new E;function Nt(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function Mt(e,t){var i,s,r,n=[];if(!t.length)return null;for(i=0;i<e.byteLength;)s=$t(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=Wt(e.subarray(i+4,i+8)),s=1<s?i+s:e.byteLength,r===t[0]&&(1===t.length?n.push(e.subarray(i+8,s)):(r=Mt(e.subarray(i+8,s),t.slice(1))).length&&(n=n.concat(r))),i=s;return n}function Rt(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return t.baseMediaDecodeTime=1===t.version?zt(e.subarray(4)):Gt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t}function Ut(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},s=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],n=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],d=8&i.flags[1],h=s.getUint32(4),u=8;for(r&&(i.dataOffset=s.getInt32(u),u+=4),n&&h&&(t={flags:Xt(e.subarray(u,u+4))},u+=4,a&&(t.duration=s.getUint32(u),u+=4),o&&(t.size=s.getUint32(u),u+=4),d&&(t.compositionTimeOffset=1===i.version?s.getInt32(u):s.getUint32(u),u+=4),i.samples.push(t),h--);h--;)t={},a&&(t.duration=s.getUint32(u),u+=4),o&&(t.size=s.getUint32(u),u+=4),l&&(t.flags=Xt(e.subarray(u,u+4)),u+=4),d&&(t.compositionTimeOffset=1===i.version?s.getInt32(u):s.getUint32(u),u+=4),i.samples.push(t);return i}function Bt(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=1&(e={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4)}).flags[2],s=2&e.flags[2],r=8&e.flags[2],n=16&e.flags[2],a=32&e.flags[2],o=65536&e.flags[0],l=131072&e.flags[0],d=8;return i&&(d+=4,e.baseDataOffset=t.getUint32(12),d+=4),s&&(e.sampleDescriptionIndex=t.getUint32(d),d+=4),r&&(e.defaultSampleDuration=t.getUint32(d),d+=4),n&&(e.defaultSampleSize=t.getUint32(d),d+=4),a&&(e.defaultSampleFlags=t.getUint32(d)),o&&(e.durationIsEmpty=!0),!i&&l&&(e.baseDataOffsetIsMoof=!0),e}function Ft(e){var t=31&e[1];return t<<8|e[2]}function jt(e){return!!(64&e[1])}function Ht(e){var t=0;return 1<(48&e[3])>>>4&&(t+=e[4]+1),t}function qt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}var Vt=St,i=function(e){return e>>>0},Pe=function(e){return("00"+e.toString(16)).slice(-2)},$t=i,Wt=Nt,Gt=i,zt=_e.getUint64,Xt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Le="undefined"!=typeof window?window:"undefined"!=typeof fe?fe:"undefined"!=typeof self?self:{},T=Le,Kt=De.discardEmulationPreventionBytes,Yt=p.CaptionStream,P=Mt,Qt=Rt,Jt=Ut,Zt=Bt,ei=T,ti=function(e,h){var i=P(e,["moof","traf"]),e=P(e,["mdat"]),u={},s=[];return e.forEach(function(e,t){t=i[t];s.push({mdat:e,traf:t})}),s.forEach(function(e){var t,i,s,r,n,a=e.mdat,e=e.traf,o=P(e,["tfhd"]),o=Zt(o[0]),l=o.trackId,d=P(e,["tfdt"]),d=0<d.length?Qt(d[0]).baseMediaDecodeTime:0,e=P(e,["trun"]);h===l&&0<e.length&&(t=d,i=o.defaultSampleDuration||0,s=o.defaultSampleSize||0,r=o.trackId,n=[],e.forEach(function(e){e=Jt(e).samples;e.forEach(function(e){void 0===e.duration&&(e.duration=i),void 0===e.size&&(e.size=s),e.trackId=r,e.dts=t,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof t?(e.pts=t+ei.BigInt(e.compositionTimeOffset),t+=ei.BigInt(e.duration)):(e.pts=t+e.compositionTimeOffset,t+=e.duration)}),n=n.concat(e)}),d=function(e,t,i){for(var s,r,n=new DataView(e.buffer,e.byteOffset,e.byteLength),a={logs:[],seiNals:[]},o=0;o+4<e.length;o+=s)if(s=n.getUint32(o),o+=4,!(s<=0))switch(31&e[o]){case 6:var l=e.subarray(o+1,o+1+s),d=function(e,t){for(var i=e,s=0;s<t.length;s++){var r=t[s];if(i<r.size)return r;i-=r.size}return null}(o,t),l={nalUnitType:"sei_rbsp",size:s,data:l,escapedRBSP:Kt(l),trackId:i};if(d)l.pts=d.pts,l.dts=d.dts,r=d;else{if(!r){a.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+o+" for trackId "+i+". See mux.js#223."});break}l.pts=r.pts,l.dts=r.dts}a.seiNals.push(l)}return a}(a,n,l),u[l]||(u[l]={seiNals:[],logs:[]}),u[l].seiNals=u[l].seiNals.concat(d.seiNals),u[l].logs=u[l].logs.concat(d.logs))}),u},ii=function(){var t,a,o,l,d,i,s=!1;this.isInitialized=function(){return s},this.init=function(e){t=new Yt,s=!0,i=!!e&&e.isPartial,t.on("data",function(e){e.startTime=e.startPts/l,e.endTime=e.endPts/l,d.captions.push(e),d.captionStreams[e.stream]=!0}),t.on("log",function(e){d.logs.push(e)})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||o===e[0]&&l===t[o])},this.parse=function(e,t,i){var s,r;if(!this.isInitialized())return null;if(!t||!i)return null;if(this.isNewInit(t,i))o=t[0],l=i[o];else if(null===o||!l)return a.push(e),null;for(;0<a.length;){var n=a.shift();this.parse(n,t,i)}return e=e,r=l,(s=null===(s=o)?null:{seiNals:(e=ti(e,s)[s]||{}).seiNals,logs:e.logs,timescale:r})&&s.logs&&(d.logs=d.logs.concat(s.logs)),null!==s&&s.seiNals?(this.pushNals(s.seiNals),this.flushStream(),d):d.logs.length?{logs:d.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(e){if(!this.isInitialized()||!e||0===e.length)return null;e.forEach(function(e){t.push(e)})},this.flushStream=function(){if(!this.isInitialized())return null;i?t.partialFlush():t.flush()},this.clearParsedCaptions=function(){d.captions=[],d.captionStreams={},d.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){a=[],l=o=null,d?this.clearParsedCaptions():d={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},si=i,L=Pe,O=Mt,ri=Nt,ni=_e.getUint64,ai=T,oi=function(e){var t=0===e[0]?12:20;return si(e[t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])},li=function(n,e){e=O(e,["moof","traf"]).reduce(function(e,t){var i=O(t,["tfhd"])[0],i=si(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),i=n[i]||9e4,t=O(t,["tfdt"])[0],s=new DataView(t.buffer,t.byteOffset,t.byteLength),t=1===t[0]?ni(t.subarray(4,12)):s.getUint32(4);let r;return"bigint"==typeof t?r=t/ai.BigInt(i):"number"!=typeof t||isNaN(t)||(r=t/i),e=(r=r<Number.MAX_SAFE_INTEGER?Number(r):r)<e?r:e},1/0);return"bigint"==typeof e||isFinite(e)?e:0},di=function(e){var e=O(e,["moov","trak"]),n=[];return e.forEach(function(e){var t,i={},s=O(e,["tkhd"])[0],r=(s&&(r=(s=new DataView(s.buffer,s.byteOffset,s.byteLength)).getUint8(0),i.id=0===r?s.getUint32(12):s.getUint32(20)),O(e,["mdia","hdlr"])[0]),r=(r&&(s=ri(r.subarray(8,12)),i.type="vide"===s?"video":"soun"===s?"audio":s),O(e,["mdia","minf","stbl","stsd"])[0]),s=(r&&(s=r.subarray(8),i.codec=ri(s.subarray(4,8)),r=O(s,[i.codec])[0])&&(/^[asm]vc[1-9]$/i.test(i.codec)?(t=r.subarray(78),"avcC"===ri(t.subarray(4,8))&&11<t.length?(i.codec+=".",i.codec+=L(t[9]),i.codec+=L(t[10]),i.codec+=L(t[11])):i.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(i.codec)?(t=r.subarray(28),"esds"===ri(t.subarray(4,8))&&20<t.length&&0!==t[19]?(i.codec+="."+L(t[19]),i.codec+="."+L(t[20]>>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2"):i.codec=i.codec.toLowerCase()),O(e,["mdia","mdhd"])[0]);s&&(i.timescale=oi(s)),n.push(i)}),n},hi=qe,ui=qe,D=Ye,N={},M=(N.ts={parseType:function(e,t){e=Ft(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=jt(e),i=4+Ht(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=jt(e),s=4+Ht(e);if(i&&(s+=e[s]+1),1&e[s+5]){for(var r=3+((15&e[s+1])<<8|e[s+2])-4,n=12+((15&e[s+10])<<8|e[s+11]);n<r;){var a=s+n;t[(31&e[a+1])<<8|e[a+2]]=e[a],n+=5+((15&e[a+3])<<8|e[a+4])}return t}},parsePayloadUnitStartIndicator:jt,parsePesType:function(e,t){switch(t[Ft(e)]){case hi.H264_STREAM_TYPE:return"video";case hi.ADTS_STREAM_TYPE:return"audio";case hi.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){var t,i,s;return!jt(e)||(t=4+Ht(e))>=e.byteLength?null:(i=null,192&(s=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&s)&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+Ht(e),i=e.subarray(t),s=0,r=0,n=!1;r<i.byteLength-3;r++)if(1===i[r+2]){s=r+5;break}for(;s<i.byteLength;)switch(i[s]){case 0:if(0!==i[s-1])s+=2;else if(0!==i[s-2])s++;else{for(r+3!==s-2&&"slice_layer_without_partitioning_rbsp_idr"===qt(31&i[r+3])&&(n=!0);1!==i[++s]&&s<i.length;);r=s-2,s+=3}break;case 1:0!==i[s-1]||0!==i[s-2]?s+=3:("slice_layer_without_partitioning_rbsp_idr"===qt(31&i[r+3])&&(n=!0),r=s-2,s+=3);break;default:s+=3}return i=i.subarray(r),s-=r,r=0,n=i&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===qt(31&i[r+3])?!0:n}},N.aac=b,c.ONE_SECOND_IN_TS),ci=function(e,t){for(var i,s=0,r=188;r<e.byteLength;)if(71===e[s]&&71===e[r]){switch(i=e.subarray(s,r),N.ts.parseType(i,t.pid)){case"pat":t.pid=N.ts.parsePat(i);break;case"pmt":var n=N.ts.parsePmt(i);t.table=t.table||{},Object.keys(n).forEach(function(e){t.table[e]=n[e]})}s+=188,r+=188}else s++,r++},pi=function(e,t,i){for(var s,r,n,a,o=0,l=188,d=!1;l<=e.byteLength;)if(71!==e[o]||71!==e[l]&&l!==e.byteLength)o++,l++;else{if(s=e.subarray(o,l),"pes"===N.ts.parseType(s,t.pid)&&(r=N.ts.parsePesType(s,t.table),n=N.ts.parsePayloadUnitStartIndicator(s),"audio"===r)&&n&&(a=N.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),d=!0),d)break;o+=188,l+=188}for(o=(l=e.byteLength)-188,d=!1;0<=o;)if(71!==e[o]||71!==e[l]&&l!==e.byteLength)o--,l--;else{if(s=e.subarray(o,l),"pes"===N.ts.parseType(s,t.pid)&&(r=N.ts.parsePesType(s,t.table),n=N.ts.parsePayloadUnitStartIndicator(s),"audio"===r)&&n&&(a=N.ts.parsePesTime(s))&&(a.type="audio",i.audio.push(a),d=!0),d)break;o-=188,l-=188}},mi=function(e,t,i){for(var s,r,n,a,o,l,d,h,u=0,c=188,p=!1,m={data:[],size:0};c<e.byteLength;)if(71===e[u]&&71===e[c]){if(s=e.subarray(u,c),"pes"===N.ts.parseType(s,t.pid))if(r=N.ts.parsePesType(s,t.table),n=N.ts.parsePayloadUnitStartIndicator(s),"video"===r&&(n&&!p&&(a=N.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),p=!0),!i.firstKeyFrame)){if(n&&0!==m.size){for(o=new Uint8Array(m.size),l=0;m.data.length;)d=m.data.shift(),o.set(d,l),l+=d.byteLength;N.ts.videoPacketContainsKeyFrame(o)&&(h=N.ts.parsePesTime(o))&&(i.firstKeyFrame=h,i.firstKeyFrame.type="video"),m.size=0}m.data.push(s),m.size+=s.byteLength}if(p&&i.firstKeyFrame)break;u+=188,c+=188}else u++,c++;for(u=(c=e.byteLength)-188,p=!1;0<=u;)if(71===e[u]&&71===e[c]){if(s=e.subarray(u,c),"pes"===N.ts.parseType(s,t.pid)&&(r=N.ts.parsePesType(s,t.table),n=N.ts.parsePayloadUnitStartIndicator(s),"video"===r)&&n&&(a=N.ts.parsePesTime(s))&&(a.type="video",i.video.push(a),p=!0),p)break;u-=188,c-=188}else u--,c--},gi=function(e,t){var i,s,r,e=(N.aac.isLikelyAacData(e)?function(e){for(var t,i,s=!1,r=0,n=null,a=null,o=0,l=0;3<=e.length-l;){switch(N.aac.parseType(e,l)){case"timed-metadata":e.length-l<10?s=!0:(o=N.aac.parseId3TagSize(e,l))>e.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=N.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7?s=!0:(o=N.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=N.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=M/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in ci(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case ui.H264_STREAM_TYPE:s.video=[],mi(e,i,s),0===s.video.length&&delete s.video;break;case ui.ADTS_STREAM_TYPE:s.audio=[],pi(e,i,s),0===s.audio.length&&delete s.audio}return s})(e);return e&&(e.audio||e.video)?(t=t,(i=e).audio&&i.audio.length&&("undefined"!=typeof(s=t)&&!isNaN(s)||(s=i.audio[0].dts),i.audio.forEach(function(e){e.dts=D(e.dts,s),e.pts=D(e.pts,s),e.dtsTime=e.dts/M,e.ptsTime=e.pts/M})),i.video&&i.video.length&&("undefined"!=typeof(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach(function(e){e.dts=D(e.dts,r),e.pts=D(e.pts,r),e.dtsTime=e.dts/M,e.ptsTime=e.pts/M}),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=D(t.dts,r),t.pts=D(t.pts,r),t.dtsTime=t.dts/M,t.ptsTime=t.pts/M),e):null};class fi{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Vt(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment,t=(e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength},e.data);e.data=t.buffer,i.postMessage({action:"data",segment:e,byteOffset:t.byteOffset,byteLength:t.byteLength},[e.data])}),e.on("done",function(e){i.postMessage({action:"done"})}),e.on("gopInfo",function(e){i.postMessage({action:"gopInfo",gopInfo:e})}),e.on("videoSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:c.videoTsToSeconds(e.start.dts),presentation:c.videoTsToSeconds(e.start.pts)},end:{decode:c.videoTsToSeconds(e.end.dts),presentation:c.videoTsToSeconds(e.end.pts)},baseMediaDecodeTime:c.videoTsToSeconds(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=c.videoTsToSeconds(e.prependedContentDuration)),i.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:t})}),e.on("id3Frame",function(e){i.postMessage({action:"id3Frame",id3Frame:e})}),e.on("caption",function(e){i.postMessage({action:"caption",caption:e})}),e.on("trackinfo",function(e){i.postMessage({action:"trackinfo",trackInfo:e})}),e.on("audioTimingInfo",function(e){i.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:c.videoTsToSeconds(e.start),end:c.videoTsToSeconds(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})}pushMp4Captions(e){this.captionParser||(this.captionParser=new ii,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),e=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=li(e,t);this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=di(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){t="number"!=typeof t||isNaN(t)?void 0:t*c.ONE_SECOND_IN_TS,t=gi(e,t);let i=null;t&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(c.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(c.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new fi(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new fi(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})));const ih=(e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,t=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),e.data.segment.boxes||{data:e.data.segment.data}),n={type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};"undefined"!=typeof l&&(n.videoFrameDtsTime=l),"undefined"!=typeof d&&(n.videoFramePtsTime=d),i(n)},sh=({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)},rh=(e,t)=>{t.gopInfo=e.data.gopInfo},nh=t=>{const{transmuxer:i,bytes:e,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y}=t,_={buffer:[]};let v=y;var b,T;i.onmessage=e=>{i.currentTransmux!==t||("data"===e.data.action&&ih(e,_,a),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&rh(e,_),"audioTimingInfo"===e.data.action&&l(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&d(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&h(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&u(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&c([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(v=!1,g()),"log"===e.data.action&&f(e.data.log),"transmuxed"!==e.data.type)||v||(i.onmessage=null,sh({transmuxedData:_,callback:m}),ah(i))},s&&i.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&i.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof n&&i.postMessage({action:"setRemux",remux:n}),e.byteLength&&(b=e instanceof ArrayBuffer?e:e.buffer,T=e instanceof ArrayBuffer?0:e.byteOffset,i.postMessage({action:"push",data:b,byteOffset:T,byteLength:e.byteLength},[b])),y&&i.postMessage({action:"endTimeline"}),i.postMessage({action:"flush"})},ah=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():nh(e.currentTransmux))},oh=(e,t)=>{e.postMessage({action:t}),ah(e)},lh=(e,t)=>{t.currentTransmux?t.transmuxQueue.push(oh.bind(null,t,e)):(t.currentTransmux=e,oh(t,e))};const dh=e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,nh(e))};var hh=e=>{lh("reset",e)},uh=(dh,e=>{const t=new th,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t});function ch(t){const i=t.transmuxer,s=t.endAction||t.action,r=t.callback;var e,n=fi({},t,{endAction:null,transmuxer:null,callback:null});const a=e=>{e.data.action===s&&(i.removeEventListener("message",a),e.data.data&&(e.data.data=new Uint8Array(e.data.data,t.byteOffset||0,t.byteLength||e.data.data.byteLength),t.data)&&(t.data=e.data.data),r(e.data))};i.addEventListener("message",a),t.data?(e=t.data instanceof ArrayBuffer,n.byteOffset=e?0:t.data.byteOffset,n.byteLength=t.data.byteLength,e=[e?t.data:t.data.buffer],i.postMessage(n,e)):i.postMessage(n)}function ph(e){let t=0;return e.audio&&t++,e.video&&t++,t}function mh(e,t){var i=t.attributes||{},s=Lh(function(e){e=e.attributes||{};if(e.CODECS)return Un(e.CODECS)}(t)||[]);return!Ph(e,t)||s.audio||((e,t)=>{if(!Ph(e,t))return!0;var t=t.attributes||{},i=e.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1})(e,t)||(t=Lh(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i){s=i[s];if(s.default&&s.playlists)return Un(s.playlists[0].attributes.CODECS)}}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function gh(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function fh(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}const yh={FAILURE:2,TIMEOUT:-101,ABORTED:-102},_h=e=>{e.forEach(e=>{e.abort()})},vh=e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}),bh=e=>{var t=e.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return t.bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},Th=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:yh.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:yh.ABORTED,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:yh.FAILURE,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:yh.FAILURE,xhr:t}:null,Sh=(r,n,a)=>(e,t)=>{var i=t.response,e=Th(e,t);if(e)return a(e,r);if(16!==i.byteLength)return a({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:yh.FAILURE,xhr:t},r);var e=new DataView(i),s=new Uint32Array([e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12)]);for(let e=0;e<n.length;e++)n[e].bytes=s;return a(null,r)},wh=(i,s)=>{var e,t=_l(i.map.bytes);if("mp4"!==t)return e=i.map.resolvedUri||i.map.uri,s({internal:!0,message:`Found unsupported ${t||"unknown"} container for initialization segment at URL: `+e,code:yh.FAILURE});ch({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:e,data:t})=>(i.map.bytes=t,e.forEach(function(e){i.map.tracks=i.map.tracks||{},i.map.tracks[e.type]||"number"==typeof(i.map.tracks[e.type]=e).id&&e.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[e.id]=e.timescale)}),s(null))})},Eh=({segment:i,bytes:t,trackInfoFn:s,timingInfoFn:e,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{var p=i.map&&i.map.tracks||{};const m=Boolean(p.audio&&p.video);let g=e.bind(null,i,"audio","start");const f=e.bind(null,i,"audio","end");let y=e.bind(null,i,"video","start");const _=e.bind(null,i,"video","end");ch({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:e=>{i.bytes=t=e.data;e=e.result;e&&(s(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:m}),s=null,e.hasAudio&&!m&&g(e.audioStart),e.hasVideo&&y(e.videoStart),g=null,y=null),dh({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:m,onData:e=>{e.type="combined"===e.type?"video":e.type,h(i,e)},onTrackInfo:e=>{s&&(m&&(e.isMuxed=!0),s(i,e))},onAudioTimingInfo:e=>{g&&"undefined"!=typeof e.start&&(g(e.start),g=null),f&&"undefined"!=typeof e.end&&f(e.end)},onVideoTimingInfo:e=>{y&&"undefined"!=typeof e.start&&(y(e.start),y=null),_&&"undefined"!=typeof e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{n(e)},onId3:(e,t)=>{a(i,e,t)},onCaptions:e=>{o(i,[e])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:e=>{u&&(e.type="combined"===e.type?"video":e.type,u(null,i,e))}})}})},kh=({segment:i,bytes:s,trackInfoFn:e,timingInfoFn:r,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{let p=new Uint8Array(s);if(m=p,0<ml(m,["moof"]).length){i.isFmp4=!0;const g=i.map["tracks"],f={isFmp4:!0,hasVideo:!!g.video,hasAudio:!!g.audio},y=(g.audio&&g.audio.codec&&"enca"!==g.audio.codec&&(f.audioCodec=g.audio.codec),g.video&&g.video.codec&&"encv"!==g.video.codec&&(f.videoCodec=g.video.codec),g.video&&g.audio&&(f.isMuxed=!0),e(i,f),e=>{h(i,{data:p,type:f.hasAudio&&!f.isMuxed?"audio":"video"}),e&&e.length&&o(i,e),u(null,i,{})});void ch({action:"probeMp4StartTime",timescales:i.map.timescales,data:p,transmuxer:i.transmuxer,callback:({data:e,startTime:t})=>{s=e.buffer,i.bytes=p=e,f.hasAudio&&!f.isMuxed&&r(i,"audio","start",t),f.hasVideo&&r(i,"video","start",t),g.video&&e.byteLength&&i.transmuxer?ch({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:p,timescales:i.map.timescales,trackIds:[g.video.id],callback:e=>{s=e.data.buffer,i.bytes=p=e.data,e.logs.forEach(function(e){c(O(e,{stream:"mp4CaptionParser"}))}),y(e.captions)}}):y()}})}else{var m;i.transmuxer?("undefined"==typeof i.container&&(i.container=_l(p)),"ts"!==i.container&&"aac"!==i.container?(e(i,{hasAudio:!1,hasVideo:!1}),u(null,i,{})):Eh({segment:i,bytes:s,trackInfoFn:e,timingInfoFn:r,videoSegmentTimingInfoFn:t,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})):u(null,i,{})}},Ch=function({id:t,key:e,encryptedBytes:i,decryptionWorker:s},r){const n=e=>{e.data.source===t&&(s.removeEventListener("message",n),e=e.data.decrypted,r(new Uint8Array(e.bytes,e.byteOffset,e.byteLength)))};s.addEventListener("message",n);let a;a=e.bytes.slice?e.bytes.slice():new Uint32Array(Array.prototype.slice.call(e.bytes)),s.postMessage(Od({source:t,encrypted:i,key:a,iv:e.iv}),[i.buffer,a.buffer])},Ih=({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})=>{Ch({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},e=>{t.bytes=e,kh({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c})})},xh=({xhr:e,xhrOptions:t,decryptionWorker:i,segment:s,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f})=>{const y=[];var _,v,i=(({activeXhrs:s,decryptionWorker:r,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})=>{let f=0,y=!1;return(e,t)=>{if(!y){if(e)return y=!0,_h(s),m(e,t);if((f+=1)===s.length){const i=function(){if(t.encryptedBytes)return Ih({decryptionWorker:r,segment:t,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g});kh({segment:t,bytes:t.bytes,trackInfoFn:n,timingInfoFn:a,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:l,id3Fn:d,captionsFn:h,isEndOfTimeline:u,endedTimelineFn:c,dataFn:p,doneFn:m,onTransmuxerLog:g})};if(t.endOfAllRequests=Date.now(),t.map&&t.map.encryptedBytes&&!t.map.bytes)return Ch({decryptionWorker:r,id:t.requestId+"-init",encryptedBytes:t.map.encryptedBytes,key:t.map.key},e=>{t.map.bytes=e,wh(t,e=>{if(e)return _h(s),m(e,t);i()})});i()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f}),u=(s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=e(O(t,{uri:s.key.resolvedUri,responseType:"arraybuffer"}),Sh(s,a,i)),y.push(o)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(l=e(O(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer"}),Sh(s,[s.map.key],i)),y.push(l)),d=O(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:Ad(s.map)}),{segment:_,finishProcessingFn:v}=[{segment:s,finishProcessingFn:i}][0],h=e(d,(e,t)=>{var e=Th(e,t);return e?v(e,_):(e=new Uint8Array(t.response),_.map.key?(_.map.encryptedBytes=e,v(null,_)):(_.map.bytes=e,void wh(_,function(e){if(e)return e.xhr=t,e.status=t.status,v(e,_);v(null,_)})))}),y.push(h)),O(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:Ad(s)}));({segment:b,finishProcessingFn:T,responseType:S}={segment:s,finishProcessingFn:i,responseType:u.responseType});var b,T,S,w,E,c=e(u,(e,t)=>{var e=Th(e,t);return e?T(e,b):(e="arraybuffer"!==S&&t.responseText?Qd(t.responseText.substring(b.lastReachedChar||0)):t.response,b.stats=vh(t),b.key?b.encryptedBytes=new Uint8Array(e):b.bytes=new Uint8Array(e),T(null,b))});c.addEventListener("progress",({segment:w,progressFn:E}=[{segment:s,progressFn:n}][0],e=>{var t=e.target;if(!t.aborted)return w.stats=O(w.stats,bh(e)),!w.stats.firstBytesReceivedAt&&w.stats.bytesReceived&&(w.stats.firstBytesReceivedAt=Date.now()),E(e,w)})),y.push(c);const k={};return y.forEach(e=>{var t,i;e.addEventListener("loadend",({loadendState:t,abortFn:i}=[{loadendState:k,abortFn:r}][0],e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),()=>_h(y)},Ah=Bl("CodecUtils"),Ph=(e,t)=>{t=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]},Lh=function(e){const s={};return e.forEach(({mediaType:e,type:t,details:i})=>{s[e]=s[e]||[],s[e].push(Rn(""+t+i))}),Object.keys(s).forEach(function(e){1<s[e].length?(Ah(`multiple ${e} codecs found as attributes: ${s[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),s[e]=null):s[e]=s[e][0]}),s},Oh=Bl("PlaylistSelector"),Dh=function(e){var t;if(e&&e.playlist)return t=e.playlist,JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},Nh=function(e,s){const r=e.slice();e.sort(function(e,t){var i=s(e,t);return 0===i?r.indexOf(e)-r.indexOf(t):i})};function Mh(o,t,l,d,h,u){if(o){var c={bandwidth:t,width:l,height:d,limitRenditionByPlayerDimensions:h};let e=o.playlists,r=(md.isAudioOnly(o)&&(e=u.getAudioTrackPlaylists_(),c.audioOnly=!0),e.map(e=>{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,s=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:s||window.Number.MAX_VALUE,width:t,height:i,playlist:e}})),n=(Nh(r,(e,t)=>e.bandwidth-t.bandwidth),(r=r.filter(e=>!md.isIncompatible(e.playlist))).filter(e=>md.isEnabled(e.playlist)));o=(n=n.length?n:r.filter(e=>!md.isDisabled(e.playlist))).filter(e=>e.bandwidth*D.BANDWIDTH_VARIANCE<t);let a=o[o.length-1];var p=o.filter(e=>e.bandwidth===a.bandwidth)[0];if(!1===h){const g=p||n[0]||r[0];if(g&&g.playlist){let e=p?"bandwidthBestRep":"sortedPlaylistReps";return n[0]&&(e="enabledPlaylistReps"),Oh(`choosing ${Dh(g)} using ${e} with options`,c),g.playlist}}else{var m,h=o.filter(e=>e.width&&e.height),o=(Nh(h,(e,t)=>e.width-t.width),h.filter(e=>e.width===l&&e.height===d)),o=(a=o[o.length-1],o.filter(e=>e.bandwidth===a.bandwidth)[0]);let t,i;o||(m=(t=h.filter(e=>e.width>l||e.height>d)).filter(e=>e.width===t[0].width&&e.height===t[0].height),a=m[m.length-1],i=m.filter(e=>e.bandwidth===a.bandwidth)[0]);let s;u.leastPixelDiffSelector&&(m=h.map(e=>(e.pixelDiff=Math.abs(e.width-l)+Math.abs(e.height-d),e)),Nh(m,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),s=m[0]);const g=s||i||o||p||n[0]||r[0];if(g&&g.playlist){let e="sortedPlaylistReps";return s?e="leastPixelDiffRep":i?e="resolutionPlusOneRep":o?e="resolutionBestRep":p?e="bandwidthBestRep":n[0]&&(e="enabledPlaylistReps"),Oh(`choosing ${Dh(g)} using ${e} with options`,c),g.playlist}}return Oh("could not choose a playlist with options",c),null}}function Rh(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return Mh(this.playlists.main,this.systemBandwidth,parseInt(gh(this.tech_.el(),"width"),10)*e,parseInt(gh(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function Uh(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}const Bh=({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(t){const a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach(e=>{const s=e.cueTime+i;!("number"!=typeof s||window.isNaN(s)||s<0)&&s<1/0&&e.frames.forEach(e=>{var t,i=new a(s,s,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get(){return T.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get(){return T.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get(){return T.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),o.addCue(i)})}),o.cues)&&o.cues.length){var r=o.cues,n=[];for(let e=0;e<r.length;e++)r[e]&&n.push(r[e]);const l=n.reduce((e,t)=>{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),d=Object.keys(l).sort((e,t)=>Number(e)-Number(t));d.forEach((e,t)=>{e=l[e];const i=Number(d[t+1])||s;e.forEach(e=>{e.endTime=i})})}}},Fh=e=>"number"==typeof e&&isFinite(e),jh=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,e=e.segment.uri?"segment":"pre-segment",p=c?ed({preloadSegment:s})-1:0;return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},Hh=e=>e+"TimingInfo",qh=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>{return!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i))},Vh=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+Gl,$h=(e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let s=0;return["video","audio"].forEach(function(t){t=e[t+"TimingInfo"];if(t){var{start:t,end:i}=t;let e;"bigint"==typeof t||"bigint"==typeof i?e=window.BigInt(i)-window.BigInt(t):"number"==typeof t&&"number"==typeof i&&(e=i-t),"undefined"!=typeof e&&e>s&&(s=e)}}),s="bigint"==typeof s&&s<Number.MAX_SAFE_INTEGER?Number(s):s})({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo}))&&(i=e.playlist.targetDuration,s=Vh({segmentDuration:t,maxDuration:2*i}),r=Vh({segmentDuration:t,maxDuration:i}),t=`Segment with index ${e.mediaIndex} `+`from playlist ${e.playlist.id} `+`has a duration of ${t} `+`when the reported duration is ${e.duration} `+`and the target duration is ${i}. `+"For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1",s||r)?{severity:s?"warn":"info",message:t}:null};class Wh extends T.EventTarget{constructor(e,t=0){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=11<=T.browser.IE_VERSION,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Bl(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return uh({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&hh(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Fl();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Dd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=Nd(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});t={resolvedUri:(s||e).resolvedUri};return s&&(t.bytes=s.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(t,i={}){if(t){var s,r=this.playlist_,n=this.pendingSegment_;this.playlist_=t,this.xhrOptions_=i,"INIT"===this.state&&(t.syncInfo={mediaSequence:t.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(t);let e=null;if(r&&(r.id?e=r.id:r.uri&&(e=r.uri)),this.logger_(`playlist update [${e} => ${t.id||t.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();r&&r.uri===t.uri?(i=t.mediaSequence-r.mediaSequence,this.logger_(`live window shift [${i}]`),null!==this.mediaIndex&&(this.mediaIndex-=i,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(s=this.playlist_.segments[this.mediaIndex],!this.partIndex||s.parts&&s.parts.length&&s.parts[this.partIndex]||(s=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=s))),n&&(n.mediaIndex-=i,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=t.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,t)):(null!==this.mediaIndex&&(t.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&hh(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(t,i,s=()=>{},r=!1){if((i=i===1/0?this.duration_():i)<=t)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let e=1;var n=()=>{0===--e&&s()};!r&&this.audioDisabled_||(e++,this.sourceUpdater_.removeAudio(t,i,n)),!r&&"main"!==this.loaderType_||(this.gopBuffer_=((t,i,e,s)=>{var r=Math.ceil((i-s)*Ml),n=Math.ceil((e-s)*Ml),i=t.slice();let a=t.length;for(;a--&&!(t[a].pts<=n););if(-1!==a){let e=a+1;for(;e--&&!(t[e].pts<=r););e=Math.max(e,0),i.splice(e,a-e+1)}return i})(this.gopBuffer_,t,i,this.timeMapping_),e++,this.sourceUpdater_.removeVideo(t,i,n));for(const a in this.inbandTextTracks_)Uh(t,i,this.inbandTextTracks_[a]);Uh(t,i,this.segmentMetadataTrack_),n()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=this.buffered_(),t=ql(e)||0,e=Vl(e,this.currentTime_()),i=!this.hasPlayed_()&&1<=e,s=e>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var n,i={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)},t=(i.isSyncRequest?i.mediaIndex=function(t,i,s){i=i||[];var r=[];let n=0;for(let e=0;e<i.length;e++){var a=i[e];if(t===a.timeline&&(r.push(e),(n+=a.duration)>s))return e}return 0===r.length?0:r[r.length-1]}(this.currentTimeline_,r,t):null!==this.mediaIndex?(s=r[this.mediaIndex],n="number"==typeof this.partIndex?this.partIndex:-1,i.startOfSegment=s.end||t,s.parts&&s.parts[n+1]?(i.mediaIndex=this.mediaIndex,i.partIndex=n+1):i.mediaIndex=this.mediaIndex+1):({segmentIndex:s,startTime:n,partIndex:o}=md.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),i.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),i.mediaIndex=s,i.startOfSegment=n,i.partIndex=o),r[i.mediaIndex]);let a=t&&"number"==typeof i.partIndex&&t.parts&&t.parts[i.partIndex];if(!t||"number"==typeof i.partIndex&&!a)return null;"number"!=typeof i.partIndex&&t.parts&&(i.partIndex=0,a=t.parts[0]),e||!a||a.independent||(0===i.partIndex?(n=(s=r[i.mediaIndex-1]).parts&&s.parts.length&&s.parts[s.parts.length-1])&&n.independent&&(--i.mediaIndex,i.partIndex=s.parts.length-1,i.independent="previous segment"):t.parts[i.partIndex-1].independent&&(--i.partIndex,i.independent="previous part"));var o=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return i.mediaIndex>=r.length-1&&o&&!this.seeking_()?null:this.generateSegmentInfo_(i)}generateSegmentInfo_(e){var{independent:e,playlist:t,mediaIndex:i,startOfSegment:s,isSyncRequest:r,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=t.segments[i],d="number"==typeof n&&l.parts[n],i={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:d?n:null,isSyncRequest:r,startOfSegment:s,playlist:t,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n="undefined"!=typeof a?a:this.isPendingTimestampOffset_,r=(i.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:n}),ql(this.sourceUpdater_.audioBuffered()));return"number"==typeof r&&(i.audioAppendStart=r-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(i.gopsToAlignWith=((e,t,i)=>{if("undefined"==typeof t||null===t||!e.length)return[];var s=Math.ceil((t-i+3)*Ml);let r;for(r=0;r<e.length&&!(e[r].pts>s);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),i}timestampOffsetForSegment_(e){return{segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r}=[e][0],r||e!==t?!(e<t)&&s.length?s.end(s.length-1):i:null;var t,i,s,r}earlyAbortWhenNeeded_(t){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(t.firstBytesReceivedAt||Date.now())<1e3)){var e=this.currentTime_(),i=t.bandwidth,s=this.pendingSegment_.duration,t=md.estimateSegmentRequestTime(s,i,this.playlist_,t.bytesReceived),r=([r,n,a=1]=[this.buffered_(),e,this.vhs_.tech_.playbackRate()],((r.length?r.end(r.length-1):0)-n)/a-1);if(!(t<=r)){var n=function(e){const{main:t,currentTime:i,bandwidth:s,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e;e=t.playlists.filter(e=>!md.isIncompatible(e));let d=e.filter(md.isEnabled);var e=(d=d.length?d:e.filter(e=>!md.isDisabled(e))).filter(md.hasAttribute.bind(null,"BANDWIDTH")).map(e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:md.estimateSegmentRequestTime(n,s,e)*t-a}}),h=e.filter(e=>e.rebufferingImpact<=0);return Nh(h,(e,t)=>fh(t.playlist,e.playlist)),h.length?h[0]:(Nh(e,(e,t)=>e.rebufferingImpact-t.rebufferingImpact),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:e,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=t-r-n.rebufferingImpact;let e=.5;r<=Gl&&(e=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a<e||(this.bandwidth=n.playlist.attributes.BANDWIDTH*D.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}}handleAbort_(e){this.logger_("Aborting "+jh(e)),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}handleTrackInfo_(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(function(t,i){if(!t&&!i||!t&&i||t&&!i)return!1;if(t!==i){var s=Object.keys(t).sort(),r=Object.keys(i).sort();if(s.length!==r.length)return!1;for(let e=0;e<s.length;e++){var n=s[e];if(n!==r[e])return!1;if(t[n]!==i[n])return!1}}return!0}(this.currentMediaInfo_,t=t||{})||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId))||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_())}handleTimingInfo_(e,t,i,s){var r;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||((e=this.pendingSegment_)[r=Hh(t)]=e[r]||{},e[r][i]=s,this.logger_(`timinginfo: ${t} - ${i} - `+s),this.hasEnoughInfoToAppend_()&&this.processCallQueue_())}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0===t.length)this.logger_("SegmentLoader received no captions from a caption event");else if(this.pendingSegment_.hasAppendedData_){const c=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),p={};t.forEach(e=>{p[e.stream]=p[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=p[e.stream];t.startTime=Math.min(t.startTime,e.startTime+c),t.endTime=Math.max(t.endTime,e.endTime+c),t.captions.push(e)}),Object.keys(p).forEach(e=>{var{startTime:t,endTime:i,captions:s}=p[e],r=this.inbandTextTracks_,n=(this.logger_(`adding cues from ${t} -> ${i} for `+e),r),a=this.vhs_.tech_,o=e;if(!n[o]){a.trigger({type:"usage",name:"vhs-608"});let s=o;/^cc708_/.test(o)&&(s="SERVICE"+o.split("_")[1]);var l=a.textTracks().getTrackById(s);if(l)n[o]=l;else{let e=o,t=o,i=!1;l=(a.options_.vhs&&a.options_.vhs.captionServices||{})[s];l&&(e=l.label,t=l.language,i=l.default),n[o]=a.addRemoteTextTrack({kind:"captions",id:s,default:i,label:e,language:t},!1).track}}Uh(t,i,r[e]);var{inbandTextTracks:d,captionArray:l,timestampOffset:h}={captionArray:s,inbandTextTracks:r,timestampOffset:c};if(l){const u=window.WebKitDataCue||window.VTTCue;l.forEach(e=>{var t=e.stream;d[t].addCue(new u(e.startTime+h,e.endTime+h,e.text))})}}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){var s,r,n,a;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?(s=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r=this.inbandTextTracks_,n=i,a=this.vhs_.tech_,r.metadataTrack_||(r.metadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,r.metadataTrack_.inBandMetadataTrackDispatchType=n),Bh({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:this.duration_()})):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach(e=>e())}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(e=>e())}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&qh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||({hasAudio:t,hasVideo:i,isMuxed:s}=t,i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||qh({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(t,e){if(this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())this.callQueue_.push(this.handleData_.bind(this,t,e));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(t.map&&(t.map=this.initSegmentForMap(t.map,!0),i.segment.map=t.map),t.key&&this.segmentKey(t.key,!0),i.isFmp4=t.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Hh(e.type)].start;else{t=this.getCurrentMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo;let e;t&&(e=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:t,firstVideoFrameTimeForData:e,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,e.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});t=this.chooseNextRequest_();if(t.mediaIndex!==i.mediaIndex||t.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,e)}}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:s}){if(i){var r=Dd(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1<r.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Yl(r).join(", ")),1<n.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Yl(n).join(", ")),r.length?r.start(0):0),o=r.length?r.end(r.length-1):0,l=n.length?n.start(0):0,d=n.length?n.end(n.length-1):0;o-a<=1&&d-l<=1?(this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. "+`Appended byte length: ${i.byteLength}, `+`audio buffer: ${Yl(r).join(", ")}, `+`video buffer: ${Yl(n).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error")):(this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i})),o=this.currentTime_()-1,this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+o),this.remove(0,o,()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},1e3)},!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${i.length}b failed for segment `+`#${e.mediaIndex} in playlist `+e.playlist.id),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.unshift(i),e+=i.byteLength),r=(e=>{let t=0,i;return e.bytes&&(i=new Uint8Array(e.bytes),e.segments.forEach(e=>{i.set(e,t),t+=e.byteLength})),i})({bytes:e,segments:n})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e=e+"TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:s}=t;s&&s.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:s})))}loadSegment_(t){this.state="WAITING",this.pendingSegment_=t,this.trimBackBuffer_(t),"number"==typeof t.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(t):this.loadQueue_.push(()=>{var e=fi({},t,{forceTimestampOffset:!0});fi(t,this.generateSegmentInfo_(e)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(t)})}updateTransmuxerAndRequestSegment_(s){this.shouldUpdateTransmuxerTimestampOffset_(s.timestampOffset)&&(this.gopBuffer_.length=0,s.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:s.timestampOffset}));var e=this.createSimplifiedSegmentObj_(s),t=this.isEndOfStream_(s.mediaIndex,s.playlist,s.partIndex),i=null!==this.mediaIndex,r=s.timeline!==this.currentTimeline_&&0<s.timeline,t=t||i&&r;this.logger_("Requesting "+jh(s)),e.map&&!e.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),s.abortRequests=xh({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:e,abortFn:this.handleAbort_.bind(this,s),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",s.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",s.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:t,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:e,level:t,stream:i})=>{this.logger_(jh(s)+` logged from transmuxer stream ${i} as a ${t}: `+e)}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-D.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0<t&&this.remove(0,t)}createSimplifiedSegmentObj_(e){var t=e.segment,i=e.part,i={resolvedUri:(i||t).resolvedUri,byterange:(i||t).byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];return s&&s.timeline===t.timeline&&(s.videoTimingInfo?i.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(i.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key&&(s=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]),i.key=this.segmentKey(t.key),i.key.iv=s),t.map&&(i.map=this.initSegmentForMap(t.map)),i}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<1/60?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+1/60):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===yh.ABORTED?void 0:(this.pause(),e.code===yh.TIMEOUT?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));e=this.pendingSegment_;this.saveBandwidthRelatedStats_(e.duration,t.stats),e.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=((e,t,i)=>{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(r;r<e.length&&!(e[r].pts>=s);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return"undefined"!=typeof e?e:n?(e=t.segments[i-1],0!==i&&e&&"undefined"!=typeof e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?({hasAudio:s,hasVideo:i,isMuxed:t}=s,i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_(),e=e;var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(t){if(null!==t.timestampOffset&&"number"==typeof t.timingInfo.start&&!t.changedTimestampOffset&&"main"===this.loaderType_){let e=!1;t.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:t.segment.videoTimingInfo,audioTimingInfo:t.segment.audioTimingInfo,timingInfo:t.timingInfo}),t.changedTimestampOffset=!0,t.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(t.timestampOffset),e=!0),t.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(t.timestampOffset),e=!0),e&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;t&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&this.trigger("appendsdone"),this.pendingSegment_?(e=this.pendingSegment_,this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=$h(e,this.sourceType_))&&("warn"===t.severity?T.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+jh(e)):(this.logger_("Appended "+jh(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+jh(e)),this.resetEverything()):(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,Fh(t))&&Fh(i)&&(Uh(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}}function Gh(){}function zh(e){return"string"!=typeof e?e:e.replace(/./,e=>e.toUpperCase())}const Xh=["video","audio"],Kh=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},Yh=(i,s)=>{if(0!==s.queue.length){let e=0,t=s.queue[e];if("mediaSource"===t.type)s.updating()||"closed"===s.mediaSource.readyState||(s.queue.shift(),t.action(s),t.doneFn&&t.doneFn(),Yh("audio",s),Yh("video",s));else if("mediaSource"!==i&&s.ready()&&"closed"!==s.mediaSource.readyState&&!Kh(i,s)){if(t.type!==i){if(null===(e=((t,i)=>{for(let e=0;e<i.length;e++){var s=i[e];if("mediaSource"===s.type)return null;if(s.type===t)return e}return null})(i,s.queue)))return;t=s.queue[e]}s.queue.splice(e,1),(s.queuePending[i]=t).action(i,s),t.doneFn||(s.queuePending[i]=null,Yh(i,s))}}},Qh=(e,t)=>{var i=t[e+"Buffer"],s=zh(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},Jh=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),Zh={appendBuffer:(s,r,n)=>(t,i)=>{var e=i[t+"Buffer"];if(Jh(i.mediaSource,e)){i.logger_(`Appending segment ${r.mediaIndex}'s ${s.length} bytes to ${t}Buffer`);try{e.appendBuffer(s)}catch(e){i.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${r.mediaIndex} to ${t}Buffer`),i.queuePending[t]=null,n(e)}}},remove:(s,r)=>(t,i)=>{var e=i[t+"Buffer"];if(Jh(i.mediaSource,e)){i.logger_(`Removing ${s} to ${r} from ${t}Buffer`);try{e.remove(s,r)}catch(e){i.logger_(`Remove ${s} to ${r} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{var i=t[e+"Buffer"];Jh(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to `+s),i.timestampOffset=s)},callback:i=>(e,t)=>{i()},endOfStream:t=>e=>{if("open"===e.mediaSource.readyState){e.logger_(`Calling mediaSource endOfStream(${t||""})`);try{e.mediaSource.endOfStream(t)}catch(e){T.log.warn("Failed to call media source endOfStream",e)}}},duration:t=>e=>{e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){T.log.warn("Failed to set media source duration",e)}},abort:()=>(t,e)=>{if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(Jh(e.mediaSource,i)){e.logger_(`calling abort on ${t}Buffer`);try{i.abort()}catch(e){T.log.warn(`Failed to abort on ${t}Buffer`,e)}}}},addSourceBuffer:(s,r)=>e=>{var t=zh(s),i=Bn(r),i=(e.logger_(`Adding ${s}Buffer with codec ${r} to mediaSource`),e.mediaSource.addSourceBuffer(i));i.addEventListener("updateend",e[`on${t}UpdateEnd_`]),i.addEventListener("error",e[`on${t}Error_`]),e.codecs[s]=r,e[s+"Buffer"]=i},removeSourceBuffer:i=>e=>{var t=e[i+"Buffer"];if(Qh(i,e),Jh(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(e){T.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,e)}}},changeType:r=>(e,t)=>{var i=t[e+"Buffer"],s=Bn(r);Jh(t.mediaSource,i)&&t.codecs[e]!==r&&(t.logger_(`changing ${e}Buffer codec from ${t.codecs[e]} to `+r),i.changeType(s),t.codecs[e]=r)}},eu=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),Yh(e,t)},tu=(i,s)=>e=>{var t;s.queuePending[i]&&(t=s.queuePending[i].doneFn,s.queuePending[i]=null,t)&&t(s[i+"Error_"]),Yh(i,s)};class iu extends T.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Yh("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Bl("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=tu("video",this),this.onAudioUpdateEnd_=tu("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){eu({type:"mediaSource",sourceUpdater:this,action:Zh.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){eu({type:e,sourceUpdater:this,action:Zh.abort(e),name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?eu({type:"mediaSource",sourceUpdater:this,action:Zh.removeSourceBuffer(e),name:"removeSourceBuffer"}):T.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!T.browser.IE_VERSION&&!T.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?eu({type:e,sourceUpdater:this,action:Zh.changeType(t),name:"changeType"}):T.log.error("changeType is not supported!")}addOrChangeSourceBuffers(i){if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(e=>{var t=i[e];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(e,t);this.canChangeType()&&this.changeType(e,t)})}appendBuffer(e,t){var{segmentInfo:i,type:s,bytes:r}=e;this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(e=t,eu({type:s,sourceUpdater:this,action:Zh.appendBuffer(r,i||{mediaIndex:-1},e),doneFn:t,name:"appendBuffer"}),"video"===s&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach(e=>{this.appendBuffer.apply(this,e)})))}audioBuffered(){return Jh(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||Fl()}videoBuffered(){return Jh(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||Fl()}buffered(){var e=Jh(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Jh(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(t&&!e)return this.audioBuffered();if(e&&!t)return this.videoBuffered();{var r=this.audioBuffered();var n=this.videoBuffered();let e=null,t=null,i=0;var a=[],o=[];if(!(r&&r.length&&n&&n.length))return Fl();let s=r.length;for(;s--;)a.push({time:r.start(s),type:"start"}),a.push({time:r.end(s),type:"end"});for(s=n.length;s--;)a.push({time:n.start(s),type:"start"}),a.push({time:n.end(s),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),s=0;s<a.length;s++)"start"===a[s].type?2===++i&&(e=a[s].time):"end"===a[s].type&&1===--i&&(t=a[s].time),null!==e&&null!==t&&(o.push([e,t]),e=null,t=null);return Fl(o);return}}setDuration(e,t=Gh){eu({type:"mediaSource",sourceUpdater:this,action:Zh.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Gh){"string"!=typeof e&&(e=void 0),eu({type:"mediaSource",sourceUpdater:this,action:Zh.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Gh){this.audioBuffered().length&&0!==this.audioBuffered().end(0)?eu({type:"audio",sourceUpdater:this,action:Zh.remove(e,t),doneFn:i,name:"remove"}):i()}removeVideo(e,t,i=Gh){this.videoBuffered().length&&0!==this.videoBuffered().end(0)?eu({type:"video",sourceUpdater:this,action:Zh.remove(e,t),doneFn:i,name:"remove"}):i()}updating(){return!(!Kh("audio",this)&&!Kh("video",this))}audioTimestampOffset(e){return"undefined"!=typeof e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(eu({type:"audio",sourceUpdater:this,action:Zh.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return"undefined"!=typeof e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(eu({type:"video",sourceUpdater:this,action:Zh.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&eu({type:"audio",sourceUpdater:this,action:Zh.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&eu({type:"video",sourceUpdater:this,action:Zh.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Xh.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"](()=>Qh(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const su=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),ru=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class nu extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class au extends Wh{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){var e;return this.subtitlesTrack_&&this.subtitlesTrack_.cues&&this.subtitlesTrack_.cues.length?Fl([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):Fl()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Dd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(t=ru.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(ru,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return"undefined"!=typeof e&&(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_())&&this.init_(),this.subtitlesTrack_}remove(e,t){Uh(e,t,this.subtitlesTrack_)}fillBuffer_(){var e=this.chooseNextRequest_();e&&(null===this.syncController_.timestampOffsetForTimeline(e.timeline)?(this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE"):this.loadSegment_(e))}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(this.subtitlesTrack_)if(this.saveTransferStats_(t.stats),this.pendingSegment_)if(e)e.code===yh.TIMEOUT&&this.handleTimeout_(),e.code===yh.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var s=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),s.segment);if(r.map&&(r.map.bytes=t.map.bytes),s.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));else{r.requested=!0;try{this.parseVTTCues_(s)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest)this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";else{s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)});var n=this.subtitlesTrack_,a=n.cues;if(a)for(let i=0;i<a.length;i++){var o=[];let t=0;for(let e=0;e<a.length;e++)a[i].startTime===a[e].startTime&&a[i].endTime===a[e].endTime&&a[i].text===a[e].text&&1<++t&&o.push(a[e]);o.length&&o.forEach(e=>n.removeCue(e))}this.handleAppendsDone_()}}}else this.state="READY",this.mediaRequestsAborted+=1;else this.state="READY"}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(t){let e,i=!1;if("function"!=typeof window.WebVTT)throw new nu;"function"==typeof window.TextDecoder?e=new window.TextDecoder("utf8"):(e=window.WebVTT.StringDecoder(),i=!0);var s=new window.WebVTT.Parser(window,window.vttjs,e);if(t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=t.cues.push.bind(t.cues),s.ontimestampmap=e=>{t.timestampmap=e},s.onparsingerror=e=>{T.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map){let e=t.segment.map.bytes;i&&(e=su(e)),s.parse(e)}let r=t.bytes;i&&(r=su(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){var s=e.segment;if(t)if(e.cues.length){var r=e.timestampmap;const n=r.MPEGTS/Ml-r.LOCAL+t.mapping;e.cues.forEach(e=>{e.startTime+=n,e.endTime+=n}),i.syncInfo||(r=e.cues[0].startTime,t=e.cues[e.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(r,t-s.duration)})}else s.empty=!0}}const ou=[{name:"VOD",run:(e,t,i,s,r)=>{return i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null}},{name:"ProgramDateTime",run:(t,i,e,s,r)=>{if(!Object.keys(t.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=Jl(i);r=r||0;for(let e=0;e<o.length;e++){var l=o[i.endList||0===r?e:o.length-(e+1)],d=l.segment,h=t.timelineToDatetimeMappings[d.timeline];if(h&&d.dateTimeObject){let t=d.dateTimeObject.getTime()/1e3+h;if(d.parts&&"number"==typeof l.partIndex)for(let e=0;e<l.partIndex;e++)t+=d.parts[e].duration;h=Math.abs(r-t);if(null!==a&&(0===h||a<h))break;a=h,n={time:t,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return n}},{name:"Segment",run:(e,t,i,s,r)=>{let n=null,a=null;r=r||0;var o=Jl(t);for(let e=0;e<o.length;e++){var l=o[t.endList||0===r?e:o.length-(e+1)],d=l.segment,h=l.part&&l.part.start||d&&d.start;if(d.timeline===s&&"undefined"!=typeof h){d=Math.abs(r-h);if(null!==a&&a<d)break;(!n||null===a||a>=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(i,s,e,t,r)=>{let n=null;if(r=r||0,s.discontinuityStarts&&s.discontinuityStarts.length){let t=null;for(let e=0;e<s.discontinuityStarts.length;e++){var a=s.discontinuityStarts[e],o=s.discontinuitySequence+e+1,o=i.discontinuities[o];if(o){var l=Math.abs(r-o.time);if(null!==t&&t<l)break;(!n||null===t||t>=l)&&(t=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>{return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}];class lu extends T.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=Bl("SyncController")}getSyncPoint(e,t,i,s){e=this.runStrategies_(e,t,i,s);return e.length?this.selectSyncPoint_(e,{key:"time",value:s}):null}getExpiredTime(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0)).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+$l({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null}runStrategies_(t,i,s,r){var n=[];for(let e=0;e<ou.length;e++){var a=ou[e],o=a.run(this,t,i,s,r);o&&(o.strategy=a.name,n.push({strategy:a.name,syncPoint:o}))}return n}selectSyncPoint_(t,i){let s=t[0].syncPoint,r=Math.abs(t[0].syncPoint[i.key]-i.value),n=t[0].strategy;for(let e=1;e<t.length;e++){var a=Math.abs(t[e].syncPoint[i.key]-i.value);a<r&&(r=a,s=t[e].syncPoint,n=t[e].strategy)}return this.logger_(`syncPoint for [${i.key}: ${i.value}] chosen with strategy`+` [${n}]: [time:${s.time},`+" segmentIndex:"+s.segmentIndex+("number"==typeof s.partIndex?",partIndex:"+s.partIndex:"")+"]"),s}saveExpiredSegmentInfo(t,i){var s=i.mediaSequence-t.mediaSequence;if(86400<s)T.log.warn(`Not saving expired segment info. Media sequence gap ${s} is too large.`);else for(let e=s-1;0<=e;e--){var r=t.segments[e];if(r&&"undefined"!=typeof r.start){i.syncInfo={mediaSequence:t.mediaSequence+e,time:r.start},this.logger_(`playlist refresh sync: [time:${i.syncInfo.time},`+` mediaSequence: ${i.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){var t;this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject&&(t=(e=e.segments[0]).dateTimeObject.getTime()/1e3,this.timelineToDatetimeMappings[e.timeline]=-t)}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){var i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment,i=(i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start})),s.dateTimeObject);s.discontinuity&&t&&i&&(this.timelineToDatetimeMappings[s.timeline]=-i.getTime()/1e3)}timestampOffsetForTimeline(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){var s=e.segment,r=e.part;let n=this.timelines[e.timeline],a,o;if("number"==typeof e.timestampOffset)n={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=n,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: `+`[time: ${n.time}] [mapping: ${n.mapping}]`)),a=e.startOfSegment;else{if(!n)return!1;a=t.start+n.mapping}return o=t.end+n.mapping,r&&(r.start=a,r.end=o),(!s.start||a<s.start)&&(s.start=a),s.end=o,!0}saveDiscontinuitySyncInfo_(t){var i=t.playlist,s=t.segment;if(s.discontinuity)this.discontinuities[s.timeline]={time:s.start,accuracy:0};else if(i.discontinuityStarts&&i.discontinuityStarts.length)for(let e=0;e<i.discontinuityStarts.length;e++){var r=i.discontinuityStarts[e],n=i.discontinuitySequence+e+1,a=r-t.mediaIndex,o=Math.abs(a);if(!this.discontinuities[n]||this.discontinuities[n].accuracy>o){let e;e=a<0?s.start-$l({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex,endIndex:r}):s.end+$l({defaultDuration:i.targetDuration,durationList:i.segments,startIndex:t.mediaIndex+1,endIndex:r}),this.discontinuities[n]={time:e,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class du extends T.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var hu=Jd(Zd(eh(function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,s=0;s<i;++s)t[s].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),n=t.length,a=0;a<n;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(t){this.on("data",function(e){t.push(e)})},e}();
- /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */let h=null;class g{constructor(e){h=h||function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],r=i[4];let n,a,o;var l,d,h,u,c=[],p=[];let m,g;for(n=0;n<256;n++)p[(c[n]=n<<1^283*(n>>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=p[o]||1)for(u=(u=o^o<<1^o<<2^o<<3^o<<4)>>8^255&u^99,h=c[d=c[l=c[r[s[a]=u]=a]]],g=16843009*h^65537*d^257*l^16843008*a,m=257*c[u]^16843008*u,n=0;n<4;n++)t[n][a]=m=m<<24^m>>>8,i[n][u]=g=g<<24^g>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].slice(0);return e}(),this._tables=[[h[0][0].slice(),h[0][1].slice(),h[0][2].slice(),h[0][3].slice(),h[0][4].slice()],[h[1][0].slice(),h[1][1].slice(),h[1][2].slice(),h[1][3].slice(),h[1][4].slice()]];let t,i,s;var r=this._tables[0][4],n=this._tables[1],a=e.length;let o=1;if(4!==a&&6!==a&&8!==a)throw new Error("Invalid aes key size");var l=e.slice(0),d=[];for(this._key=[l,d],t=a;t<4*a+28;t++)s=l[t-1],(t%a==0||8===a&&t%a==4)&&(s=r[s>>>24]<<24^r[s>>16&255]<<16^r[s>>8&255]<<8^r[255&s],t%a==0)&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7)),l[t]=l[t-a]^s;for(i=0;t;i++,t--)s=l[3&i?t:t-4],t<=4||i<4?d[i]=s:d[i]=n[0][r[s>>>24]]^n[1][r[s>>16&255]]^n[2][r[s>>8&255]]^n[3][r[255&s]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d=e^l[0],h=s^l[1],u=i^l[2],c=t^l[3],p;var m=l.length/4-2;let g,f=4;var e=this._tables[1],y=e[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g<m;g++)p=y[d>>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f],a=y[h>>>24]^_[u>>16&255]^v[c>>8&255]^b[255&d]^l[f+1],o=y[u>>>24]^_[c>>16&255]^v[d>>8&255]^b[255&h]^l[f+2],c=y[c>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&u]^l[f+3],f+=4,d=p,h=a,u=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[d>>>24]<<24^T[h>>16&255]<<16^T[u>>8&255]<<8^T[255&c]^l[f++],p=d,d=h,h=u,u=c,c=p}}class l extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function f(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class d{constructor(e,t,i,s){var r=d.STEP,n=new Int32Array(e.buffer);const a=new Uint8Array(e.byteLength);let o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a)),o=r;o<n.length;o+=r)i=new Uint32Array([f(n[o-4]),f(n[o-3]),f(n[o-2]),f(n[o-1])]),this.asyncStream_.push(this.decryptChunk_(n.subarray(o,o+r),t,i,a));this.asyncStream_.push(function(){var e;
- /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */s(null,(e=a).subarray(0,e.byteLength-e[e.byteLength-1]))})}static get STEP(){return 32e3}decryptChunk_(t,i,s,r){return function(){var e=function(e,t,i){var s,r,n,a,o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),l=new g(Array.prototype.slice.call(t)),t=new Uint8Array(e.byteLength),d=new Int32Array(t.buffer);let h,u,c,p,m;for(h=i[0],u=i[1],c=i[2],p=i[3],m=0;m<o.length;m+=4)s=f(o[m]),r=f(o[m+1]),n=f(o[m+2]),a=f(o[m+3]),l.decrypt(s,r,n,a,d,m),d[m]=f(d[m]^h),d[m+1]=f(d[m+1]^u),d[m+2]=f(d[m+2]^c),d[m+3]=f(d[m+3]^p),h=s,u=r,c=n,p=a;return t}(t,i,s);r.set(e,t.byteOffset)}}}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t="undefined"!=typeof window?window:"undefined"!=typeof t?t:"undefined"!=typeof self?self:{},t=t.BigInt||Number;t("0x1"),t("0x100"),t("0x10000"),t("0x1000000"),t("0x100000000"),t("0x10000000000"),t("0x1000000000000"),t("0x100000000000000"),t("0x10000000000000000"),t=new Uint16Array([65484]),255!==(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))[0]&&t[0];function r(s){const r={};return Object.keys(s).forEach(e=>{var t,i=s[e];t=i,("function"===ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer)?r[e]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:r[e]=i}),r}self.onmessage=function(e){const i=e.data;var e=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),t=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),s=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new d(e,t,s,function(e,t){self.postMessage(r({source:i.source,decrypted:t}),[t.buffer])})}})));const uu=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},cu=(e,t)=>{(t.activePlaylistLoader=e).load()},pu={AUDIO:(a,o)=>()=>{var{segmentLoaders:{[a]:e},mediaTypes:{[a]:t},excludePlaylist:i}=o,e=(uu(e,t),t.activeTrack()),s=t.activeGroup(),s=(s.filter(e=>e.default)[0]||s[0]).id,r=t.tracks[s];if(e===r)i({error:{message:"Problem encountered loading the default audio track."}});else{T.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const n in t.tracks)t.tracks[n].enabled=t.tracks[n]===r;t.onTrackChanged()}},SUBTITLES:(i,s)=>()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s,e=(T.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),uu(e,t),t.activeTrack());e&&(e.mode="disabled"),t.onTrackChanged()}},mu={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",pu[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),r),s.paused()||n.load()}),t.on("error",pu[e](e,i))}},gu={AUDIO:(i,s)=>{var r,{vhs:n,sourceType:a,segmentLoaders:{[i]:e},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[i]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=s,p=pd(c.main);l[i]&&0!==Object.keys(l[i]).length||(l[i]={main:{default:{default:!0}}},p&&(l[i].main.default.playlists=c.main.playlists));for(const m in l[i]){d[m]||(d[m]=[]);for(const g in l[i][m]){let e=l[i][m][g],t;t=p?(u(`AUDIO group '${m}' label '${g}' is a main playlist`),e.isMainPlaylist=!0,null):"vhs-json"===a&&e.playlists?new Cd(e.playlists[0],n,o):e.resolvedUri?new Cd(e.resolvedUri,n,o):e.playlists&&"dash"===a?new Kd(e.playlists[0],n,o,c):null,e=O({id:g,playlistLoader:t},e),mu[i](i,e.playlistLoader,s),d[m].push(e),"undefined"==typeof h[g]&&(r=new T.AudioTrack({id:g,kind:(e=>{let t=e.default?"main":"alternative";return t=e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(e),enabled:!1,language:e.language,default:e.default,label:g}),h[g]=r)}}e.on("error",pu[i](i,s))},SUBTITLES:(i,s)=>{var r,{tech:n,vhs:a,sourceType:o,segmentLoaders:{[i]:e},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[i]:{groups:h,tracks:u}},mainPlaylistLoader:c}=s;for(const p in d[i]){h[p]||(h[p]=[]);for(const m in d[i][p])if(!d[i][p][m].forced){let e=d[i][p][m],t;if("hls"===o)t=new Cd(e.resolvedUri,a,l);else if("dash"===o){if(!e.playlists.filter(e=>e.excludeUntil!==1/0).length)return;t=new Kd(e.playlists[0],a,l,c)}else"vhs-json"===o&&(t=new Cd(e.playlists?e.playlists[0]:e.resolvedUri,a,l));e=O({id:m,playlistLoader:t},e),mu[i](i,e.playlistLoader,s),h[p].push(e),"undefined"==typeof u[m]&&(r=n.addRemoteTextTrack({id:m,kind:"subtitles",default:e.default&&e.autoselect,language:e.language,label:m},!1).track,u[m]=r)}}e.on("error",pu[i](i,s))},"CLOSED-CAPTIONS":(e,t)=>{var{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:r,tracks:n}}}=t;for(const l in s[e]){r[l]||(r[l]=[]);for(const d in s[e][l]){var a=s[e][l][d];if(/^(?:CC|SERVICE)/.test(a.instreamId)){var o=i.options_.vhs&&i.options_.vhs.captionServices||{};let e={label:d,language:a.language,instreamId:a.instreamId,default:a.default&&a.autoselect};void 0===(e=o[e.instreamId]?O(e,o[e.instreamId]):e).default&&delete e.default,r[l].push(O({id:d},a)),"undefined"==typeof n[d]&&(o=i.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,n[d]=o)}}}}},fu=(t,i)=>{for(let e=0;e<t.length;e++){if(cd(i,t[e]))return!0;if(t[e].playlists&&fu(t[e].playlists,i))return!0}return!1},yu={AUDIO:(i,s)=>()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if(e[t].enabled)return e[t];return null},SUBTITLES:(i,s)=>()=>{var{[i]:{tracks:e}}=s["mediaTypes"];for(const t in e)if("showing"===e[t].mode||"hidden"===e[t].mode)return e[t];return null}},_u=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{gu[e](e,n)});const{mediaTypes:a,mainPlaylistLoader:e,tech:t,vhs:i,segmentLoaders:{AUDIO:s,main:r}}=n;["AUDIO","SUBTITLES"].forEach(e=>{var o,l,d,h,i,s,u,c,t,r;a[e].activeGroup=(o=e,l=n,t=>{var{mainPlaylistLoader:e,mediaTypes:{[o]:{groups:i}}}=l,s=e.media();if(!s)return null;let r=null;s.attributes[o]&&(r=i[s.attributes[o]]);var n=Object.keys(i);if(!r)if("AUDIO"===o&&1<n.length&&pd(l.main))for(let e=0;e<n.length;e++){var a=i[n[e]];if(fu(a,s)){r=a;break}}else i.main?r=i.main:1===n.length&&(r=i[n[0]]);return"undefined"==typeof t?r:null!==t&&r&&r.filter(e=>e.id===t.id)[0]||null}),a[e].activeTrack=yu[e](e,n),a[e].onGroupChanged=(d=e,h=n,()=>{var{segmentLoaders:{[d]:e,main:t},mediaTypes:{[d]:i}}=h,s=i.activeTrack(),r=i.getActiveGroup(),n=i.activePlaylistLoader,a=i.lastGroup_;r&&a&&r.id===a.id||(i.lastGroup_=r,i.lastTrack_=s,uu(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),cu(r.playlistLoader,i)):n&&t.resetEverything()))}),a[e].onGroupChanging=(i=e,s=n,()=>{var{segmentLoaders:{[i]:e},mediaTypes:{[i]:t}}=s;t.lastGroup_=null,e.abort(),e.pause()}),a[e].onTrackChanged=(u=e,c=n,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:s,main:r},mediaTypes:{[u]:n}}=c,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,d=n.lastTrack_;if((!d||!a||d.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,uu(s,n),o)){if(o.isMainPlaylist)return!a||!d||a.id===d.id||(t=(e=c.vhs.playlistController_).selectPlaylist(),e.media()===t)?void 0:(n.logger_(`track change. Switching main audio from ${d.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t));if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),cu(o.playlistLoader,n)}}),a[e].getActiveGroup=([t,r]=[e,n["mediaTypes"]],()=>{var e=r[t].activeTrack();return e?r[t].activeGroup(e):null})});var o=a.AUDIO.activeGroup();o&&(o=(o.filter(e=>e.default)[0]||o[0]).id,a.AUDIO.tracks[o].enabled=!0,a.AUDIO.onGroupChanged(),a.AUDIO.onTrackChanged(),(a.AUDIO.getActiveGroup().playlistLoader?(r.setAudio(!1),s):r).setAudio(!0)),e.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanged())}),e.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>a[e].onGroupChanging())});const l=()=>{a.AUDIO.onTrackChanged(),t.trigger({type:"usage",name:"vhs-audio-change"})};t.audioTracks().addEventListener("change",l),t.remoteTextTracks().addEventListener("change",a.SUBTITLES.onTrackChanged),i.on("dispose",()=>{t.audioTracks().removeEventListener("change",l),t.remoteTextTracks().removeEventListener("change",a.SUBTITLES.onTrackChanged)}),t.clearTracks("audio");for(const d in a.AUDIO.tracks)t.audioTracks().addTrack(a.AUDIO.tracks[d])};let vu;const bu=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class Tu extends T.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let m=e["maxPlaylistRetries"];null!==m&&"undefined"!=typeof m||(m=1/0),vu=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const t={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{t[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Gh,activeTrack:Gh,getActiveGroup:Gh,onGroupChanged:Gh,onTrackChanged:Gh,lastTrack_:null,logger_:Bl(`MediaGroups[${e}]`)}}),t})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Fl(),this.hasPlayed_=!1,this.syncController_=new lu(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new hu,this.sourceUpdater_=new iu(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new du;var g={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings},g=(this.mainPlaylistLoader_=new("dash"===this.sourceType_?Kd:Cd)(t,this.vhs_,this.requestOptions_),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Wh(O(g,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Wh(O(g,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new au(O(g,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),bu.forEach(e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)}),this.logger_=Bl("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,"none"===this.tech_.preload()?"play":"loadstart");this.tech_.one(g,()=>{const e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var s=this.media(),s=s&&(s.id||s.uri),r=e.id||e.uri;s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var t=this.main(),e=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return e;var i=t.mediaGroups.AUDIO,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n=i.main||s.length&&i[s[0]];for(const d in n)if(n[d].default){r={label:d};break}}if(!r)return e;var a=[];for(const h in i)if(i[h][r.label]){var o=i[h][r.label];if(o.playlists&&o.playlists.length)a.push.apply(a,o.playlists);else if(o.uri)a.push(o);else if(t.playlists.length)for(let e=0;e<t.playlists.length;e++){var l=t.playlists[e];l.attributes&&l.attributes.AUDIO&&l.attributes.AUDIO===h&&a.push(l)}}return a.length?a:e}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ud(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),_u({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.excludeUnsupportedVariants_();let e;if(!(e=(e=this.enableLowInitialPlaylist?this.selectInitialPlaylist():e)||this.selectPlaylist())||!this.shouldSwitchToMedia_(e))return;if(this.initialMedia_=e,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ud(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;e=Object.keys(i.AUDIO);for(const r in i.AUDIO)for(const n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),vu.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1<Object.keys(i.AUDIO[e[0]]).length&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(t){var e=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),{currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:s,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}=[{buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:e,nextPlaylist:t,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_}][0];if(s){var d=`allowing switch ${i&&i.id||"null"} -> `+s.id;if(!i)return l(d+" as current playlist is not set"),!0;if(s.id!==i.id){var h=Boolean(jl(e,t).length);if(!i.endList)return h||"number"!=typeof i.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);h=Vl(e,t),e=o?D.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:D.MAX_BUFFER_LOW_WATER_LINE;if(a<e)return l(d+` as duration < max low water line (${a} < ${e})`),!0;t=s.attributes.BANDWIDTH,a=i.attributes.BANDWIDTH;if(t<a&&(!o||h<n)){let e=d+` as next bandwidth < current bandwidth (${t} < ${a})`;return o&&(e+=` and forwardBuffer < bufferHighWaterLine (${h} < ${n})`),l(e),!0}if((!o||a<t)&&r<=h){let e=d+` as forwardBuffer >= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${t} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else T.log.warn("We received no playlist to switch to. Please check your stream.");return!1}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:120}))});var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything(()=>{T.browser.IE_VERSION||T.browser.IS_EDGE?this.tech_.setCurrentTime(this.tech_.currentTime()+.04):this.tech_.setCurrentTime(this.tech_.currentTime())}))}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){var e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList){const t=this.seekable();if(!t.length)return!1;if(T.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",()=>{this.trigger("firstplay"),this.tech_.setCurrentTime(t.end(0)),this.hasPlayed_=!0}),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(t.end(0))}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){var e;this.tryToCreateSourceBuffers_(),this.tech_.autoplay()&&"undefined"!=typeof(e=this.tech_.play())&&"function"==typeof e.then&&e.then(null,e=>{}),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mainSegmentLoader_.getCurrentMediaInfo_(),e=(t&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=vu.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=zl&&e-i<=zl:e-t<=zl)}excludePlaylist({playlistToExclude:s=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(s=s||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,s){s.playlistErrors_++;var r=this.mainPlaylistLoader_.main.playlists,n=r.filter(ld),n=1===n.length&&n[0]===s;if(1===r.length&&i!==1/0)return T.log.warn(`Problem encountered with playlist ${s.id}. `+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){let i=!1;r.forEach(e=>{var t;e!==s&&"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(i=!0,delete e.excludeUntil)}),i&&(T.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let e;e=s.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,s.excludeUntil=e,t.reason&&(s.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});var a,r=this.selectPlaylist();if(r)return i=t.internal?this.logger_:T.log.warn,a=t.message?" "+t.message:"",i(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${s.id}.`+a+` Switching to playlist ${r.id}.`),r.attributes.AUDIO!==s.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),r.attributes.SUBTITLES!==s.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),i=r.targetDuration/2*1e3||5e3,a="number"==typeof r.lastRequest&&Date.now()-r.lastRequest<=i,this.switchMedia_(r,"exclude",n||a);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(i,e){const s=[];var t="all"===i,r=(!t&&"main"!==i||s.push(this.mainPlaylistLoader_),[]);!t&&"audio"!==i||r.push("AUDIO"),!t&&"subtitle"!==i||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(e=>{e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;e&&s.push(e)}),["main","audio","subtitle"].forEach(e=>{var t=this[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||s.push(t)}),s.forEach(t=>e.forEach(e=>{"function"==typeof t[e]&&t[e]()}))}setCurrentTime(e){var t=jl(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:vu.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let i;if(this.mainPlaylistLoader_){var s=this.mainPlaylistLoader_.media();if(s){var r=this.syncController_.getExpiredTime(s,this.duration());if(null!==r){var n=this.mainPlaylistLoader_.main,a=vu.Playlist.seekable(s,r,vu.Playlist.liveEdgeDelay(n,s));if(0!==a.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(s=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(r=this.syncController_.getExpiredTime(s,this.duration())))return;if(0===(i=vu.Playlist.seekable(s,r,vu.Playlist.liveEdgeDelay(n,s))).length)return}let e,t;this.seekable_&&this.seekable_.length&&(e=this.seekable_.end(0),t=this.seekable_.start(0)),!i||i.start(0)>a.end(0)||a.start(0)>i.end(0)?this.seekable_=a:this.seekable_=Fl([[(i.start(0)>a.start(0)?i:a).start(0),(i.end(0)<a.end(0)?i:a).end(0)]]),this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===e&&this.seekable_.start(0)===t||(this.logger_(`seekable updated [${Kl(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}}}}}updateDuration(t){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)this.updateDuration_=this.updateDuration.bind(this,t),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);else{if(t)return(t=this.seekable()).length?void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))):void 0;t=this.tech_.buffered();let e=vu.Playlist.duration(this.mainPlaylistLoader_.media());0<t.length&&(e=Math.max(e,t.end(t.length-1))),this.mediaSource.duration!==e&&this.sourceUpdater_.setDuration(e)}}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{var t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e}getCodecsOrExclude_(){const r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();r.video=r.main;var e=mh(this.main(),t);const n={};var i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(n.video=e.video||r.main.videoCodec||"avc1.4d400d"),r.main.isMuxed&&(n.video+=","+(e.audio||r.main.audioCodec||Fn)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||i)&&(n.audio=e.audio||r.main.audioCodec||r.audio.audioCodec||Fn,r.audio.isFmp4=(r.main.hasAudio&&!r.main.isMuxed?r.main:r.audio).isFmp4),n.audio||n.video){const a={};let s;if(["video","audio"].forEach(function(e){var t,i;n.hasOwnProperty(e)&&(t=r[e].isFmp4,i=n[e],!(t?In:xn)(i))&&(t=r[e].isFmp4?"browser":"muxer",a[t]=a[t]||[],a[t].push(n[e]),"audio"===e&&(s=t))}),i&&s&&t.attributes.AUDIO){const o=t.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===o&&e!==t&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${o} as ${s} does not support codec(s): "${n.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const l=[];if(["video","audio"].forEach(e=>{var t=(Un(this.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(Un(n[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&l.push(`"${this.sourceUpdater_.codecs[e]}" -> "${n[e]}"`)}),l.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${l.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}e=Object.keys(a).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${a[t].join(",")}"`),"")+".",this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){const s=this.main().playlists,r=[];Object.keys(s).forEach(e=>{var t,i,e=s[e];-1===r.indexOf(e.id)&&(r.push(e.id),i=[],!(t=mh(this.main,e)).audio||xn(t.audio)||In(t.audio)||i.push("audio codec "+t.audio),!t.video||xn(t.video)||In(t.video)||i.push("video codec "+t.video),t.text&&"stpp.ttml.im1t"===t.text&&i.push("text codec "+t.text),i.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id} for unsupported: `+i.join(", ")))})}excludeIncompatibleVariants_(e){const r=[],n=this.main().playlists;e=Lh(Un(e));const a=ph(e),o=e.video&&Un(e.video)[0]||null,l=e.audio&&Un(e.audio)[0]||null;Object.keys(n).forEach(e=>{var t,i,s,e=n[e];-1===r.indexOf(e.id)&&e.excludeUntil!==1/0&&(r.push(e.id),t=[],s=mh(this.mainPlaylistLoader_.main,e),i=ph(s),s.audio||s.video)&&(i!==a&&t.push(`codec count "${i}" !== "${a}"`),this.sourceUpdater_.canChangeType()||(i=s.video&&Un(s.video)[0]||null,s=s.audio&&Un(s.audio)[0]||null,i&&o&&i.type.toLowerCase()!==o.type.toLowerCase()&&t.push(`video codec "${i.type}" !== "${o.type}"`),s&&l&&s.type.toLowerCase()!==l.type.toLowerCase()&&t.push(`audio codec "${s.type}" !== "${l.type}"`)),t.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+t.join(" && ")))})}updateAdCues_(e){let t=0;var s=this.seekable(),[r,n,s=0]=(s.length&&(t=s.start(0)),[e,this.cueTagsTrack_,t]);if(r.segments){let t=s,i;for(let e=0;e<r.segments.length;e++){var a,o,l=r.segments[e];if(i=i||function(e,t){var i=e.cues;for(let e=0;e<i.length;e++){var s=i[e];if(t>=s.adStartTime&&t<=s.adEndTime)return s}return null}(n,t+l.duration/2)){if("cueIn"in l){i.endTime=t,i.adEndTime=t,t+=l.duration,i=null;continue}if(t<i.endTime){t+=l.duration;continue}i.endTime+=l.duration}else"cueOut"in l&&((i=new window.VTTCue(t,t+l.duration,l.cueOut)).adStartTime=t,i.adEndTime=t+parseFloat(l.cueOut),n.addCue(i)),"cueOutCont"in l&&([a,o]=l.cueOutCont.split("/").map(parseFloat),(i=new window.VTTCue(t,t+l.duration,"")).adStartTime=t-a,i.adEndTime=i.adStartTime+o,n.addCue(i));t+=l.duration}}}goalBufferLength(){var e=this.tech_.currentTime(),t=D.GOAL_BUFFER_LENGTH,i=D.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,D.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){var e=this.tech_.currentTime(),t=D.BUFFER_LOW_WATER_LINE,i=D.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,D.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,D.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:s)}bufferHighWaterLine(){return D.BUFFER_HIGH_WATER_LINE}}class Su{constructor(e,t,i){var s,r,n,a,o=e["playlistController_"],l=o.fastQualityChange_.bind(o);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=mh(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,n=t.id,a=l,e=>{var t=r.main.playlists[n],i=od(t),s=ld(t);return"undefined"==typeof e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const wu=["seeking","seeked","pause","playing","error"];class Eu{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Bl("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)}),t=>{["main","audio"].forEach(e=>{n[e+"SegmentLoader_"][t]("appended",this.seekingAppendCheck_)})});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(wu,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(wu,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0<this[e+"StalledDownloads_"]&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()}checkSegmentDownloads_(e){var t=this.playlistController_,i=t[e+"SegmentLoader_"],s=i.buffered_(),r=function(t,i){if(t!==i){if(!t&&i||!i&&t)return!0;if(t.length!==i.length)return!0;for(let e=0;e<t.length;e++)if(t.start(e)!==i.start(e)||t.end(e)!==i.end(e))return!0}return!1}(this[e+"Buffered_"],s);this[e+"Buffered_"]=s,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_(`found #${this[e+"StalledDownloads_"]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:Yl(s)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})))}checkCurrentTime_(){var e,t;if(!this.tech_.paused()&&!this.tech_.seeking())return e=this.tech_.currentTime(),t=this.tech_.buffered(),this.lastRecordedTime===e&&(!t.length||e+zl>=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(s=e.end(e.length-1),i=s),this.beforeSeekableWindow_(e,t)&&(s=e.start(0),i=s+(s===e.end(0)?0:zl)),"undefined"!=typeof i)this.logger_(`Trying to seek outside of seekable at time ${t} with `+`seekable range ${Kl(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,e=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,s=s.videoBuffer?s.videoBuffered():null,n=this.media(),a=n.partTargetDuration||2*(n.targetDuration-Gl),o=[r,s];for(let e=0;e<o.length;e++)if(o[e])if(Vl(o[e],t)<a)return!1;if(0===(n=Hl(e,t)).length)return!1;i=n.start(0)+zl,this.logger_(`Buffered region starts (${n.start(0)}) `+` just beyond seek point (${t}). Seeking to ${i}.`)}return this.tech_.setCurrentTime(i),!0}waiting_(){var e,t;this.techWaiting_()||(e=this.tech_.currentTime(),t=this.tech_.buffered(),(t=jl(t,e)).length&&e+3<=t.end(0)&&(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region `+`[${t.start(0)} -> ${t.end(0)}]. Attempting to resume `+"playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to `+"live point (seekable end) "+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=Hl(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+zl;var n=!i.endList;return t>(r=n&&s?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0<e.start(0)&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:t,audioBuffered:i,currentTime:s}){if(t){let e;var r,n;return t.length&&i.length?(r=jl(t,s-3),n=jl(t,s),(i=jl(i,s)).length&&!n.length&&r.length&&(e={start:r.end(0),end:i.end(0)})):Hl(t,s).length||(e=this.gapFromVideoUnderflow_(t,s)),!!e&&(this.logger_(`Encountered a gap in video from ${e.start} to ${e.end}. `+"Seeking to current time "+s),!0)}}skipTheGap_(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),t=Hl(t,i);this.resetTimeUpdate_(),0!==t.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",t.start(0)),this.tech_.setCurrentTime(t.start(0)+Gl),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){var i=function(t){if(t.length<2)return Fl();var i=[];for(let e=1;e<t.length;e++){var s=t.end(e-1),r=t.start(e);i.push([s,r])}return Fl(i)}(e);for(let e=0;e<i.length;e++){var s=i.start(e),r=i.end(e);if(t-s<4&&2<t-s)return{start:s,end:r}}return null}}const ku={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Cu=function(t,e){let i=0,s=0;function r(e){null!=e&&(s=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",l),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.play())}function n(){if(Date.now()-i<1e3*o.errorInterval)t.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(o.getSource&&"function"==typeof o.getSource)return i=Date.now(),o.getSource.call(t,r);T.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}}function a(){t.off("loadedmetadata",l),t.off("error",n),t.off("dispose",a)}const o=O(ku,e),l=(t.ready(()=>{t.trigger({type:"usage",name:"vhs-error-reload-initialized"})}),function(){s&&t.currentTime(s)});t.on("error",n),t.on("dispose",a),t.reloadSourceOnError=function(e){a(),Cu(t,e)}};function Iu(t,e){var i=e.media();let s=-1;for(let e=0;e<t.length;e++)if(t[e].id===i.id){s=e;break}t.selectedIndex_=s,t.trigger({selectedIndex:s,type:"change"})}const N={PlaylistLoader:Cd,Playlist:md,utils:Or,STANDARD_PLAYLIST_SELECTOR:Rh,INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.main.playlists.filter(md.isEnabled),e=(Nh(e,(e,t)=>fh(e,t)),e.filter(e=>!!mh(this.playlists.main,e).video));return e[0]||null},lastBandwidthSelector:Rh,movingAverageBandwidthSelector:function(t){let i=-1,s=-1;if(t<0||1<t)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return i<0&&(i=this.systemBandwidth,s=this.systemBandwidth),0<this.systemBandwidth&&this.systemBandwidth!==s&&(i=t*this.systemBandwidth+(1-t)*i,s=this.systemBandwidth),Mh(this.playlists.main,i,parseInt(gh(this.tech_.el(),"width"),10)*e,parseInt(gh(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:fh,comparePlaylistResolution:function(e,t){let i,s;return i=(i=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width?e.attributes.RESOLUTION.width:i)||window.Number.MAX_VALUE,s=(s=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width?t.attributes.RESOLUTION.width:s)||window.Number.MAX_VALUE,i===s&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-s},xhr:xd()},xu=(Object.keys(D).forEach(t=>{Object.defineProperty(N,t,{get(){return T.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),D[t]},set(e){T.log.warn(`using Vhs.${t} is UNSAFE be sure you know what you are doing`),"number"!=typeof e||e<0?T.log.warn(`value of Vhs.${t} must be greater than or equal to 0`):D[t]=e}})}),"videojs-vhs"),Au=(N.canPlaySource=function(){return T.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();var r,t=t?i.concat([t]):i,t=(i=t,r=Object.keys(e),i.reduce((e,s)=>{var t;return s.contentProtection&&(t=r.reduce((e,t)=>{var i=s.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{}),Object.keys(t).length)&&e.push(t),e},[]));const n=[],a=[];return t.forEach(e=>{a.push(new Promise((e,t)=>{s.tech_.one("keysessioncreated",e)})),n.push(new Promise((t,i)=>{s.eme.initializeMediaKeys({keySystems:e},e=>{e?i(e):t()})}))}),Promise.race([Promise.all(n),Promise.race(a)])}),Pu=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=Lh(Un(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r=Bn(s.video),n=Bn(s.audio),a={};for(const o in e)a[o]={},n&&(a[o].audioContentType=n),r&&(a[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(a[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(a[o].url=e[o]);return O(e,a)})(t,i,s);return!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(T.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))},Lu=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(xu);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};N.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const t=document.createElement("video");return!!T.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(t.canPlayType(e))})}(),N.supportsNativeDash=!!(document&&document.createElement&&T.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),N.supportsTypeNatively=e=>"hls"===e?N.supportsNativeHls:"dash"===e&&N.supportsNativeDash,N.isSupported=function(){return T.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};class Ou extends T.getComponent("Component"){constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Bl("VhsHandler"),t.options_&&t.options_.playerId&&(i=T.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(){var e;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage="undefined"!=typeof this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=Lu())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=D.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===D.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{"undefined"!=typeof this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=N,this.options_.sourceType=An(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new Tu(this.options_),e=O({liveRangeSafeTimeDelta:zl},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new Eu(e),this.playlistController_.on("error",()=>{var e=T.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.bufferBasedABR?N.movingAverageBandwidthSelector(.55):N.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=N.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(t=1e3*t.downlink*1e3,e=1e7<=t&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0<this.throughput?1/this.throughput:0,Math.floor(1/(e+t))},set(){T.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Yl(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Yl(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=Lu())?O(t,e):e;try{window.localStorage.setItem(xu,JSON.stringify(t))}catch(e){return}}}}),this.playlistController_.on("selectedinitialmedia",()=>{var i;(i=this).representations=()=>{var e=i.playlistController_.main(),e=pd(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(e=>!od(e)).map((e,t)=>new Su(i,e,e.id)):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Au({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=Pu({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",e=>{if("output-restricted"===e.status){e=this.playlistController_.main();if(e&&e.playlists){const t=[];e.playlists.forEach(e=>{e&&e.attributes&&e.attributes.RESOLUTION&&720<=e.attributes.RESOLUTION.height&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,t.push(e))}),t.length&&(T.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...t),this.playlistController_.fastQualityChange_())}}}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==T.browser.IE_VERSION&&e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=T.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{var t,e;t=this.qualityLevels_,(e=this).representations().forEach(e=>{t.addQualityLevel(e)}),Iu(t,e.playlists)}),this.playlists.on("mediachange",()=>{Iu(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":"3.0.2","mux.js":"6.3.0","mpd-parser":"1.0.1","m3u8-parser":"6.0.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return iu.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Fd({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return jd({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}const Du={name:"videojs-http-streaming",VERSION:"3.0.2",canHandleSource(e,t={}){t=O(T.options,t);return Du.canPlayType(e.type,t)},handleSource(e,t,i={}){i=O(T.options,i);return t.vhs=new Ou(e,t,i),t.vhs.xhr=xd(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){e=An(e);return e&&(t=Du.getOverrideNative(t),!N.supportsTypeNatively(e)||t)?"maybe":""},getOverrideNative(e={}){var{vhs:e={}}=e,t=!(T.browser.IS_ANY_SAFARI||T.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return In("avc1.4d400d,mp4a.40.2")&&T.getTech("Html5").registerSourceHandler(Du,0),T.VhsHandler=Ou,T.VhsSourceHandler=Du,T.Vhs=N,T.use||T.registerComponent("Vhs",N),T.options.vhs=T.options.vhs||{},T.getPlugin&&T.getPlugin("reloadSourceOnError")||T.registerPlugin("reloadSourceOnError",function(e){Cu(this,e)}),T});
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.flvjs=t():e.flvjs=t()}(self,(function(){return function(){var e={264:function(e,t,i){
- e.exports=function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,s=void 0,o=void 0,a=function(e,t){E[r]=e,E[r+1]=t,2===(r+=2)&&(o?o(b):R())};function h(e){o=e}function u(e){a=e}var d="undefined"!=typeof window?window:void 0,l=d||{},c=l.MutationObserver||l.WebKitMutationObserver,_="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(b)}}function m(){return void 0!==s?function(){s(b)}:y()}function g(){var e=0,t=new c(b),i=document.createTextNode("");return t.observe(i,{characterData:!0}),function(){i.data=e=++e%2}}function v(){var e=new MessageChannel;return e.port1.onmessage=b,function(){return e.port2.postMessage(0)}}function y(){var e=setTimeout;return function(){return e(b,1)}}var E=new Array(1e3);function b(){for(var e=0;e<r;e+=2)(0,E[e])(E[e+1]),E[e]=void 0,E[e+1]=void 0;r=0}function S(){try{var e=Function("return this")().require("vertx");return s=e.runOnLoop||e.runOnContext,m()}catch(e){return y()}}var R=void 0;function A(e,t){var i=this,n=new this.constructor(O);void 0===n[w]&&W(n);var r=i._state;if(r){var s=arguments[r-1];a((function(){return V(r,n,s,i._result)}))}else F(i,n,e,t);return n}function L(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var i=new t(O);return x(i,e),i}R=_?p():c?g():f?v():void 0===d?S():y();var w=Math.random().toString(36).substring(2);function O(){}var T=void 0,C=1,k=2;function D(){return new TypeError("You cannot resolve a promise with itself")}function B(){return new TypeError("A promises callback cannot return that same promise.")}function I(e,t,i,n){try{e.call(t,i,n)}catch(e){return e}}function M(e,t,i){a((function(e){var n=!1,r=I(i,t,(function(i){n||(n=!0,t!==i?x(e,i):G(e,i))}),(function(t){n||(n=!0,Z(e,t))}),"Settle: "+(e._label||" unknown promise"));!n&&r&&(n=!0,Z(e,r))}),e)}function U(e,t){t._state===C?G(e,t._result):t._state===k?Z(e,t._result):F(t,void 0,(function(t){return x(e,t)}),(function(t){return Z(e,t)}))}function P(e,i,n){i.constructor===e.constructor&&n===A&&i.constructor.resolve===L?U(e,i):void 0===n?G(e,i):t(n)?M(e,i,n):G(e,i)}function x(t,i){if(t===i)Z(t,D());else if(e(i)){var n=void 0;try{n=i.then}catch(e){return void Z(t,e)}P(t,i,n)}else G(t,i)}function N(e){e._onerror&&e._onerror(e._result),j(e)}function G(e,t){e._state===T&&(e._result=t,e._state=C,0!==e._subscribers.length&&a(j,e))}function Z(e,t){e._state===T&&(e._state=k,e._result=t,a(N,e))}function F(e,t,i,n){var r=e._subscribers,s=r.length;e._onerror=null,r[s]=t,r[s+C]=i,r[s+k]=n,0===s&&e._state&&a(j,e)}function j(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,r=void 0,s=e._result,o=0;o<t.length;o+=3)n=t[o],r=t[o+i],n?V(i,n,r,s):r(s);e._subscribers.length=0}}function V(e,i,n,r){var s=t(n),o=void 0,a=void 0,h=!0;if(s){try{o=n(r)}catch(e){h=!1,a=e}if(i===o)return void Z(i,B())}else o=r;i._state!==T||(s&&h?x(i,o):!1===h?Z(i,a):e===C?G(i,o):e===k&&Z(i,o))}function z(e,t){try{t((function(t){x(e,t)}),(function(t){Z(e,t)}))}catch(t){Z(e,t)}}var H=0;function K(){return H++}function W(e){e[w]=H++,e._state=void 0,e._result=void 0,e._subscribers=[]}function q(){return new Error("Array Methods must be provided an Array")}var Y=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(O),this.promise[w]||W(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?G(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&G(this.promise,this._result))):Z(this.promise,q())}return e.prototype._enumerate=function(e){for(var t=0;this._state===T&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===L){var r=void 0,s=void 0,o=!1;try{r=e.then}catch(e){o=!0,s=e}if(r===A&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(i===te){var a=new i(O);o?Z(a,s):P(a,e,r),this._willSettleAt(a,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,i){var n=this.promise;n._state===T&&(this._remaining--,e===k?Z(n,i):this._result[t]=i),0===this._remaining&&G(n,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;F(e,void 0,(function(e){return i._settledAt(C,t,e)}),(function(e){return i._settledAt(k,t,e)}))},e}();function X(e){return new Y(this,e).promise}function J(e){var t=this;return n(e)?new t((function(i,n){for(var r=e.length,s=0;s<r;s++)t.resolve(e[s]).then(i,n)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))}function Q(e){var t=new this(O);return Z(t,e),t}function $(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ee(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var te=function(){function e(t){this[w]=K(),this._result=this._state=void 0,this._subscribers=[],O!==t&&("function"!=typeof t&&$(),this instanceof e?z(this,t):ee())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var i=this,n=i.constructor;return t(e)?i.then((function(t){return n.resolve(e()).then((function(){return t}))}),(function(t){return n.resolve(e()).then((function(){throw t}))})):i.then(e,e)},e}();function ie(){var e=void 0;if(void 0!==i.g)e=i.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===n&&!t.cast)return}e.Promise=te}return te.prototype.then=A,te.all=X,te.race=J,te.resolve=L,te.reject=Q,te._setScheduler=h,te._setAsap=u,te._asap=a,te.polyfill=ie,te.Promise=te,te}()},716:function(e){"use strict";var t,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,s),n(i)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}p(e,t,s,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&p(e,"error",t,i)}(e,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,i,n){var r,s,o,u;if(a(i),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),o=s[t]),void 0===o)o=s[t]=i,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[i,o]:[o,i]:n?o.unshift(i):o.push(i),(r=h(e))>0&&o.length>r&&!o.warned){o.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=o.length,u=d,console&&console.warn&&console.warn(u)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=d.bind(n);return r.listener=i,n.wrapFn=r,r}function c(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(r):f(r,r.length)}function _(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function f(e,t){for(var i=new Array(t),n=0;n<t;++n)i[n]=e[n];return i}function p(e,t,i,n){if("function"==typeof e.on)n.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(s){n.once&&e.removeEventListener(t,r),i(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(void 0===h)return!1;if("function"==typeof h)n(h,this,t);else{var u=h.length,d=f(h,u);for(i=0;i<u;++i)n(d[i],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,l(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,l(this,e,t)),this},s.prototype.removeListener=function(e,t){var i,n,r,s,o;if(a(t),void 0===(n=this._events))return this;if(void 0===(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){o=i[s].listener,r=s;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,r),1===i.length&&(n[e]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var r,s=Object.keys(i);for(n=0;n<s.length;++n)"removeListener"!==(r=s[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return c(this,e,!0)},s.prototype.rawListeners=function(e){return c(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):_.call(e,t)},s.prototype.listenerCount=_,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},397:function(e,t,i){function n(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var n=i(i.s=ENTRY_MODULE);return n.default||n}var r="[\\.|\\-|\\+|\\w|/|@]+",s="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+r+").*?\\)";function o(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var h=t.toString(),u=h.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return a;for(var d,l=u[1],c=new RegExp("(\\\\n|\\W)"+o(l)+s,"g");d=c.exec(h);)"dll-reference"!==d[3]&&a[n].push(d[3]);for(c=new RegExp("\\("+o(l)+'\\("(dll-reference\\s('+r+'))"\\)\\)'+s,"g");d=c.exec(h);)e[d[2]]||(a[n].push(d[1]),e[d[2]]=i(d[1]).m),a[d[2]]=a[d[2]]||[],a[d[2]].push(d[4]);for(var _,f=Object.keys(a),p=0;p<f.length;p++)for(var m=0;m<a[f[p]].length;m++)_=a[f[p]][m],isNaN(1*_)||(a[f[p]][m]=1*a[f[p]][m]);return a}function h(e){return Object.keys(e).reduce((function(t,i){return t||e[i].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:i.m},s=t.all?{main:Object.keys(r.main)}:function(e,t){for(var i={main:[t]},n={main:[]},r={main:{}};h(i);)for(var s=Object.keys(i),o=0;o<s.length;o++){var u=s[o],d=i[u].pop();if(r[u]=r[u]||{},!r[u][d]&&e[u][d]){r[u][d]=!0,n[u]=n[u]||[],n[u].push(d);for(var l=a(e,e[u][d],u),c=Object.keys(l),_=0;_<c.length;_++)i[c[_]]=i[c[_]]||[],i[c[_]]=i[c[_]].concat(l[c[_]])}}return n}(r,e),o="";Object.keys(s).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;s[e][t];)t++;s[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),o=o+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([o],{type:"text/javascript"});if(t.bare)return u;var d=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),l=new window.Worker(d);return l.objectURL=d,l}},118:function(e,t){"use strict";var i=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(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===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&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t},e.prototype.isSeekable=function(){return!0===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,s=0,o=n;for(t<e[0]&&(i=0,s=o+1);s<=o;){if((r=s+Math.floor((o-s)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?s=r+1:o=r-1}return i},e}();t.Z=i},51:function(e,t,i){"use strict";i.d(t,{J1:function(){return o},Vn:function(){return s},Wk:function(){return n},Yy:function(){return r}});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}(),s=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,s=0,o=n;for(e<t[0].dts&&(i=0,s=o+1);s<=o;){if((r=s+Math.floor((o-s)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?s=r+1:o=r-1}return this._list[i]},e}(),o=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=this._list;if(0===t.length)return-2;var i=t.length-1,n=0,r=0,s=i,o=0;if(e<t[0].originalBeginDts)return o=-1;for(;r<=s;){if((n=r+Math.floor((s-r)/2))===i||e>t[n].lastSample.originalDts&&e<t[n+1].originalBeginDts){o=n;break}t[n].originalBeginDts<e?r=n+1:s=n-1}return o},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,n=this._lastAppendLocation,r=0;-1!==n&&n<t.length&&i.originalBeginDts>=t[n].lastSample.originalDts&&(n===t.length-1||n<t.length-1&&i.originalBeginDts<t[n+1].originalBeginDts)?r=n+1:t.length>0&&(r=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,i)},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}()},18:function(e,t,i){"use strict";i.d(t,{Z:function(){return O}});var n=i(716),r=i.n(n),s=i(300),o=i(538),a=i(118);function h(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}var u,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(h(i,n,1))if((s=(31&i[n])<<6|63&i[n+1])>=128){t.push(String.fromCharCode(65535&s)),n+=2;continue}}else if(i[n]<240){if(h(i,n,2))if((s=(15&i[n])<<12|(63&i[n+1])<<6|63&i[n+2])>=2048&&55296!=(63488&s)){t.push(String.fromCharCode(65535&s)),n+=3;continue}}else if(i[n]<248){var s;if(h(i,n,3))if((s=(7&i[n])<<18|(63&i[n+1])<<12|(63&i[n+2])<<6|63&i[n+3])>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),n+=4;continue}}t.push(String.fromCharCode(65533)),++n}return t.join("")},l=i(29),c=(u=new ArrayBuffer(2),new DataView(u).setInt16(0,256,!0),256===new Int16Array(u)[0]),_=function(){function e(){}return e.parseScriptData=function(t,i,n){var r={};try{var o=e.parseValue(t,i,n),a=e.parseValue(t,i+o.size,n-o.size);r[o.data]=a.data}catch(e){s.Z.e("AMF",e.toString())}return r},e.parseObject=function(t,i,n){if(n<3)throw new l.rT("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),s=e.parseValue(t,i+r.size,n-r.size),o=s.objectEnd;return{data:{name:r.data,value:s.data},size:r.size+s.size,objectEnd:o}},e.parseVariable=function(t,i,n){return e.parseObject(t,i,n)},e.parseString=function(e,t,i){if(i<2)throw new l.rT("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!c);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 l.rT("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!c);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 l.rT("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!c),s=n.getInt16(8,!c);return{data:new Date(r+=60*s*1e3),size:10}},e.parseValue=function(t,i,n){if(n<1)throw new l.rT("Data not enough when parse Value");var r,o=new DataView(t,i,n),a=1,h=o.getUint8(0),u=!1;try{switch(h){case 0:r=o.getFloat64(1,!c),a+=8;break;case 1:r=!!o.getUint8(1),a+=1;break;case 2:var d=e.parseString(t,i+1,n-1);r=d.data,a+=d.size;break;case 3:r={};var _=0;for(9==(16777215&o.getUint32(n-4,!c))&&(_=3);a<n-4;){var f=e.parseObject(t,i+a,n-a-_);if(f.objectEnd)break;r[f.data.name]=f.data.value,a+=f.size}if(a<=n-3)9===(16777215&o.getUint32(a-1,!c))&&(a+=3);break;case 8:r={},a+=4;_=0;for(9==(16777215&o.getUint32(n-4,!c))&&(_=3);a<n-8;){var p=e.parseVariable(t,i+a,n-a-_);if(p.objectEnd)break;r[p.data.name]=p.data.value,a+=p.size}if(a<=n-3)9===(16777215&o.getUint32(a-1,!c))&&(a+=3);break;case 9:r=void 0,a=1,u=!0;break;case 10:r=[];var m=o.getUint32(1,!c);a+=4;for(var g=0;g<m;g++){var v=e.parseValue(t,i+a,n-a);r.push(v.data),a+=v.size}break;case 11:var y=e.parseDate(t,i+1,n-1);r=y.data,a+=y.size;break;case 12:var E=e.parseString(t,i+1,n-1);r=E.data,a+=E.size;break;default:a=n,s.Z.w("AMF","Unsupported AMF value type "+h)}}catch(e){s.Z.e("AMF",e.toString())}return{data:r,size:a,objectEnd:u}},e}(),f=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=this._total_bytes-this._buffer_index;if(e<=0)throw new l.rT("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new l.OC("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),s=this._current_word>>>32-r;return this._current_word<<=r,this._current_word_bits_left-=r,i=i<<r|s},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(0!=(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,s=0;s<i;s++)s>=2&&3===t[s]&&0===t[s-1]&&0===t[s-2]||(n[r]=t[s],r++);return new Uint8Array(n.buffer,0,r)},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),n=new f(i);n.readByte();var r=n.readByte();n.readByte();var s=n.readByte();n.readUEG();var o=e.getProfileString(r),a=e.getLevelString(s),h=1,u=420,d=8;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r||138===r||144===r)&&(3===(h=n.readUEG())&&n.readBits(1),h<=3&&(u=[0,420,422,444][h]),d=n.readUEG()+8,n.readUEG(),n.readBits(1),n.readBool()))for(var l=3!==h?8:12,c=0;c<l;c++)n.readBool()&&(c<6?e._skipScalingList(n,16):e._skipScalingList(n,64));n.readUEG();var _=n.readUEG();if(0===_)n.readUEG();else if(1===_){n.readBits(1),n.readSEG(),n.readSEG();var p=n.readUEG();for(c=0;c<p;c++)n.readSEG()}var m=n.readUEG();n.readBits(1);var g=n.readUEG(),v=n.readUEG(),y=n.readBits(1);0===y&&n.readBits(1),n.readBits(1);var E=0,b=0,S=0,R=0;n.readBool()&&(E=n.readUEG(),b=n.readUEG(),S=n.readUEG(),R=n.readUEG());var A=1,L=1,w=0,O=!0,T=0,C=0;if(n.readBool()){if(n.readBool()){var k=n.readByte();k>0&&k<16?(A=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][k-1],L=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][k-1]):255===k&&(A=n.readByte()<<8|n.readByte(),L=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){var D=n.readBits(32),B=n.readBits(32);O=n.readBool(),w=(T=B)/(C=2*D)}}var I=1;1===A&&1===L||(I=A/L);var M=0,U=0;0===h?(M=1,U=2-y):(M=3===h?1:2,U=(1===h?2:1)*(2-y));var P=16*(g+1),x=16*(v+1)*(2-y);P-=(E+b)*M,x-=(S+R)*U;var N=Math.ceil(P*I);return n.destroy(),n=null,{profile_string:o,level_string:a,bit_depth:d,ref_frames:m,chroma_format:u,chroma_format_string:e.getChromaFormatString(u),frame_rate:{fixed:O,fps:w,fps_den:C,fps_num:T},sar_ratio:{width:A,height:L},codec_size:{width:P,height:x},present_size:{width:N,height:x}}},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}(),m=function(){function e(){}return e.parseSPS=function(t){var i=p._ebsp2rbsp(t),n=new f(i),r={};n.readBits(16),n.readBits(4);var s=n.readBits(3);n.readBits(1),e._hvcc_parse_ptl(n,r,s),n.readUEG();var o=0,a=n.readUEG();3==a&&(o=n.readBits(1)),r.sar_width=r.sar_height=1,r.conf_win_left_offset=r.conf_win_right_offset=r.conf_win_top_offset=r.conf_win_bottom_offset=0,r.def_disp_win_left_offset=r.def_disp_win_right_offset=r.def_disp_win_top_offset=r.def_disp_win_bottom_offset=0;var h=n.readUEG(),u=n.readUEG();n.readBits(1)&&(r.conf_win_left_offset=n.readUEG(),r.conf_win_right_offset=n.readUEG(),r.conf_win_top_offset=n.readUEG(),r.conf_win_bottom_offset=n.readUEG(),1===r.default_display_window_flag&&(r.conf_win_left_offset+r.def_disp_win_left_offset,r.conf_win_right_offset+r.def_disp_win_right_offset,r.conf_win_top_offset+r.def_disp_win_top_offset,r.conf_win_bottom_offset,r.def_disp_win_bottom_offset));var d=n.readUEG()+8;n.readUEG();for(var l=n.readUEG(),c=n.readBits(1)?0:s;c<=s;c++)e._skip_sub_layer_ordering_info(n);n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readUEG(),n.readBits(1)&&n.readBits(1)&&e._skip_scaling_list_data(n),n.readBits(1),n.readBits(1),n.readBits(1)&&(n.readBits(4),n.readBits(4),n.readUEG(),n.readUEG(),n.readBits(1));var _=[],m=n.readUEG();for(c=0;c<m;c++){var g=e._parse_rps(n,c,m,_);if(g<0)return g}if(n.readBits(1)){var v=n.readUEG();for(c=0;c<v;c++){var y=Math.min(l+4,16);if(y>32){for(var E=y/32,b=y%32,S=0;S<E;S++)n.readBits(32);n.readBits(b)}else n.readBits(y);n.readBits(1)}}n.readBits(1),n.readBits(1),n.readBits(1)&&e._hvcc_parse_vui(n,r,s);var R=e.getProfileString(r.profile_idc),A=e.getLevelString(r.level_idc),L=1;1===r.sar_width&&1===r.sar_height||(L=r.sar_width/r.sar_height);var w=h,O=u,T=1===a&&0===o?2:1;w-=(1!==a&&2!=a||0!==o?1:2)*(r.conf_win_left_offset+r.conf_win_right_offset),O-=T*(r.conf_win_top_offset+r.conf_win_bottom_offset);var C=Math.ceil(w*L);return n.destroy(),n=null,{profile_string:R,level_string:A,profile_idc:r.profile_idc,level_idc:r.level_idc,bit_depth:d,ref_frames:1,chroma_format:a,chroma_format_string:e.getChromaFormatString(a),frame_rate:{fixed:r.fps_fixed,fps:r.fps,fps_den:r.fps_den,fps_num:r.fps_num},sar_ratio:{width:r.sar_width,height:r.sar_height},codec_size:{width:w,height:O},present_size:{width:C,height:O}}},e._hvcc_parse_ptl=function(e,t,i){e.readBits(2);var n=e.readBits(1),r=e.readBits(5);e.readBits(32),e.readBits(32),e.readBits(16);var s=e.readByte();void 0===t.tier_flag||void 0===t.level_idc||t.tier_flag<n?t.level_idc=s:t.level_idc=Math.max(t.level_idc,s),t.profile_idc=Math.max(void 0===t.profile_idc?0:t.profile_idc,r);for(var o=[],a=[],h=0;h<i;h++)o.push(e.readBits(1)),a.push(e.readBits(1));if(i>0)for(h=i;h<8;h++)e.readBits(2);for(h=0;h<i;h++)o[h]&&(e.readBits(32),e.readBits(32),e.readBits(24)),a[h]&&e.readByte()},e._parse_rps=function(e,t,i,n){if(t&&e.readBits(1)){if(t>=i)return-1;e.readBits(1),e.readUEG(),n[t]=0;for(var r=0;r<=n[t-1];r++){var s=0,o=e.readBits(1);o||(s=e.readBits(1)),(o||s)&&n[t]++}}else{var a=e.readUEG(),h=e.readUEG();n[t]=a+h;for(r=0;r<a;r++)e.readUEG(),e.readBits(1);for(r=0;r<h;r++)e.readUEG(),e.readBits(1)}return 0},e._hvcc_parse_vui=function(t,i,n){t.readBits(1)&&255==t.readByte()&&(i.sar_width=t.readBits(16),i.sar_height=t.readBits(16)),t.readBits(1)&&t.readBits(1),t.readBits(1)&&(t.readBits(4),t.readBits(1)&&t.readBits(24)),t.readBits(1)&&(t.readUEG(),t.readUEG()),t.readBits(3),i.default_display_window_flag=t.readBits(1),i.default_display_window_flag&&(i.def_disp_win_left_offset=t.readUEG(),i.def_disp_win_right_offset=t.readUEG(),i.def_disp_win_top_offset=t.readUEG(),i.def_disp_win_bottom_offset=t.readUEG()),t.readBits(1)&&(e._skip_timing_info(t,i),t.readBits(1)&&e._skip_hrd_parameters(t,i,1,n)),t.readBits(1)&&(t.readBits(3),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG(),t.readUEG())},e._skip_sub_layer_ordering_info=function(e,t){e.readUEG(),e.readUEG(),e.readUEG()},e._skip_scaling_list_data=function(e){for(var t=0;t<4;t++)for(var i=0;i<(3==t?2:6);i++)if(e.readBits(1)){var n=Math.min(64,1<<4+(t<<1));t>1&&e.readSEG();for(var r=0;r<n;r++)e.readSEG()}else e.readUEG()},e._skip_sub_layer_hrd_parameters=function(e,t,i){for(var n=0;n<=t;n++)e.readUEG(),e.readUEG(),i&&(e.readUEG(),e.readUEG()),e.readBits(1)},e._skip_timing_info=function(e,t){t.fps_den=e.readBits(32),t.fps_num=e.readBits(32),t.fps_den>0&&(t.fps=t.fps_num/t.fps_den);var i=0;e.readBits(1)&&(i=e.readUEG())>=0&&(t.fps/=i+1)},e._skip_hrd_parameters=function(t,i,n){var r=0,s=0;if(i&&(r=t.readBits(1),s=t.readBits(1),r||s)){var o=t.readBits(1);o&&t.readBits(19),t.readByte(),o&&t.readBits(4),t.readBits(15)}for(var a=0;a<=n;a++){var h=0,u=0,d=0,l=t.readBits(1);hvcc.fps_fixed=l,l||(d=t.readBits(1)),d?t.readUEG():u=t.readBits(1),u||(h=t.readUEG(t)),r&&e._skip_sub_layer_hrd_parameters(t,h,0),s&&e._skip_sub_layer_hrd_parameters(t,h,0)}},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.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}(),g=i(600);var v=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.Z,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),i={match:!1};if(t.byteLength<4)return i;if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var n,r,s=(4&t[4])>>>2!=0,o=0!=(1&t[4]),a=(n=t)[r=5]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3];return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:s,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.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new a.Z},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){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new l.rT("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0,r=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;n=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,i+n!==this._dataOffset&&s.Z.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(o=new DataView(t,n)).getUint32(0,!r)&&s.Z.w(this.TAG,"PrevTagSize0 !== 0 !!!"),n+=4);for(;n<t.byteLength;){this._dispatch=!0;var o=new DataView(t,n);if(n+11+4>t.byteLength)break;var a=o.getUint8(0),h=16777215&o.getUint32(0,!r);if(n+11+h+4>t.byteLength)break;if(8===a||9===a||18===a){var u=o.getUint8(4),d=o.getUint8(5),c=o.getUint8(6)|d<<8|u<<16|o.getUint8(7)<<24;0!==(16777215&o.getUint32(7,!r))&&s.Z.w(this.TAG,"Meet tag which has StreamID != 0!");var _=n+11;switch(a){case 8:this._parseAudioData(t,_,h,c);break;case 9:this._parseVideoData(t,_,h,c,i+n);break;case 18:this._parseScriptData(t,_,h)}var f=o.getUint32(11+h,!r);f!==11+h&&s.Z.w(this.TAG,"Invalid PrevTagSize ".concat(f)),n+=11+h+4}else s.Z.w(this.TAG,"Unsupported tag type ".concat(a,", skipped")),n+=11+h+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),n},e.prototype._parseScriptData=function(e,t,i){var n=_.parseScriptData(e,t,i);if(n.hasOwnProperty("onMetaData")){if(null==n.onMetaData||"object"!=typeof n.onMetaData)return void s.Z.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&s.Z.w(this.TAG,"Found another onMetaData tag!"),this._metadata=n;var r=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},r)),"boolean"==typeof r.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=r.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof r.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=r.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof r.audiodatarate&&(this._mediaInfo.audioDataRate=r.audiodatarate),"number"==typeof r.videodatarate&&(this._mediaInfo.videoDataRate=r.videodatarate),"number"==typeof r.width&&(this._mediaInfo.width=r.width),"number"==typeof r.height&&(this._mediaInfo.height=r.height),"number"==typeof r.duration){if(!this._durationOverrided){var o=Math.floor(r.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if("number"==typeof r.framerate){var a=Math.floor(1e3*r.framerate);if(a>0){var h=a/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=h,this._referenceFrameRate.fps_num=a,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=h}}if("object"==typeof r.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var u=r.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(u),r.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=r,s.Z.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(n).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},n))},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){if(i<=1)s.Z.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var r=new DataView(e,t,i).getUint8(0),o=r>>>4;if(2===o||10===o){var a=0,h=(12&r)>>>2;if(h>=0&&h<=4){a=this._flvSoundRateTable[h];var u=1&r,d=this._audioMetadata,l=this._audioTrack;if(d||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(d=this._audioMetadata={}).type="audio",d.id=l.id,d.timescale=this._timescale,d.duration=this._duration,d.audioSampleRate=a,d.channelCount=0===u?1:2),10===o){var c=this._parseAACAudioData(e,t+1,i-1);if(null==c)return;if(0===c.packetType){d.config&&s.Z.w(this.TAG,"Found another AudioSpecificConfig!");var _=c.data;d.audioSampleRate=_.samplingRate,d.channelCount=_.channelCount,d.codec=_.codec,d.originalCodec=_.originalCodec,d.config=_.config,d.refSampleDuration=1024/d.audioSampleRate*d.timescale,s.Z.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",d),(m=this._mediaInfo).audioCodec=d.originalCodec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}else if(1===c.packetType){var f=this._timestampBase+n,p={unit:c.data,length:c.data.byteLength,dts:f,pts:f};l.samples.push(p),l.length+=c.data.length}else s.Z.e(this.TAG,"Flv: Unsupported AAC data type ".concat(c.packetType))}else if(2===o){if(!d.codec){var m;if(null==(_=this._parseMP3AudioData(e,t+1,i-1,!0)))return;d.audioSampleRate=_.samplingRate,d.channelCount=_.channelCount,d.codec=_.codec,d.originalCodec=_.originalCodec,d.refSampleDuration=1152/d.audioSampleRate*d.timescale,s.Z.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",d),(m=this._mediaInfo).audioCodec=d.codec,m.audioSampleRate=d.audioSampleRate,m.audioChannelCount=d.channelCount,m.audioDataRate=_.bitRate,m.hasVideo?null!=m.videoCodec&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}var v=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==v)return;f=this._timestampBase+n;var y={unit:v,length:v.byteLength,dts:f,pts:f};l.samples.push(y),l.length+=v.length}}else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+h)}else this._onError(g.Z.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+o)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var n={},r=new Uint8Array(e,t,i);return n.packetType=r[0],0===r[0]?n.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):n.data=r.subarray(1),n}s.Z.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var n,r,s=new Uint8Array(e,t,i),o=null,a=0,h=null;if(a=n=s[0]>>>3,(r=(7&s[0])<<1|s[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(g.Z.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var u=this._mpegSamplingRates[r],d=(120&s[1])>>>3;if(!(d<0||d>=8)){5===a&&(h=(7&s[1])<<1|s[2]>>>7,(124&s[2])>>>2);var l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?r>=6?(a=5,o=new Array(4),h=r-3):(a=2,o=new Array(2),h=r):-1!==l.indexOf("android")?(a=2,o=new Array(2),h=r):(a=5,h=r,o=new Array(4),r>=6?h=r-3:1===d&&(a=2,o=new Array(2),h=r)),o[0]=a<<3,o[0]|=(15&r)>>>1,o[1]=(15&r)<<7,o[1]|=(15&d)<<3,5===a&&(o[1]|=(15&h)>>>1,o[2]=(1&h)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:u,channelCount:d,codec:"mp4a.40."+a,originalCodec:"mp4a.40."+n}}this._onError(g.Z.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,n){if(!(i<4)){this._littleEndian;var r=new Uint8Array(e,t,i),o=null;if(n){if(255!==r[0])return;var a=r[1]>>>3&3,h=(6&r[1])>>1,u=(240&r[2])>>>4,d=(12&r[2])>>>2,l=3!==(r[3]>>>6&3)?2:1,c=0,_=0;switch(a){case 0:c=this._mpegAudioV25SampleRateTable[d];break;case 2:c=this._mpegAudioV20SampleRateTable[d];break;case 3:c=this._mpegAudioV10SampleRateTable[d]}switch(h){case 1:34,u<this._mpegAudioL3BitRateTable.length&&(_=this._mpegAudioL3BitRateTable[u]);break;case 2:33,u<this._mpegAudioL2BitRateTable.length&&(_=this._mpegAudioL2BitRateTable[u]);break;case 3:32,u<this._mpegAudioL1BitRateTable.length&&(_=this._mpegAudioL1BitRateTable[u])}o={bitRate:_,samplingRate:c,channelCount:l,codec:"mp3",originalCodec:"mp3"}}else o=r;return o}s.Z.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,n,r){if(i<=1)s.Z.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,i)[0],a=(240&o)>>>4,h=15&o;if(7===h)this._parseAVCVideoPacket(e,t+1,i-1,n,r,a);else{if(12!==h)return void this._onError(g.Z.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(h));this._parseHVCVideoPacket(e,t+1,i-1,n,r,a)}}},e.prototype._parseAVCVideoPacket=function(e,t,i,n,r,o){if(i<4)s.Z.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var a=this._littleEndian,h=new DataView(e,t,i),u=h.getUint8(0),d=(16777215&h.getUint32(0,!a))<<8>>8;if(0===u)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===u)this._parseAVCVideoData(e,t+4,i-4,n,r,o,d);else if(2!==u)return void this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(u))}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)s.Z.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,r=this._videoTrack,o=this._littleEndian,a=new DataView(e,t,i);n?void 0!==n.avcc&&s.Z.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=r.id,n.timescale=this._timescale,n.duration=this._duration);var h=a.getUint8(0),u=a.getUint8(1);a.getUint8(2),a.getUint8(3);if(1===h&&0!==u)if(this._naluLengthSize=1+(3&a.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var d=31&a.getUint8(5);if(0!==d){d>1&&s.Z.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(d));for(var l=6,c=0;c<d;c++){var _=a.getUint16(l,!o);if(l+=2,0!==_){var f=new Uint8Array(e,t+l,_);l+=_;var m=p.parseSPS(f);if(0===c){n.codecWidth=m.codec_size.width,n.codecHeight=m.codec_size.height,n.presentWidth=m.present_size.width,n.presentHeight=m.present_size.height,n.profile=m.profile_string,n.level=m.level_string,n.bitDepth=m.bit_depth,n.chromaFormat=m.chroma_format,n.sarRatio=m.sar_ratio,n.frameRate=m.frame_rate,!1!==m.frame_rate.fixed&&0!==m.frame_rate.fps_num&&0!==m.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var v=n.frameRate.fps_den,y=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(v/y);for(var E=f.subarray(1,4),b="avc1.",S=0;S<3;S++){var R=E[S].toString(16);R.length<2&&(R="0"+R),b+=R}n.codec=b;var A=this._mediaInfo;A.width=n.codecWidth,A.height=n.codecHeight,A.fps=n.frameRate.fps,A.profile=n.profile,A.level=n.level,A.refFrames=m.ref_frames,A.chromaFormat=m.chroma_format_string,A.sarNum=n.sarRatio.width,A.sarDen=n.sarRatio.height,A.videoCodec=b,A.hasAudio?null!=A.audioCodec&&(A.mimeType='video/x-flv; codecs="'+A.videoCodec+","+A.audioCodec+'"'):A.mimeType='video/x-flv; codecs="'+A.videoCodec+'"',A.isComplete()&&this._onMediaInfo(A)}}}var L=a.getUint8(l);if(0!==L){L>1&&s.Z.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(L)),l++;for(c=0;c<L;c++){_=a.getUint16(l,!o);l+=2,0!==_&&(l+=_)}n.avcc=new Uint8Array(i),n.avcc.set(new Uint8Array(e,t,i),0),s.Z.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(g.Z.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,n,r,o,a){for(var h=this._littleEndian,u=new DataView(e,t,i),d=[],l=0,c=0,_=this._naluLengthSize,f=this._timestampBase+n,p=1===o;c<i;){if(c+4>=i){s.Z.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(c,", dataSize = ").concat(i));break}var m=u.getUint32(c,!h);if(3===_&&(m>>>=8),m>i-_)return void s.Z.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var g=31&u.getUint8(c+_);5===g&&(p=!0);var v=new Uint8Array(e,t+c,_+m),y={type:g,data:v};d.push(y),l+=v.byteLength,c+=_+m}if(d.length){var E=this._videoTrack,b={units:d,length:l,isKeyframe:p,dts:f,cts:a,pts:f+a};p&&(b.fileposition=r),E.samples.push(b),E.length+=l}},e.prototype._parseHVCVideoPacket=function(e,t,i,n,r,o){if(i<4)s.Z.w(this.TAG,"Flv: Invalid HVC packet, missing HVCPacketType or/and CompositionTime");else{var a=this._littleEndian,h=new DataView(e,t,i),u=h.getUint8(0),d=(16777215&h.getUint32(0,!a))<<8>>8;if(0===u)this._parseHVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===u)this._parseHVCVideoData(e,t+4,i-4,n,r,o,d);else if(2!==u)return void this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(u))}},e.prototype._parseHVCDecoderConfigurationRecord=function(e,t,i){if(i<23)s.Z.w(this.TAG,"Flv: Invalid HVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,r=this._videoTrack,o=this._littleEndian,a=new DataView(e,t,i);n?void 0!==n.hvcc&&s.Z.w(this.TAG,"Found another HVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=r.id,n.timescale=this._timescale,n.duration=this._duration);var h=a.getUint8(0),u=31&a.getUint8(1);if(1===h&&0!==u)if(this._naluLengthSize=1+(3&a.getUint8(21)),3===this._naluLengthSize||4===this._naluLengthSize){for(var d,l,c,_=a.getUint8(22),f=23,p=[],v=0;v<_;v++){var y=63&a.getUint8(f++),E=a.getUint16(f,!o);if(f+=2,0!==E){switch(y){case 32:d+=E;break;case 33:l+=E;break;case 34:c+=E}for(var b=0;b<E;b++){var S=a.getUint16(f,!o);if(f+=2,0!==S){if(33===y){var R=new Uint8Array(e,t+f,S);p.push(R)}f+=S}}}}if(0!==d)if(d>1&&s.Z.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: VPS Count = ".concat(d)),0!==l)if(l>1&&s.Z.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: SPS Count = ".concat(l)),0!==c){c>1&&s.Z.w(this.TAG,"Flv: Strange HVCDecoderConfigurationRecord: PPS Count = ".concat(l));var A=p[0],L=m.parseSPS(A);n.codecWidth=L.codec_size.width,n.codecHeight=L.codec_size.height,n.presentWidth=L.present_size.width,n.presentHeight=L.present_size.height,n.profile=L.profile_string,n.level=L.level_string,n.profile_idc=L.profile_idc,n.level_idc=L.level_idc,n.bitDepth=L.bit_depth,n.chromaFormat=L.chroma_format,n.sarRatio=L.sar_ratio,n.frameRate=L.frame_rate,!1!==L.frame_rate.fixed&&0!==L.frame_rate.fps_num&&0!==L.frame_rate.fps_den||(n.frameRate=this._referenceFrameRate);var w=n.frameRate.fps_den,O=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(w/O);var T="hvc1."+n.profile_idc+".1.L"+n.level_idc+".B0";n.codec=T;var C=this._mediaInfo;C.width=n.codecWidth,C.height=n.codecHeight,C.fps=n.frameRate.fps,C.profile=n.profile,C.level=n.level,C.refFrames=L.ref_frames,C.chromaFormat=L.chroma_format_string,C.sarNum=n.sarRatio.width,C.sarDen=n.sarRatio.height,C.videoCodec=T,C.hasAudio?null!=C.audioCodec&&(C.mimeType='video/x-flv; codecs="'+C.videoCodec+","+C.audioCodec+'"'):C.mimeType='video/x-flv; codecs="'+C.videoCodec+'"',C.isComplete()&&this._onMediaInfo(C),n.hvcc=new Uint8Array(i),n.hvcc.set(new Uint8Array(e,t,i),0),s.Z.v(this.TAG,"Parsed HVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No PPS");else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No SPS");else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord: No VPS")}else this._onError(g.Z.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else this._onError(g.Z.FORMAT_ERROR,"Flv: Invalid HVCDecoderConfigurationRecord")}},e.prototype._parseHVCVideoData=function(e,t,i,n,r,o,a){for(var h=this._littleEndian,u=new DataView(e,t,i),d=[],l=0,c=0,_=this._naluLengthSize,f=this._timestampBase+n,p=1===o;c<i;){if(c+4>=i){s.Z.w(this.TAG,"Malformed Nalu near timestamp ".concat(f,", offset = ").concat(c,", dataSize = ").concat(i));break}var m=u.getUint32(c,!h);if(3===_&&(m>>>=8),m>i-_)return void s.Z.w(this.TAG,"Malformed Nalus near timestamp ".concat(f,", NaluSize > DataSize!"));var g=u.getUint8(c+_)>>1&63;g>=16&&g<=23&&(p=!0);var v=new Uint8Array(e,t+c,_+m),y={type:g,data:v};d.push(y),l+=v.byteLength,c+=_+m}if(d.length){var E=this._videoTrack,b={units:d,length:l,isKeyframe:p,dts:f,cts:a,pts:f+a};p&&(b.fileposition=r),E.samples.push(b),E.length+=l}},e}(),y=v,E=function(){function e(){}return e.init=function(){for(var t in e.types={hvc1:[],hvcC:[],avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],pasp:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,n=Array.prototype.slice.call(arguments,1),r=n.length,s=0;s<r;s++)t+=n[s].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var o=8;for(s=0;s<r;s++)i.set(n[s],o),o+=n[s].byteLength;return i},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,s=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,s>>>8&255,255&s,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=null;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=null;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)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):t.codec.indexOf("avc1")>=0?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.hvc1(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.esds=function(t){var i=t.config||[],n=i.length,r=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(i).concat([6,1,2]));return e.box(e.types.esds,r)},e.avc1=function(t){var i=t.avcc,n=t.codecWidth,r=t.codecHeight,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,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,s,e.box(e.types.avcC,i))},e.hvc1=function(t){var i=t.hvcc,n=t.codecWidth,r=t.codecHeight,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,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,s,e.box(e.types.hvcC,i))},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])),s=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),o=e.sdtp(t),a=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,s,a,o)},e.sdtp=function(t){for(var i=t.samples||[],n=i.length,r=new Uint8Array(4+n),s=0;s<n;s++){var o=i[s].flags;r[s+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,r)},e.trun=function(t,i){var n=t.samples||[],r=n.length,s=12+16*r,o=new Uint8Array(s);i+=8+s,o.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 a=0;a<r;a++){var h=n[a].duration,u=n[a].size,d=n[a].flags,l=n[a].cts;o.set([h>>>24&255,h>>>16&255,h>>>8&255,255&h,u>>>24&255,u>>>16&255,u>>>8&255,255&u,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.isNonSync,0,0,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*a)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();E.init();var b=E,S=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}(),R=i(51),A=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===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 R.J1("audio"),this._videoSegmentInfoList=new R.J1("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.Z.chrome||!(o.Z.version.major<50||50===o.Z.version.major&&o.Z.version.build<2661)),this._fillSilentAfterSeek=o.Z.msedge||o.Z.msie,this._mp3UseMpegAudio=!o.Z.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){return e.onDataAvailable=this.remux.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 l.rT("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),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=b.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=b.generateInitSegment(t)}if(!this._onInitSegment)throw new l.rT("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){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},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=e.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,n=e,r=n.samples,a=void 0,h=-1,u=this._audioMeta.refSampleDuration,d="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,l=this._dtsBaseInited&&void 0===this._audioNextDts,c=!1;if(r&&0!==r.length&&(1!==r.length||t)){var _=0,f=null,p=0;d?(_=0,p=n.length):(_=8,p=8+n.length);var m=null;if(r.length>1&&(p-=(m=r.pop()).length),null!=this._audioStashedLastSample){var g=this._audioStashedLastSample;this._audioStashedLastSample=null,r.unshift(g),p+=g.length}null!=m&&(this._audioStashedLastSample=m);var v=r[0].dts-this._dtsBase;if(this._audioNextDts)a=v-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())a=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(c=!0);else{var y=this._audioSegmentInfoList.getLastSampleBefore(v);if(null!=y){var E=v-(y.originalDts+y.duration);E<=3&&(E=0),a=v-(y.dts+y.duration+E)}else a=0}if(c){var A=v-a,L=this._videoSegmentInfoList.getLastSegmentBefore(v);if(null!=L&&L.beginDts<A){if(P=S.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var w=L.beginDts,O=A-L.beginDts;s.Z.v(this.TAG,"InsertPrefixSilentAudio: dts: ".concat(w,", duration: ").concat(O)),r.unshift({unit:P,dts:w,pts:w}),p+=P.byteLength}}else c=!1}for(var T=[],C=0;C<r.length;C++){var k=(g=r[C]).unit,D=g.dts-this._dtsBase,B=(w=D,!1),I=null,M=0;if(!(D<-.001)){if("mp3"!==this._audioMeta.codec){var U=D;if(this._audioNextDts&&(U=this._audioNextDts),(a=D-U)<=-3*u){s.Z.w(this.TAG,"Dropping 1 audio frame (originalDts: ".concat(D," ms ,curRefDts: ").concat(U," ms) due to dtsCorrection: ").concat(a," ms overlap."));continue}if(a>=3*u&&this._fillAudioTimestampGap&&!o.Z.safari){B=!0;var P,x=Math.floor(a/u);s.Z.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(D," ms, curRefDts: ").concat(U," ms, ")+"dtsCorrection: ".concat(Math.round(a)," ms, generate: ").concat(x," frames")),w=Math.floor(U),M=Math.floor(U+u)-w,null==(P=S.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(s.Z.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),P=k),I=[];for(var N=0;N<x;N++){U+=u;var G=Math.floor(U),Z=Math.floor(U+u)-G,F={dts:G,pts:G,cts:0,unit:P,size:P.byteLength,duration:Z,originalDts:D,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};I.push(F),p+=F.size}this._audioNextDts=U+u}else w=Math.floor(U),M=Math.floor(U+u)-w,this._audioNextDts=U+u}else{if(w=D-a,C!==r.length-1)M=r[C+1].dts-this._dtsBase-a-w;else if(null!=m)M=m.dts-this._dtsBase-a-w;else M=T.length>=1?T[T.length-1].duration:Math.floor(u);this._audioNextDts=w+M}-1===h&&(h=w),T.push({dts:w,pts:w,cts:0,unit:g.unit,size:g.unit.byteLength,duration:M,originalDts:D,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),B&&T.push.apply(T,I)}}if(0===T.length)return n.samples=[],void(n.length=0);d?f=new Uint8Array(p):((f=new Uint8Array(p))[0]=p>>>24&255,f[1]=p>>>16&255,f[2]=p>>>8&255,f[3]=255&p,f.set(b.types.mdat,4));for(C=0;C<T.length;C++){k=T[C].unit;f.set(k,_),_+=k.byteLength}var j=T[T.length-1];i=j.dts+j.duration;var V=new R.Yy;V.beginDts=h,V.endDts=i,V.beginPts=h,V.endPts=i,V.originalBeginDts=T[0].originalDts,V.originalEndDts=j.originalDts+j.duration,V.firstSample=new R.Wk(T[0].dts,T[0].pts,T[0].duration,T[0].originalDts,!1),V.lastSample=new R.Wk(j.dts,j.pts,j.duration,j.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(V),n.samples=T,n.sequenceNumber++;var z=null;z=d?new Uint8Array:b.moof(n,h),n.samples=[],n.length=0;var H={type:"audio",data:this._mergeBoxes(z,f).buffer,sampleCount:T.length,info:V};d&&l&&(H.timestampOffset=h),this._onMediaSegment("audio",H)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,n,r=e,s=r.samples,o=void 0,a=-1,h=-1;if(s&&0!==s.length&&(1!==s.length||t)){var u=8,d=null,l=8+e.length,c=null;if(s.length>1&&(l-=(c=s.pop()).length),null!=this._videoStashedLastSample){var _=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(_),l+=_.length}null!=c&&(this._videoStashedLastSample=c);var f=s[0].dts-this._dtsBase;if(this._videoNextDts)o=f-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var p=this._videoSegmentInfoList.getLastSampleBefore(f);if(null!=p){var m=f-(p.originalDts+p.duration);m<=3&&(m=0),o=f-(p.dts+p.duration+m)}else o=0}for(var g=new R.Yy,v=[],y=0;y<s.length;y++){var E=(_=s[y]).dts-this._dtsBase,S=_.isKeyframe,A=E-o,L=_.cts,w=A+L;-1===a&&(a=A,h=w);var O=0;if(y!==s.length-1)O=s[y+1].dts-this._dtsBase-o-A;else if(null!=c)O=c.dts-this._dtsBase-o-A;else O=v.length>=1?v[v.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(S){var T=new R.Wk(A,w,O,_.dts,!0);T.fileposition=_.fileposition,g.appendSyncPoint(T)}v.push({dts:A,pts:w,cts:L,units:_.units,size:_.length,isKeyframe:S,duration:O,originalDts:E,flags:{isLeading:0,dependsOn:S?2:1,isDependedOn:S?1:0,hasRedundancy:0,isNonSync:S?0:1}})}(d=new Uint8Array(l))[0]=l>>>24&255,d[1]=l>>>16&255,d[2]=l>>>8&255,d[3]=255&l,d.set(b.types.mdat,4);for(y=0;y<v.length;y++)for(var C=v[y].units;C.length;){var k=C.shift().data;d.set(k,u),u+=k.byteLength}var D=v[v.length-1];if(i=D.dts+D.duration,n=D.pts+D.duration,this._videoNextDts=i,g.beginDts=a,g.endDts=i,g.beginPts=h,g.endPts=n,g.originalBeginDts=v[0].originalDts,g.originalEndDts=D.originalDts+D.duration,g.firstSample=new R.Wk(v[0].dts,v[0].pts,v[0].duration,v[0].originalDts,v[0].isKeyframe),g.lastSample=new R.Wk(D.dts,D.pts,D.duration,D.originalDts,D.isKeyframe),this._isLive||this._videoSegmentInfoList.append(g),r.samples=v,r.sequenceNumber++,this._forceFirstIDR){var B=v[0].flags;B.dependsOn=2,B.isNonSync=0}var I=b.moof(r,a);r.samples=[],r.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(I,d).buffer,sampleCount:v.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}(),L=i(34),w=i(257),O=(i(939),function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new(r()),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 i=0;this._mediaDataSource.segments.forEach((function(n){n.timestampBase=i,i+=n.duration,n.cors=e.cors,n.withCredentials=e.withCredentials,t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),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(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.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){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],n=this._ioctl=new L.Z(i,this._config,e);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.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(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var n=i.getNearestKeyframe(e);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var r=this._mediaInfo.segments[t];if(null==r)this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t);else{n=r.getNearestKeyframe(e);this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,n.fileposition),this._pendingResolveSeekPoint=n.milliseconds,this._reportSegmentMediaInfo(t)}}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,n=0;n<t.length;n++)if(e<t[n].timestampBase){i=n-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,n=null,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else if((n=y.probe(e)).match){this._demuxer=new y(n,this._config),this._remuxer||(this._remuxer=new A(this._config));var o=this._mediaDataSource;null==o.duration||isNaN(o.duration)||(this._demuxer.overridedDuration=o.duration),"boolean"==typeof o.hasAudio&&(this._demuxer.overridedHasAudio=o.hasAudio),"boolean"==typeof o.hasVideo&&(this._demuxer.overridedHasVideo=o.hasVideo),this._demuxer.timestampBase=o.segments[this._currentSegmentIndex].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),r=this._demuxer.parseChunks(e,t)}else n=null,s.Z.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then((function(){i._internalAbort()})),this._emitter.emit(w.Z.DEMUX_ERROR,g.Z.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),r=0;return r},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,a.Z.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,a.Z.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(w.Z.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(w.Z.SCRIPTDATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer.flushStashedSamples(),this._emitter.emit(w.Z.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(w.Z.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){s.Z.e(this.TAG,"IOException: type = ".concat(e,", code = ").concat(t.code,", msg = ").concat(t.msg)),this._emitter.emit(w.Z.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){s.Z.e(this.TAG,"DemuxException: type = ".concat(e,", info = ").concat(t)),this._emitter.emit(w.Z.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(w.Z.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(w.Z.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.Z.safari&&i.length>0&&i[0].originalDts===n&&(n=i[0].pts),this._emitter.emit(w.Z.RECOMMEND_SEEKPOINT,n)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(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=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(w.Z.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(w.Z.STATISTICS_INFO,e)},e}())},257:function(e,t){"use strict";t.Z={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",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"}},82:function(e,t,i){"use strict";i(300),i(846),i(219),i(18),i(257)},600:function(e,t){"use strict";t.Z={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},60:function(e,t,i){"use strict";i.d(t,{default:function(){return B}});var n=i(219),r=i(34),s={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,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};function o(){return Object.assign({},s)}var a=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportMSEH265Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"')},e.supportNetworkStreamIO=function(){var e=new r.Z({},o()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new r.Z({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,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}(),h=a,u=i(939),d=i(716),l=i.n(d),c=i(300),_=i(538),f={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"},p=i(397),m=i.n(p),g=i(846),v=i(18),y=i(257),E=(i(82),i(118)),b=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new(l()),t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=m()(82),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)},g.Z.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:g.Z.getConfig()})}catch(i){c.Z.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new v.Z(e,t)}else this._controller=new v.Z(e,t);if(this._controller){var i=this._controller;i.on(y.Z.IO_ERROR,this._onIOError.bind(this)),i.on(y.Z.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(y.Z.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(y.Z.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(y.Z.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(y.Z.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(y.Z.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(y.Z.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(y.Z.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(y.Z.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(y.Z.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),g.Z.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.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(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},e.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},e.prototype.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},e.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},e.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},e.prototype._onInitSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(y.Z.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(y.Z.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(y.Z.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(y.Z.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.Z.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.Z.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.Z.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.Z.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(y.Z.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(y.Z.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.Z.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=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case y.Z.INIT_SEGMENT:case y.Z.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case y.Z.LOADING_COMPLETE:case y.Z.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case y.Z.MEDIA_INFO:Object.setPrototypeOf(i,E.Z.prototype),this._emitter.emit(t.msg,i);break;case y.Z.METADATA_ARRIVED:case y.Z.SCRIPTDATA_ARRIVED:case y.Z.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case y.Z.IO_ERROR:case y.Z.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case y.Z.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":c.Z.emitter.emit("log",i.type,i.logcat)}},e}(),S={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",VIDEO_TYPE:"video_type",BUFFER_FULL:"buffer_full"},R=i(51),A=i(29),L=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new(l()),this._config.isLive&&null==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 R.Vn}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 A.rT("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){c.Z.e(this.TAG,e.message)}n.removeEventListener("error",this.e.onSourceBufferError),n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){c.Z.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=this;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 s=!1;if(c.Z.v(this.TAG,"Received Initialization Segment, mimeType: "+r),r.includes("video/mp4;")&&setTimeout((function(){return i._emitter.emit(S.VIDEO_TYPE,r)}),500),this._lastInitSegments[n.type]=n,r!==this._mimeTypes[n.type]){if(this._mimeTypes[n.type])c.Z.v(this.TAG,"Notice: ".concat(n.type," mimeType changed, origin: ").concat(this._mimeTypes[n.type],", target: ").concat(r));else{s=!0;try{var o=this._sourceBuffers[n.type]=this._mediaSource.addSourceBuffer(r);o.addEventListener("error",this.e.onSourceBufferError),o.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return c.Z.e(this.TAG,e.message),void this._emitter.emit(S.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[n.type]=r}t||this._pendingSegments[n.type].push(n),s||this._sourceBuffers[n.type]&&!this._sourceBuffers[n.type].updating&&this._doAppendSegments(),_.Z.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){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(e){c.Z.e(this.TAG,e.message)}this._idrList.clear();var n=this._pendingSegments[t];if(n.splice(0,n.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<i.buffered.length;r++){var s=i.buffered.start(r),o=i.buffered.end(r);this._pendingRemoveRanges[t].push({start:s,end:o})}if(i.updating||this._doRemoveRanges(),_.Z.safari){var a=this._lastInitSegments[t];a&&(this._pendingSegments[t].push(a),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var n=i.buffered;if(n.length>=1&&e-n.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var n=i.buffered,r=!1,s=0;s<n.length;s++){var o=n.start(s),a=n.end(s);if(o<=e&&e<a+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){r=!0;var h=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:h})}}else a<e&&(r=!0,this._pendingRemoveRanges[t].push({start:o,end:a}))}r&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(c.Z.v(this.TAG,"Update MediaSource duration from ".concat(t," to ").concat(i)),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var n=i.shift();t.remove(n.start,n.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var n=this._sourceBuffers[t].timestampOffset,r=i.timestampOffset/1e3;Math.abs(n-r)>.1&&(c.Z.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(n," to ").concat(r)),this._sourceBuffers[t].timestampOffset=r),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(e){this._pendingSegments[t].unshift(i),22===e.code?(this._isBufferFull||this._emitter.emit(S.BUFFER_FULL),this._isBufferFull=!0):(c.Z.e(this.TAG,t,e.message),this._emitter.emit(S.ERROR,{code:e.code,msg:e.message}))}}},e.prototype._onSourceOpen=function(){if(c.Z.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(S.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){c.Z.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){c.Z.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&&e.video.length)>0||e.audio&&e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return(e.video&&e.video.length)>0||e.audio&&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(S.UPDATE_END)},e.prototype._onSourceBufferError=function(e){c.Z.e(this.TAG,"SourceBuffer Error: ".concat(e))},e}(),w=i(600),O={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},T={NETWORK_EXCEPTION:u.nm.EXCEPTION,NETWORK_STATUS_CODE_INVALID:u.nm.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:u.nm.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:u.nm.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:w.Z.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:w.Z.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:w.Z.CODEC_UNSUPPORTED},C=function(){function e(e,t){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(l()),this._config=o(),"object"==typeof t&&Object.assign(this._config,t),"flv"!==e.type.toLowerCase())throw new A.OC("FlvPlayer requires an flv MediaDataSource input!");!0===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 i=_.Z.chrome&&(_.Z.version.major<50||50===_.Z.version.major&&_.Z.version.build<2661);this._alwaysSeekKeyframe=!!(i||_.Z.msedge||_.Z.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){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===f.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(f.MEDIA_INFO,i.mediaInfo)})):e===f.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(f.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=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 L(this._config),this._msectl.on(S.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(S.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(S.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(S.ERROR,(function(e){t._emitter.emit(f.ERROR,O.MEDIA_ERROR,T.MEDIA_MSE_ERROR,e)})),this._msectl.on(S.VIDEO_TYPE,(function(e){t._emitter.emit(S.VIDEO_TYPE,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._msectl.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 A.rT("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new A.rT("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new b(this._mediaDataSource,this._config),this._transmuxer.on(y.Z.INIT_SEGMENT,(function(t,i){e._msectl.appendInitSegment(i)})),this._transmuxer.on(y.Z.MEDIA_SEGMENT,(function(t,i){if(e._msectl.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var n=e._mediaElement.currentTime;i.info.endDts>=1e3*(n+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(c.Z.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(y.Z.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(f.LOADING_COMPLETE)})),this._transmuxer.on(y.Z.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(f.RECOVERED_EARLY_EOF)})),this._transmuxer.on(y.Z.IO_ERROR,(function(t,i){e._emitter.emit(f.ERROR,O.NETWORK_ERROR,t,i)})),this._transmuxer.on(y.Z.DEMUX_ERROR,(function(t,i){e._emitter.emit(f.ERROR,O.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(y.Z.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(f.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(y.Z.METADATA_ARRIVED,(function(t){e._emitter.emit(f.METADATA_ARRIVED,t)})),this._transmuxer.on(y.Z.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(f.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(y.Z.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(f.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(y.Z.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))},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(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this._mediaElement.playbackRate},set:function(e){this._mediaElement.playbackRate=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 null!=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(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,i=0,n=0;n<e.length;n++){var r=e.start(n),s=e.end(n);if(r<=t&&t<s){r,i=s;break}}i>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(c.Z.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){c.Z.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=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,n=0;n<t.length;n++){var r=t.start(n),s=t.end(n);if(e>=r&&e<s){e>=s-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(c.Z.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var n=t.start(i),r=t.end(i);if(e>=n&&e<r)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),i=!1,n=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||_.Z.safari)&&(i=!0,n=_.Z.safari?.1:r)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=n;else if(t){if(this._alwaysSeekKeyframe){var s=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=s?s.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}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)&&(c.Z.w(this.TAG,"Playback seems stuck at ".concat(t.currentTime,", seek to ").concat(i.start(0))),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var n=i.start(0);if(n<1&&t<n||_.Z.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=_.Z.safari?.1:n)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var r=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=r&&(this._requestSetTime=!0,this._mediaElement.currentTime=r.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}(),k=function(){function e(e,t){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(l()),this._config=o(),"object"==typeof t&&Object.assign(this._config,t),"flv"===e.type.toLowerCase())throw new A.OC("NativePlayer does't support flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new A.OC("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(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===f.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(f.MEDIA_INFO,i.mediaInfo)})):e===f.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(f.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(){if(!this._mediaElement)throw new A.rT("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.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(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this._mediaElement.playbackRate},set:function(e){this._mediaElement.playbackRate=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 null!=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.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(f.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(f.STATISTICS_INFO,this.statisticsInfo)},e}();n.Z.install();var D={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new A.OC("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new A.OC("MediaDataSource must has type field to indicate video file type!");return"flv"===i.type?new C(i,t):new k(i,t)},isSupported:function(){return h.supportMSEH264Playback()},getFeatureList:function(){return h.getFeatureList()}};D.BaseLoader=u.fp,D.LoaderStatus=u.GM,D.LoaderErrors=u.nm,D.Events=f,D.ErrorTypes=O,D.ErrorDetails=T,D.FlvPlayer=C,D.NativePlayer=k,D.LoggingControl=g.Z,Object.defineProperty(D,"version",{enumerable:!0,get:function(){return"1.7.2"}}),window.flv265=D;var B=D},324:function(e,t,i){e.exports=i(60).default},34:function(e,t,i){"use strict";i.d(t,{Z:function(){return E}});var n,r=i(300),s=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.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}(),o=i(939),a=i(538),h=i(29),u=(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)}),d=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._contentLength=null,n._receivedLength=0,n}return u(t,e),t.isSupported=function(){try{var e=a.Z.msedge&&a.Z.version.minor>=15048,t=!a.Z.msedge||e;return self.fetch&&self.ReadableStream&&t}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&&null!=e.redirectedURL&&(n=e.redirectedURL);var r=this._seekHandler.getConfig(n,t),s=new self.Headers;if("object"==typeof r.headers){var a=r.headers;for(var u in a)a.hasOwnProperty(u)&&s.append(u,a[u])}var d={method:"GET",headers:s,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var u in this._config.headers)s.append(u,this._config.headers[u]);!1===e.cors&&(d.mode="same-origin"),e.withCredentials&&(d.credentials="include"),e.referrerPolicy&&(d.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,d.signal=this._abortController.signal),this._status=o.GM.kConnecting,self.fetch(r.url,d).then((function(e){if(i._requestAbort)return i._status=o.GM.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==r.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var n=e.headers.get("Content-Length");return null!=n&&(i._contentLength=parseInt(n),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=o.GM.kError,!i._onError)throw new h.OZ("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=o.GM.kError,!i._onError)throw e;i._onError(o.nm.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.GM.kBuffering||!a.Z.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.GM.kError;var n=o.nm.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new h.OZ(r.msg);t._onError(n,r)}else t._status=o.GM.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.GM.kComplete);if(!0===t._requestAbort)return t._status=o.GM.kComplete,e.cancel();t._status=o.GM.kBuffering;var s=i.value.buffer,a=t._range.from+t._receivedLength;t._receivedLength+=s.byteLength,t._onDataArrival&&t._onDataArrival(s,a,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.GM.kComplete;else if(11!==e.code||!a.Z.msedge){t._status=o.GM.kError;var i=0,n=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=o.nm.EXCEPTION,n={code:e.code,msg:e.message}):(i=o.nm.EARLY_EOF,n={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new h.OZ(n.msg);t._onError(i,n)}}))},t}(o.fp),l=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)}}(),c=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 l(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 r.Z.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&&null!=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 s=n.headers;for(var a in s)s.hasOwnProperty(a)&&r.setRequestHeader(a,s[a])}if("object"==typeof this._config.headers){s=this._config.headers;for(var a in s)s.hasOwnProperty(a)&&r.setRequestHeader(a,s[a])}this._status=o.GM.kConnecting,r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.GM.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=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=o.GM.kError,!this._onError)throw new h.OZ("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.GM.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.GM.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.GM.kError&&(this._status=o.GM.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=o.GM.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.nm.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.nm.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.OZ(i.msg);this._onError(t,i)},t}(o.fp),_=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)}}(),f=(function(e){function t(t,i){var n=e.call(this,"xhr-msstream-loader")||this;return n.TAG="MSStreamLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._xhr=null,n._reader=null,n._totalRange=null,n._currentRange=null,n._currentRequestURL=null,n._currentRedirectedURL=null,n._contentLength=null,n._receivedLength=0,n._bufferLimit=16777216,n._lastTimeBufferSize=0,n._isReconnecting=!1,n}_(t,e),t.isSupported=function(){try{if(void 0===self.MSStream||void 0===self.MSStreamReader)return!1;var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="ms-stream","ms-stream"===e.responseType}catch(e){return r.Z.w("MSStreamLoader",e.message),!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._internalOpen(e,t,!1)},t.prototype._internalOpen=function(e,t,i){this._dataSource=e,i?this._currentRange=t:this._totalRange=t;var n=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?n=this._currentRedirectedURL:null!=e.redirectedURL&&(n=e.redirectedURL));var r=this._seekHandler.getConfig(n,t);this._currentRequestURL=r.url;var s=this._reader=new self.MSStreamReader;s.onprogress=this._msrOnProgress.bind(this),s.onload=this._msrOnLoad.bind(this),s.onerror=this._msrOnError.bind(this);var a=this._xhr=new XMLHttpRequest;if(a.open("GET",r.url,!0),a.responseType="ms-stream",a.onreadystatechange=this._xhrOnReadyStateChange.bind(this),a.onerror=this._xhrOnError.bind(this),e.withCredentials&&(a.withCredentials=!0),"object"==typeof r.headers){var h=r.headers;for(var u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u])}if("object"==typeof this._config.headers){h=this._config.headers;for(var u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u])}this._isReconnecting?this._isReconnecting=!1:this._status=o.GM.kConnecting,a.send()},t.prototype.abort=function(){this._internalAbort(),this._status=o.GM.kComplete},t.prototype._internalAbort=function(){this._reader&&(1===this._reader.readyState&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)},t.prototype._xhrOnReadyStateChange=function(e){var t=e.target;if(2===t.readyState)if(t.status>=200&&t.status<=299){if(this._status=o.GM.kBuffering,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))}var n=t.getResponseHeader("Content-Length");if(null!=n&&null==this._contentLength){var r=parseInt(n);r>0&&(this._contentLength=r,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else{if(this._status=o.GM.kError,!this._onError)throw new h.OZ("MSStreamLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else if(3===t.readyState&&t.status>=200&&t.status<=299){this._status=o.GM.kBuffering;var s=t.response;this._reader.readAsArrayBuffer(s)}},t.prototype._xhrOnError=function(e){this._status=o.GM.kError;var t=o.nm.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type};if(!this._onError)throw new h.OZ(i.msg);this._onError(t,i)},t.prototype._msrOnProgress=function(e){var t=e.target.result;if(null!=t){var i=t.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=t.byteLength;var n=this._totalRange.from+this._receivedLength;this._receivedLength+=i.byteLength,this._onDataArrival&&this._onDataArrival(i,n,this._receivedLength),t.byteLength>=this._bufferLimit&&(r.Z.v(this.TAG,"MSStream buffer exceeded max size near ".concat(n+i.byteLength,", reconnecting...")),this._doReconnectIfNeeded())}else this._doReconnectIfNeeded()},t.prototype._doReconnectIfNeeded=function(){if(null==this._contentLength||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();var e={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,e,!0)}},t.prototype._msrOnLoad=function(e){this._status=o.GM.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)},t.prototype._msrOnError=function(e){this._status=o.GM.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength<this._contentLength?(t=o.nm.EARLY_EOF,i={code:-1,msg:"MSStream meet Early-Eof"}):(t=o.nm.EARLY_EOF,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.OZ(i.msg);this._onError(t,i)}}(o.fp),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)}}()),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 s,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 f(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 r.Z.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=o.GM.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=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},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 s=n.headers;for(var o in s)s.hasOwnProperty(o)&&r.setRequestHeader(o,s[o])}if("object"==typeof this._config.headers){s=this._config.headers;for(var o in s)s.hasOwnProperty(o)&&r.setRequestHeader(o,s[o])}r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.GM.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=o.GM.kBuffering}else{if(this._status=o.GM.kError,!this._onError)throw new h.OZ("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.nm.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==o.GM.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-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,s=i;if(e<t[0])return t[0];for(;r<=s;){if((n=r+Math.floor((s-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:s=n-1}},t.prototype._onLoad=function(e){if(this._status!==o.GM.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 s=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():s=!0,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),s&&(this._status=o.GM.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=o.GM.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.nm.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.nm.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new h.OZ(i.msg);this._onError(t,i)},t}(o.fp),m=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)}}(),g=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return m(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=o.GM.kConnecting}catch(e){this._status=o.GM.kError;var i={code:e.code,msg:e.message};if(!this._onError)throw new h.OZ(i.msg);this._onError(o.nm.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=o.GM.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=o.GM.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.GM.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!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(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=o.GM.kError;var n={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new h.OZ(n.msg);this._onError(o.nm.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=o.GM.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new h.OZ(t.msg);this._onError(o.nm.EXCEPTION,t)},t}(o.fp),v=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=void 0;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}(),y=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;-1===i.indexOf("?")&&(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=e.split("?")[0],i=void 0,n=e.indexOf("?");-1!==n&&(i=e.substring(n+1));var r="";if(null!=i&&i.length>0)for(var s=i.split("&"),o=0;o<s.length;o++){var a=s[o].split("="),h=o>0;a[0]!==this._startName&&a[0]!==this._endName&&(h&&(r+="&"),r+=s[o])}return 0===r.length?t:t+"?"+r},e}(),E=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=393216,null!=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,!1===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 s,this._speedNormalizeList=[64,128,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(){this._loader.isWorking()&&this._loader.abort(),this._loader.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(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.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(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===p?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new v(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new y(t,i)}else{if("custom"!==e.seekType)throw new h.OC("Invalid seekType in config: ".concat(e.seekType));if("function"!=typeof e.customSeekHandler)throw new h.OC("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=g;else if(d.isSupported())this._loaderClass=d;else if(c.isSupported())this._loaderClass=c;else{if(!p.isSupported())throw new h.OZ("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=p}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),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){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+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){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new h.OC("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,s=i;if(e<t[0])return t[0];for(;r<=s;){if((n=r+Math.floor((s-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:s=n-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive||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.to=t+e.byteLength-1,this._onDataArrival(e,t)},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){if(!this._onDataArrival)throw new h.rT("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var n=this._speedSampler.lastSecondKBps;if(0!==n){var r=this._normalizeSpeed(n);this._speedNormalized!==r&&(this._speedNormalized=r,this._adjustStashSize(r))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize){(a=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{a=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){var s=this._stashBuffer.slice(0,this._stashUsed);if((u=this._dispatchChunks(s,this._stashByteStart))<s.byteLength){if(u>0){d=new Uint8Array(s,u);a.set(d,0),this._stashUsed=d.byteLength,this._stashByteStart+=u}}else this._stashUsed=0,this._stashByteStart+=u;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{if((u=this._dispatchChunks(e,t))<e.byteLength)(o=e.byteLength-u)>this._bufferSize&&(this._expandBuffer(o),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,u),0),this._stashUsed+=o,this._stashByteStart=t+u}}else if(0===this._stashUsed){var o;if((u=this._dispatchChunks(e,t))<e.byteLength)(o=e.byteLength-u)>this._bufferSize&&this._expandBuffer(o),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,u),0),this._stashUsed+=o,this._stashByteStart=t+u}else{var a,u;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(u=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&u>0){var d=new Uint8Array(this._stashBuffer,u);a.set(d,0)}this._stashUsed-=u,this._stashByteStart+=u}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),n=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var s=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,i);s.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=i}return 0}r.Z.w(this.TAG,"".concat(n," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,n}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(r.Z.e(this.TAG,"Loader error, code = ".concat(t.code,", msg = ").concat(t.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.nm.UNRECOVERABLE_EARLY_EOF),e){case o.nm.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(r.Z.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=o.nm.UNRECOVERABLE_EARLY_EOF;case o.nm.UNRECOVERABLE_EARLY_EOF:case o.nm.CONNECTING_TIMEOUT:case o.nm.HTTP_STATUS_CODE_INVALID:case o.nm.EXCEPTION:}if(!this._onError)throw new h.OZ("IOException: "+t.msg);this._onError(e,t)},e}()},939:function(e,t,i){"use strict";i.d(t,{GM:function(){return r},fp:function(){return o},nm:function(){return s}});var n=i(29),r={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},s={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},o=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.do("Unimplemented abstract function!")},e.prototype.abort=function(){throw new n.do("Unimplemented abstract function!")},e}()},538:function(e,t){"use strict";var i={};!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.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(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:n[0]||""},s={};if(r.browser){s[r.browser]=!0;var o=r.majorVersion.split(".");s.version={major:parseInt(r.majorVersion,10),string:r.version},o.length>1&&(s.version.minor=parseInt(o[1],10)),o.length>2&&(s.version.build=parseInt(o[2],10))}if(r.platform&&(s[r.platform]=!0),(s.chrome||s.opr||s.safari)&&(s.webkit=!0),s.rv||s.iemobile){s.rv&&delete s.rv;var a="msie";r.browser=a,s[a]=!0}if(s.edge){delete s.edge;var h="msedge";r.browser=h,s[h]=!0}if(s.opr){var u="opera";r.browser=u,s[u]=!0}if(s.safari&&s.android){var d="android";r.browser=d,s[d]=!0}for(var l in s.name=r.browser,s.platform=r.platform,i)i.hasOwnProperty(l)&&delete i[l];Object.assign(i,s)}(),t.Z=i},29:function(e,t,i){"use strict";i.d(t,{OC:function(){return a},OZ:function(){return s},do:function(){return h},rT:function(){return o}});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)}),s=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),o=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(s),a=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(s),h=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(s)},300:function(e,t,i){"use strict";var n=i(716),r=i.n(n),s=function(){function e(){}return e.e=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","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))},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?console.info(n):console.log(n))},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?console.warn(n):console.log(n))},e.d=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","debug",n),e.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))},e.v=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","verbose",n),e.ENABLE_VERBOSE&&console.log(n)},e}();s.GLOBAL_TAG="flv.js",s.FORCE_GLOBAL_TAG=!1,s.ENABLE_ERROR=!0,s.ENABLE_INFO=!1,s.ENABLE_WARN=!1,s.ENABLE_DEBUG=!1,s.ENABLE_VERBOSE=!1,s.ENABLE_CALLBACK=!1,s.emitter=new(r()),t.Z=s},846:function(e,t,i){"use strict";var n=i(716),r=i.n(n),s=i(300),o=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return s.Z.FORCE_GLOBAL_TAG},set:function(t){s.Z.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return s.Z.GLOBAL_TAG},set:function(t){s.Z.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return s.Z.ENABLE_VERBOSE&&s.Z.ENABLE_DEBUG&&s.Z.ENABLE_INFO&&s.Z.ENABLE_WARN&&s.Z.ENABLE_ERROR},set:function(t){s.Z.ENABLE_VERBOSE=t,s.Z.ENABLE_DEBUG=t,s.Z.ENABLE_INFO=t,s.Z.ENABLE_WARN=t,s.Z.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return s.Z.ENABLE_DEBUG},set:function(t){s.Z.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return s.Z.ENABLE_VERBOSE},set:function(t){s.Z.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return s.Z.ENABLE_INFO},set:function(t){s.Z.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return s.Z.ENABLE_WARN},set:function(t){s.Z.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return s.Z.ENABLE_ERROR},set:function(t){s.Z.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:s.Z.GLOBAL_TAG,forceGlobalTag:s.Z.FORCE_GLOBAL_TAG,enableVerbose:s.Z.ENABLE_VERBOSE,enableDebug:s.Z.ENABLE_DEBUG,enableInfo:s.Z.ENABLE_INFO,enableWarn:s.Z.ENABLE_WARN,enableError:s.Z.ENABLE_ERROR,enableCallback:s.Z.ENABLE_CALLBACK}},e.applyConfig=function(e){s.Z.GLOBAL_TAG=e.globalTag,s.Z.FORCE_GLOBAL_TAG=e.forceGlobalTag,s.Z.ENABLE_VERBOSE=e.enableVerbose,s.Z.ENABLE_DEBUG=e.enableDebug,s.Z.ENABLE_INFO=e.enableInfo,s.Z.ENABLE_WARN=e.enableWarn,s.Z.ENABLE_ERROR=e.enableError,s.Z.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){s.Z.emitter.addListener("log",t),s.Z.emitter.listenerCount("log")>0&&(s.Z.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){s.Z.emitter.removeListener("log",t),0===s.Z.emitter.listenerCount("log")&&(s.Z.ENABLE_CALLBACK=!1,e._notifyChange())},e}();o.emitter=new(r()),t.Z=o},219:function(e,t,i){"use strict";var n=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t},"function"!=typeof self.Promise&&i(264).polyfill()},e}();n.install(),t.Z=n}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}return i.m=e,i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i(324)}()}));
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.flvjs=t():e.flvjs=t()}(this,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=230)}([function(e,t,r){"use strict";var i=r(8),n=r.n(i),a=function(){function e(){}return e.e=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",i),e.ENABLE_ERROR&&(console.error?console.error(i):console.warn?console.warn(i):console.log(i))},e.i=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",i),e.ENABLE_INFO&&(console.info?console.info(i):console.log(i))},e.w=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",i),e.ENABLE_WARN&&(console.warn?console.warn(i):console.log(i))},e.d=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",i),e.ENABLE_DEBUG&&(console.debug?console.debug(i):console.log(i))},e.v=function(t,r){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var i="["+t+"] > "+r;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",i),e.ENABLE_VERBOSE&&console.log(i)},e}();a.GLOBAL_TAG="flv.js",a.FORCE_GLOBAL_TAG=!1,a.ENABLE_ERROR=!0,a.ENABLE_INFO=!1,a.ENABLE_WARN=!1,a.ENABLE_DEBUG=!1,a.ENABLE_VERBOSE=!1,a.ENABLE_CALLBACK=!1,a.emitter=new n.a,t.a=a},function(e,t,r){"use strict";r.d(t,"G",(function(){return i})),r.d(t,"E",(function(){return n})),r.d(t,"F",(function(){return a})),r.d(t,"w",(function(){return o})),r.d(t,"l",(function(){return s})),r.d(t,"q",(function(){return u})),r.d(t,"y",(function(){return d})),r.d(t,"v",(function(){return h})),r.d(t,"k",(function(){return l})),r.d(t,"s",(function(){return f})),r.d(t,"t",(function(){return c})),r.d(t,"m",(function(){return p})),r.d(t,"D",(function(){return m})),r.d(t,"x",(function(){return g})),r.d(t,"A",(function(){return _})),r.d(t,"B",(function(){return y})),r.d(t,"u",(function(){return b})),r.d(t,"r",(function(){return v})),r.d(t,"o",(function(){return w})),r.d(t,"z",(function(){return E})),r.d(t,"n",(function(){return A})),r.d(t,"b",(function(){return S})),r.d(t,"a",(function(){return M})),r.d(t,"f",(function(){return T})),r.d(t,"p",(function(){return R})),r.d(t,"C",(function(){return k})),r.d(t,"i",(function(){return D})),r.d(t,"d",(function(){return x})),r.d(t,"h",(function(){return C})),r.d(t,"c",(function(){return P})),r.d(t,"j",(function(){return N})),r.d(t,"e",(function(){return L})),r.d(t,"g",(function(){return B}));var i=1,n=2,a=3,o=1,s=2,u=3,d=4,h=6,l=7,f=10,c=11,p=12,m=13,g=14,_=15,y=16,b=20,v=21,w=102,E=103,A=200,S=1,M=2,T=3,R=22,k=23,I=!0,O=!0;function D(e){I=e}function x(){return I}function C(e){e}function P(){return O}function N(e){return new Promise((function(t){return setTimeout(t,e)}))}function L(e){var t,r=new Date,i=r.getFullYear(),n=r.getMonth()+1,a=r.getDate();r.getDay();t=i+"-"+n+"-"+a+" "+r.getHours()+":"+r.getMinutes()+":"+r.getSeconds(),console.log("["+t+"]: "+e)}function B(){for(var e=window.location.href.split("/"),t="",r=0;r<3;r++)t+=e[r],t+="/";return t}},function(e,t,r){"use strict";t.a={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",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint",RECONNECT_ING:"reconnect_ing",RECONNECT_SUCCESS:"reconnect_success",IS_ENCODED_H265:"encoded_265",SOURCE_ENDED:"source_ended",UPDATE_DURATION:"update_duration",UPDATE_KBPS:"update_kbps",SOCKET_CLOSE:"socket_close",SEI_DATA:"sei_data",AUDIO_ERROR:"audio_error",ON_DBL_CLICK:"ondblclick",RECORDING:"recording"}},function(e,t,r){"use strict";r.d(t,"c",(function(){return a})),r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s}));var i=r(4);function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var a={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"},s=function(){function e(e){this._type=e||"undefined",this._status=a.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onHLSError=null,this._onError=null,this._onComplete=null}var t,r,o,s=e.prototype;return s.destroy=function(){this._status=a.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onHLSError=null,this._onComplete=null},s.isWorking=function(){return this._status===a.kConnecting||this._status===a.kBuffering},s.open=function(e,t){throw new i.c("Unimplemented abstract function!")},s.abort=function(){throw new i.c("Unimplemented abstract function!")},t=e,(r=[{key:"type",get:function(){return this._type}},{key:"status",get:function(){return this._status}},{key:"needStashBuffer",get:function(){return this._needStash}},{key:"onContentLengthKnown",get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e}},{key:"onURLRedirect",get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"onHLSError",get:function(){return this._onHLSError},set:function(e){this._onHLSError=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}}])&&n(t.prototype,r),o&&n(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}()},function(e,t,r){"use strict";function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}r.d(t,"d",(function(){return s})),r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return h}));var s=function(){function e(e){this._message=e}return e.prototype.toString=function(){return this.name+": "+this.message},o(e,[{key:"name",get:function(){return"RuntimeException"}},{key:"message",get:function(){return this._message}}]),e}(),u=function(e){function t(t){return e.call(this,t)||this}return i(t,e),o(t,[{key:"name",get:function(){return"IllegalStateException"}}]),t}(s),d=function(e){function t(t){return e.call(this,t)||this}return i(t,e),o(t,[{key:"name",get:function(){return"InvalidArgumentException"}}]),t}(s),h=function(e){function t(t){return e.call(this,t)||this}return i(t,e),o(t,[{key:"name",get:function(){return"NotImplementedException"}}]),t}(s)},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},function(e,t,r){
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
- var i=r(10),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";var i={};!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.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],r=/(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)||[],n={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:r[0]||""},a={};if(n.browser){a[n.browser]=!0;var o=n.majorVersion.split(".");a.version={major:parseInt(n.majorVersion,10),string:n.version},o.length>1&&(a.version.minor=parseInt(o[1],10)),o.length>2&&(a.version.build=parseInt(o[2],10))}if(n.platform&&(a[n.platform]=!0),(a.chrome||a.opr||a.safari)&&(a.webkit=!0),a.rv||a.iemobile){a.rv&&delete a.rv;n.browser="msie",a.msie=!0}if(a.edge){delete a.edge;n.browser="msedge",a.msedge=!0}if(a.opr){n.browser="opera",a.opera=!0}if(a.safari&&a.android){n.browser="android",a.android=!0}for(var s in a.name=n.browser,a.platform=n.platform,i)i.hasOwnProperty(s)&&delete i[s];Object.assign(i,a)}(),t.a=i},function(e,t,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,a),i(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}_(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&_(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function d(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function h(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,i){var n,a,o,s;if(d(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=h(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):g(n,n.length)}function m(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function _(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(a){i.once&&e.removeEventListener(t,n),r(a)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return h(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var d=u.length,h=g(u,d);for(r=0;r<d;++r)a(h[r],this,t)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){return d(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return d(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,a,o;if(d(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,a=Object.keys(r);for(i=0;i<a.length;++i)"removeListener"!==(n=a[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t){var r,i,n=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var u,d=[],h=!1,l=-1;function f(){h&&u&&(h=!1,u.length?d=u.concat(d):l=-1,d.length&&c())}function c(){if(!h){var e=s(f);h=!0;for(var t=d.length;t;){for(u=d,d=[];++l<t;)u&&u[l].run();l=-1,t=d.length}u=null,h=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];d.push(new p(e,t)),1!==d.length||h||s(c)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){"use strict";(function(e){
- /*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <http://feross.org>
- * @license MIT
- */
- var i=r(125),n=r(126),a=r(66);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return l(this,e)}return d(this,e,t,r)}function d(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|p(t,r),n=(e=s(e,i)).write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|c(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?s(e,0):f(e,t);if("Buffer"===t.type&&a(t.data))return f(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function l(e,t){if(h(t),e=s(e,t<0?0:0|c(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|c(t.length);e=s(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function c(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(i)return j(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return k(this,t,r);case"base64":return M(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function _(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var a,o=1,s=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,r/=2}function d(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){var h=-1;for(a=r;a<s;a++)if(d(e,a)===d(t,-1===h?0:a-h)){if(-1===h&&(h=a),a-h+1===u)return h*o}else-1!==h&&(a-=a-h),h=-1}else for(r+u>s&&(r=s-u),a=r;a>=0;a--){for(var l=!0,f=0;f<u;f++)if(d(e,a+f)!==d(t,f)){l=!1;break}if(l)return a}return-1}function b(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");i>a/2&&(i=a/2);for(var o=0;o<i;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function v(e,t,r,i){return X(j(t,e.length-r),e,r,i)}function w(e,t,r,i){return X(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function E(e,t,r,i){return w(e,t,r,i)}function A(e,t,r,i){return X(H(t),e,r,i)}function S(e,t,r,i){return X(function(e,t){for(var r,i,n,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),i=r>>8,n=r%256,a.push(n),a.push(i);return a}(t,e.length-r),e,r,i)}function M(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var a,o,s,u,d=e[n],h=null,l=d>239?4:d>223?3:d>191?2:1;if(n+l<=r)switch(l){case 1:d<128&&(h=d);break;case 2:128==(192&(a=e[n+1]))&&(u=(31&d)<<6|63&a)>127&&(h=u);break;case 3:a=e[n+1],o=e[n+2],128==(192&a)&&128==(192&o)&&(u=(15&d)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:a=e[n+1],o=e[n+2],s=e[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&d)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=l}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return r}(i)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return d(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,i){return h(t),t<=0?s(e,t):void 0!==r?"string"==typeof i?s(e,t).fill(r,i):s(e,t).fill(r):s(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return l(null,e)},u.allocUnsafeSlow=function(e){return l(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,a=Math.min(r,i);n<a;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=u.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var o=e[r];if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,n),n+=o.length}return i},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?T(this,0,e):m.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,i,n){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),d=this.slice(i,n),h=e.slice(t,r),l=0;l<s;++l)if(d[l]!==h[l]){a=d[l],o=h[l];break}return a<o?-1:o<a?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},u.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return w(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function R(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function k(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function I(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",a=t;a<r;++a)n+=U(e[a]);return n}function O(e,t,r){for(var i=e.slice(t,r),n="",a=0;a<i.length;a+=2)n+=String.fromCharCode(i[a]+256*i[a+1]);return n}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,r,i,n,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<a)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function C(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,a=Math.min(e.length-r,2);n<a;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function P(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,a=Math.min(e.length-r,4);n<a;++n)e[r+n]=t>>>8*(i?n:3-n)&255}function N(e,t,r,i,n,a){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,a){return a||N(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function B(e,t,r,i,a){return a||N(e,0,r,8),n.write(e,t,r,i,52,8),r+8}u.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var n=t-e;r=new u(n,void 0);for(var a=0;a<n;++a)r[a]=this[a+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},u.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var i=this[e],n=1,a=0;++a<t&&(n*=256);)i+=this[e+a]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var i=t,n=1,a=this[e+--i];i>0&&(n*=256);)a+=this[e+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||x(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[t]=255&e;++a<r&&(n*=256);)this[t+a]=e/n&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||x(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):C(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):C(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);x(this,e,t,r,n-1,-n)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);x(this,e,t,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):C(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):C(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,a=i-r;if(this===e&&r<t&&t<i)for(n=a-1;n>=0;--n)e[n+t]=this[n+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n<a;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},u.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=u.isBuffer(e)?e:j(new u(e,i).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e,t){var r;t=t||1/0;for(var i=e.length,n=null,a=[],o=0;o<i;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function H(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(13))},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(178).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function d(e,t,r,i){for(var n=0,a=Math.min(e.length,r),o=t;o<a;o++){var s=e.charCodeAt(o)-48;n*=i,n+=s>=49?s-49+10:s>=17?s-17+10:s}return n}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,o,s=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,o=a%i,s=Math.min(a,a-o)+r,u=0,h=r;h<s;h+=i)u=d(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var l=1;for(u=d(e,h,e.length,t),h=0;h<o;h++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function c(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var d=1;d<i;d++){for(var h=u>>>26,l=67108863&u,f=Math.min(d,t.length-1),c=Math.max(0,d-e.length+1);c<=f;c++){var p=d-c|0;h+=(o=(n=0|e.words[p])*(a=0|t.words[c])+l)/67108864|0,l=67108863&o}r.words[d]=0|l,u=0|h}return 0!==u?r.words[d]=0|u:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|a)).toString(16);r=0!==(a=s>>>24-n&16777215)||o!==this.length-1?h[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=l[e],c=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(c).toString(e);r=(p=p.idivn(c)).isZero()?m+r:h[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return i(void 0!==o),this.toArrayLike(o,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===t,d=new e(a),h=this.clone();if(u){for(s=0;!h.isZero();s++)o=h.andln(255),h.iushrn(8),d[s]=o;for(;s<a;s++)d[s]=0}else{for(s=0;s<a-n;s++)d[s]=0;for(s=0;!h.isZero();s++)o=h.andln(255),h.iushrn(8),d[a-s-1]=o}return d},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)a=(t=(0|r.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var i,n,a,o=e.words,s=t.words,u=r.words,d=0,h=0|o[0],l=8191&h,f=h>>>13,c=0|o[1],p=8191&c,m=c>>>13,g=0|o[2],_=8191&g,y=g>>>13,b=0|o[3],v=8191&b,w=b>>>13,E=0|o[4],A=8191&E,S=E>>>13,M=0|o[5],T=8191&M,R=M>>>13,k=0|o[6],I=8191&k,O=k>>>13,D=0|o[7],x=8191&D,C=D>>>13,P=0|o[8],N=8191&P,L=P>>>13,B=0|o[9],F=8191&B,U=B>>>13,j=0|s[0],H=8191&j,X=j>>>13,W=0|s[1],V=8191&W,z=W>>>13,q=0|s[2],G=8191&q,Q=q>>>13,Y=0|s[3],K=8191&Y,J=Y>>>13,Z=0|s[4],$=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],ae=8191&ne,oe=ne>>>13,se=0|s[7],ue=8191&se,de=se>>>13,he=0|s[8],le=8191&he,fe=he>>>13,ce=0|s[9],pe=8191&ce,me=ce>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(d+(i=Math.imul(l,H))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(f,H)|0))<<13)|0;d=((a=Math.imul(f,X))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,X))+Math.imul(m,H)|0,a=Math.imul(m,X);var _e=(d+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(f,V)|0))<<13)|0;d=((a=a+Math.imul(f,z)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(_,H),n=(n=Math.imul(_,X))+Math.imul(y,H)|0,a=Math.imul(y,X),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,z)|0;var ye=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(f,G)|0))<<13)|0;d=((a=a+Math.imul(f,Q)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,X))+Math.imul(w,H)|0,a=Math.imul(w,X),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,z)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,Q)|0;var be=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(f,K)|0))<<13)|0;d=((a=a+Math.imul(f,J)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,X))+Math.imul(S,H)|0,a=Math.imul(S,X),i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,z)|0)+Math.imul(w,V)|0,a=a+Math.imul(w,z)|0,i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Q)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,Q)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,J)|0;var ve=(d+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(f,$)|0))<<13)|0;d=((a=a+Math.imul(f,ee)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,X))+Math.imul(R,H)|0,a=Math.imul(R,X),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,z)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,Q)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,Q)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(y,K)|0,a=a+Math.imul(y,J)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(f,re)|0))<<13)|0;d=((a=a+Math.imul(f,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(I,H),n=(n=Math.imul(I,X))+Math.imul(O,H)|0,a=Math.imul(O,X),i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,z)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,z)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,Q)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,J)|0,i=i+Math.imul(_,$)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Ee=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,oe)|0)+Math.imul(f,ae)|0))<<13)|0;d=((a=a+Math.imul(f,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(x,H),n=(n=Math.imul(x,X))+Math.imul(C,H)|0,a=Math.imul(C,X),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(O,V)|0,a=a+Math.imul(O,z)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,Q)|0,i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(S,K)|0,a=a+Math.imul(S,J)|0,i=i+Math.imul(v,$)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(w,$)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(y,re)|0,a=a+Math.imul(y,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Ae=(d+(i=i+Math.imul(l,ue)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(f,ue)|0))<<13)|0;d=((a=a+Math.imul(f,de)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(N,H),n=(n=Math.imul(N,X))+Math.imul(L,H)|0,a=Math.imul(L,X),i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,z)|0)+Math.imul(C,V)|0,a=a+Math.imul(C,z)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,Q)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,J)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,i=i+Math.imul(v,re)|0,n=(n=n+Math.imul(v,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(y,ae)|0,a=a+Math.imul(y,oe)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ue)|0,a=a+Math.imul(m,de)|0;var Se=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,fe)|0)+Math.imul(f,le)|0))<<13)|0;d=((a=a+Math.imul(f,fe)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(F,H),n=(n=Math.imul(F,X))+Math.imul(U,H)|0,a=Math.imul(U,X),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,V)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,Q)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,Q)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,J)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(S,re)|0,a=a+Math.imul(S,ie)|0,i=i+Math.imul(v,ae)|0,n=(n=n+Math.imul(v,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(y,ue)|0,a=a+Math.imul(y,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,fe)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,fe)|0;var Me=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(f,pe)|0))<<13)|0;d=((a=a+Math.imul(f,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,z))+Math.imul(U,V)|0,a=Math.imul(U,z),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,Q)|0)+Math.imul(L,G)|0,a=a+Math.imul(L,Q)|0,i=i+Math.imul(x,K)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,J)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,ee)|0)+Math.imul(O,$)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(A,ae)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,i=i+Math.imul(v,ue)|0,n=(n=n+Math.imul(v,de)|0)+Math.imul(w,ue)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,fe)|0)+Math.imul(y,le)|0,a=a+Math.imul(y,fe)|0;var Te=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,Q))+Math.imul(U,G)|0,a=Math.imul(U,Q),i=i+Math.imul(N,K)|0,n=(n=n+Math.imul(N,J)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,J)|0,i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,ee)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(I,re)|0,n=(n=n+Math.imul(I,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,de)|0)+Math.imul(S,ue)|0,a=a+Math.imul(S,de)|0,i=i+Math.imul(v,le)|0,n=(n=n+Math.imul(v,fe)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,fe)|0;var Re=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(y,pe)|0))<<13)|0;d=((a=a+Math.imul(y,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,J))+Math.imul(U,K)|0,a=Math.imul(U,J),i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,ee)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,ee)|0,i=i+Math.imul(x,re)|0,n=(n=n+Math.imul(x,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(I,ae)|0,n=(n=n+Math.imul(I,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,i=i+Math.imul(T,ue)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(A,le)|0,n=(n=n+Math.imul(A,fe)|0)+Math.imul(S,le)|0,a=a+Math.imul(S,fe)|0;var ke=(d+(i=i+Math.imul(v,pe)|0)|0)+((8191&(n=(n=n+Math.imul(v,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(F,$),n=(n=Math.imul(F,ee))+Math.imul(U,$)|0,a=Math.imul(U,ee),i=i+Math.imul(N,re)|0,n=(n=n+Math.imul(N,ie)|0)+Math.imul(L,re)|0,a=a+Math.imul(L,ie)|0,i=i+Math.imul(x,ae)|0,n=(n=n+Math.imul(x,oe)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,oe)|0,i=i+Math.imul(I,ue)|0,n=(n=n+Math.imul(I,de)|0)+Math.imul(O,ue)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,fe)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,fe)|0;var Ie=(d+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(S,pe)|0))<<13)|0;d=((a=a+Math.imul(S,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(F,re),n=(n=Math.imul(F,ie))+Math.imul(U,re)|0,a=Math.imul(U,ie),i=i+Math.imul(N,ae)|0,n=(n=n+Math.imul(N,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,i=i+Math.imul(x,ue)|0,n=(n=n+Math.imul(x,de)|0)+Math.imul(C,ue)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(I,le)|0,n=(n=n+Math.imul(I,fe)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,fe)|0;var Oe=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(F,ae),n=(n=Math.imul(F,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),i=i+Math.imul(N,ue)|0,n=(n=n+Math.imul(N,de)|0)+Math.imul(L,ue)|0,a=a+Math.imul(L,de)|0,i=i+Math.imul(x,le)|0,n=(n=n+Math.imul(x,fe)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,fe)|0;var De=(d+(i=i+Math.imul(I,pe)|0)|0)+((8191&(n=(n=n+Math.imul(I,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(F,ue),n=(n=Math.imul(F,de))+Math.imul(U,ue)|0,a=Math.imul(U,de),i=i+Math.imul(N,le)|0,n=(n=n+Math.imul(N,fe)|0)+Math.imul(L,le)|0,a=a+Math.imul(L,fe)|0;var xe=(d+(i=i+Math.imul(x,pe)|0)|0)+((8191&(n=(n=n+Math.imul(x,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(F,le),n=(n=Math.imul(F,fe))+Math.imul(U,le)|0,a=Math.imul(U,fe);var Ce=(d+(i=i+Math.imul(N,pe)|0)|0)+((8191&(n=(n=n+Math.imul(N,me)|0)+Math.imul(L,pe)|0))<<13)|0;d=((a=a+Math.imul(L,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Pe=(d+(i=Math.imul(F,pe))|0)+((8191&(n=(n=Math.imul(F,me))+Math.imul(U,pe)|0))<<13)|0;return d=((a=Math.imul(U,me))+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u[0]=ge,u[1]=_e,u[2]=ye,u[3]=be,u[4]=ve,u[5]=we,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=Me,u[10]=Te,u[11]=Re,u[12]=ke,u[13]=Ie,u[14]=Oe,u[15]=De,u[16]=xe,u[17]=Ce,u[18]=Pe,0!==d&&(u[19]=d,r.length++),r};function m(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=c),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?c(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var o=n;n=0;for(var s=67108863&i,u=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=u;d++){var h=a-d,l=(0|e.words[h])*(0|t.words[d]),f=67108863&l;s=67108863&(f=f+s|0),n+=(o=(o=o+(l/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r.strip()}(this,e,t):m(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},g.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},g.prototype.permute=function(e,t,r,i,n,a){for(var o=0;o<a;o++)i[o]=t[e[o]],n[o]=r[e[o]]},g.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),d=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var l=u,f=d,c=0;c<o;c++){var p=r[h+c],m=i[h+c],g=r[h+c+o],_=i[h+c+o],y=l*g-f*_;_=l*_+f*g,g=y,r[h+c]=p+g,i[h+c]=m+_,r[h+c+o]=p-g,i[h+c+o]=m-_,c!==s&&(y=u*l-d*f,f=u*f+d*l,l=y)}},g.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},g.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},g.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},g.prototype.convert13b=function(e,t,r,n){for(var a=0,o=0;o<t;o++)a+=0|e[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===a),i(0==(-8192&a))},g.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},g.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),o=new Array(i),s=new Array(i),u=new Array(i),d=new Array(i),h=new Array(i),l=new Array(i),f=r.words;f.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,d,i),this.transform(o,a,s,u,i,n),this.transform(d,a,h,l,i,n);for(var c=0;c<i;c++){var p=s[c]*h[c]-u[c]*l[c];u[c]=s[c]*l[c]+u[c]*h[c],s[c]=p}return this.conjugate(s,u,i),this.transform(s,u,f,a,i,n),this.conjugate(f,a,i),this.normalize13b(f,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),m(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){i("number"==typeof e),i(e<67108864);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,a=(67108863&n)+(67108863&t);t>>=26,t+=n/67108864|0,t+=a>>>26,this.words[r]=67108863&a}return 0!==t&&(this.words[r]=t,this.length++),this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(n-=o,n=Math.max(0,n),u){for(var d=0;d<o;d++)u.words[d]=this.words[d];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,d=0;d<this.length;d++)this.words[d]=this.words[d+o];else this.words[0]=0,this.length=1;var h=0;for(d=this.length-1;d>=0&&(0!==h||d>=n);d--){var l=0|this.words[d];this.words[d]=h<<26-a|l>>>a,h=l&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this.strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,o=e.length+r;this._expand(o);var s=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)s=(a=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&a;if(0===s)return this.strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(a=-(0|this.words[n])+s)>>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var d=0;d<s.length;d++)s.words[d]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var l=u-1;l>=0;l--){var f=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(f=Math.min(f/o|0,67108863),i._ishlnsubmul(n,f,l);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=f)}return s&&s.strip(),i.strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modn=function(e){i(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},a.prototype.idivn=function(e){i(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var h=r.clone(),l=t.clone();!t.isZero();){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),o.isub(u)):(r.isub(t),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,f=1;0==(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(n=0===t.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new A(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},n(b,y),b.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(4194303&a)<<4|n>>>22,n=a}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,y),n(w,y),n(E,y),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return _[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),d=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new a(2*h*h).toRed(this);0!==this.pow(h,d).cmp(u);)h.redIAdd(u);for(var l=this.pow(h,n),f=this.pow(e,n.addn(1).iushrn(1)),c=this.pow(e,n),p=o;0!==c.cmp(s);){for(var m=c,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var _=this.pow(l,new a(1).iushln(p-g-1));f=f.redMul(_),l=_.redSqr(),c=c.redMul(l),p=g}return f},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],h=u-1;h>=0;h--){var l=d>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new S(e)},n(S,A),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(55)(e))},function(e,t,r){"use strict";t.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){"use strict";var i=t,n=r(11),a=r(14),o=r(108);i.assert=a,i.toArray=o.toArray,i.zero2=o.zero2,i.toHex=o.toHex,i.encode=o.encode,i.getNAF=function(e,t,r){var i=new Array(Math.max(e.bitLength(),r)+1);i.fill(0);for(var n=1<<t+1,a=e.clone(),o=0;o<i.length;o++){var s,u=a.andln(n-1);a.isOdd()?(s=u>(n>>1)-1?(n>>1)-u:u,a.isubn(s)):s=0,i[o]=s,a.iushrn(1)}return i},i.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,a=0;e.cmpn(-n)>0||t.cmpn(-a)>0;){var o,s,u=e.andln(3)+n&3,d=t.andln(3)+a&3;3===u&&(u=-1),3===d&&(d=-1),o=0==(1&u)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==d?u:-u,r[0].push(o),s=0==(1&d)?0:3!==(i=t.andln(7)+a&7)&&5!==i||2!==u?d:-d,r[1].push(s),2*n===o+1&&(n=1-n),2*a===s+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},i.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new n(e,"hex","le")}},function(e,t,r){"use strict";function i(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}r.d(t,"d",(function(){return n})),r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return o})),r.d(t,"c",(function(){return s}));var n=function(e,t,r,i,n){this.dts=e,this.pts=t,this.duration=r,this.originalDts=i,this.isSyncPoint=n,this.fileposition=null},a=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=[]}var t=e.prototype;return t.clear=function(){this._list=[]},t.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))},t.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,r=0,i=t.length-1,n=0,a=0,o=i;for(e<t[0].dts&&(r=0,a=o+1);a<=o;){if((n=a+Math.floor((o-a)/2))===i||e>=t[n].dts&&e<t[n+1].dts){r=n;break}t[n].dts<e?a=n+1:o=n-1}return this._list[r]},e}(),s=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}var t,r,n,a=e.prototype;return a.isEmpty=function(){return 0===this._list.length},a.clear=function(){this._list=[],this._lastAppendLocation=-1},a._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var r=t.length-1,i=0,n=0,a=r,o=0;if(e<t[0].originalBeginDts)return o=-1;for(;n<=a;){if((i=n+Math.floor((a-n)/2))===r||e>t[i].lastSample.originalDts&&e<t[i+1].originalBeginDts){o=i;break}t[i].originalBeginDts<e?n=i+1:a=i-1}return o},a._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},a.append=function(e){var t=this._list,r=e,i=this._lastAppendLocation,n=0;-1!==i&&i<t.length&&r.originalBeginDts>=t[i].lastSample.originalDts&&(i===t.length-1||i<t.length-1&&r.originalBeginDts<t[i+1].originalBeginDts)?n=i+1:t.length>0&&(n=this._searchNearestSegmentBefore(r.originalBeginDts)+1),this._lastAppendLocation=n,this._list.splice(n,0,r)},a.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},a.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},a.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),r=this._list[t].syncPoints;0===r.length&&t>0;)t--,r=this._list[t].syncPoints;return r.length>0?r[r.length-1]:null},t=e,(r=[{key:"type",get:function(){return this._type}},{key:"length",get:function(){return this._list.length}}])&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},function(e,t,r){"use strict";var i=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}var t=e.prototype;return t.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===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&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t},t.isSeekable=function(){return!0===this.hasKeyframesIndex},t.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,r=this._search(t.times,e);return{index:r,milliseconds:t.times[r],fileposition:t.filepositions[r]}},t._search=function(e,t){var r=0,i=e.length-1,n=0,a=0,o=i;for(t<e[0]&&(r=0,a=o+1);a<=o;){if((n=a+Math.floor((o-a)/2))===i||t>=e[n]&&t<e[n+1]){r=n;break}e[n]<t?a=n+1:o=n-1}return r},e}();t.a=i},function(e,t,r){"use strict";var i=r(14),n=r(5);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=63&o|128):a(e,n)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++n)),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=63&o|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=63&o|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=o,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=o(n)),r+=u(n.toString(16))}return r},t.zero2=s,t.zero8=u,t.join32=function(e,t,r,n){var a=r-t;i(a%4==0);for(var o=new Array(a/4),s=0,u=t;s<o.length;s++,u+=4){var d;d="big"===n?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],o[s]=d>>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var a=e[i];"big"===t?(r[n]=a>>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],a=i+e[t+1]>>>0,o=(a<i?1:0)+r+n;e[t]=o>>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,a,o,s){var u=0,d=t;return u+=(d=d+i>>>0)<t?1:0,u+=(d=d+a>>>0)<a?1:0,e+r+n+o+(u+=(d=d+s>>>0)<s?1:0)>>>0},t.sum64_4_lo=function(e,t,r,i,n,a,o,s){return t+i+a+s>>>0},t.sum64_5_hi=function(e,t,r,i,n,a,o,s,u,d){var h=0,l=t;return h+=(l=l+i>>>0)<t?1:0,h+=(l=l+a>>>0)<a?1:0,h+=(l=l+s>>>0)<s?1:0,e+r+n+o+u+(h+=(l=l+d>>>0)<d?1:0)>>>0},t.sum64_5_lo=function(e,t,r,i,n,a,o,s,u,d){return t+i+a+s+d>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){"use strict";var i=r(8),n=r.n(i),a=r(0);function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var s=function(){function e(){}var t,r,i;return e.getConfig=function(){return{globalTag:a.a.GLOBAL_TAG,forceGlobalTag:a.a.FORCE_GLOBAL_TAG,enableVerbose:a.a.ENABLE_VERBOSE,enableDebug:a.a.ENABLE_DEBUG,enableInfo:a.a.ENABLE_INFO,enableWarn:a.a.ENABLE_WARN,enableError:a.a.ENABLE_ERROR,enableCallback:a.a.ENABLE_CALLBACK}},e.applyConfig=function(e){a.a.GLOBAL_TAG=e.globalTag,a.a.FORCE_GLOBAL_TAG=e.forceGlobalTag,a.a.ENABLE_VERBOSE=e.enableVerbose,a.a.ENABLE_DEBUG=e.enableDebug,a.a.ENABLE_INFO=e.enableInfo,a.a.ENABLE_WARN=e.enableWarn,a.a.ENABLE_ERROR=e.enableError,a.a.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var r=e.getConfig();t.emit("change",r)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){a.a.emitter.addListener("log",t),a.a.emitter.listenerCount("log")>0&&(a.a.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){a.a.emitter.removeListener("log",t),0===a.a.emitter.listenerCount("log")&&(a.a.ENABLE_CALLBACK=!1,e._notifyChange())},t=e,i=[{key:"forceGlobalTag",get:function(){return a.a.FORCE_GLOBAL_TAG},set:function(t){a.a.FORCE_GLOBAL_TAG=t,e._notifyChange()}},{key:"globalTag",get:function(){return a.a.GLOBAL_TAG},set:function(t){a.a.GLOBAL_TAG=t,e._notifyChange()}},{key:"enableAll",get:function(){return a.a.ENABLE_VERBOSE&&a.a.ENABLE_DEBUG&&a.a.ENABLE_INFO&&a.a.ENABLE_WARN&&a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_VERBOSE=t,a.a.ENABLE_DEBUG=t,a.a.ENABLE_INFO=t,a.a.ENABLE_WARN=t,a.a.ENABLE_ERROR=t,e._notifyChange()}},{key:"enableDebug",get:function(){return a.a.ENABLE_DEBUG},set:function(t){a.a.ENABLE_DEBUG=t,e._notifyChange()}},{key:"enableVerbose",get:function(){return a.a.ENABLE_VERBOSE},set:function(t){a.a.ENABLE_VERBOSE=t,e._notifyChange()}},{key:"enableInfo",get:function(){return a.a.ENABLE_INFO},set:function(t){a.a.ENABLE_INFO=t,e._notifyChange()}},{key:"enableWarn",get:function(){return a.a.ENABLE_WARN},set:function(t){a.a.ENABLE_WARN=t,e._notifyChange()}},{key:"enableError",get:function(){return a.a.ENABLE_ERROR},set:function(t){a.a.ENABLE_ERROR=t,e._notifyChange()}}],(r=null)&&o(t.prototype,r),i&&o(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();s.emitter=new n.a,t.a=s},function(e,t,r){var i=r(6).Buffer,n=r(148).Transform,a=r(22).StringDecoder;function o(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(5)(o,n),o.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},o.prototype.setAutoPadding=function(){},o.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},o.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},o.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},o.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){i=e}finally{r(i)}},o.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},o.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},o.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new a(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i},e.exports=o},function(e,t,r){function i(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r.oe=function(e){throw console.error(e),e};var i=r(r.s=ENTRY_MODULE);return i.default||i}function n(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,i){var a={};a[i]=[];var o=t.toString(),s=o.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return a;for(var u,d=s[1],h=new RegExp("(\\\\n|\\W)"+n(d)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=h.exec(o);)"dll-reference"!==u[3]&&a[i].push(u[3]);for(h=new RegExp("\\("+n(d)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=h.exec(o);)e[u[2]]||(a[i].push(u[1]),e[u[2]]=r(u[1]).m),a[u[2]]=a[u[2]]||[],a[u[2]].push(u[4]);for(var l,f=Object.keys(a),c=0;c<f.length;c++)for(var p=0;p<a[f[c]].length;p++)l=a[f[c]][p],isNaN(1*l)||(a[f[c]][p]=1*a[f[c]][p]);return a}function o(e){return Object.keys(e).reduce((function(t,r){return t||e[r].length>0}),!1)}e.exports=function(e,t){t=t||{};var n={main:r.m},s=t.all?{main:Object.keys(n.main)}:function(e,t){for(var r={main:[t]},i={main:[]},n={main:{}};o(r);)for(var s=Object.keys(r),u=0;u<s.length;u++){var d=s[u],h=r[d].pop();if(n[d]=n[d]||{},!n[d][h]&&e[d][h]){n[d][h]=!0,i[d]=i[d]||[],i[d].push(h);for(var l=a(e,e[d][h],d),f=Object.keys(l),c=0;c<f.length;c++)r[f[c]]=r[f[c]]||[],r[f[c]]=r[f[c]].concat(l[f[c]])}}return i}(n,e),u="";Object.keys(s).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;s[e][t];)t++;s[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s[e].map((function(t){return JSON.stringify(t)+": "+n[e][t].toString()})).join(",")+"});\n"})),u=u+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s.main.map((function(e){return JSON.stringify(e)+": "+n.main[e].toString()})).join(",")+"}))(self);";var d=new window.Blob([u],{type:"text/javascript"});if(t.bare)return d;var h=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(d),l=new window.Worker(h);return l.objectURL=h,l}},function(e,t,r){"use strict";var i=r(6).Buffer,n=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===n||!n(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=d,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=h,this.end=l,t=3;break;default:return this.write=f,void(this.end=c)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function d(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function h(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function c(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},a.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},a.prototype.text=function(e,t){var r=function(e,t,r){var i=t.length-1;if(i<r)return 0;var n=o(t[i]);if(n>=0)return n>0&&(e.lastNeed=n-1),n;if(--i<r||-2===n)return 0;if((n=o(t[i]))>=0)return n>0&&(e.lastNeed=n-2),n;if(--i<r||-2===n)return 0;if((n=o(t[i]))>=0)return n>0&&(2===n?n=0:e.lastNeed=n-3),n;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,r){"use strict";var i=r(38),n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=l;var a=Object.create(r(32));a.inherits=r(5);var o=r(81),s=r(51);a.inherits(l,o);for(var u=n(s.prototype),d=0;d<u.length;d++){var h=u[d];l.prototype[h]||(l.prototype[h]=s.prototype[h])}function l(e){if(!(this instanceof l))return new l(e);o.call(this,e),s.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",f)}function f(){this.allowHalfOpen||this._writableState.ended||i.nextTick(c,this)}function c(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),l.prototype._destroy=function(e,t){this.push(null),this.end(),i.nextTick(t,e)}},function(e,t,r){"use strict";(function(t,i){var n=r(6).Buffer,a=t.crypto||t.msCrypto;a&&a.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=n.allocUnsafe(e);if(e>0)if(e>65536)for(var o=0;o<e;o+=65536)a.getRandomValues(r.slice(o,o+65536));else a.getRandomValues(r);if("function"==typeof t)return i.nextTick((function(){t(null,r)}));return r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(13),r(9))},function(e,t,r){"use strict";var i={};function n(e,t,r){r||(r=Error);var n=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=e,i[e]=n}function a(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,o,s;if("string"==typeof t&&(n="not ",t.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(a(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(u," ").concat(i," ").concat(a(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},function(e,t,r){"use strict";(function(t){var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=d;var n=r(73),a=r(77);r(5)(d,n);for(var o=i(a.prototype),s=0;s<o.length;s++){var u=o[s];d.prototype[u]||(d.prototype[u]=a.prototype[u])}function d(e){if(!(this instanceof d))return new d(e);n.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||t.nextTick(l,this)}function l(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(d.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this,r(9))},function(e,t,r){var i=r(6).Buffer;function n(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}n.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var r=this._block,n=this._blockSize,a=e.length,o=this._len,s=0;s<a;){for(var u=o%n,d=Math.min(a-s,n-u),h=0;h<d;h++)r[u+h]=e[s+h];s+=d,(o+=d)%n==0&&this._update(r)}return this._len+=a,this},n.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var a=this._hash();return e?a.toString(e):a},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=n},function(e,t,r){"use strict";var i={};function n(e,t,r){r||(r=Error);var n=function(e){var r,i;function n(r,i,n){return e.call(this,function(e,r,i){return"string"==typeof t?t:t(e,r,i)}(r,i,n))||this}return i=e,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);n.prototype.name=r.name,n.prototype.code=e,i[e]=n}function a(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,n,o,s;if("string"==typeof t&&(n="not ",t.substr(!o||o<0?0:+o,n.length)===n)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(i," ").concat(a(t,"type"));else{var u=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(u," ").concat(i," ").concat(a(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},function(e,t,r){"use strict";(function(t){var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=d;var n=r(102),a=r(106);r(5)(d,n);for(var o=i(a.prototype),s=0;s<o.length;s++){var u=o[s];d.prototype[u]||(d.prototype[u]=a.prototype[u])}function d(e){if(!(this instanceof d))return new d(e);n.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||t.nextTick(l,this)}function l(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(d.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this,r(9))},function(e,t,r){"use strict";
- /*! @name @videojs/vhs-utils @version 1.3.0 @license MIT */var i=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var r=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(r,1),r>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var r=t.length,i=0;i<r;++i)t[i].call(this,arguments[1]);else for(var n=Array.prototype.slice.call(arguments,1),a=t.length,o=0;o<a;++o)t[o].apply(this,n)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();e.exports=i},function(e,t,r){"use strict";var i=r(5),n=r(44),a=r(47),o=r(48),s=r(20);function u(e){s.call(this,"digest"),this._hash=e}i(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new n:"rmd160"===e||"ripemd160"===e?new a:new u(o(e))}},function(e,t,r){function i(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===i(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===i(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===i(e)},t.isError=function(e){return"[object Error]"===i(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(10).Buffer.isBuffer},function(e,t,r){(function(t){e.exports=function(e,r){for(var i=Math.min(e.length,r.length),n=new t(i),a=0;a<i;++a)n[a]=e[a]^r[a];return n}}).call(this,r(10).Buffer)},function(e,t,r){"use strict";var i=r(18),n=r(14);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},a.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},a.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,a=8;a<this.padLength;a++)i[n++]=0;return i}},function(e,t,r){"use strict";var i=r(5),n=r(64).Reporter,a=r(62).Buffer;function o(e,t){n.call(this,t),a.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function s(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return s.isEncoderBuffer(e)||(e=new s(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=a.byteLength(e);else{if(!a.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}i(o,n),t.DecoderBuffer=o,o.isDecoderBuffer=function(e){return e instanceof o||"object"==typeof e&&a.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},o.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},o.prototype.restore=function(e){var t=new o(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,n.prototype.restore.call(this,e.reporter),t},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},o.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var r=new o(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},o.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=s,s.isEncoderBuffer=function(e){return e instanceof s||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},s.prototype.join=function(e,t){return e||(e=a.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):a.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},function(e,t,r){"use strict";var i=r(8),n=r.n(i),a=r(0),o=r(7),s=r(17);function u(e,t,r){var i=e;if(t+r<i.length){for(;r--;)if(128!=(192&i[++t]))return!1;return!0}return!1}var d,h=function(e){for(var t=[],r=e,i=0,n=e.length;i<n;)if(r[i]<128)t.push(String.fromCharCode(r[i])),++i;else{if(r[i]<192);else if(r[i]<224){if(u(r,i,1)){var a=(31&r[i])<<6|63&r[i+1];if(a>=128){t.push(String.fromCharCode(65535&a)),i+=2;continue}}}else if(r[i]<240){if(u(r,i,2)){var o=(15&r[i])<<12|(63&r[i+1])<<6|63&r[i+2];if(o>=2048&&55296!=(63488&o)){t.push(String.fromCharCode(65535&o)),i+=3;continue}}}else if(r[i]<248&&u(r,i,3)){var s=(7&r[i])<<18|(63&r[i+1])<<12|(63&r[i+2])<<6|63&r[i+3];if(s>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),i+=4;continue}}t.push(String.fromCharCode(65533)),++i}return t.join("")},l=r(4),f=(d=new ArrayBuffer(2),new DataView(d).setInt16(0,256,!0),256===new Int16Array(d)[0]),c=function(){function e(){}return e.parseScriptData=function(t,r,i){var n={};try{var o=e.parseValue(t,r,i),s=e.parseValue(t,r+o.size,i-o.size);n[o.data]=s.data}catch(e){a.a.e("AMF",e.toString())}return n},e.parseObject=function(t,r,i){if(i<3)throw new l.a("Data not enough when parse ScriptDataObject");var n=e.parseString(t,r,i),a=e.parseValue(t,r+n.size,i-n.size),o=a.objectEnd;return{data:{name:n.data,value:a.data},size:n.size+a.size,objectEnd:o}},e.parseVariable=function(t,r,i){return e.parseObject(t,r,i)},e.parseString=function(e,t,r){if(r<2)throw new l.a("Data not enough when parse String");var i=new DataView(e,t,r).getUint16(0,!f);return{data:i>0?h(new Uint8Array(e,t+2,i)):"",size:2+i}},e.parseLongString=function(e,t,r){if(r<4)throw new l.a("Data not enough when parse LongString");var i=new DataView(e,t,r).getUint32(0,!f);return{data:i>0?h(new Uint8Array(e,t+4,i)):"",size:4+i}},e.parseDate=function(e,t,r){if(r<10)throw new l.a("Data size invalid when parse Date");var i=new DataView(e,t,r),n=i.getFloat64(0,!f),a=i.getInt16(8,!f);return{data:new Date(n+=60*a*1e3),size:10}},e.parseValue=function(t,r,i){if(i<1)throw new l.a("Data not enough when parse Value");var n,o=new DataView(t,r,i),s=1,u=o.getUint8(0),d=!1;try{switch(u){case 0:n=o.getFloat64(1,!f),s+=8;break;case 1:n=!!o.getUint8(1),s+=1;break;case 2:var h=e.parseString(t,r+1,i-1);n=h.data,s+=h.size;break;case 3:n={};var c=0;for(9==(16777215&o.getUint32(i-4,!f))&&(c=3);s<i-4;){var p=e.parseObject(t,r+s,i-s-c);if(p.objectEnd)break;n[p.data.name]=p.data.value,s+=p.size}if(s<=i-3)9===(16777215&o.getUint32(s-1,!f))&&(s+=3);break;case 8:n={},s+=4;var m=0;for(9==(16777215&o.getUint32(i-4,!f))&&(m=3);s<i-8;){var g=e.parseVariable(t,r+s,i-s-m);if(g.objectEnd)break;n[g.data.name]=g.data.value,s+=g.size}if(s<=i-3)9===(16777215&o.getUint32(s-1,!f))&&(s+=3);break;case 9:n=void 0,s=1,d=!0;break;case 10:n=[];var _=o.getUint32(1,!f);s+=4;for(var y=0;y<_;y++){var b=e.parseValue(t,r+s,i-s);n.push(b.data),s+=b.size}break;case 11:var v=e.parseDate(t,r+1,i-1);n=v.data,s+=v.size;break;case 12:var w=e.parseString(t,r+1,i-1);n=w.data,s+=w.size;break;default:s=i,a.a.w("AMF","Unsupported AMF value type "+u)}}catch(e){a.a.e("AMF",e.toString())}return{data:n,size:s,objectEnd:d}},e}(),p=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}var t=e.prototype;return t.destroy=function(){this._buffer=null},t._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new l.a("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),r=new Uint8Array(4);r.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(r.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},t.readBits=function(e){if(e>32)throw new l.b("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 r=this._current_word_bits_left?this._current_word:0;r>>>=32-this._current_word_bits_left;var i=e-this._current_word_bits_left;this._fillCurrentWord();var n=Math.min(i,this._current_word_bits_left),a=this._current_word>>>32-n;return this._current_word<<=n,this._current_word_bits_left-=n,r=r<<n|a},t.readBool=function(){return 1===this.readBits(1)},t.readByte=function(){return this.readBits(8)},t._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},t.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},t.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}(),m=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,r=t.byteLength,i=new Uint8Array(r),n=0,a=0;a<r;a++)a>=2&&3===t[a]&&0===t[a-1]&&0===t[a-2]||(i[n]=t[a],n++);return new Uint8Array(i.buffer,0,n)},e.parseSPS=function(t){var r=e._ebsp2rbsp(t),i=new p(r);i.readByte();var n=i.readByte();i.readByte();var a=i.readByte();i.readUEG();var o=e.getProfileString(n),s=e.getLevelString(a),u=1,d=420,h=8;if((100===n||110===n||122===n||244===n||44===n||83===n||86===n||118===n||128===n||138===n||144===n)&&(3===(u=i.readUEG())&&i.readBits(1),u<=3&&(d=[0,420,422,444][u]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool()))for(var l=3!==u?8:12,f=0;f<l;f++)i.readBool()&&(f<6?e._skipScalingList(i,16):e._skipScalingList(i,64));i.readUEG();var c=i.readUEG();if(0===c)i.readUEG();else if(1===c){i.readBits(1),i.readSEG(),i.readSEG();for(var m=i.readUEG(),g=0;g<m;g++)i.readSEG()}var _=i.readUEG();i.readBits(1);var y=i.readUEG(),b=i.readUEG(),v=i.readBits(1);0===v&&i.readBits(1),i.readBits(1);var w=0,E=0,A=0,S=0;i.readBool()&&(w=i.readUEG(),E=i.readUEG(),A=i.readUEG(),S=i.readUEG());var M=1,T=1,R=0,k=!0,I=0,O=0;if(i.readBool()){if(i.readBool()){var D=i.readByte();D>0&&D<16?(M=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][D-1],T=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][D-1]):255===D&&(M=i.readByte()<<8|i.readByte(),T=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){var x=i.readBits(32),C=i.readBits(32);k=i.readBool(),R=(I=C)/(O=2*x)}}var P=1;1===M&&1===T||(P=M/T);var N=0,L=0;0===u?(N=1,L=2-v):(N=3===u?1:2,L=(1===u?2:1)*(2-v));var B=16*(y+1),F=16*(b+1)*(2-v);B-=(w+E)*N,F-=(A+S)*L;var U=Math.ceil(B*P);return i.destroy(),i=null,{avc_profile:n,profile_string:o,avc_level:a,level_string:s,bit_depth:h,ref_frames:_,chroma_format:d,chroma_format_string:e.getChromaFormatString(d),frame_rate:{fixed:k,fps:R,fps_den:O,fps_num:I},sar_ratio:{width:M,height:T},codec_size:{width:B,height:F},present_size:{width:U,height:F}}},e._skipScalingList=function(e,t){for(var r=8,i=8,n=0;n<t;n++)0!==i&&(i=(r+e.readSEG()+256)%256),r=0===i?r:i},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}(),g=r(1),_=r(12);function y(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var b=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 s.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]}(),this._onReceiveH265MediaFLVFrame=null,this._onAudioError=null,this._videoCodecId=0,this._audioCodecId=0,this._AVC_SPS=null,this._AVC_PPS=null,this._HEVC_VPS=null,this._HEVC_SPS=null,this._HEVC_PPS=null,this._StartCode=[0,0,0,1],this._SampleRate=8e3,this._ChannelNum=1,this._AudioMaxFrameSize=0,this._DebugBuf=null,this._DebugBufPos=0,this._lastAudioPts=0,this._lastVideoPts=0,this._index=0,this._allowAudio=!1,this.sei_data=null}var t,r,i,n=e.prototype;return n.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,this._onAudioError=null,this._onReceiveSEIData=null,this._onReceiveH265MediaFLVFrame=null},e.probe=function(e){var t=new Uint8Array(e),r={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return r;var i,n,a=(4&t[4])>>>2!=0,o=0!=(1&t[4]),s=(i=t)[n=5]<<24|i[n+1]<<16|i[n+2]<<8|i[n+3];return s<9?r:{match:!0,consumed:s,dataOffset:s,hasAudioTrack:a,hasVideoTrack:o}},n.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},n.resetMediaInfo=function(){this._mediaInfo=new s.a},n._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},n.parseChunks=function(t,r){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new l.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var i=0,n=this._littleEndian;if(0===r){if(!(t.byteLength>13))return 0;i=e.probe(t).dataOffset}this._firstParse&&(this._firstParse=!1,r+i!==this._dataOffset&&a.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==new DataView(t,i).getUint32(0,!n)&&a.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),i+=4);for(;i<t.byteLength;){this._dispatch=!0;var o=new DataView(t,i);if(i+11+4>t.byteLength)break;var s=o.getUint8(0),u=16777215&o.getUint32(0,!n);if(i+11+u+4>t.byteLength)break;if(8===s||9===s||18===s){var d=o.getUint8(4),h=o.getUint8(5),f=o.getUint8(6)|h<<8|d<<16|o.getUint8(7)<<24;0!==(16777215&o.getUint32(7,!n))&&a.a.w(this.TAG,"Meet tag which has StreamID != 0!");var c=i+11;switch(s){case 8:f-this._lastAudioPts<=0&&(this._index>1&&(this._hasAudioFlagOverrided=!0,this._mediaInfo.hasAudio=!1,this._hasAudio=!1,this._onAudioError()),this._index++),this._lastAudioPts=f,this._audioCodecId=this._parseAudioData(t,c,u,f);break;case 9:this._lastVideoPts=f,this._parseVideoData(t,c,u,f,r+i);break;case 18:this._parseScriptData(t,c,u)}var p=o.getUint32(11+u,!n);p!==11+u&&a.a.w(this.TAG,"Invalid PrevTagSize "+p),i+=11+u+4}else a.a.w(this.TAG,"Unsupported tag type "+s+", skipped"),i+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.samples.length||this._videoTrack.samples.length)&&(7===this._videoCodecId||0===this._videoCodecId?"auto"===this._config.decodeType?this._onDataAvailable(this._audioTrack,this._videoTrack):(this._videoTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeVideo(27,this._videoTrack),this._audioTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeAudio(10===this._audioCodecId?86018:0,this._audioTrack)):12===this._videoCodecId&&(this._videoTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeVideo(173,this._videoTrack),this._audioTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeAudio(10===this._audioCodecId?86018:0,this._audioTrack))),i},n._parseScriptData=function(e,t,r){new DataView(e,t,r);var i=c.parseScriptData(e,t,r);if(i.hasOwnProperty("onMetaData")){if(null==i.onMetaData||"object"!=typeof i.onMetaData)return void a.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&a.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=i;var n=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},n)),"boolean"==typeof n.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=n.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof n.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=n.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof n.audiodatarate&&(this._mediaInfo.audioDataRate=n.audiodatarate),"number"==typeof n.videodatarate&&(this._mediaInfo.videoDataRate=n.videodatarate),"number"==typeof n.width&&(this._mediaInfo.width=n.width),"number"==typeof n.height&&(this._mediaInfo.height=n.height),"number"==typeof n.duration){if(!this._durationOverrided){var o=Math.floor(n.duration*this._timescale);this._duration=o,this._mediaInfo.duration=o}}else this._mediaInfo.duration=0;if("number"==typeof n.framerate){var s=Math.floor(1e3*n.framerate);if(s>0){var u=s/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=u,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=u}}if("object"==typeof n.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var d=n.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(d),n.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=n,a.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(i).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},i))},n._parseKeyframesIndex=function(e){for(var t=[],r=[],i=1;i<e.times.length;i++){var n=this._timestampBase+Math.floor(1e3*e.times[i]);t.push(n),r.push(e.filepositions[i])}return{times:t,filepositions:r}},n._parseAudioData=function(e,t,r,i){if(r<=1)return a.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!"),0;if(!0===this._hasAudioFlagOverrided&&!1===this._hasAudio)return 0;this._littleEndian;var n=new DataView(e,t,r).getUint8(0),o=n>>>4;if(2!==o&&10!==o)return this._onError(_.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+o),0;var s=0,u=(12&n)>>>2;if(!(u>=0&&u<=4))return this._onError(_.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+u),0;s=this._flvSoundRateTable[u];var d=1&n,h=this._audioMetadata,l=this._audioTrack;if(h||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(h=this._audioMetadata={}).type="audio",h.id=l.id,h.timescale=this._timescale,h.duration=this._duration,h.audioSampleRate=s,h.channelCount=0===d?1:2),10===o){var f=this._parseAACAudioData(e,t+1,r-1);if(null==f)return 0;if(0===f.packetType){h.config&&a.a.w(this.TAG,"Found another AudioSpecificConfig!");var c=f.data;h.audioSampleRate=c.samplingRate,h.channelCount=c.channelCount,h.codec=c.codec,h.originalCodec=c.originalCodec,h.config=c.config,h.refSampleDuration=1024/h.audioSampleRate*h.timescale,a.a.v(this.TAG,"Parsed AudioSpecificConfig"),this._SampleRate=c.samplingRate,this._ChannelNum=c.channelCount,this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.samples.length||this._videoTrack.samples.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",h);var p=this._mediaInfo;p.audioCodec=h.originalCodec,p.audioSampleRate=h.audioSampleRate,p.audioChannelCount=h.channelCount,p.hasVideo?null!=p.videoCodec&&(p.mimeType='video/x-flv; codecs="'+p.videoCodec+","+p.audioCodec+'"'):p.mimeType='video/x-flv; codecs="'+p.audioCodec+'"',p.isComplete()&&this._onMediaInfo(p)}else if(1===f.packetType){var m=this._timestampBase+i,g={unit:f.data,length:f.data.byteLength,dts:m,pts:m};l.samples.push(g),l.length+=f.data.length,f.data.length>this._AudioMaxFrameSize&&(this._AudioMaxFrameSize=f.data.length)}else a.a.e(this.TAG,"Flv: Unsupported AAC data type "+f.packetType)}else if(2===o){if(!h.codec){var y=this._parseMP3AudioData(e,t+1,r-1,!0);if(null==y)return 0;h.audioSampleRate=y.samplingRate,h.channelCount=y.channelCount,h.codec=y.codec,h.originalCodec=y.originalCodec,h.refSampleDuration=1152/h.audioSampleRate*h.timescale,a.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",h);var b=this._mediaInfo;b.audioCodec=h.codec,b.audioSampleRate=h.audioSampleRate,b.audioChannelCount=h.channelCount,b.audioDataRate=y.bitRate,b.hasVideo?null!=b.videoCodec&&(b.mimeType='video/x-flv; codecs="'+b.videoCodec+","+b.audioCodec+'"'):b.mimeType='video/x-flv; codecs="'+b.audioCodec+'"',b.isComplete()&&this._onMediaInfo(b)}var v=this._parseMP3AudioData(e,t+1,r-1,!1);if(null==v)return 0;var w=this._timestampBase+i,E={unit:v,length:v.byteLength,dts:w,pts:w};l.samples.push(E),l.length+=v.length}return o},n._parseAACAudioData=function(e,t,r){if(!(r<=1)){var i={},n=new Uint8Array(e,t,r);return i.packetType=n[0],0===n[0]?i.data=this._parseAACAudioSpecificConfig(e,t+1,r-1):i.data=n.subarray(1),i}a.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},n._parseAACAudioSpecificConfig=function(e,t,r){var i,n,a=new Uint8Array(e,t,r),o=null,s=0,u=null;if(s=i=a[0]>>>3,(n=(7&a[0])<<1|a[1]>>>7)<0||n>=this._mpegSamplingRates.length)this._onError(_.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var d=this._mpegSamplingRates[n],h=(120&a[1])>>>3;if(!(h<0||h>=8)){5===s&&(u=(7&a[1])<<1|a[2]>>>7,(124&a[2])>>>2);var l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?n>=6?(s=5,o=new Array(4),u=n-3):(s=2,o=new Array(2),u=n):-1!==l.indexOf("android")?(s=2,o=new Array(2),u=n):(s=5,u=n,o=new Array(4),n>=6?u=n-3:1===h&&(s=2,o=new Array(2),u=n)),o[0]=s<<3,o[0]|=(15&n)>>>1,o[1]=(15&n)<<7,o[1]|=(15&h)<<3,5===s&&(o[1]|=(15&u)>>>1,o[2]=(1&u)<<7,o[2]|=8,o[3]=0),{config:o,samplingRate:d,channelCount:h,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+i}}this._onError(_.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},n._parseMP3AudioData=function(e,t,r,i){if(!(r<4)){this._littleEndian;var n=new Uint8Array(e,t,r),o=null;if(i){if(255!==n[0])return;var s=n[1]>>>3&3,u=(6&n[1])>>1,d=(240&n[2])>>>4,h=(12&n[2])>>>2,l=3!==(n[3]>>>6&3)?2:1,f=0,c=0;switch(s){case 0:f=this._mpegAudioV25SampleRateTable[h];break;case 2:f=this._mpegAudioV20SampleRateTable[h];break;case 3:f=this._mpegAudioV10SampleRateTable[h]}switch(u){case 1:34,d<this._mpegAudioL3BitRateTable.length&&(c=this._mpegAudioL3BitRateTable[d]);break;case 2:33,d<this._mpegAudioL2BitRateTable.length&&(c=this._mpegAudioL2BitRateTable[d]);break;case 3:32,d<this._mpegAudioL1BitRateTable.length&&(c=this._mpegAudioL1BitRateTable[d])}o={bitRate:c,samplingRate:f,channelCount:l,codec:"mp3",originalCodec:"mp3"}}else o=n;return o}a.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},n._parseVideoData=function(e,t,r,i,n){if(r<=1)a.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var o=new Uint8Array(e,t,r)[0],s=(240&o)>>>4;this._videoCodecId=15&o,7===this._videoCodecId||12===this._videoCodecId?(g.h(7===this._videoCodecId?"H264":"H265"),this._parseAVCAndHEVCVideoPacket(e,t+1,r-1,i,n,s)):this._onError(_.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+codecId)}},n._parseAVCAndHEVCVideoPacket=function(e,t,r,i,n,o){if(r<4)a.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var s=this._littleEndian,u=new DataView(e,t,r),d=u.getUint8(0),h=(16777215&u.getUint32(0,!s))<<8>>8;if(0===d)7===this._videoCodecId?this._parseAVCDecoderConfigurationRecord(e,t+4,r-4):this._parseHEVCDecoderConfigurationRecord(e,t+4,r-4);else if(1===d)7===this._videoCodecId?this._parseAVCVideoData(e,t+4,r-4,i,n,o,h):this._parseHEVCVideoData(e,t+4,r-4,i,n,o,h);else if(2!==d)return void this._onError(_.a.FORMAT_ERROR,"Flv: Invalid video packet type "+d)}},n._parseAVCDecoderConfigurationRecord=function(e,t,r){if(r<7)a.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var i=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,r);if(i)void 0!==i.avcc&&a.a.w(this.TAG,"Found another AVCDecoderConfigurationRecord!");else{!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(i=this._videoMetadata={}).type="video",i.id=n.id,i.timescale=this._timescale,i.duration=this._duration;var u=s.getUint8(0),d=s.getUint8(1);s.getUint8(2),s.getUint8(3);if(1===u&&0!==d)if(this._naluLengthSize=1+(3&s.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var h=31&s.getUint8(5);if(0!==h){h>1&&a.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+h);for(var l=6,f=0;f<h;f++){var c=s.getUint16(l,!o);if(l+=2,0!==c){var p=new Uint8Array(e,t+l,c);this._AVC_SPS=new Uint8Array(c+4),l+=c,this._AVC_SPS.set(this._StartCode,0),this._AVC_SPS.set(p,4);var g=m.parseSPS(p);if(0===f){i.codecWidth=g.codec_size.width,i.codecHeight=g.codec_size.height,i.presentWidth=g.present_size.width,i.presentHeight=g.present_size.height,i.profile=g.profile_string,i.level=g.level_string,i.bitDepth=g.bit_depth,i.chromaFormat=g.chroma_format,i.sarRatio=g.sar_ratio,i.frameRate=g.frame_rate,!1!==g.frame_rate.fixed&&0!==g.frame_rate.fps_num&&0!==g.frame_rate.fps_den||(i.frameRate=this._referenceFrameRate);var y=i.frameRate.fps_den,b=i.frameRate.fps_num;i.refSampleDuration=i.timescale*(y/b);for(var v=p.subarray(1,4),w="avc1.",E=0;E<3;E++){var A=v[E].toString(16);A.length<2&&(A="0"+A),w+=A}i.codec=w;var S=this._mediaInfo;S.width=i.codecWidth,S.height=i.codecHeight,S.fps=i.frameRate.fps,S.profile=i.profile,S.level=i.level,S.refFrames=g.ref_frames,S.chromaFormat=g.chroma_format_string,S.sarNum=i.sarRatio.width,S.sarDen=i.sarRatio.height,S.videoCodec=w,S.hasAudio?null!=S.audioCodec&&(S.mimeType='video/x-flv; codecs="'+S.videoCodec+","+S.audioCodec+'"'):S.mimeType='video/x-flv; codecs="'+S.videoCodec+'"',S.isComplete()&&this._onMediaInfo(S)}}}var M=s.getUint8(l);if(0!==M){M>1&&a.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+M),l++;for(var T=0;T<M;T++){var R=s.getUint16(l,!o);if(l+=2,0!==R){var k=new Uint8Array(e,t+l,R);this._AVC_PPS=new Uint8Array(R+4),this._AVC_PPS.set(this._StartCode,0),this._AVC_PPS.set(k,4),l+=R}}i.avcc=new Uint8Array(r),i.avcc.set(new Uint8Array(e,t,r),0),a.a.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",i)}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(_.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(_.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}}},n._parseHEVCDecoderConfigurationRecord=function(e,t,r){if(r<7)a.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var i=this._videoMetadata,n=this._videoTrack,o=this._littleEndian,s=new DataView(e,t,r);i?void 0!==i.avcc&&a.a.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(i=this._videoMetadata={}).type="video",i.id=n.id,i.timescale=this._timescale,i.duration=this._duration);var u=s.getUint8(0),d=s.getUint8(1),h=s.getUint8(2),l=s.getUint8(3);if(0===u&&0===d&&0===h&&1===l);else{var f=22,c=s.getUint8(f);f+=1;for(var p=0;p<c;p++){var m=s.getUint8(f);f+=1;s.getUint16(f,!o);f+=2;var g=s.getUint16(f,!o);if(f+=2,32===m||160==m){var _=new Uint8Array(e,t+f,g);this._HEVC_VPS=new Uint8Array(g+4),this._HEVC_VPS.set(this._StartCode,0),this._HEVC_VPS.set(_,4)}else if(33===m||161==m){var y=new Uint8Array(e,t+f,g);this._HEVC_SPS=new Uint8Array(g+4),this._HEVC_SPS.set(this._StartCode,0),this._HEVC_SPS.set(y,4)}else if(34===m||162==m){var b=new Uint8Array(e,t+f,g);this._HEVC_PPS=new Uint8Array(g+4),this._HEVC_PPS.set(this._StartCode,0),this._HEVC_PPS.set(b,4)}else if(39===m){var v=new Uint8Array(e,t+f,g);console.log(" 265 sei = ",v)}f+=g}}this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1}},n._parseAVCVideoData=function(e,t,r,i,n,o,s){var u=0,d=this._littleEndian,h=new DataView(e,t,r),l=[],f=0,c=0,p=this._naluLengthSize,m=this._timestampBase+i,g=1===o,_=!0;for(7==this._videoCodecId&&("auto"!==this._config.decodeType&&"hard"!==this._config.decodeType||(_=!1));c<r;){if(c+4>=r){a.a.w(this.TAG,"Malformed Nalu near timestamp "+m+", offset = "+c+", dataSize = "+r);break}var y=h.getUint32(c,!d);if(3===p&&(y>>>=8),y>r-p)return void a.a.w(this.TAG,"Malformed Nalus near timestamp "+m+", NaluSize > DataSize!");if(5===(u=31&h.getUint8(c+p))&&(g=!0,l.length<1&&this._AVC_SPS&&this._AVC_SPS.length>0))if(_){var b={type:7,data:this._AVC_SPS};l.push(b),f+=b.data.length;var v={type:8,data:this._AVC_PPS};l.push(v),f+=v.data.length}else{var w=this._AVC_SPS.subarray(0,this._AVC_SPS.length),E=w.length-4;w[0]=E>>24,w[1]=E>>16,w[2]=E>>8,w[3]=255&E;var A={type:7,data:w};l.push(A),f+=A.data.length;var S=this._AVC_PPS.subarray(0,this._AVC_PPS.length),M=S.length-4;S[0]=M>>24,S[1]=M>>16,S[2]=M>>8,S[3]=255&M;var T={type:8,data:S};l.push(T),f+=T.data.length}if(6===u&&l.length<1){var R=h.getUint8(c+p+1);h.getUint8(c+p+4);if(100===R){for(var k=0,I=0,O=0;O<10;O++){var D=255&h.getUint8(c+p+1+1+I);if(I++,k+=D,255!==D)break}var x=void 0,C=null;(k>16||k>=3)&&(x=new Uint8Array(e,t+c+p+1+I+1,k-1),C=new TextDecoder("utf-8").decode(x)),this.sei_data=C}else this.sei_data=null}var P=new Uint8Array(e,t+c,p+y),N={type:u,data:P};l.push(N),f+=P.byteLength,c+=p+y}if(6===u&&"soft"!==this._config.decodeType)return console.log("{unitType:"+u+",decodeType:"+this._config.decodeType);if(l.length){var L=this._videoTrack,B={units:l,length:f,isKeyframe:g,dts:m,cts:s,pts:m+s,sei:this.deepClone(this.sei_data)};if(1===l.length)if(6===l[0].type)return;g&&(B.fileposition=n),L.samples.push(B),L.length+=f,this.sei_data=null}},n._makeH265Header=function(e){var t=2;switch(e){case 78:case 80:t=1;break;case 64:case 66:case 32:case 34:case 36:case 38:case 40:case 42:t=1}return t},n._parseHEVCVideoData=function(e,t,r,i,n,o,s){var u=this._littleEndian,d=new DataView(e,t,r),h=this._timestampBase+i,l=1===o,f=[],c=0;for(this._naluLengthSize;c<r;){if(c+4>=r){a.a.w(this.TAG,"Malformed Nalu near timestamp "+h+", offset = "+c+", dataSize = "+r);break}var p=d.getUint8(c),m=d.getUint8(c+1),g=d.getUint8(c+2),_=d.getUint8(c+3);if(0===p&&0===m&&0===g&&1===_);else{var y=d.getUint32(c,!u);c+=4;var b=d.getUint8(c);if(c+=1,y>r-4)return void a.a.w(this.TAG,"Malformed Nalus near timestamp "+h+", NaluSize > DataSize!");if(y+c-1>r)break;var v=d.getUint8(c-1),w=this._makeH265Header(v);if((32===v||34===v||36===v||38===v||40===v||42===v)&&f.length<1){if(this._HEVC_VPS){var E={type:5,data:this._HEVC_VPS};f.push(E),this._HEVC_VPS.length}if(this._HEVC_SPS){var A={type:6,data:this._HEVC_SPS};f.push(A),this._HEVC_SPS.length}if(this._HEVC_PPS){var S={type:7,data:this._HEVC_PPS};f.push(S),this._HEVC_PPS.length}}if(1===w&&this._HEVC_VPS&&this._HEVC_VPS[0],78!=b&&t+c-1-4>=0&&y>0){var M=new Uint8Array(e,t+c-1-4,y+4);M[0]=0,M[1]=0,M[2]=0,M[3]=1;var T={type:5,data:M};f.push(T),M.length}else if(78===b&&t+c-1-4>=0&&y>0){var R=new Uint8Array(e,t+c-1-4+4+3,y-5),k=new TextDecoder("utf-8").decode(R);this.sei_data=k.trim()}c+=y-1}}if(f.length){var I=this._videoTrack,O={units:f,length:0,isKeyframe:l,dts:h,cts:s,pts:h+s,sei:this.deepClone(this.sei_data)};l&&(O.fileposition=n),I.samples.push(O),I.length+=0,this.sei_data=null}},n._onDataAvailableToSoftwareDecodeVideo=function(e,t){var r=t.samples,i=-1;for(r.length>1&&(i=0);r.length;){for(var n=r.shift(),a=0,o=0;o<n.units.length;o++)a+=n.units[o].data.length;for(var s=0,u=new Uint8Array(a);n.units.length;){var d=n.units.shift();27===e&&(d.data[0]=0,d.data[1]=0,d.data[2]=0,d.data[3]=1),u.set(d.data,s),s+=d.data.length}this._onReceiveH265MediaFLVFrame&&(i>=0&&i++,this._onReceiveH265MediaFLVFrame("video",!0,1,e,n.isKeyframe,u,a,n.pts,0,0,0,n.sei))}},n._onDataAvailableToSoftwareDecodeAudio=function(e,t){var r=t.samples,i=-1;for(r.length>1&&(i=0);r.length;){var n=r.shift();this._onReceiveH265MediaFLVFrame&&(i>=0&&i++,this._onReceiveH265MediaFLVFrame("audio",!0,2,e,0,n.unit,n.length,n.pts,this._SampleRate,this._ChannelNum,this._SampleRate>=44100?32:16))}},n.deepClone=function(e){var t=Object.prototype.toString;if(!e||"object"!=typeof e)return e;if(e.nodeType&&"cloneNode"in e)return e.cloneNode(!0);if("[object Date]"===t.call(e))return new Date(e.getTime());if("[object RegExp]"===t.call(e)){var r=[];return e.global&&r.push("g"),e.multiline&&r.push("m"),e.ignoreCase&&r.push("i"),new RegExp(e.source,r.join(""))}var i=Array.isArray(e)?[]:e.constructor?new e.constructor:{};for(var n in e)i[n]=this.deepClone(e[n]);return i},t=e,(r=[{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e}},{key:"onMetaDataArrived",get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e}},{key:"onReceiveH265MediaFLVFrame",get:function(){return this._onReceiveH265MediaFLVFrame},set:function(e){this._onReceiveH265MediaFLVFrame=e}},{key:"onAudioError",get:function(){return this._onAudioError},set:function(e){this._onAudioError=e}},{key:"onReceiveSEIData",get:function(){return this._onReceiveSEIData},set:function(e){this._onReceiveSEIData=e}},{key:"onScriptDataArrived",get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e}},{key:"timestampBase",get:function(){return this._timestampBase},set:function(e){this._timestampBase=e}},{key:"overridedDuration",get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e}},{key:"overridedHasAudio",set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e}},{key:"overridedHasVideo",set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e}}])&&y(t.prototype,r),i&&y(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e,t,r){var i,n,a,o,s,u=navigator.userAgent.toLowerCase(),d=r,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];if(i=1+((192&e[t+2])>>>6),!((n=(60&e[t+2])>>>2)>h.length-1))return o=(1&e[t+2])<<2,o|=(192&e[t+3])>>>6,/firefox/i.test(u)?n>=6?(i=5,s=new Array(4),a=n-3):(i=2,s=new Array(2),a=n):-1!==u.indexOf("android")?(i=2,s=new Array(2),a=n):(i=5,s=new Array(4),r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&n>=6?a=n-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(n>=6&&1===o||/vivaldi/i.test(u))||!r&&1===o)&&(i=2,s=new Array(2)),a=n)),s[0]=i<<3,s[0]|=(14&n)>>1,s[1]|=(1&n)<<7,s[1]|=o<<3,5===i&&(s[1]|=(14&a)>>1,s[2]=(1&a)<<7,s[2]|=8,s[3]=0),{config:s,samplerate:h[n],channelCount:o,codec:"mp4a.40."+i,manifestCodec:d};console.log("ADTS parse fail. reason: 'invalid ADTS sampling index:${adtsSampleingIndex}'")}function w(e,t){return 255===e[t]&&240==(246&e[t+1])}function E(e,t){return 1&e[t+1]?7:9}function A(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function S(e,t){return!!(t+1<e.length&&w(e,t))}function M(e,t,r){return v(e,t,r)}function T(e){return 9216e4/e}function R(e,t,r,i,n){var a=function(e,t,r,i,n){var a,o,s=e.length;if(a=E(e,t),o=A(e,t),(o-=a)>0&&t+a+o<=s)return{headerLength:a,frameLength:o,stamp:r+i*n}}(t,r,i,n,T(e));if(a){var o=a.stamp,s=a.headerLength,u=a.frameLength;return{sample:{unit:t.subarray(r+s,r+s+u),pts:o,dts:o},length:u+s}}}var k=function(){function e(e){this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,i=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw new Error("no bytes available");i.set(e.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){var t,r=8,i=8;for(t=0;t<e;t++)0!==i&&(i=(r+this.readEG()+256)%256),r=0===i?r:i},t.readSPS=function(){var e,t,r,i,n,a,o,s=0,u=0,d=0,h=0,l=this.readUByte.bind(this),f=this.readBits.bind(this),c=this.readUEG.bind(this),p=this.readBoolean.bind(this),m=this.skipBits.bind(this),g=this.skipEG.bind(this),_=this.skipUEG.bind(this),y=this.skipScalingList.bind(this);if(l(),e=l(),f(5),m(3),l(),_(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var b=c();if(3===b&&m(1),_(),_(),m(1),p())for(a=3!==b?8:12,o=0;o<a;o++)p()&&y(o<6?16:64)}_();var v=c();if(0===v)c();else if(1===v)for(m(1),g(),g(),t=c(),o=0;o<t;o++)g();_(),m(1),r=c(),i=c(),0===(n=f(1))&&m(1),m(1),p()&&(s=c(),u=c(),d=c(),h=c());var w=[1,1];if(p()&&p())switch(l()){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:w=[l()<<8|l(),l()<<8|l()]}return{width:Math.ceil(16*(r+1)-2*s-2*u),height:(2-n)*(i+1)*16-(n?2:4)*(d+h),pixelRatio:w}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();function I(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var O=function(){function e(e,t,r){this.TAG="M3U8Demuxer",this._config=e,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._hasAudio=!1,this._hasVideo=!1,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._initVideoMetadata=!1,this._initAudioMetadata=!1,this._mediaInfo=new s.a,this._mediaInfo.hasAudio=!1,this._mediaInfo.hasVideo=!1,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this.tagPosition=0,this.filePosition=0,this.isHEVC=0,this.isAAC=0,this.avcTrackPid=-1,this.audioTrackPid=-1,this.id3TrackPid=-1,this.audioSampleRate=0,this.audioChannel=2,this.audioBitPerSample=16,this.avcTrackPesData=null,this.audioTrackPesData=null,this.id3TrackPesData=null,this.findKeyframe=!0,this.syncVideoPts=0,this.syncAudioPts=0,this.startVideoPts=0,this.startAudioPts=0,this.accurateTimeOffset=0,this.lastVideoPts=0,this.currentVideoPts=0,this.seekVideoHistoryPts=0,this.currentAudioPts=0,this.audioFrameNum=0,this.reset=0,this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._AVC_SPS=null,this._AVC_PPS=null,this._HEVC_VPS=null,this._HEVC_SPS=null,this._HEVC_PPS=null,this._StartCode=[0,0,0,1],this._AVC_Config=null,this._callbackInitFlag=!1,this._callbackMediaDataFunc=t,this._callbackMediaDataUserPtr=r,this._onReceiveH265MediaHLSFrame=null}var t,r,i,n=e.prototype;return n.bindDataSource=function(e){return e.onDataArrival=this.append.bind(this),this},n.resetMediaInfo=function(){this._mediaInfo=new s.a},n.resetMediaPts=function(e){this.reset=e,this.syncVideoPts=0,this.syncAudioPts=0,this.findKeyframe=!0,this._videoTrack.samples=[],this._audioTrack.samples=[]},n._onDataAvailableToSoftwareDecodeVideo=function(e,t){var r=t.samples;if(e<1&&r.length>0)console.log("EXCEPTION:: No used...");else{var i=-1;for(r.length>1&&(i=0);r.length;){for(var n=r.shift(),a=0,o=0;o<n.units.length;o++)a+=n.units[o].data.length;for(var s=0,u=new Uint8Array(a);n.units.length;){var d=n.units.shift();27==e&&(d.data[0]=0,d.data[1]=0,d.data[2]=0,d.data[3]=1),u.set(d.data,s),s+=d.data.length}this._onReceiveH265MediaHLSFrame&&(i>=0&&i++,this._onReceiveH265MediaHLSFrame("video",!0,1,e,n.isKeyframe,u,a,n.pts,0,0,0))}}},n._onDataAvailableToSoftwareDecodeAudio=function(e,t){var r=t.samples,i=-1;for(r.length>1&&(i=0);r.length;){var n=r.shift();this._onReceiveH265MediaHLSFrame&&(i>=0&&i++,this._onReceiveH265MediaHLSFrame("audio",!0,2,e,0,n.unit,n.length,n.pts,this._SampleRate,this._ChannelNum,this._SampleRate>=44100?32:16))}},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:RemuxerTrackIdConfig[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:"video"===e?0:void 0,isAAC:"audio"===e||void 0,duration:"audio"===e?t:void 0,isHEVC:0}},e._syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},n.destroy=function(){this._initPTS=this._initDTS=void 0,this._duration=0,this._onReceiveH265MediaHLSFrame=null},n.parsePAT=function(e,t){return(31&e[t+10])<<8|e[t+11]},n.parsePMT=function(e,t,r,i){var n,a,o={audio:-1,avc:-1,hevc:-1,id3:-1,isAAC:!0};for(n=t+3+((15&e[t+1])<<8|e[t+2])-4,t+=12+((15&e[t+10])<<8|e[t+11]);t<n;){switch(a=(31&e[t+1])<<8|e[t+2],e[t]){case 207:if(!i)break;case 15:-1===o.audio&&(o.audio=a);break;case 21:-1===o.id3&&(o.id3=a);break;case 219:if(!i){logger.log("unknown stream type:"+e[t]);break}case 27:-1===o.avc&&(o.avc=a),g.h("H264");break;case 36:-1===o.avc&&(o.avc=a,o.hevc=a),g.h("H265");break;case 3:case 4:r?-1===o.audio&&(o.audio=a,o.isAAC=!1):logger.log("MPEG audio found, not supported in this browser for now");break;case 36:console.warn("HEVC stream type found, not supported for now")}t+=5+((15&e[t+3])<<8|e[t+4])}return o},n.parsePES=function(e){if(1!==this.reset){var t,r,i,n,a,o,s,u,d=0,h=e.data;if(!e||0===e.size)return null;for(;h[0].length<19&&h.length>1;){var l=new Uint8Array(h[0].length+h[1].length);l.set(h[0]),l.set(h[1],h[0].length),h[0]=l,h.splice(1,1)}if(1===((t=h[0])[0]<<16)+(t[1]<<8)+t[2]){if((i=(t[4]<<8)+t[5])&&i>e.size-6)return null;if(192&(r=t[7])&&((o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2)>4294967295&&(o-=4294967295),64&r?((s=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>4294967295&&(s-=4294967295),o-s>54e5&&(console.warn(Math.round((o-s)/9e4)+"s delta between PTS and DTS, align them"),o=s)):s=o),u=(n=t[8])+9,e.size<=u)return null;e.size-=u,a=new Uint8Array(e.size);for(var f=0,c=h.length;f<c;f++){var p=(t=h[f]).byteLength;if(u){if(u>p){u-=p;continue}t=t.subarray(u),p-=u,u=0}a.set(t,d),d+=p}return i&&(i-=n+3),{data:a,pts:o,dts:s,len:i}}return null}},n.pushAccesUnit=function(e,t){if(e.units.length&&e.frame){var r=t.samples,i=r.length;if(isNaN(e.pts)){if(!i)return void t.dropped++;var n=r[i-1];e.pts=n.pts,e.dts=n.dts}!this.config.forceKeyFrameOnDiscontinuity||!0===e.key||t.sps&&(i||this.contiguous)?(e.id=i,r.push(e)):t.dropped++}e.debug.length&&logger.log(e.pts+"/"+e.dts+":"+e.debug)},n.parseAVCPES=function(e,t,r){var i=this,n=0;(0===this.startVideoPts||e.pts<this.startVideoPts)&&(this.startVideoPts=e.pts,n=1),this.audioFrameNum=0;var o=this._parseAVCNALu(e.data),s=[],u=0;e.data=null;var d=!1;o.forEach((function(t){var r=t.data.length,n=new Uint8Array(4+r);n[0]=r>>24&255,n[1]=r>>16&255,n[2]=r>>8&255,n[3]=255&r,n.set(t.data,4);var o={type:t.type,data:n};switch(u+=n.length,s.push(o),t.type){case 1:!0;break;case 5:!0,i.findKeyframe=!1,d=!0;break;case 6:!0;var h=new k(i.discardEPB(t.data));h.readUByte();for(var l=0,f=0,c=!1,p=0;!c&&h.bytesAvailable>1;){l=0;do{l+=p=h.readUByte()}while(255===p);f=0;do{f+=p=h.readUByte()}while(255===p);if(4===l&&0!==h.bytesAvailable){if(c=!0,181===h.readUByte())if(49===h.readUShort())if(1195456820===h.readUInt())if(3===h.readUByte()){for(var g=h.readUByte(),_=31&g,y=[g,h.readUByte()],b=0;b<_;b++)y.push(h.readUByte()),y.push(h.readUByte()),y.push(h.readUByte());i._insertSampleInOrder(i._txtTrack.samples,{type:3,pts:e.pts,bytes:y})}}else if(5===l&&0!==h.bytesAvailable){if(c=!0,f>16){for(var v=[],w=0;w<16;w++)v.push(h.readUByte().toString(16)),3!==w&&5!==w&&7!==w&&9!==w||v.push("-");for(var E=f-16,A=new Uint8Array(E),S=0;S<E;S++)A[S]=h.readUByte()}}else if(f<h.bytesAvailable)for(var M=0;M<f;M++)h.readUByte()}break;case 7:!0,!0,i.findKeyframe=!1,i.tagPosition=i.filePosition,i._AVC_Config=m.parseSPS(t.data);var T=i._AVC_Config,R="avc1.";if(T)for(var I=t.data.subarray(1,4),O=0;O<3;O++){var D=I[O].toString(16);D.length<2&&(D="0"+D),R+=D}if(!i._initVideoMetadata){null==i._AVC_SPS&&(i._AVC_SPS=new Uint8Array(t.data.length+4),i._AVC_SPS.set(i._StartCode,0),i._AVC_SPS.set(t.data,4));var x=i._videoMetadata,C=i._videoTrack;if(x?void 0!==x.avcc&&a.a.w(i.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===i._hasVideo&&!1===i._hasVideoFlagOverrided&&(i._hasVideo=!0,i._mediaInfo.hasVideo=!0),(x=i._videoMetadata={}).type="video",x.id=C.id,x.timescale=i._timescale,x.duration=i._duration),x.codecWidth=T.codec_size.width,x.codecHeight=T.codec_size.height,x.presentWidth=T.present_size.width,x.presentHeight=T.present_size.height,x.profile=T.profile_string,x.level=T.level_string,x.bitDepth=T.bit_depth,x.chromaFormat=T.chroma_format,x.sarRatio=T.sar_ratio,x.frameRate=T.frame_rate,!1!==T.frame_rate.fixed&&0!==T.frame_rate.fps_num&&0!==T.frame_rate.fps_den||(x.frameRate=i._referenceFrameRate),void 0!==x.frameRate){var P=x.frameRate.fps_den,N=x.frameRate.fps_num;x.refSampleDuration=x.timescale*(P/N)}x.codec=R;var L=i._mediaInfo;L.width=x.codecWidth,L.height=x.codecHeight,void 0!==x.frameRate&&(L.fps=x.frameRate.fps),L.profile=x.profile,L.level=x.level,L.refFrames=T.ref_frames,L.chromaFormat=T.chroma_format_string,L.sarNum=x.sarRatio.width,L.sarDen=x.sarRatio.height,L.videoCodec=R,L.hasAudio?null!=L.audioCodec&&(L.mimeType='video/x-flv; codecs="'+L.videoCodec+","+L.audioCodec+'"'):L.mimeType='video/x-flv; codecs="'+L.videoCodec+'"',L.isComplete()&&i._onMediaInfo(L)}break;case 8:if(!0,i.findKeyframe=!1,null==i._AVC_PPS&&(i._AVC_PPS=new Uint8Array(t.data.length+4),i._AVC_PPS.set(i._StartCode,0),i._AVC_PPS.set(t.data,4)),!i._initVideoMetadata){i._initVideoMetadata=!0;var B=i._videoMetadata;if(null==B.avcc){var F=0,U=i._AVC_SPS.length-4+8+1+2+(i._AVC_PPS.length-4);B.avcc=new Uint8Array(U+1),B.avcc[0]=1,B.avcc[1]=i._AVC_SPS[5],B.avcc[2]=i._AVC_SPS[6],B.avcc[3]=i._AVC_SPS[7],B.avcc[4]=255,B.avcc[5]=225,F=6;new Uint8Array;B.avcc[F++]=i._AVC_SPS.length-4>>8,B.avcc[F++]=i._AVC_SPS.length-4&255;var j=i._AVC_SPS.subarray(4,i._AVC_SPS.length);B.avcc.set(j,F),F+=j.length,B.avcc[F++]=1,B.avcc[F++]=i._AVC_PPS.length-4>>8,B.avcc[F++]=i._AVC_PPS.length-4&255;var H=i._AVC_PPS.subarray(4,i._AVC_PPS.length);B.avcc.set(H,F),F+=H.length,B.avcc[U]=1}i._onTrackMetadata("video",B)}break;case 9:case 12:default:!1}}));var h=(e.pts-this.startVideoPts)/90;d&&this.syncVideoPts<1&&(this.syncVideoPts=this.startVideoPts);var l=this._videoTrack,f={units:s,length:u,isKeyframe:d,dts:h,cts:0,pts:h};d&&(f.fileposition=this.tagPosition),0!==this.reset||this.findKeyframe||(l.samples.push(f),l.length+=u),this.filePosition+=u,this.accurateTimeOffset=f.pts,this.lastVideoPts=e.pts,1===n&&(this.seekVideoHistoryPts=h),t&&0===this.reset&&(console.log("this._config",this._config,this._config.decodeType),"auto"===this._config.decodeType||"hard"===this._config.decodeType?(this._onDataAvailable(this._audioTrack,this._videoTrack),console.log("_onDataAvailable",this._audioTrack,this._videoTrack)):(this._videoTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeVideo(27,this._videoTrack),this._audioTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeAudio(86018,this._audioTrack)))},n.parseHEVCPES=function(e,t,r){(0===this.startVideoPts||e.pts<this.startVideoPts)&&(this.startVideoPts=e.pts);var i=[],n=0,a={type:1,data:e.data},o=0;if((n+=e.data.length)>32)for(var s=0;s<32;s++)if(0===e.data[s]&&0===e.data[s+1]&&0===e.data[s+2]&&1===e.data[s+3]&&(64===e.data[s+4]||70===e.data[s+4])){o=1,this.findKeyframe=!1;break}i.push(a);var u=(e.pts-this.startVideoPts)/90;o&&this.syncVideoPts<1&&(this.syncVideoPts=this.startVideoPts);var d=this._videoTrack,h={units:i,length:n,isKeyframe:o,dts:u,cts:0,pts:u};o&&(h.fileposition=this.tagPosition),d.samples.push(h),d.length+=n,this._videoTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeVideo(173,this._videoTrack),this._audioTrack.samples.length>0&&this._onDataAvailableToSoftwareDecodeAudio(86018,this._audioTrack)},n._insertSampleInOrder=function(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var i=r-1;i>=0;i--)if(t.pts<e[i].pts){e.splice(i,0,t);break}}else e.push(t)},n._getLastNalUnit=function(){var e,t=this.avcSample;if(!t||0===t.units.length){var r=this._avcTrack.samples;t=r[r.length-1]}if(t){var i=t.units;e=i[i.length-1]}return e},n._parseAVCNALu=function(e){var t,r,i,n=0,a=e.byteLength,o=0,s=[],u=-1;for(-1===o&&(u=0,i=31&e[0],o=0,n=1);n<a;)if(t=e[n++],o)if(1!==o)if(t)if(1===t){if(u>=0)9!=(r={data:e.subarray(u,n-o-1),type:i}).type&&s.push(r);else;n<a?(u=n,i=31&e[n],o=0):o=-1}else o=0;else o=3;else o=t?0:2;else o=t?0:1;if(u>=0&&o>=0&&(r={data:e.subarray(u,a),type:i,state:o},s.push(r)),0===s.length){var d=this._getLastNalUnit();if(d){var h=new Uint8Array(d.data.byteLength+e.byteLength);h.set(d.data,0),h.set(e,d.data.byteLength),d.data=h}}return s},n.discardEPB=function(e){for(var t,r,i=e.byteLength,n=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(n.push(a+2),a+=2):a++;if(0===n.length)return e;t=i-n.length,r=new Uint8Array(t);var o=0;for(a=0;a<t;o++,a++)o===n[0]&&(o++,n.shift()),r[a]=e[o];return r},n.parseAACPES=function(e,t){0===this.startAudioPts&&(this.startAudioPts=e.pts);var r,i,n,o,s,u,d,h=this._audioTrack,l=e.data,f=e.pts,c=this.aacOverFlow,p=this.aacLastPTS;if(c){var m=new Uint8Array(c.byteLength+l.byteLength);m.set(c,0),m.set(l,c.byteLength),l=m}for(n=0,s=l.length;n<s-1&&!S(l,n);n++);if(n&&(n<s-1?(u="AAC PES did not start with ADTS header,offset:"+n,d=!1):(u="no ADTS header found in AAC PES",d=!0),logger.warn("parsing error:"+u),this.observer.trigger(Event.ERROR,{type:ErrorTypes.MEDIA_ERROR,details:ErrorDetails.FRAG_PARSING_ERROR,fatal:d,reason:u}),d))return;if(this.audioSampleRate<1){var g=M(l,n,this.audioCodec);if(g&&(this.audioSampleRate=g.samplerate,this.audioChannel=g.channelCount,this.audioBitPerSample=16,!this._initAudioMetadata)){this._initAudioMetadata=!0;var _=this._audioMetadata,y=this._audioTrack;_||((_=this._audioMetadata={}).type="audio",_.id=y.id,_.timescale=1e3,_.duration=0,_.audioSampleRate=this.audioSampleRate,_.channelCount=this.audioChannel),_.config&&a.a.w(this.TAG,"Found another AudioSpecificConfig!");g.config;_.audioSampleRate=g.samplerate,_.channelCount=g.channelCount,_.codec=g.codec,_.originalCodec=g.originalCodec,_.config=g.config,_.refSampleDuration=1024/_.audioSampleRate*_.timescale,this._SampleRate=g.samplerate,this._ChannelNum=g.channelCount,this._onDataAvailable(this._audioTrack,this._videoTrack),this._onTrackMetadata("audio",_);var b=this._mediaInfo;b.audioCodec=_.originalCodec,b.audioSampleRate=_.audioSampleRate,b.audioChannelCount=_.channelCount,b.hasVideo?null!=b.videoCodec&&(b.mimeType='video/x-flv; codecs="'+b.videoCodec+","+b.audioCodec+'"'):b.mimeType='video/x-flv; codecs="'+b.audioCodec+'"',b.isComplete()&&this._onMediaInfo(b)}}if(i=0,r=T(this.audioSampleRate),c&&p){var v=p+r;Math.abs(v-f)>1&&(console.log("AAC: align PTS for overlapping frames by "+Math.round((v-f)/90)),f=v)}for(;n<s;)if(S(l,n)&&n+5<s){var w=R(this.audioSampleRate,l,n,f,i);if(!w)break;var E=Math.round((w.sample.pts-this.startAudioPts)/90),A={unit:w.sample.unit,length:w.length,dts:E,pts:E};0!==this.reset||this.findKeyframe||(this.syncAudioPts<1&&this.syncVideoPts>0&&(this.syncAudioPts=this.syncVideoPts),this.syncAudioPts>0&&(h.samples.push(A),h.length+=w.length)),n+=w.length,o=w.sample.pts,i++}else n++;c=n<s?l.subarray(n,s):null,this.aacOverFlow=c,this.aacLastPTS=o},n.parseMPEGPES=function(e){for(var t=e.data,r=t.length,i=0,n=0,a=e.pts;n<r;)if(MpegAudio.isHeader(t,n)){var o=MpegAudio.appendFrame(this._audioTrack,t,n,a,i);if(!o)break;n+=o.length,i++}else n++},n.append=function(t,r,i){if(null!=t&&1!==this.reset){var n,a,o,s,u,d,h=t.length,l=!1,f=-1,c=-1,p=-1,m=this.avcTrackPesData,g=this.audioTrackPesData,_=this.id3TrackPesData,y=!1,b=e._syncOffset(t);for(h-=(h+b)%188,n=b;n<h;n+=188)if(71===t[n]){if(a=!!(64&t[n+1]),o=((31&t[n+1])<<8)+t[n+2],(48&t[n+3])>>4>1){if((s=n+5+t[n+4])===n+188)continue}else s=n+4;switch(o){case f:a&&(m&&(u=this.parsePES(m))&&(1===this.isHEVC?this.parseHEVCPES(u,!1,i):this.parseAVCPES(u,!1,i)),m={data:[],size:0}),m&&(m.data.push(t.subarray(s,n+188)),m.size+=n+188-s);break;case c:a&&(g&&(u=this.parsePES(g))&&(this.isAAC?this.parseAACPES(u,!1):this.parseMPEGPES(u)),g={data:[],size:0}),g&&(g.data.push(t.subarray(s,n+188)),g.size+=n+188-s);break;case p:a&&(_&&(u=this.parsePES(_))&&parseID3PES(u),_={data:[],size:0}),_&&(_.data.push(t.subarray(s,n+188)),_.size+=n+188-s);break;case 0:a&&(s+=t[s]+1),d=this.parsePAT(t,s);break;case d:a&&(s+=t[s]+1);var v=this.parsePMT(t,s,!1,!1);f=v.avc,v.hevc>0&&(f=v.hevc,this.isHEVC=1),f>0&&(this.avcTrackPid=f),!this._callbackInitFlag&&this._callbackMediaDataFunc&&(this._callbackInitFlag=!0,1===this.isHEVC||"auto"!==this._config.decodeType&&"hard"!==this._config.decodeType||this._callbackMediaDataFunc(this._callbackMediaDataUserPtr,!1,1,0,0,null,0,0,0,0)),(c=v.audio)>0&&(this.audioTrackPid=c,this.isAAC=v.isAAC),(p=v.id3)>0&&(this.id3TrackPid=p),l&&!y&&(console.log("reparse from beginning"),l=!1,n=b-188),y=!0;break;case 17:case 8191:break;default:l=!0}}else console.log("parse error... reason: 'TS packet did not start with 0x47'");m&&(u=this.parsePES(m))?(1==this.isHEVC?this.parseHEVCPES(u,!0,i):this.parseAVCPES(u,!0,i),this.avcTrackPesData=null):this.avcTrackPesData=m,g&&(u=this.parsePES(g))?(this.isAAC?this.parseAACPES(u,!0):this.parseMPEGPES(u),this.audioTrackPesData=null):(g&&g.size&&logger.log("last AAC PES packet truncated,might overlap between fragments"),this.audioTrackPesData=g),_&&(u=this.parsePES(_))?(parseID3PES(u),this.id3TrackPesData=null):this.id3TrackPesData=_}},t=e,(r=[{key:"onReceiveH265MediaHLSFrame",get:function(){return this._onReceiveH265MediaHLSFrame},set:function(e){this._onReceiveH265MediaHLSFrame=e}},{key:"onTrackMetadata",get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e}},{key:"onMediaInfo",get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e}},{key:"onMetaDataArrived",get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e}},{key:"onScriptDataArrived",get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onDataAvailable",get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e}},{key:"timestampBase",get:function(){return this._timestampBase},set:function(e){this._timestampBase=e}},{key:"overridedDuration",get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e}},{key:"overridedHasAudio",set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e}},{key:"overridedHasVideo",set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e}}])&&I(t.prototype,r),i&&I(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),D=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=e.constants={};r.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),r.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),r.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),r.STSC=r.STCO=r.STTS,r.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),r.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),r.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),r.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length,a=0;a<n;a++)t+=i[a].byteLength;(r=new Uint8Array(t))[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);for(var o=8,s=0;s<n;s++)r.set(i[s],o),o+=i[s].byteLength;return r},e.generateInitSegment=function(t){var r=e.box(e.types.ftyp,e.constants.FTYP),i=e.moov(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n},e.moov=function(t){var r=e.mvhd(t.timescale,t.duration),i=e.trak(t),n=e.mvex(t);return e.box(e.types.moov,r,i,n)},e.mvhd=function(t,r){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,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var r=t.id,i=t.duration,n=t.presentWidth,a=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,a>>>8&255,255&a,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 r=t.timescale,i=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))},e.hdlr=function(t){var r=null;return r="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,r)},e.minf=function(t){var r=null;return r="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,r,e.dinf(),e.stbl(t))},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)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var r=t.channelCount,i=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types[".mp3"],n)},e.mp4a=function(t){var r=t.channelCount,i=t.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,r,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return e.box(e.types.mp4a,n,e.esds(t))},e.esds=function(t){var r=t.config||[],i=r.length,n=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(r).concat([6,1,2]));return e.box(e.types.esds,n)},e.avc1=function(t){var r=t.avcc,i=t.codecWidth,n=t.codecHeight,a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,i>>>8&255,255&i,n>>>8&255,255&n,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,a,e.box(e.types.avcC,r))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var r=t.id,i=new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,i)},e.moof=function(t,r){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,r))},e.mfhd=function(t){var r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,r)},e.traf=function(t,r){var i=t.id,n=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),a=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),o=e.sdtp(t),s=e.trun(t,o.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,n,a,s,o)},e.sdtp=function(t){for(var r=t.samples||[],i=r.length,n=new Uint8Array(4+i),a=0;a<i;a++){var o=r[a].flags;n[a+4]=o.isLeading<<6|o.dependsOn<<4|o.isDependedOn<<2|o.hasRedundancy}return e.box(e.types.sdtp,n)},e.trun=function(t,r){var i=t.samples||[],n=i.length,a=12+16*n,o=new Uint8Array(a);r+=8+a,o.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0);for(var s=0;s<n;s++){var u=i[s].duration,d=i[s].size,h=i[s].flags,l=i[s].cts;o.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.isNonSync,0,0,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*s)}return e.box(e.types.trun,o)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();D.init();var x=D,C=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}(),P=r(21),N=r(16);function L(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var B=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===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 N.c("audio"),this._videoSegmentInfoList=new N.c("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!o.a.chrome||!(o.a.version.major<50||50===o.a.version.major&&o.a.version.build<2661)),this._fillSilentAfterSeek=o.a.msedge||o.a.msie,this._mp3UseMpegAudio=!o.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap,this._recordWorker=null,this._findKeyframe=!0,this._initRecordFlag=!1,this._recordFileName="record.mp4"}var t,r,i,n=e.prototype;return n.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,this._recordWorker&&(this._recordWorker.terminate(),this._recordWorker=null)},n.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},n.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},n.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},n.remux=function(e,t){if(!this._onMediaSegment)throw new l.a("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)},n._onTrackMetadataReceived=function(e,t){var r=null,i="mp4",n=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(i="mpeg",n="",r=new Uint8Array):r=x.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,r=x.generateInitSegment(t)}if(!this._onInitSegment)throw new l.a("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:r.buffer,codec:n,container:e+"/"+i,mediaDuration:t.duration})},n._calculateDtsBase=function(e,t){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},n.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,r={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(r.samples.push(e),r.length=e.length);var i={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(i.samples.push(t),i.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(r,!0),this._remuxAudio(i,!0)},n._remuxAudio=function(e,t){if(null!=this._audioMeta){var r,i=e,n=i.samples,s=void 0,u=-1,d=this._audioMeta.refSampleDuration,h="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,l=this._dtsBaseInited&&void 0===this._audioNextDts,f=!1;if(n&&0!==n.length&&(1!==n.length||t)){if(!g.c())for(var c=0;c<n.length;c++)n.shift();var p=0,m=null,_=0;h?(p=0,_=i.length):(p=8,_=8+i.length);var y=null;if(n.length>1&&(_-=(y=n.pop()).length),null!=this._audioStashedLastSample){var b=this._audioStashedLastSample;this._audioStashedLastSample=null,n.unshift(b),_+=b.length}null!=y&&(this._audioStashedLastSample=y);var v=n[0].dts-this._dtsBase;if(this._audioNextDts)s=v-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())s=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(f=!0);else{var w=this._audioSegmentInfoList.getLastSampleBefore(v);if(null!=w){var E=v-(w.originalDts+w.duration);E<=3&&(E=0),s=v-(w.dts+w.duration+E)}else s=0}if(f){var A=v-s,S=this._videoSegmentInfoList.getLastSegmentBefore(v);if(null!=S&&S.beginDts<A){var M=C.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(M){var T=S.beginDts,R=A-S.beginDts;a.a.v(this.TAG,"InsertPrefixSilentAudio: dts: "+T+", duration: "+R),n.unshift({unit:M,dts:T,pts:T}),_+=M.byteLength}}else f=!1}for(var k=[],I=0;I<n.length;I++){var O=n[I],D=O.unit,P=O.dts-this._dtsBase,L=P,B=!1,F=null,U=0;if(!(P<-.001)){if("mp3"!==this._audioMeta.codec){var j=P;if(this._audioNextDts&&(j=this._audioNextDts),(s=P-j)<=-3*d){a.a.w(this.TAG,"Dropping 1 audio frame (originalDts: "+P+" ms ,curRefDts: "+j+" ms) due to dtsCorrection: "+s+" ms overlap.");continue}if(s>=3*d&&this._fillAudioTimestampGap&&!o.a.safari){B=!0;var H=Math.floor(s/d);a.a.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+P+" ms, curRefDts: "+j+" ms, dtsCorrection: "+Math.round(s)+" ms, generate: "+H+" frames"),L=Math.floor(j),U=Math.floor(j+d)-L;var X=C.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);null==X&&(a.a.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),X=D),F=[];for(var W=0;W<H;W++){j+=d;var V=Math.floor(j),z=Math.floor(j+d)-V,q={dts:V,pts:V,cts:0,unit:X,size:X.byteLength,duration:z,originalDts:P,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};F.push(q),_+=q.size}this._audioNextDts=j+d}else L=Math.floor(j),U=Math.floor(j+d)-L,this._audioNextDts=j+d}else{if(L=P-s,I!==n.length-1)U=n[I+1].dts-this._dtsBase-s-L;else if(null!=y)U=y.dts-this._dtsBase-s-L;else U=k.length>=1?k[k.length-1].duration:Math.floor(d);this._audioNextDts=L+U}if(-1===u&&(u=L),this._initRecordFlag&&this._recordWorker&&!this._findKeyframe){var G=new Uint8Array(O.unit),Q={cmd:g.q,mediaType:"audio",dat:G,pts:L};this._recordWorker.postMessage(Q,[Q.dat.buffer])}k.push({dts:L,pts:L,cts:0,unit:O.unit,size:O.unit.byteLength,duration:U,originalDts:P,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),B&&k.push.apply(k,F)}}if(0===k.length)return i.samples=[],void(i.length=0);h?m=new Uint8Array(_):((m=new Uint8Array(_))[0]=_>>>24&255,m[1]=_>>>16&255,m[2]=_>>>8&255,m[3]=255&_,m.set(x.types.mdat,4));for(var Y=0;Y<k.length;Y++){var K=k[Y].unit;m.set(K,p),p+=K.byteLength}var J=k[k.length-1];r=J.dts+J.duration;var Z=new N.b;Z.beginDts=u,Z.endDts=r,Z.beginPts=u,Z.endPts=r,Z.originalBeginDts=k[0].originalDts,Z.originalEndDts=J.originalDts+J.duration,Z.firstSample=new N.d(k[0].dts,k[0].pts,k[0].duration,k[0].originalDts,!1),Z.lastSample=new N.d(J.dts,J.pts,J.duration,J.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Z),i.samples=k,i.sequenceNumber++;var $=null;$=h?new Uint8Array:x.moof(i,u),i.samples=[],i.length=0;var ee={type:"audio",data:this._mergeBoxes($,m).buffer,sampleCount:k.length,info:Z};h&&l&&(ee.timestampOffset=u),this._onMediaSegment("audio",ee)}}},n._remuxVideo=function(e,t){if(null!=this._videoMeta){var r,i,n=e,a=n.samples,o=void 0,s=-1,u=-1;if(a&&0!==a.length&&(1!==a.length||t)){var d=8,h=null,l=8+e.length,f=null;if(a.length>1&&(l-=(f=a.pop()).length),null!=this._videoStashedLastSample){var c=this._videoStashedLastSample;this._videoStashedLastSample=null,a.unshift(c),l+=c.length}null!=f&&(this._videoStashedLastSample=f);var p=a[0].dts-this._dtsBase;if(this._videoNextDts)o=p-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())o=0;else{var m=this._videoSegmentInfoList.getLastSampleBefore(p);if(null!=m){var _=p-(m.originalDts+m.duration);_<=3&&(_=0),o=p-(m.dts+m.duration+_)}else o=0}for(var y=new N.b,b=[],v=0;v<a.length;v++){var w=a[v],E=w.dts-this._dtsBase,A=w.isKeyframe,S=E-o,M=w.cts,T=S+M;-1===s&&(s=S,u=T);var R=0;if(v!==a.length-1)R=a[v+1].dts-this._dtsBase-o-S;else if(null!=f)R=f.dts-this._dtsBase-o-S;else R=b.length>=1?b[b.length-1].duration:Math.floor(this._videoMeta.refSampleDuration);if(A){var k=new N.d(S,T,R,w.dts,!0);k.fileposition=w.fileposition,y.appendSyncPoint(k),this._findKeyframe=!1}b.push({dts:S,pts:T,cts:M,units:w.units,size:w.length,isKeyframe:A,duration:R,originalDts:E,flags:{isLeading:0,dependsOn:A?2:1,isDependedOn:A?1:0,hasRedundancy:0,isNonSync:A?0:1}})}if(this._initRecordFlag&&this._recordWorker&&!this._findKeyframe)for(var I=!1,O=0;O<a.length;O++){var D=a[O],C=D.units[0].data.length;if(D.units.length>=3)for(var P=1;P<D.units.length;P++){if(6===D.units.length){if(P<4)continue;if(5===D.units.length&&P<3)continue}C+=D.units[P].data.length}I=D.isKeyframe;var L=new Uint8Array(D.units[0].data),B=0,F=new Uint8Array(C);if(F.set(L,0),F[0]=0,F[1]=0,F[2]=0,F[3]=1,B+=L.length,D.units.length>=3)for(var U=1;U<D.units.length;U++)if(!(6===D.units.length&&U<4||5===D.units.length&&U<3)){var j=new Uint8Array(D.units[U].data);F.set(j,B),F[B+0]=0,F[B+1]=0,F[B+2]=0,F[B+3]=1,B+=j.length}var H={cmd:g.q,mediaType:"video",codecId:28,type:I,dat:F,pts:D.dts};this._recordWorker.postMessage(H,[H.dat.buffer])}(h=new Uint8Array(l))[0]=l>>>24&255,h[1]=l>>>16&255,h[2]=l>>>8&255,h[3]=255&l,h.set(x.types.mdat,4);for(var X=0;X<b.length;X++)for(var W=b[X].units;W.length;){var V=W.shift().data;h.set(V,d),d+=V.byteLength}var z=b[b.length-1];if(r=z.dts+z.duration,i=z.pts+z.duration,this._videoNextDts=r,y.beginDts=s,y.endDts=r,y.beginPts=u,y.endPts=i,y.originalBeginDts=b[0].originalDts,y.originalEndDts=z.originalDts+z.duration,y.firstSample=new N.d(b[0].dts,b[0].pts,b[0].duration,b[0].originalDts,b[0].isKeyframe),y.lastSample=new N.d(z.dts,z.pts,z.duration,z.originalDts,z.isKeyframe),this._isLive||this._videoSegmentInfoList.append(y),n.samples=b,n.sequenceNumber++,this._forceFirstIDR){var q=b[0].flags;q.dependsOn=2,q.isNonSync=0}var G=x.moof(n,s);n.samples=[],n.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(G,h).buffer,sampleCount:b.length,info:y})}}},n._mergeBoxes=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(e,0),r.set(t,e.byteLength),r},n.videoRecording=function(e,t,r,i){if(1===r){if(this._recordFileName=e,null!=this._recordWorker)return-1e3;this._findKeyframe=!0;try{this._recordWorker=P(67),this.onwmsg=this._onRecordingWorkerMessage.bind(this);var n={cmd:g.w,url:g.g(),filesize:t,audioSamplerate:this._audioMeta?this._audioMeta.audioSampleRate:0,channelCount:this._audioMeta?this._audioMeta.channelCount:1};this._recordWorker.postMessage(n),this._recordWorker.addEventListener("message",this.onwmsg)}catch(e){this.recordWorker=null}}else this._initRecordFlag=!1,this._recordWorker&&(this._recordWorker.postMessage({cmd:g.C}),this._findKeyframe=!0)},n._onRecordingWorkerMessage=function(e){var t=e.data;switch(t.cmd){case g.w:this._findKeyframe=!0,this._initRecordFlag=!0;break;case g.p:this._initRecordFlag=!1;var r=document.createElement("a");r.style.display="none",r.href=t.dat,r.download=this._recordFileName,document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(r.href),document.body.removeChild(r),this._findKeyframe=!1,this._recordWorker.terminate(),this._recordWorker=null}},t=e,(r=[{key:"onInitSegment",get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e}},{key:"onMediaSegment",get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e}}])&&L(t.prototype,r),i&&L(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),F=r(37),U=r(2),j=(r(3),function(){function e(e,t){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;this._mediaDataSource.segments.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,this._onReceiveH265MediaFrameFuc=null,this._mediaTypeIsHLS=e.url.includes(".m3u8")}var t=e.prototype;return t.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},t.on=function(e,t){this._emitter.addListener(e,t)},t.off=function(e,t){this._emitter.removeListener(e,t)},t.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},t._loadSegment=function(e,t){this._currentSegmentIndex=e;var r=this._mediaDataSource.segments[e],i=this._ioctl=new F.a(r,this._config,e);i.onError=this._onIOException.bind(this),i.onSeeked=this._onIOSeeked.bind(this),i.onComplete=this._onIOComplete.bind(this),i.onRedirect=this._onIORedirect.bind(this),i.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):i.onDataArrival=this._onInitChunkArrival.bind(this),i.open(t),i.loaderChunkArrival=this._loaderChunkArrival.bind(this),i.loaderHLSError=this._loaderHLSError.bind(this)},t._loaderChunkArrival=function(e){this._emitter.emit("loaderChunkArrival",e)},t._loaderHLSError=function(){this._emitter.emit("hls_error")},t.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},t._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},t.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},t.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},t.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var r=this._mediaInfo.segments[t];if(null==r)this._pendingSeekTime=e;else{var i=r.getNearestKeyframe(e);this._remuxer.seek(i.milliseconds),this._ioctl.seek(i.fileposition),this._pendingResolveSeekPoint=i.milliseconds}}else{var n=this._mediaInfo.segments[t];if(null==n)this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t);else{var a=n.getNearestKeyframe(e);this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,a.fileposition),this._pendingResolveSeekPoint=a.milliseconds,this._reportSegmentMediaInfo(t)}}this._enableStatisticsReporter()}},t._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,r=t.length-1,i=0;i<t.length;i++)if(e<t[i].timestampBase){r=i-1;break}return r},t._onInitChunkArrival=function(e,t){var r=this;this._emitter.emit(U.a.RECORDING,e);var i=null,n=0;if(this._mediaTypeIsHLS){if(null==e&&t<0)return void this._emitter.emit(U.a.RECONNECT_ING,t);if(null==e&&t>0)return;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,this._demuxer.append(e,t,0),n=e.length;else{this._demuxer=new O(this._config),this._remuxer||(this._remuxer=new B(this._config));var o=this._mediaDataSource;null==o.duration||isNaN(o.duration)||(this._demuxer.overridedDuration=o.duration),"boolean"==typeof o.hasAudio&&(this._demuxer.overridedHasAudio=o.hasAudio),"boolean"==typeof o.hasVideo&&(this._demuxer.overridedHasVideo=o.hasVideo),this._demuxer.timestampBase=o.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onReceiveH265MediaHLSFrame=this._onReceiveH265MediaFrameFuc,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),this._demuxer.append(e,t,0),n=e.length}}else if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(e,t);else if((i=b.probe(e)).match){this._demuxer=new b(i,this._config),this._remuxer||(this._remuxer=new B(this._config));var s=this._mediaDataSource;null==s.duration||isNaN(s.duration)||(this._demuxer.overridedDuration=s.duration),"boolean"==typeof s.hasAudio&&(this._demuxer.overridedHasAudio=s.hasAudio),"boolean"==typeof s.hasVideo&&(this._demuxer.overridedHasVideo=s.hasVideo),this._mediaDataSource.hasAudio=!1,this._demuxer.timestampBase=s.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onReceiveSEIData=this._onReceiveSEIData.bind(this),this._demuxer.onAudioError=this._onAudioError.bind(this),this._demuxer.onReceiveH265MediaFLVFrame=this._onReceiveH265MediaFrameFuc,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),n=this._demuxer.parseChunks(e,t)}else i=null,a.a.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then((function(){r._internalAbort()})),this._emitter.emit(U.a.DEMUX_ERROR,_.a.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),n=0;return n},t._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,s.a.prototype));var r=Object.assign({},e);Object.setPrototypeOf(r,s.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=r,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},t._onMetaDataArrived=function(e){this._emitter.emit(U.a.METADATA_ARRIVED,e)},t._onAudioError=function(){this._emitter.emit(U.a.AUDIO_ERROR)},t._onReceiveSEIData=function(e){this._emitter.emit(U.a.SEI_DATA,e)},t._onScriptDataArrived=function(e){this._emitter.emit(U.a.SCRIPTDATA_ARRIVED,e)},t._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},t._onIOComplete=function(e,t){var r=e+1;r<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(r)):(t&&"socket-close"===t&&this._emitter.emit(U.a.SOCKET_CLOSE),this._remuxer.flushStashedSamples(),this._emitter.emit(U.a.LOADING_COMPLETE),this._disableStatisticsReporter())},t._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},t._onIORecoveredEarlyEof=function(){this._emitter.emit(U.a.RECOVERED_EARLY_EOF)},t._onIOException=function(e,t){a.a.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(U.a.IO_ERROR,e,t),this._disableStatisticsReporter()},t._onDemuxException=function(e,t){a.a.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(U.a.DEMUX_ERROR,e,t)},t._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(U.a.INIT_SEGMENT,e,t)},t._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(U.a.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var r=t.info.syncPoints,i=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,o.a.safari&&r.length>0&&r[0].originalDts===i&&(i=r[0].pts),this._emitter.emit(U.a.RECOMMEND_SEEKPOINT,i)}},t._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},t._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},t._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],r=Object.assign({},t);r.duration=this._mediaInfo.duration,r.segmentCount=this._mediaInfo.segmentCount,delete r.segments,delete r.keyframesIndex,this._emitter.emit(U.a.MEDIA_INFO,r)},t._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(U.a.STATISTICS_INFO,e)},t.setReceiveH265MediaFrame=function(e){this._onReceiveH265MediaFrameFuc=e},t._getHLSTotalDuration=function(){if(null==this._ioctl)return 0;var e=this._ioctl._getM3u8Loader();return e?e._getM3u8TotalDuration():0},t._seekToSecs=function(e,t){var r=this._ioctl._getM3u8Loader();r&&(r.seek(e,t),this._demuxer&&this._demuxer.resetMediaPts(1)),this._remuxer&&this._remuxer.seek(0),r&&this._demuxer&&this._demuxer.resetMediaPts(0)},t.videoRecording=function(e,t,r,i){this._remuxer&&this._remuxer.videoRecording(e,t,r,i)},e}());t.a=j},function(e,t,r){"use strict";var i=r(0);function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var a=function(){function e(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}var t,r,i,a=e.prototype;return a.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},a.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())},t=e,(r=[{key:"currentKBps",get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024}},{key:"lastSecondKBps",get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}},{key:"averageKBps",get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024}}])&&n(t.prototype,r),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}(),o=r(3),s=r(7),u=r(4);function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){var t,r;function i(t,r){var i;return(i=e.call(this,"fetch-stream-loader")||this).TAG="FetchStreamLoader",i._seekHandler=t,i._config=r,i._needStash=!0,i._requestAbort=!1,i._contentLength=null,i._receivedLength=0,i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,d(t,r),i.isSupported=function(){try{var e=s.a.msedge&&s.a.version.minor>=15048,t=!s.a.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}};var n=i.prototype;return n.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},n.open=function(e,t){var r=this;this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var n=this._seekHandler.getConfig(i,t),a=new self.Headers;if("object"==typeof n.headers){var s=n.headers;for(var d in s)s.hasOwnProperty(d)&&a.append(d,s[d])}var h={method:"GET",headers:a,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var l in this._config.headers)a.append(l,this._config.headers[l]);!1===e.cors&&(h.mode="same-origin"),e.withCredentials&&(h.credentials="include"),e.referrerPolicy&&(h.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,h.signal=this._abortController.signal),this._status=o.c.kConnecting,self.fetch(n.url,h).then((function(e){if(r._requestAbort)return r._status=o.c.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==n.url&&r._onURLRedirect){var t=r._seekHandler.removeURLParameters(e.url);r._onURLRedirect(t)}var i=e.headers.get("Content-Length");return null!=i&&(r._contentLength=parseInt(i),0!==r._contentLength&&r._onContentLengthKnown&&r._onContentLengthKnown(r._contentLength)),r._pump.call(r,e.body.getReader())}if(r._status=o.c.kError,!r._onError)throw new u.d("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);r._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!r._abortController||!r._abortController.signal.aborted){if(r._status=o.c.kError,!r._onError)throw e;r._onError(o.b.EXCEPTION,{code:-1,msg:e.message})}}))},n.abort=function(){if(this._requestAbort=!0,(this._status!==o.c.kBuffering||!s.a.chrome)&&this._abortController)try{this._abortController.abort()}catch(e){}},n._pump=function(e){var t=this;return e.read().then((function(r){if(r.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.c.kError;var i=o.b.EARLY_EOF,n={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new u.d(n.msg);t._onError(i,n)}else t._status=o.c.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.c.kComplete);if(!0===t._requestAbort)return t._status=o.c.kComplete,e.cancel();t._status=o.c.kBuffering;var a=r.value.buffer,s=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,s,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.c.kComplete;else if(11!==e.code||!s.a.msedge){t._status=o.c.kError;var r=0,i=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(r=o.b.EXCEPTION,i={code:e.code,msg:e.message}):(r=o.b.EARLY_EOF,i={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new u.d(i.msg);t._onError(r,i)}}))},i}(o.a),l=r(21),f=r(1);function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=function(e){var t,r;function i(){var t;return(t=e.call(this,"m3u8-loader")||this).TAG="M3U8Loader",t._needStash=!0,t.url="",t.startPlayTime=0,t._requestAbort=!1,t._receivedLength=0,t.getNextFileFlag=!0,t.pauseDisplay=!1,t.totalDuration=0,t.seeking=!1,t.downloadWorker=null,t}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,c(t,r),i.isSupported=function(){return!0};var n=i.prototype;return n.destroy=function(){this.abort(),e.prototype.destroy.call(this),this.downloadWorker&&this.downloadWorker.terminate(),this.downloadWorker=null},n.createDownloadWorker=function(){if(!this.downloadWorker)if("undefined"!=typeof Worker)try{this.downloadWorker=l(231),this.onwmsg=this.onWorkerMessage.bind(this);var e={cmd:f.w,url:this.url,time:this.startPlayTime};this.downloadWorker.postMessage(e),this.downloadWorker.addEventListener("message",this.onwmsg),this.downloadWorker.onerror=function(e){}}catch(e){this.downloadWorker&&this.downloadWorker.terminate(),this.downloadWorker=null}else console.log("Unsupport worker...")},n.setStartPlaySecs=function(e){this.startPlayTime=e},n.open=function(e){try{this.url=e.url,this.createDownloadWorker(),this._status=o.c.kConnecting}catch(e){this._status=o.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new u.d(t.msg);this._onError(o.b.EXCEPTION,t)}},n.abort=function(){var e={cmd:f.l};this.downloadWorker&&void 0!==this.downloadWorker&&this.downloadWorker.postMessage(e),this._status=o.c.kComplete},n._onWebSocketOpen=function(e){this._status=o.c.kBuffering},n._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},n.seek=function(e,t){this.pauseDisplay=!1;var r={cmd:f.B,type:t,time:e};this.downloadWorker&&void 0!==this.downloadWorker&&(this.downloadWorker.postMessage(r),this.seeking=!0)},n.pause=function(){this.pauseDisplay=!0;var e={cmd:f.x};this.downloadWorker&&void 0!==this.downloadWorker&&this.downloadWorker.postMessage(e)},n.resume=function(){this.pauseDisplay=!1;var e={cmd:f.A};this.downloadWorker&&void 0!==this.downloadWorker&&this.downloadWorker.postMessage(e)},n.onWorkerMessage=function(e){var t=e.data;switch(t.cmd){case f.w:var r={cmd:f.s,t:0};this.downloadWorker.postMessage(r);break;case f.t:this.getNextFileFlag=!0;break;case f.r:this.playComplete=!0;break;case f.o:r={cmd:f.y};this.downloadWorker.postMessage(r);break;case f.l:t.workerId==f.b?(this.downloadWorker&&this.downloadWorker.terminate(),this.downloadWorker=null):t.workerId==f.a?(this.decodeWorker&&this.decodeWorker.terminate(),this.decodeWorker=null,this.soundPlayer&&(this.soundPlayer.destroy(),delete this.soundPlayer,this.soundPlayer=null),this.webGLPlayer&&this.webGLPlayer.renderVideoFrame(null,0,0)):t.workerId==f.f&&(this.renderWorker.terminate(),this.renderWorker=null);break;case f.q:if(t.workerId==f.b){var i=t.dat,n=this._receivedLength;this._receivedLength+=i.byteLength,this._onDataArrival&&this._onDataArrival(i,n,this._receivedLength);break}if(t.workerId==f.a){if(this.pauseDisplay)break;1==t.mediaType?(this.canvas.width=t.width,this.canvas.height=t.height,this.webGLPlayer.renderVideoFrame(t.dat,t.width,t.height),this.OnUpdatePlayInfo(t.playTimeSec,t.frameNum)):2==t.mediaType&&(null==this.soundPlayer&&this.OpenAudioPlayer(t.fmt,t.ch,t.samplerate),null!=this.soundPlayer&&this.soundPlayer.play(t.dat))}break;case f.u:this.totalDuration=t.duration,f.i(t.live);break;case f.s:this.pauseDisplay||this.getNextFileFlag&&(this.downloadWorker.postMessage(t),this.getNextFileFlag=!1);break;case f.B:this.seeking=!1;break;case f.z:this._onDataArrival&&(this._receivedLength=0,this._onDataArrival(null,t.fileSequence,0));break;case 404:this._onHLSError()}},n._dispatchArrayBuffer=function(e){var t=e,r=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,r,this._receivedLength)},n._onWebSocketError=function(e){this._status=o.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new u.d(t.msg);this._onError(o.b.EXCEPTION,t)},n._getM3u8TotalDuration=function(){return this.totalDuration},i}(o.a);function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=function(e){var t,r;function n(t,r){var i;return(i=e.call(this,"xhr-moz-chunked-loader")||this).TAG="MozChunkedLoader",i._seekHandler=t,i._config=r,i._needStash=!0,i._xhr=null,i._requestAbort=!1,i._contentLength=null,i._receivedLength=0,i}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,m(t,r),n.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 i.a.w("MozChunkedLoader",e.message),!1}};var a=n.prototype;return a.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)},a.open=function(e,t){this._dataSource=e,this._range=t;var r=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(r=e.redirectedURL);var i=this._seekHandler.getConfig(r,t);this._requestURL=i.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",i.url,!0),n.responseType="moz-chunked-arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onloadend=this._onLoadEnd.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof i.headers){var a=i.headers;for(var s in a)a.hasOwnProperty(s)&&n.setRequestHeader(s,a[s])}if("object"==typeof this._config.headers){var u=this._config.headers;for(var d in u)u.hasOwnProperty(d)&&n.setRequestHeader(d,u[d])}this._status=o.c.kConnecting,n.send()},a.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.c.kComplete},a._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var r=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(r)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=o.c.kError,!this._onError)throw new u.d("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.c.kBuffering}},a._onProgress=function(e){if(this._status!==o.c.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,r,this._receivedLength)}},a._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.c.kError&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},a._onXhrError=function(e){this._status=o.c.kError;var t=0,r=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.b.EARLY_EOF,r={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.b.EXCEPTION,r={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.d(r.msg);this._onError(t,r)},n}(o.a);function _(e,t){return(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}o.a;function y(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var v=function(e){var t,r;function n(t,r){var i;return(i=e.call(this,"xhr-range-loader")||this).TAG="RangeLoader",i._seekHandler=t,i._config=r,i._needStash=!1,i._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],i._currentChunkSizeKB=384,i._currentSpeedNormalized=0,i._zeroSpeedChunkCount=0,i._xhr=null,i._speedSampler=new a,i._requestAbort=!1,i._waitForTotalLength=!1,i._totalLengthReceived=!1,i._currentRequestURL=null,i._currentRedirectedURL=null,i._currentRequestRange=null,i._totalLength=null,i._contentLength=null,i._receivedLength=0,i._lastTimeLoaded=0,i}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,b(t,r),n.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch(e){return i.a.w("RangeLoader",e.message),!1}};var s,d,h,l=n.prototype;return l.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)},l.open=function(e,t){this._dataSource=e,this._range=t,this._status=o.c.kConnecting;var r=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(r=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||r?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},l._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,r=t+e;null!=this._contentLength&&r-this._range.from>=this._contentLength&&(r=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:r},this._internalOpen(this._dataSource,this._currentRequestRange)},l._internalOpen=function(e,t){this._lastTimeLoaded=0;var r=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?r=this._currentRedirectedURL:null!=e.redirectedURL&&(r=e.redirectedURL));var i=this._seekHandler.getConfig(r,t);this._currentRequestURL=i.url;var n=this._xhr=new XMLHttpRequest;if(n.open("GET",i.url,!0),n.responseType="arraybuffer",n.onreadystatechange=this._onReadyStateChange.bind(this),n.onprogress=this._onProgress.bind(this),n.onload=this._onLoad.bind(this),n.onerror=this._onXhrError.bind(this),e.withCredentials&&(n.withCredentials=!0),"object"==typeof i.headers){var a=i.headers;for(var o in a)a.hasOwnProperty(o)&&n.setRequestHeader(o,a[o])}if("object"==typeof this._config.headers){var s=this._config.headers;for(var u in s)s.hasOwnProperty(u)&&n.setRequestHeader(u,s[u])}n.send()},l.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=o.c.kComplete},l._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)},l._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var r=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&r!==this._currentRedirectedURL&&(this._currentRedirectedURL=r,this._onURLRedirect&&this._onURLRedirect(r))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=o.c.kBuffering}else{if(this._status=o.c.kError,!this._onError)throw new u.d("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.b.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},l._onProgress=function(e){if(this._status!==o.c.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var r=e.total;this._internalAbort(),null!=r&0!==r&&(this._totalLength=r)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var i=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(i)}},l._normalizeSpeed=function(e){var t=this._chunkSizeKBList,r=t.length-1,i=0,n=0,a=r;if(e<t[0])return t[0];for(;n<=a;){if((i=n+Math.floor((a-n)/2))===r||e>=t[i]&&e<t[i+1])return t[i];t[i]<e?n=i+1:a=i-1}},l._onLoad=function(e){if(this._status!==o.c.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 r=this._normalizeSpeed(t);this._currentSpeedNormalized!==r&&(this._currentSpeedNormalized=r,this._currentChunkSizeKB=r)}var i=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=i.byteLength;var a=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():a=!0,this._onDataArrival&&this._onDataArrival(i,n,this._receivedLength),a&&(this._status=o.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},l._onXhrError=function(e){this._status=o.c.kError;var t=0,r=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=o.b.EARLY_EOF,r={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=o.b.EXCEPTION,r={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new u.d(r.msg);this._onError(t,r)},s=n,(d=[{key:"currentSpeed",get:function(){return this._speedSampler.lastSecondKBps}}])&&y(s.prototype,d),h&&y(s,h),Object.defineProperty(s,"prototype",{writable:!1}),n}(o.a);function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var E=function(e){var t,r;function i(){var t;return(t=e.call(this,"websocket-loader")||this).TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,w(t,r),i.isSupported=function(){try{return void 0!==self.WebSocket}catch(e){return!1}};var n=i.prototype;return n.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},n.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=o.c.kConnecting}catch(e){this._status=o.c.kError;var r={code:e.code,msg:e.message};if(!this._onError)throw new u.d(r.msg);this._onError(o.b.EXCEPTION,r)}},n.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=o.c.kComplete},n._onWebSocketOpen=function(e){this._status=o.c.kBuffering},n._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=o.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1,"socket-close")):this._requestAbort=!1},n._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var r=new FileReader;r.onload=function(){t._dispatchArrayBuffer(r.result)},r.readAsArrayBuffer(e.data)}else{this._status=o.c.kError;var i={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new u.d(i.msg);this._onError(o.b.EXCEPTION,i)}},n._dispatchArrayBuffer=function(e){var t=e,r=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,r,this._receivedLength)},n._onWebSocketError=function(e){this._status=o.c.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new u.d(t.msg);this._onError(o.b.EXCEPTION,t)},i}(o.a),A=function(){function e(e){this._zeroStart=e||!1}var t=e.prototype;return t.getConfig=function(e,t){var r,i={};0!==t.from||-1!==t.to?(r=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=r):this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},t.removeURLParameters=function(e){return e},e}(),S=function(){function e(e,t){this._startName=e,this._endName=t}var t=e.prototype;return t.getConfig=function(e,t){var r=e;if(0!==t.from||-1!==t.to){var i=!0;-1===r.indexOf("?")&&(r+="?",i=!1),i&&(r+="&"),r+=this._startName+"="+t.from.toString(),-1!==t.to&&(r+="&"+this._endName+"="+t.to.toString())}return{url:r,headers:{}}},t.removeURLParameters=function(e){var t=e.split("?")[0],r=void 0,i=e.indexOf("?");-1!==i&&(r=e.substring(i+1));var n="";if(null!=r&&r.length>0)for(var a=r.split("&"),o=0;o<a.length;o++){var s=a[o].split("="),u=o>0;s[0]!==this._startName&&s[0]!==this._endName&&(u&&(n+="&"),n+=a[o])}return 0===n.length?t:t+"?"+n},e}(),M=r(8),T=r.n(M);function R(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var k=function(){function e(e,t,r){this.TAG="IOController",this._emitter=new T.a,this._config=t,this._extraData=r,this._stashInitialSize=393216,null!=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,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._isHLSURL=e.url&&e.url.includes(".m3u8"),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 a,this._speedNormalizeList=[64,128,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._loaderChunkArrival=null,this._loaderHLSError=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}var t,r,n,s=e.prototype;return s.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.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._loaderChunkArrival=null,this._loaderHLSError=null,this._extraData=null},s.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},s.isPaused=function(){return this._paused},s._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new A(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",r=e.seekParamEnd||"bend";this._seekHandler=new S(t,r)}else{if("custom"!==e.seekType)throw new u.b("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new u.b("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},s._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isHLSURL)this._loaderClass=p;else if(this._isWebSocketURL)this._loaderClass=E;else if(h.isSupported())this._loaderClass=h;else if(g.isSupported())this._loaderClass=g;else{if(!v.isSupported())throw new u.d("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=v}},s._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),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),this._loader.onHLSError=this._onLoaderHLSError.bind(this)},s.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},s.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},s.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},s.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},s.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},s._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var r={from:e,to:-1};this._currentRange={from:r.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,r),this._onSeeked&&this._onSeeked()},s.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new u.b("Url must be a non-empty string!");this._dataSource.url=e},s._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var r=new ArrayBuffer(t);if(this._stashUsed>0){var i=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(r,0,t).set(i,0)}this._stashBuffer=r,this._bufferSize=t}},s._normalizeSpeed=function(e){var t=this._speedNormalizeList,r=t.length-1,i=0,n=0,a=r;if(e<t[0])return t[0];for(;n<=a;){if((i=n+Math.floor((a-n)/2))===r||e>=t[i]&&e<t[i+1])return t[i];t[i]<e?n=i+1:a=i-1}},s._adjustStashSize=function(e){var t=0;(t=this._config.isLive||e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var r=1024*t+1048576;this._bufferSize<r&&this._expandBuffer(r),this._stashSize=1024*t},s._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},s._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},s._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},s._onLoaderChunkArrival=function(e,t,r){if(this._loaderChunkArrival&&this._loaderChunkArrival(e),!this._onDataArrival)throw new u.a("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused&&(this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),e)){this._speedSampler.addBytes(e.byteLength);var i=this._speedSampler.lastSecondKBps;if(0!==i){var n=this._normalizeSpeed(i);this._speedNormalized!==n&&(this._speedNormalized=n,this._adjustStashSize(n))}if(this._isHLSURL&&(this._enableStash=!1),this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize){new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var a=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){var o=this._stashBuffer.slice(0,this._stashUsed),s=this._dispatchChunks(o,this._stashByteStart);if(s<o.byteLength){if(s>0){var d=new Uint8Array(o,s);a.set(d,0),this._stashUsed=d.byteLength,this._stashByteStart+=s}}else this._stashUsed=0,this._stashByteStart+=s;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{var h=this._dispatchChunks(e,t);if(h<e.byteLength){var l=e.byteLength-h;l>this._bufferSize&&(this._expandBuffer(l),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,h),0),this._stashUsed+=l,this._stashByteStart=t+h}}}else if(0===this._stashUsed){var f=this._dispatchChunks(e,t);if(f<e.byteLength){var c=e.byteLength-f;c>this._bufferSize&&this._expandBuffer(c),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(e,f),0),this._stashUsed+=c,this._stashByteStart=t+f}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);var p=new Uint8Array(this._stashBuffer,0,this._bufferSize);p.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;var m=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(m<this._stashUsed&&m>0){var g=new Uint8Array(this._stashBuffer,m);p.set(g,0)}this._stashUsed-=m,this._stashByteStart+=m}}},s._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),r=this._dispatchChunks(t,this._stashByteStart),n=t.byteLength-r;if(r<t.byteLength){if(!e){if(r>0){var a=new Uint8Array(this._stashBuffer,0,this._bufferSize),o=new Uint8Array(t,r);a.set(o,0),this._stashUsed=o.byteLength,this._stashByteStart+=r}return 0}i.a.w(this.TAG,n+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,n}return 0},s._onLoaderComplete=function(e,t,r){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData,r)},s._onLoaderHLSError=function(){this._loaderHLSError()},s._onLoaderError=function(e,t){switch(i.a.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.b.UNRECOVERABLE_EARLY_EOF),e){case o.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var r=this._currentRange.to+1;return void(r<this._totalLength&&(i.a.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(r,!1)))}e=o.b.UNRECOVERABLE_EARLY_EOF;break;case o.b.UNRECOVERABLE_EARLY_EOF:case o.b.CONNECTING_TIMEOUT:case o.b.HTTP_STATUS_CODE_INVALID:case o.b.EXCEPTION:}if(!this._onError)throw new u.d("IOException: "+t.msg);this._onError(e,t)},s._getM3u8Loader=function(){return this._isHLSURL?this._loader:null},t=e,(r=[{key:"status",get:function(){return this._loader.status}},{key:"extraData",get:function(){return this._extraData},set:function(e){this._extraData=e}},{key:"onDataArrival",get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e}},{key:"loaderChunkArrival",get:function(){return this._loaderChunkArrival},set:function(e){this._loaderChunkArrival=e}},{key:"loaderHLSError",get:function(){return this._loaderHLSError},set:function(e){this._loaderHLSError=e}},{key:"onSeeked",get:function(){return this._onSeeked},set:function(e){this._onSeeked=e}},{key:"onError",get:function(){return this._onError},set:function(e){this._onError=e}},{key:"onComplete",get:function(){return this._onComplete},set:function(e){this._onComplete=e}},{key:"onRedirect",get:function(){return this._onRedirect},set:function(e){this._onRedirect=e}},{key:"onRecoveredEarlyEof",get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e}},{key:"currentURL",get:function(){return this._dataSource.url}},{key:"hasRedirect",get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL}},{key:"currentRedirectedURL",get:function(){return this._redirectedURL||this._dataSource.redirectedURL}},{key:"currentSpeed",get:function(){return this._loaderClass===v?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}},{key:"averageKBps",get:function(){return this._speedSampler.averageKBps}},{key:"loaderType",get:function(){return this._loader.type}}])&&R(t.prototype,r),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.a=k},function(e,t,r){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,r,i,n){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,r)}));case 3:return t.nextTick((function(){e.call(null,r,i)}));case 4:return t.nextTick((function(){e.call(null,r,i,n)}));default:for(a=new Array(s-1),o=0;o<a.length;)a[o++]=arguments[o];return t.nextTick((function(){e.apply(null,a)}))}}}:e.exports=t}).call(this,r(9))},function(e,t,r){var i=r(6).Buffer;function n(e){i.isBuffer(e)||(e=i.from(e));for(var t=e.length/4|0,r=new Array(t),n=0;n<t;n++)r[n]=e.readUInt32BE(4*n);return r}function a(e){for(;0<e.length;e++)e[0]=0}function o(e,t,r,i,n){for(var a,o,s,u,d=r[0],h=r[1],l=r[2],f=r[3],c=e[0]^t[0],p=e[1]^t[1],m=e[2]^t[2],g=e[3]^t[3],_=4,y=1;y<n;y++)a=d[c>>>24]^h[p>>>16&255]^l[m>>>8&255]^f[255&g]^t[_++],o=d[p>>>24]^h[m>>>16&255]^l[g>>>8&255]^f[255&c]^t[_++],s=d[m>>>24]^h[g>>>16&255]^l[c>>>8&255]^f[255&p]^t[_++],u=d[g>>>24]^h[c>>>16&255]^l[p>>>8&255]^f[255&m]^t[_++],c=a,p=o,m=s,g=u;return a=(i[c>>>24]<<24|i[p>>>16&255]<<16|i[m>>>8&255]<<8|i[255&g])^t[_++],o=(i[p>>>24]<<24|i[m>>>16&255]<<16|i[g>>>8&255]<<8|i[255&c])^t[_++],s=(i[m>>>24]<<24|i[g>>>16&255]<<16|i[c>>>8&255]<<8|i[255&p])^t[_++],u=(i[g>>>24]<<24|i[c>>>16&255]<<16|i[p>>>8&255]<<8|i[255&m])^t[_++],[a>>>=0,o>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],a=[[],[],[],[]],o=0,s=0,u=0;u<256;++u){var d=s^s<<1^s<<2^s<<3^s<<4;d=d>>>8^255&d^99,r[o]=d,i[d]=o;var h=e[o],l=e[h],f=e[l],c=257*e[d]^16843008*d;n[0][o]=c<<24|c>>>8,n[1][o]=c<<16|c>>>16,n[2][o]=c<<8|c>>>24,n[3][o]=c,c=16843009*f^65537*l^257*h^16843008*o,a[0][d]=c<<24|c>>>8,a[1][d]=c<<16|c>>>16,a[2][d]=c<<8|c>>>24,a[3][d]=c,0===o?o=s=1:(o=h^e[e[e[f^h]]],s^=e[e[s]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:a}}();function d(e){this._key=n(e),this._reset()}d.blockSize=16,d.keySize=32,d.prototype.blockSize=d.blockSize,d.prototype.keySize=d.keySize,d.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=4*(r+1),n=[],a=0;a<t;a++)n[a]=e[a];for(a=t;a<i;a++){var o=n[a-1];a%t==0?(o=o<<8|o>>>24,o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o],o^=s[a/t|0]<<24):t>6&&a%t==4&&(o=u.SBOX[o>>>24]<<24|u.SBOX[o>>>16&255]<<16|u.SBOX[o>>>8&255]<<8|u.SBOX[255&o]),n[a]=n[a-t]^o}for(var d=[],h=0;h<i;h++){var l=i-h,f=n[l-(h%4?0:4)];d[h]=h<4||l<=4?f:u.INV_SUB_MIX[0][u.SBOX[f>>>24]]^u.INV_SUB_MIX[1][u.SBOX[f>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[f>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&f]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=d},d.prototype.encryptBlockRaw=function(e){return o(e=n(e),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},d.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},d.prototype.decryptBlock=function(e){var t=(e=n(e))[1];e[1]=e[3],e[3]=t;var r=o(e,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),a=i.allocUnsafe(16);return a.writeUInt32BE(r[0],0),a.writeUInt32BE(r[3],4),a.writeUInt32BE(r[2],8),a.writeUInt32BE(r[1],12),a},d.prototype.scrub=function(){a(this._keySchedule),a(this._invKeySchedule),a(this._key)},e.exports.AES=d},function(e,t,r){var i=r(6).Buffer,n=r(44);e.exports=function(e,t,r,a){if(i.isBuffer(e)||(e=i.from(e,"binary")),t&&(i.isBuffer(t)||(t=i.from(t,"binary")),8!==t.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=r/8,s=i.alloc(o),u=i.alloc(a||0),d=i.alloc(0);o>0||a>0;){var h=new n;h.update(d),h.update(e),t&&h.update(t),d=h.digest();var l=0;if(o>0){var f=s.length-o;l=Math.min(o,d.length),d.copy(s,f,0,l),o-=l}if(l<d.length&&a>0){var c=u.length-a,p=Math.min(a,d.length-l);d.copy(u,c,l,l+p),a-=p}}return d.fill(0),{key:s,iv:u}}},function(e,t,r){"use strict";var i=r(11),n=r(15),a=n.getNAF,o=n.getJSF,s=n.assert;function u(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function d(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),i=a(t,1,this._bitLength),n=(1<<r.step+1)-(r.step%2==0?2:1);n/=3;var o,u,d=[];for(o=0;o<i.length;o+=r.step){u=0;for(var h=o+r.step-1;h>=o;h--)u=(u<<1)+i[h];d.push(u)}for(var l=this.jpoint(null,null,null),f=this.jpoint(null,null,null),c=n;c>0;c--){for(o=0;o<d.length;o++)(u=d[o])===c?f=f.mixedAdd(r.points[o]):u===-c&&(f=f.mixedAdd(r.points[o].neg()));l=l.add(f)}return l.toP()},u.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=a(t,r,this._bitLength),u=this.jpoint(null,null,null),d=o.length-1;d>=0;d--){for(var h=0;d>=0&&0===o[d];d--)h++;if(d>=0&&h++,u=u.dblp(h),d<0)break;var l=o[d];s(0!==l),u="affine"===e.type?l>0?u.mixedAdd(n[l-1>>1]):u.mixedAdd(n[-l-1>>1].neg()):l>0?u.add(n[l-1>>1]):u.add(n[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,i,n){var s,u,d,h=this._wnafT1,l=this._wnafT2,f=this._wnafT3,c=0;for(s=0;s<i;s++){var p=(d=t[s])._getNAFPoints(e);h[s]=p.wnd,l[s]=p.points}for(s=i-1;s>=1;s-=2){var m=s-1,g=s;if(1===h[m]&&1===h[g]){var _=[t[m],null,null,t[g]];0===t[m].y.cmp(t[g].y)?(_[1]=t[m].add(t[g]),_[2]=t[m].toJ().mixedAdd(t[g].neg())):0===t[m].y.cmp(t[g].y.redNeg())?(_[1]=t[m].toJ().mixedAdd(t[g]),_[2]=t[m].add(t[g].neg())):(_[1]=t[m].toJ().mixedAdd(t[g]),_[2]=t[m].toJ().mixedAdd(t[g].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],b=o(r[m],r[g]);for(c=Math.max(b[0].length,c),f[m]=new Array(c),f[g]=new Array(c),u=0;u<c;u++){var v=0|b[0][u],w=0|b[1][u];f[m][u]=y[3*(v+1)+(w+1)],f[g][u]=0,l[m]=_}}else f[m]=a(r[m],h[m],this._bitLength),f[g]=a(r[g],h[g],this._bitLength),c=Math.max(f[m].length,c),c=Math.max(f[g].length,c)}var E=this.jpoint(null,null,null),A=this._wnafT4;for(s=c;s>=0;s--){for(var S=0;s>=0;){var M=!0;for(u=0;u<i;u++)A[u]=0|f[u][s],0!==A[u]&&(M=!1);if(!M)break;S++,s--}if(s>=0&&S++,E=E.dblp(S),s<0)break;for(u=0;u<i;u++){var T=A[u];0!==T&&(T>0?d=l[u][T-1>>1]:T<0&&(d=l[u][-T-1>>1].neg()),E="affine"===d.type?E.mixedAdd(d):E.add(d))}}for(s=0;s<i;s++)l[s]=null;return n?E:E.toP()},u.BasePoint=d,d.prototype.eq=function(){throw new Error("Not implemented")},d.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){e=n.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},d.prototype.encodeCompressed=function(e){return this.encode(e,!0)},d.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},d.prototype.encode=function(e,t){return n.encode(this._encode(t),e)},d.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},d.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},d.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var a=0;a<e;a++)i=i.dbl();r.push(i)}return{step:e,points:r}},d.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},d.prototype._getBeta=function(){return null},d.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},function(e,t,r){var i=r(213),n=r(220),a=r(221),o=r(53),s=r(88),u=r(6).Buffer;function d(e){var t;"object"!=typeof e||u.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=u.from(e));var r,d,h=a(e,t),l=h.tag,f=h.data;switch(l){case"CERTIFICATE":d=i.certificate.decode(f,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(d||(d=i.PublicKey.decode(f,"der")),r=d.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPublicKey.decode(d.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return d.subjectPrivateKey=d.subjectPublicKey,{type:"ec",data:d};case"1.2.840.10040.4.1":return d.algorithm.params.pub_key=i.DSAparam.decode(d.subjectPublicKey.data,"der"),{type:"dsa",data:d.algorithm.params};default:throw new Error("unknown key id "+r)}case"ENCRYPTED PRIVATE KEY":f=function(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),a=n[e.algorithm.decrypt.cipher.algo.join(".")],d=e.algorithm.decrypt.cipher.iv,h=e.subjectPrivateKey,l=parseInt(a.split("-")[1],10)/8,f=s.pbkdf2Sync(t,r,i,l,"sha1"),c=o.createDecipheriv(a,f,d),p=[];return p.push(c.update(h)),p.push(c.final()),u.concat(p)}(f=i.EncryptedPrivateKey.decode(f,"der"),t);case"PRIVATE KEY":switch(r=(d=i.PrivateKey.decode(f,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return i.RSAPrivateKey.decode(d.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:d.algorithm.curve,privateKey:i.ECPrivateKey.decode(d.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return d.algorithm.params.priv_key=i.DSAparam.decode(d.subjectPrivateKey,"der"),{type:"dsa",params:d.algorithm.params};default:throw new Error("unknown key id "+r)}case"RSA PUBLIC KEY":return i.RSAPublicKey.decode(f,"der");case"RSA PRIVATE KEY":return i.RSAPrivateKey.decode(f,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:i.DSAPrivateKey.decode(f,"der")};case"EC PRIVATE KEY":return{curve:(f=i.ECPrivateKey.decode(f,"der")).parameters.value,privateKey:f.privateKey};default:throw new Error("unknown key type "+l)}}e.exports=d,d.signature=i.signature},function(e,t,r){"use strict";var i=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])}return t},"function"!=typeof self.Promise&&r(124).polyfill()},e}();i.install(),t.a=i},function(e,t,r){"use strict";var i=r(5),n=r(72),a=r(6).Buffer,o=new Array(16);function s(){n.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(e,t){return e<<t|e>>>32-t}function d(e,t,r,i,n,a,o){return u(e+(t&r|~t&i)+n+a|0,o)+t|0}function h(e,t,r,i,n,a,o){return u(e+(t&i|r&~i)+n+a|0,o)+t|0}function l(e,t,r,i,n,a,o){return u(e+(t^r^i)+n+a|0,o)+t|0}function f(e,t,r,i,n,a,o){return u(e+(r^(t|~i))+n+a|0,o)+t|0}i(s,n),s.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,i=this._b,n=this._c,a=this._d;r=d(r,i,n,a,e[0],3614090360,7),a=d(a,r,i,n,e[1],3905402710,12),n=d(n,a,r,i,e[2],606105819,17),i=d(i,n,a,r,e[3],3250441966,22),r=d(r,i,n,a,e[4],4118548399,7),a=d(a,r,i,n,e[5],1200080426,12),n=d(n,a,r,i,e[6],2821735955,17),i=d(i,n,a,r,e[7],4249261313,22),r=d(r,i,n,a,e[8],1770035416,7),a=d(a,r,i,n,e[9],2336552879,12),n=d(n,a,r,i,e[10],4294925233,17),i=d(i,n,a,r,e[11],2304563134,22),r=d(r,i,n,a,e[12],1804603682,7),a=d(a,r,i,n,e[13],4254626195,12),n=d(n,a,r,i,e[14],2792965006,17),r=h(r,i=d(i,n,a,r,e[15],1236535329,22),n,a,e[1],4129170786,5),a=h(a,r,i,n,e[6],3225465664,9),n=h(n,a,r,i,e[11],643717713,14),i=h(i,n,a,r,e[0],3921069994,20),r=h(r,i,n,a,e[5],3593408605,5),a=h(a,r,i,n,e[10],38016083,9),n=h(n,a,r,i,e[15],3634488961,14),i=h(i,n,a,r,e[4],3889429448,20),r=h(r,i,n,a,e[9],568446438,5),a=h(a,r,i,n,e[14],3275163606,9),n=h(n,a,r,i,e[3],4107603335,14),i=h(i,n,a,r,e[8],1163531501,20),r=h(r,i,n,a,e[13],2850285829,5),a=h(a,r,i,n,e[2],4243563512,9),n=h(n,a,r,i,e[7],1735328473,14),r=l(r,i=h(i,n,a,r,e[12],2368359562,20),n,a,e[5],4294588738,4),a=l(a,r,i,n,e[8],2272392833,11),n=l(n,a,r,i,e[11],1839030562,16),i=l(i,n,a,r,e[14],4259657740,23),r=l(r,i,n,a,e[1],2763975236,4),a=l(a,r,i,n,e[4],1272893353,11),n=l(n,a,r,i,e[7],4139469664,16),i=l(i,n,a,r,e[10],3200236656,23),r=l(r,i,n,a,e[13],681279174,4),a=l(a,r,i,n,e[0],3936430074,11),n=l(n,a,r,i,e[3],3572445317,16),i=l(i,n,a,r,e[6],76029189,23),r=l(r,i,n,a,e[9],3654602809,4),a=l(a,r,i,n,e[12],3873151461,11),n=l(n,a,r,i,e[15],530742520,16),r=f(r,i=l(i,n,a,r,e[2],3299628645,23),n,a,e[0],4096336452,6),a=f(a,r,i,n,e[7],1126891415,10),n=f(n,a,r,i,e[14],2878612391,15),i=f(i,n,a,r,e[5],4237533241,21),r=f(r,i,n,a,e[12],1700485571,6),a=f(a,r,i,n,e[3],2399980690,10),n=f(n,a,r,i,e[10],4293915773,15),i=f(i,n,a,r,e[1],2240044497,21),r=f(r,i,n,a,e[8],1873313359,6),a=f(a,r,i,n,e[15],4264355552,10),n=f(n,a,r,i,e[6],2734768916,15),i=f(i,n,a,r,e[13],1309151649,21),r=f(r,i,n,a,e[4],4149444226,6),a=f(a,r,i,n,e[11],3174756917,10),n=f(n,a,r,i,e[2],718787259,15),i=f(i,n,a,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+a|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=a.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e},e.exports=s},function(e,t,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this,r(13))},function(e,t,r){"use strict";var i=r(25).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}e.exports=function e(t,r,a){if("function"==typeof r)return e(t,null,r);r||(r={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}(a||n);var o=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||h()},d=t._writableState&&t._writableState.finished,h=function(){s=!1,d=!0,o||a.call(t)},l=t._readableState&&t._readableState.endEmitted,f=function(){o=!1,l=!0,s||a.call(t)},c=function(e){a.call(t,e)},p=function(){var e;return o&&!l?(t._readableState&&t._readableState.ended||(e=new i),a.call(t,e)):s&&!d?(t._writableState&&t._writableState.ended||(e=new i),a.call(t,e)):void 0},m=function(){t.req.on("finish",h)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",u),t.on("close",u)):(t.on("complete",h),t.on("abort",p),t.req?m():t.on("request",m)),t.on("end",f),t.on("finish",h),!1!==r.error&&t.on("error",c),t.on("close",p),function(){t.removeListener("complete",h),t.removeListener("abort",p),t.removeListener("request",m),t.req&&t.req.removeListener("finish",h),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",h),t.removeListener("end",f),t.removeListener("error",c),t.removeListener("close",p)}}},function(e,t,r){"use strict";var i=r(10).Buffer,n=r(5),a=r(72),o=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],d=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],l=[0,1518500249,1859775393,2400959708,2840853838],f=[1352829926,1548603684,1836072691,2053994217,0];function c(){a.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<<t|e>>>32-t}function m(e,t,r,i,n,a,o,s){return p(e+(t^r^i)+a+o|0,s)+n|0}function g(e,t,r,i,n,a,o,s){return p(e+(t&r|~t&i)+a+o|0,s)+n|0}function _(e,t,r,i,n,a,o,s){return p(e+((t|~r)^i)+a+o|0,s)+n|0}function y(e,t,r,i,n,a,o,s){return p(e+(t&i|r&~i)+a+o|0,s)+n|0}function b(e,t,r,i,n,a,o,s){return p(e+(t^(r|~i))+a+o|0,s)+n|0}n(c,a),c.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,i=0|this._b,n=0|this._c,a=0|this._d,c=0|this._e,v=0|this._a,w=0|this._b,E=0|this._c,A=0|this._d,S=0|this._e,M=0;M<80;M+=1){var T,R;M<16?(T=m(r,i,n,a,c,e[s[M]],l[0],d[M]),R=b(v,w,E,A,S,e[u[M]],f[0],h[M])):M<32?(T=g(r,i,n,a,c,e[s[M]],l[1],d[M]),R=y(v,w,E,A,S,e[u[M]],f[1],h[M])):M<48?(T=_(r,i,n,a,c,e[s[M]],l[2],d[M]),R=_(v,w,E,A,S,e[u[M]],f[2],h[M])):M<64?(T=y(r,i,n,a,c,e[s[M]],l[3],d[M]),R=g(v,w,E,A,S,e[u[M]],f[3],h[M])):(T=b(r,i,n,a,c,e[s[M]],l[4],d[M]),R=m(v,w,E,A,S,e[u[M]],f[4],h[M])),r=c,c=a,a=p(n,10),n=i,i=T,v=S,S=A,A=p(E,10),E=w,w=R}var k=this._b+n+A|0;this._b=this._c+a+S|0,this._c=this._d+c+v|0,this._d=this._e+r+w|0,this._e=this._a+i+E|0,this._a=k},c.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=i.alloc?i.alloc(20):new i(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=c},function(e,t,r){(t=e.exports=function(e){e=e.toLowerCase();var r=t[e];if(!r)throw new Error(e+" is not supported (we accept pull requests)");return new r}).sha=r(144),t.sha1=r(145),t.sha224=r(146),t.sha256=r(79),t.sha384=r(147),t.sha512=r(80)},function(e,t,r){(t=e.exports=r(81)).Stream=t,t.Readable=t,t.Writable=r(51),t.Duplex=r(23),t.Transform=r(84),t.PassThrough=r(154)},function(e,t,r){var i=r(10),n=i.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,t),t.Buffer=o),a(n,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},function(e,t,r){"use strict";(function(t,i,n){var a=r(38);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?i:a.nextTick;y.WritableState=_;var d=Object.create(r(32));d.inherits=r(5);var h={deprecate:r(45)},l=r(82),f=r(50).Buffer,c=n.Uint8Array||function(){};var p,m=r(83);function g(){}function _(e,t){s=s||r(23),e=e||{};var i=t instanceof s;this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,d=e.writableHighWaterMark,h=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(d||0===d)?d:h,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===e.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,i,n){--t.pendingcb,r?(a.nextTick(n,i),a.nextTick(S,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),S(e,t))}(e,r,i,t,n);else{var o=E(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||w(e,r),i?u(v,e,r,o,n):v(e,r,o,n)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(e){if(s=s||r(23),!(p.call(y,this)||this instanceof s))return new y(e);this._writableState=new _(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function b(e,t,r,i,n,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function v(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),S(e,t)}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)n[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;n.allBuffers=u,b(e,t,!0,t.length,n,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,h=r.encoding,l=r.callback;if(b(e,t,!1,t.objectMode?1:d.length,d,h,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),S(e,t)}))}function S(e,t){var r=E(t);return r&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,a.nextTick(A,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}d.inherits(y,l),_.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(_.prototype,"buffer",{get:h.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===y&&(e&&e._writableState instanceof _)}})):p=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,r){var i,n=this._writableState,o=!1,s=!n.objectMode&&(i=e,f.isBuffer(i)||i instanceof c);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=g),n.ended?function(e,t){var r=new Error("write after end");e.emit("error",r),a.nextTick(t,r)}(this,r):(s||function(e,t,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),a.nextTick(i,o),n=!1),n}(this,n,e,r))&&(n.pendingcb++,o=function(e,t,r,i,n,a){if(!r){var o=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r));return t}(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var u=t.length<t.highWaterMark;u||(t.needDrain=!0);if(t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:a,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else b(e,t,!1,s,i,n,a);return u}(this,n,s,e,t,r)),o},y.prototype.cork=function(){this._writableState.corked++},y.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||w(this,e))},y.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(e,t,r){t.ending=!0,S(e,t),r&&(t.finished?a.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,r(9),r(152).setImmediate,r(13))},function(e,t,r){"use strict";var i=r(14);function n(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}e.exports=n,n.prototype._init=function(){},n.prototype.update=function(e){return 0===e.length?[]:"decrypt"===this.type?this._updateDecrypt(e):this._updateEncrypt(e)},n.prototype._buffer=function(e,t){for(var r=Math.min(this.buffer.length-this.bufferOff,e.length-t),i=0;i<r;i++)this.buffer[this.bufferOff+i]=e[t+i];return this.bufferOff+=r,r},n.prototype._flushBuffer=function(e,t){return this._update(this.buffer,0,e,t),this.bufferOff=0,this.blockSize},n.prototype._updateEncrypt=function(e){var t=0,r=0,i=(this.bufferOff+e.length)/this.blockSize|0,n=new Array(i*this.blockSize);0!==this.bufferOff&&(t+=this._buffer(e,t),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(n,r)));for(var a=e.length-(e.length-t)%this.blockSize;t<a;t+=this.blockSize)this._update(e,t,n,r),r+=this.blockSize;for(;t<e.length;t++,this.bufferOff++)this.buffer[this.bufferOff]=e[t];return n},n.prototype._updateDecrypt=function(e){for(var t=0,r=0,i=Math.ceil((this.bufferOff+e.length)/this.blockSize)-1,n=new Array(i*this.blockSize);i>0;i--)t+=this._buffer(e,t),r+=this._flushBuffer(n,r);return t+=this._buffer(e,t),n},n.prototype.final=function(e){var t,r;return e&&(t=this.update(e)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(r):r},n.prototype._pad=function(e,t){if(0===t)return!1;for(;t<e.length;)e[t++]=0;return!0},n.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var e=new Array(this.blockSize);return this._update(this.buffer,0,e,0),e},n.prototype._unpad=function(e){return e},n.prototype._finalDecrypt=function(){i.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var e=new Array(this.blockSize);return this._flushBuffer(e,0),this._unpad(e)}},function(e,t,r){var i=r(167),n=r(175),a=r(97);t.createCipher=t.Cipher=i.createCipher,t.createCipheriv=t.Cipheriv=i.createCipheriv,t.createDecipher=t.Decipher=n.createDecipher,t.createDecipheriv=t.Decipheriv=n.createDecipheriv,t.listCiphers=t.getCiphers=function(){return Object.keys(a)}},function(e,t,r){var i={ECB:r(168),CBC:r(169),CFB:r(170),CFB8:r(171),CFB1:r(172),OFB:r(173),CTR:r(95),GCM:r(95)},n=r(97);for(var a in n)n[a].module=i[n[a].mode];e.exports=n},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var a=r(179);if("function"!=typeof a.randomBytes)throw new Error("Not supported");n.prototype._rand=function(e){return a.randomBytes(e)}}catch(e){}},function(e,t,r){"use strict";var i=r(28).codes.ERR_STREAM_PREMATURE_CLOSE;function n(){}e.exports=function e(t,r,a){if("function"==typeof r)return e(t,null,r);r||(r={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}(a||n);var o=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||h()},d=t._writableState&&t._writableState.finished,h=function(){s=!1,d=!0,o||a.call(t)},l=t._readableState&&t._readableState.endEmitted,f=function(){o=!1,l=!0,s||a.call(t)},c=function(e){a.call(t,e)},p=function(){var e;return o&&!l?(t._readableState&&t._readableState.ended||(e=new i),a.call(t,e)):s&&!d?(t._writableState&&t._writableState.ended||(e=new i),a.call(t,e)):void 0},m=function(){t.req.on("finish",h)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(t)?s&&!t._writableState&&(t.on("end",u),t.on("close",u)):(t.on("complete",h),t.on("abort",p),t.req?m():t.on("request",m)),t.on("end",f),t.on("finish",h),!1!==r.error&&t.on("error",c),t.on("close",p),function(){t.removeListener("complete",h),t.removeListener("abort",p),t.removeListener("request",m),t.req&&t.req.removeListener("finish",h),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",h),t.removeListener("end",f),t.removeListener("error",c),t.removeListener("close",p)}}},function(e,t,r){(function(t){var i=r(192),n=r(24);function a(e){var t,r=e.modulus.byteLength();do{t=new i(n(r))}while(t.cmp(e.modulus)>=0||!t.umod(e.prime1)||!t.umod(e.prime2));return t}function o(e,r){var n=function(e){var t=a(e);return{blinder:t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}(r),o=r.modulus.byteLength(),s=new i(e).mul(n.blinder).umod(r.modulus),u=s.toRed(i.mont(r.prime1)),d=s.toRed(i.mont(r.prime2)),h=r.coefficient,l=r.prime1,f=r.prime2,c=u.redPow(r.exponent1).fromRed(),p=d.redPow(r.exponent2).fromRed(),m=c.isub(p).imul(h).umod(l).imul(f);return p.iadd(m).imul(n.unblinder).umod(r.modulus).toArrayLike(t,"be",o)}o.getr=a,e.exports=o}).call(this,r(10).Buffer)},function(e,t,r){"use strict";var i=t;i.version=r(194).version,i.utils=r(15),i.rand=r(56),i.curve=r(109),i.curves=r(60),i.ec=r(205),i.eddsa=r(209)},function(e,t,r){"use strict";var i,n=t,a=r(61),o=r(109),s=r(15).assert;function u(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function d(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new u(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=u,d("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),d("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),d("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),d("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),d("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),d("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),d("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(204)}catch(e){i=void 0}d("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(e,t,r){var i=t;i.utils=r(18),i.common=r(34),i.sha=r(198),i.ripemd=r(202),i.hmac=r(203),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(e,t,r){"use strict";(function(t){var i,n=r(10),a=n.Buffer,o={};for(i in n)n.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(o[i]=n[i]);var s=o.Buffer={};for(i in a)a.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(s[i]=a[i]);if(o.Buffer.prototype=a.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(e,t,r){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return a(e,t,r)}),s.alloc||(s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var i=a(e);return t&&0!==t.length?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i}),!o.kStringMaxLength)try{o.kStringMaxLength=t.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),e.exports=o}).call(this,r(9))},function(e,t,r){"use strict";var i=r(64).Reporter,n=r(35).EncoderBuffer,a=r(35).DecoderBuffer,o=r(14),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function d(e,t,r){var i={};this._baseState=i,i.name=r,i.enc=e,i.parent=t||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}e.exports=d;var h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var e=this._baseState,t={};h.forEach((function(r){t[r]=e[r]}));var r=new this.constructor(t.parent);return r._baseState=t,r},d.prototype._wrap=function(){var e=this._baseState;u.forEach((function(t){this[t]=function(){var r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},d.prototype._init=function(e){var t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),o.equal(t.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(e){var t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(o(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(o(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);var i=e[r];t[i]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){d.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),s.forEach((function(e){d.prototype[e]=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(r),this}})),d.prototype.use=function(e){o(e);var t=this._baseState;return o(null===t.use),t.use=e,this},d.prototype.optional=function(){return this._baseState.optional=!0,this},d.prototype.def=function(e){var t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},d.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},d.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},d.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},d.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},d.prototype.any=function(){return this._baseState.any=!0,this},d.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},d.prototype.contains=function(e){var t=this._baseState;return o(null===t.use),t.contains=e,this},d.prototype._decode=function(e,t){var r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));var i,n=r.default,o=!0,s=null;if(null!==r.key&&(s=e.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(o=this._peekTag(e,u,r.any),e.isError(o))return o}else{var d=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),o=!0}catch(e){o=!1}e.restore(d)}}if(r.obj&&o&&(i=e.enterObject()),o){if(null!==r.explicit){var h=this._decodeTag(e,r.explicit);if(e.isError(h))return h;e=h}var l=e.offset;if(null===r.use&&null===r.choice){var f;r.any&&(f=e.save());var c=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(c))return c;r.any?n=e.raw(f):e=c}if(t&&t.track&&null!==r.tag&&t.track(e.path(),l,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(n=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var p=new a(n);n=this._getUse(r.contains,e._reporterState.obj)._decode(p,t)}}return r.obj&&o&&(n=e.leaveObject(i)),null===r.key||null===n&&!0!==o?null!==s&&e.exitKey(s):e.leaveKey(s,r.key,n),n},d.prototype._decodeGeneric=function(e,t,r){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},d.prototype._getUse=function(e,t){var r=this._baseState;return r.useDecoder=this._use(e,t),o(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},d.prototype._decodeChoice=function(e,t){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(a){var o=e.save(),s=r.choice[a];try{var u=s._decode(e,t);if(e.isError(u))return!1;i={type:a,value:u},n=!0}catch(t){return e.restore(o),!1}return!0}),this),n?i:e.error("Choice not matched")},d.prototype._createEncoderBuffer=function(e){return new n(e,this.reporter)},d.prototype._encode=function(e,t,r){var i=this._baseState;if(null===i.default||i.default!==e){var n=this._encodeValue(e,t,r);if(void 0!==n&&!this._skipDefault(n,t,r))return n}},d.prototype._encodeValue=function(e,t,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(e,t||new i);var a=null;if(this.reporter=t,n.optional&&void 0===e){if(null===n.default)return;e=n.default}var o=null,s=!1;if(n.any)a=this._createEncoderBuffer(e);else if(n.choice)a=this._encodeChoice(e,t);else if(n.contains)o=this._getUse(n.contains,r)._encode(e,t),s=!0;else if(n.children)o=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");var i=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=r._encode(e[r._baseState.key],t,e);return t.leaveKey(i),n}),this).filter((function(e){return e})),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return t.error("Too many args for : "+n.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,o=this._createEncoderBuffer(e.map((function(r){var i=this._baseState;return this._getUse(i.args[0],e)._encode(r,t)}),u))}else null!==n.use?a=this._getUse(n.use,r)._encode(e,t):(o=this._encodePrimitive(n.tag,e),s=!0);if(!n.any&&null===n.choice){var d=null!==n.implicit?n.implicit:n.tag,h=null===n.implicit?"universal":"context";null===d?null===n.use&&t.error("Tag could be omitted only for .use()"):null===n.use&&(a=this._encodeComposite(d,s,h,o))}return null!==n.explicit&&(a=this._encodeComposite(n.explicit,!1,"context",a)),a},d.prototype._encodeChoice=function(e,t){var r=this._baseState,i=r.choice[e.type];return i||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(e.value,t)},d.prototype._encodePrimitive=function(e,t){var r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},d.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},d.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},function(e,t,r){"use strict";var i=r(5);function n(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function a(e,t){this.path=e,this.rethrow(t)}t.Reporter=n,n.prototype.isError=function(e){return e instanceof a},n.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},n.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},n.prototype.enterKey=function(e){return this._reporterState.path.push(e)},n.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},n.prototype.leaveKey=function(e,t,r){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},n.prototype.leaveObject=function(e){var t=this._reporterState,r=t.obj;return t.obj=e,r},n.prototype.error=function(e){var t,r=this._reporterState,i=e instanceof a;if(t=i?e:new a(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return i||r.errors.push(t),t},n.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},i(a,Error),a.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,a),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,r){"use strict";function i(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r})),t}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=i(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=i(t.tag)},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";r.r(t),function(e,i,n,a){var o,s=r(1),u=!1,d="",h=void 0!==h?h:{};function l(){var t,s={};for(t in h)h.hasOwnProperty(t)&&(s[t]=h[t]);var u=[],l="./this.program",f=function(e,t){throw t},c=!1,p=!1,m=!1,g=!1,_=!1;if(c="object"==typeof window,p="function"==typeof importScripts,g="object"==typeof e&&"object"==typeof e.versions&&"string"==typeof e.versions.node,m=g&&!c&&!p,_=!c&&!m&&!p,h.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var y,b,v,w,E="";function A(e){return h.locateFile?h.locateFile(e,E):E+e}if(m)E=i+"/",y=function(e,t){var i;return v||(v=r(69)),w||(w=r(70)),e=w.normalize(e),i=v.readFileSync(e),t?i:i.toString()},b=function(e){var t=y(e,!0);return t.buffer||(t=new Uint8Array(t)),N(t.buffer),t},e.argv.length>1&&(l=e.argv[1].replace(/\\/g,"/")),u=e.argv.slice(2),n.exports=h,e.on("uncaughtException",(function(e){if(!(e instanceof ei))throw e})),e.on("unhandledRejection",Le),f=function(t){e.exit(t)},h.inspect=function(){return"[Emscripten Module object]"};else if(_)"undefined"!=typeof read&&(y=function(e){return read(e)}),b=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(N("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?u=scriptArgs:void 0!==arguments&&(u=arguments),"function"==typeof quit&&(f=function(e){quit(e)}),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print);else{if(!c&&!p)throw new Error("environment detection error");p?E=self.location.href:document.currentScript&&(E=document.currentScript.src),E=0!==E.indexOf("blob:")?E.substr(0,E.lastIndexOf("/")+1):"",y=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},p&&(b=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),function(e,t,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)},function(e){document.title=e}}var S=h.print||console.log.bind(console),M=h.printErr||console.warn.bind(console);for(t in s)s.hasOwnProperty(t)&&(h[t]=s[t]);function T(e){T.shown||(T.shown={}),T.shown[e]||(T.shown[e]=1,M(e))}function R(e,t){var r=[1,0,1,96],i=t.slice(0,1),n=t.slice(1),a={i:127,j:126,f:125,d:124};r.push(n.length);for(var o=0;o<n.length;++o)r.push(a[n[o]]);"v"==i?r.push(0):r=r.concat([1,a[i]]),r[1]=r.length-2;var s=new Uint8Array([0,97,115,109,1,0,0,0].concat(r,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),u=new WebAssembly.Module(s);return new WebAssembly.Instance(u,{e:{f:e}}).exports.f}function k(e,t){var r=C,i=r.length;try{r.grow(1)}catch(e){if(!e instanceof RangeError)throw e;throw"Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."}try{r.set(i,e)}catch(a){if(!a instanceof TypeError)throw a;N(void 0!==t,"Missing signature argument to addFunction");var n=R(e,t);r.set(i,n)}return i}function I(e,t){return N(void 0!==e),k(e,t)}s=null,h.arguments&&(u=h.arguments),Object.getOwnPropertyDescriptor(h,"arguments")||Object.defineProperty(h,"arguments",{configurable:!0,get:function(){Le("Module.arguments has been replaced with plain arguments_")}}),h.thisProgram&&(l=h.thisProgram),Object.getOwnPropertyDescriptor(h,"thisProgram")||Object.defineProperty(h,"thisProgram",{configurable:!0,get:function(){Le("Module.thisProgram has been replaced with plain thisProgram")}}),h.quit&&(f=h.quit),Object.getOwnPropertyDescriptor(h,"quit")||Object.defineProperty(h,"quit",{configurable:!0,get:function(){Le("Module.quit has been replaced with plain quit_")}}),N(void 0===h.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.read,"Module.read option was removed (modify read_ in JS)"),N(void 0===h.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),N(void 0===h.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),N(void 0===h.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),Object.getOwnPropertyDescriptor(h,"read")||Object.defineProperty(h,"read",{configurable:!0,get:function(){Le("Module.read has been replaced with plain read_")}}),Object.getOwnPropertyDescriptor(h,"readAsync")||Object.defineProperty(h,"readAsync",{configurable:!0,get:function(){Le("Module.readAsync has been replaced with plain readAsync")}}),Object.getOwnPropertyDescriptor(h,"readBinary")||Object.defineProperty(h,"readBinary",{configurable:!0,get:function(){Le("Module.readBinary has been replaced with plain readBinary")}}),Jr=$r=Zr=function(){Le("cannot use the stack before compiled code is ready to run, and has provided stack access")};var O,D,x=function(e){e};h.wasmBinary&&(O=h.wasmBinary),Object.getOwnPropertyDescriptor(h,"wasmBinary")||Object.defineProperty(h,"wasmBinary",{configurable:!0,get:function(){Le("Module.wasmBinary has been replaced with plain wasmBinary")}}),h.noExitRuntime&&(o=h.noExitRuntime),Object.getOwnPropertyDescriptor(h,"noExitRuntime")||Object.defineProperty(h,"noExitRuntime",{configurable:!0,get:function(){Le("Module.noExitRuntime has been replaced with plain noExitRuntime")}}),"object"!=typeof WebAssembly&&Le("No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.");var C=new WebAssembly.Table({initial:2542,maximum:2552,element:"anyfunc"}),P=!1;function N(e,t){e||Le("Assertion failed: "+t)}function L(e){var t=h["_"+e];return N(t,"Cannot call unknown function "+e+", make sure it is exported"),t}function B(e,t,r,i,n){var a={string:function(e){var t=0;if(null!=e&&0!==e){var r=1+(e.length<<2);W(e,t=Zr(r),r)}return t},array:function(e){var t=Zr(e.length);return z(e,t),t}};var o=L(e),s=[],u=0;if(N("array"!==t,'Return type should not be "array".'),i)for(var d=0;d<i.length;d++){var h=a[r[d]];h?(0===u&&(u=Jr()),s[d]=h(i[d])):s[d]=i[d]}var l=o.apply(null,s);return l=function(e){return"string"===t?H(e):"boolean"===t?Boolean(e):e}(l),0!==u&&$r(u),l}function F(e,t,r,i){return function(){return B(e,t,r,arguments)}}var U="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function j(e,t,r){for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.subarray&&U)return U.decode(e.subarray(t,n));for(var a="";t<n;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if(224==(240&o)?o=(15&o)<<12|s<<6|u:(240!=(248&o)&&T("Invalid UTF-8 leading byte 0x"+o.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),o=(7&o)<<18|s<<12|u<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var d=o-65536;a+=String.fromCharCode(55296|d>>10,56320|1023&d)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}function H(e,t){return e?j(Y,e,t):""}function X(e,t,r,i){if(!(i>0))return 0;for(var n=r,a=r+i-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o);if(s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;s>=2097152&&T("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."),t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-n}function W(e,t,r){return N("number"==typeof r,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),X(e,Y,t,r)}function V(e){for(var t=0,r=0;r<e.length;++r){var i=e.charCodeAt(r);i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++r)),i<=127?++t:t+=i<=2047?2:i<=65535?3:4}return t}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");function z(e,t){N(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),Q.set(e,t)}function q(e,t,r){for(var i=0;i<e.length;++i)N(e.charCodeAt(i)==e.charCodeAt(i)&255),Q[t++>>0]=e.charCodeAt(i);r||(Q[t>>0]=0)}var G,Q,Y,K,J,Z,$=65536;function ee(e,t){return e%t>0&&(e+=t-e%t),e}function te(e){G=e,h.HEAP8=Q=new Int8Array(e),h.HEAP16=K=new Int16Array(e),h.HEAP32=J=new Int32Array(e),h.HEAPU8=Y=new Uint8Array(e),h.HEAPU16=new Uint16Array(e),h.HEAPU32=Z=new Uint32Array(e),h.HEAPF32=new Float32Array(e),h.HEAPF64=new Float64Array(e)}var re=6584208,ie=1341328,ne=6584208,ae=1341168;N(re%16==0,"stack must start aligned"),N(ne%16==0,"heap must start aligned");var oe=5242880;h.TOTAL_STACK&&N(oe===h.TOTAL_STACK,"the stack size can no longer be determined at runtime");var se=h.TOTAL_MEMORY||67108864;function ue(){N(0==(3&ie)),Z[1+(ie>>2)]=34821223,Z[2+(ie>>2)]=2310721022,J[0]=1668509029}function de(){var e=Z[1+(ie>>2)],t=Z[2+(ie>>2)];34821223==e&&2310721022==t||Le("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+t.toString(16)+" "+e.toString(16)),1668509029!==J[0]&&Le("Runtime error: The application has corrupted its heap memory area (address zero)!")}function he(e){Le("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(ie-Jr()+e)+" bytes available!")}function le(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?h.dynCall_v(r):h.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}Object.getOwnPropertyDescriptor(h,"TOTAL_MEMORY")||Object.defineProperty(h,"TOTAL_MEMORY",{configurable:!0,get:function(){Le("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY")}}),N(se>=oe,"TOTAL_MEMORY should be larger than TOTAL_STACK, was "+se+"! (TOTAL_STACK="+oe+")"),N("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&void 0!==Int32Array.prototype.subarray&&void 0!==Int32Array.prototype.set,"JS engine does not provide full typed array support"),(D=h.wasmMemory?h.wasmMemory:new WebAssembly.Memory({initial:se/$}))&&(G=D.buffer),N((se=G.byteLength)%$==0),te(G),J[ae>>2]=ne,function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian!"}();var fe=[],ce=[],pe=[],me=[],ge=!1,_e=!1;function ye(){if(h.preRun)for("function"==typeof h.preRun&&(h.preRun=[h.preRun]);h.preRun.length;)Ae(h.preRun.shift());le(fe)}function be(){de(),N(!ge),ge=!0,h.noFSInit||ot.init.initialized||ot.init(),rt.init(),le(ce)}function ve(){de(),ot.ignorePermissions=!1,le(pe)}function we(){de(),_e=!0}function Ee(){if(de(),h.postRun)for("function"==typeof h.postRun&&(h.postRun=[h.postRun]);h.postRun.length;)Se(h.postRun.shift());le(me)}function Ae(e){fe.unshift(e)}function Se(e){me.unshift(e)}N(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var Me=Math.abs,Te=Math.ceil,Re=Math.floor,ke=Math.min,Ie=0,Oe=null,De=null,xe={};function Ce(e){for(var t=e;;){if(!xe[e])return e;e=t+Math.random()}return e}function Pe(e){Ie++,h.monitorRunDependencies&&h.monitorRunDependencies(Ie),e?(N(!xe[e]),xe[e]=1,null===Oe&&"undefined"!=typeof setInterval&&(Oe=setInterval((function(){if(P)return clearInterval(Oe),void(Oe=null);var e=!1;for(var t in xe)e||(e=!0,M("still waiting on run dependencies:")),M("dependency: "+t);e&&M("(end of list)")}),1e4))):M("warning: run dependency added without ID")}function Ne(e){if(Ie--,h.monitorRunDependencies&&h.monitorRunDependencies(Ie),e?(N(xe[e]),delete xe[e]):M("warning: run dependency removed without ID"),0==Ie&&(null!==Oe&&(clearInterval(Oe),Oe=null),De)){var t=De;De=null,t()}}function Le(e){throw h.onAbort&&h.onAbort(e),S(e+=""),M(e),P=!0,1,e="abort("+e+") at "+Qe(),new WebAssembly.RuntimeError(e)}h.preloadedImages={},h.preloadedAudios={};var Be="data:application/octet-stream;base64,";function Fe(e){return String.prototype.startsWith?e.startsWith(Be):0===e.indexOf(Be)}var Ue,je,He=d+"EasyPlayer.wasm";function Xe(){try{if(O)return new Uint8Array(O);if(b)return b(He);throw"both async and sync fetching of the wasm failed"}catch(e){Le(e)}}function We(){return O||!c&&!p||"function"!=typeof fetch?new Promise((function(e,t){e(Xe())})):fetch(He,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+He+"'";return e.arrayBuffer()})).catch((function(){return Xe()}))}function Ve(){var e={env:Dt,wasi_unstable:Dt};function t(e,t){var r=e.exports;h.asm=r,Ne("wasm-instantiate")}Pe("wasm-instantiate");var r=h;function i(e){N(h===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(e.instance)}function n(t){return We().then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){M("failed to asynchronously prepare wasm: "+e),Le(e)}))}if(h.instantiateWasm)try{return h.instantiateWasm(e,t)}catch(e){return M("Module.instantiateWasm callback failed with error: "+e),!1}return function(){if(O||"function"!=typeof WebAssembly.instantiateStreaming||Fe(He)||"function"!=typeof fetch)return n(i);fetch(He,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(i,(function(e){M("wasm streaming compile failed: "+e),M("falling back to ArrayBuffer instantiation"),n(i)}))}))}(),{}}function ze(e){return T("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function qe(e){return e.replace(/\b_Z[\w\d_]+/g,(function(e){var t=ze(e);return e===t?e:t+" ["+e+"]"}))}function Ge(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function Qe(){var e=Ge();return h.extraStackTrace&&(e+="\n"+h.extraStackTrace()),qe(e)}function Ye(e){return Yr(e)}Fe(He)||(He=A(He)),ce.push({func:function(){Qr()}});var Ke={};function Je(e,t,r){throw Ke[e]={ptr:e,adjusted:[e],type:t,destructor:r,refcount:0,caught:!1,rethrown:!1},e,"uncaught_exception"in Kr?Kr.uncaught_exceptions++:Kr.uncaught_exceptions=1,e+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function Ze(){}function $e(e){return h.___errno_location?J[h.___errno_location()>>2]=e:M("failed to set errno from JS"),e}var et={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,t){for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:function(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=et.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=et.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:function(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)},extname:function(e){return et.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return et.normalize(e.join("/"))},join2:function(e,t){return et.normalize(e+"/"+t)}},tt={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ot.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t="/"===i.charAt(0)}return(t?"/":"")+(e=et.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||"."},relative:function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=tt.resolve(e).substr(1),t=tt.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),a=Math.min(i.length,n.length),o=a,s=0;s<a;s++)if(i[s]!==n[s]){o=s;break}var u=[];for(s=o;s<i.length;s++)u.push("..");return(u=u.concat(n.slice(o))).join("/")}},rt={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){rt.ttys[e]={input:[],output:[],ops:t},ot.registerDevice(e,rt.stream_ops)},stream_ops:{open:function(e){var t=rt.ttys[e.node.rdev];if(!t)throw new ot.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ot.ErrnoError(60);for(var a=0,o=0;o<i;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new ot.ErrnoError(29)}if(void 0===s&&0===a)throw new ot.ErrnoError(6);if(null==s)break;a++,t[r+o]=s}return a&&(e.node.timestamp=Date.now()),a},write:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.put_char)throw new ot.ErrnoError(60);try{for(var a=0;a<i;a++)e.tty.ops.put_char(e.tty,t[r+a])}catch(e){throw new ot.ErrnoError(29)}return i&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:function(t){if(!t.input.length){var r=null;if(m){var i=a.alloc?a.alloc(256):new a(256),n=0;try{n=v.readSync(e.stdin.fd,i,0,256,null)}catch(e){if(-1==e.toString().indexOf("EOF"))throw e;n=0}r=n>0?i.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&null!==(r=readline())&&(r+="\n");if(!r)return null;t.input=Ot(r,!0)}return t.input.shift()},put_char:function(e,t){null===t||10===t?e.output=[]:0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(M(j(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(M(j(e.output,0)),e.output=[])}}},it={ops_table:null,mount:function(e){return it.createNode(null,"/",16895,0)},createNode:function(e,t,r,i){if(ot.isBlkdev(r)||ot.isFIFO(r))throw new ot.ErrnoError(63);it.ops_table||(it.ops_table={dir:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr,lookup:it.node_ops.lookup,mknod:it.node_ops.mknod,rename:it.node_ops.rename,unlink:it.node_ops.unlink,rmdir:it.node_ops.rmdir,readdir:it.node_ops.readdir,symlink:it.node_ops.symlink},stream:{llseek:it.stream_ops.llseek}},file:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr},stream:{llseek:it.stream_ops.llseek,read:it.stream_ops.read,write:it.stream_ops.write,allocate:it.stream_ops.allocate,mmap:it.stream_ops.mmap,msync:it.stream_ops.msync}},link:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr,readlink:it.node_ops.readlink},stream:{}},chrdev:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr},stream:ot.chrdev_stream_ops}});var n=ot.createNode(e,t,r,i);return ot.isDir(n.mode)?(n.node_ops=it.ops_table.dir.node,n.stream_ops=it.ops_table.dir.stream,n.contents={}):ot.isFile(n.mode)?(n.node_ops=it.ops_table.file.node,n.stream_ops=it.ops_table.file.stream,n.usedBytes=0,n.contents=null):ot.isLink(n.mode)?(n.node_ops=it.ops_table.link.node,n.stream_ops=it.ops_table.link.stream):ot.isChrdev(n.mode)&&(n.node_ops=it.ops_table.chrdev.node,n.stream_ops=it.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n),n},getFileDataAsRegularArray:function(e){if(e.contents&&e.contents.subarray){for(var t=[],r=0;r<e.usedBytes;++r)t.push(e.contents[r]);return t}return e.contents},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t){if(0==t)return e.contents=null,void(e.usedBytes=0);if(!e.contents||e.contents.subarray){var r=e.contents;return e.contents=new Uint8Array(new ArrayBuffer(t)),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),void(e.usedBytes=t)}if(e.contents||(e.contents=[]),e.contents.length>t)e.contents.length=t;else for(;e.contents.length<t;)e.contents.push(0);e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=ot.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ot.isDir(e.mode)?t.size=4096:ot.isFile(e.mode)?t.size=e.usedBytes:ot.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&it.resizeFileStorage(e,t.size)},lookup:function(e,t){throw ot.genericErrors[44]},mknod:function(e,t,r,i){return it.createNode(e,t,r,i)},rename:function(e,t,r){if(ot.isDir(e.mode)){var i;try{i=ot.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ot.ErrnoError(55)}delete e.parent.contents[e.name],e.name=r,t.contents[r]=e,e.parent=t},unlink:function(e,t){delete e.contents[t]},rmdir:function(e,t){var r=ot.lookupNode(e,t);for(var i in r.contents)throw new ot.ErrnoError(55);delete e.contents[t]},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=it.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!ot.isLink(e.mode))throw new ot.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var a=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(N(o>=0),o>8&&a.subarray)t.set(a.subarray(n,n+o),r);else for(var s=0;s<o;s++)t[r+s]=a[n+s];return o},write:function(e,t,r,i,n,a){if(a&&T("file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)"),a=!1,!i)return 0;var o=e.node;if(o.timestamp=Date.now(),t.subarray&&(!o.contents||o.contents.subarray)){if(a)return N(0===n,"canOwn must imply no weird position inside the file"),o.contents=t.subarray(r,r+i),o.usedBytes=i,i;if(0===o.usedBytes&&0===n)return o.contents=new Uint8Array(t.subarray(r,r+i)),o.usedBytes=i,i;if(n+i<=o.usedBytes)return o.contents.set(t.subarray(r,r+i),n),i}if(it.expandFileStorage(o,n+i),o.contents.subarray&&t.subarray)o.contents.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)o.contents[n+s]=t[r+s];return o.usedBytes=Math.max(o.usedBytes,n+i),i},llseek:function(e,t,r){var i=t;if(1===r?i+=e.position:2===r&&ot.isFile(e.node.mode)&&(i+=e.node.usedBytes),i<0)throw new ot.ErrnoError(28);return i},allocate:function(e,t,r){it.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap:function(e,t,r,i,n,a,o){if(!ot.isFile(e.node.mode))throw new ot.ErrnoError(43);var s,u,d=e.node.contents;if(2&o||d.buffer!==t&&d.buffer!==t.buffer){(n>0||n+i<e.node.usedBytes)&&(d=d.subarray?d.subarray(n,n+i):Array.prototype.slice.call(d,n,n+i)),u=!0;var h=t.buffer==Q.buffer;if(!(s=Yr(i)))throw new ot.ErrnoError(48);(h?Q:t).set(d,s)}else u=!1,s=d.byteOffset;return{ptr:s,allocated:u}},msync:function(e,t,r,i,n){if(!ot.isFile(e.node.mode))throw new ot.ErrnoError(43);if(2&n)return 0;it.stream_ops.write(e,t,0,i,r,!1);return 0}}},nt={0:"Success",1:"Arg list too long",2:"Permission denied",3:"Address already in use",4:"Address not available",5:"Address family not supported by protocol family",6:"No more processes",7:"Socket already connected",8:"Bad file number",9:"Trying to read unreadable message",10:"Mount device busy",11:"Operation canceled",12:"No children",13:"Connection aborted",14:"Connection refused",15:"Connection reset by peer",16:"File locking deadlock error",17:"Destination address required",18:"Math arg out of domain of func",19:"Quota exceeded",20:"File exists",21:"Bad address",22:"File too large",23:"Host is unreachable",24:"Identifier removed",25:"Illegal byte sequence",26:"Connection already in progress",27:"Interrupted system call",28:"Invalid argument",29:"I/O error",30:"Socket is already connected",31:"Is a directory",32:"Too many symbolic links",33:"Too many open files",34:"Too many links",35:"Message too long",36:"Multihop attempted",37:"File or path name too long",38:"Network interface is not configured",39:"Connection reset by network",40:"Network is unreachable",41:"Too many open files in system",42:"No buffer space available",43:"No such device",44:"No such file or directory",45:"Exec format error",46:"No record locks available",47:"The link has been severed",48:"Not enough core",49:"No message of desired type",50:"Protocol not available",51:"No space left on device",52:"Function not implemented",53:"Socket is not connected",54:"Not a directory",55:"Directory not empty",56:"State not recoverable",57:"Socket operation on non-socket",59:"Not a typewriter",60:"No such device or address",61:"Value too large for defined data type",62:"Previous owner died",63:"Not super-user",64:"Broken pipe",65:"Protocol error",66:"Unknown protocol",67:"Protocol wrong type for socket",68:"Math result not representable",69:"Read only file system",70:"Illegal seek",71:"No such process",72:"Stale file handle",73:"Connection timed out",74:"Text file busy",75:"Cross-device link",100:"Device not a stream",101:"Bad font file fmt",102:"Invalid slot",103:"Invalid request code",104:"No anode",105:"Block device required",106:"Channel number out of range",107:"Level 3 halted",108:"Level 3 reset",109:"Link number out of range",110:"Protocol driver not attached",111:"No CSI structure available",112:"Level 2 halted",113:"Invalid exchange",114:"Invalid request descriptor",115:"Exchange full",116:"No data (for no delay io)",117:"Timer expired",118:"Out of streams resources",119:"Machine is not on the network",120:"Package not installed",121:"The object is remote",122:"Advertise error",123:"Srmount error",124:"Communication error on send",125:"Cross mount point (not really error)",126:"Given log. name not unique",127:"f.d. invalid for this operation",128:"Remote address changed",129:"Can access a needed shared lib",130:"Accessing a corrupted shared lib",131:".lib section in a.out corrupted",132:"Attempting to link in too many libs",133:"Attempting to exec a shared library",135:"Streams pipe error",136:"Too many users",137:"Socket type not supported",138:"Not supported",139:"Protocol family not supported",140:"Can't send after socket shutdown",141:"Too many references",142:"Host is down",148:"No medium (in tape drive)",156:"Level 2 not synchronized"},at={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},ot={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof ot.ErrnoError))throw e+" : "+Qe();return $e(e.errno)},lookupPath:function(e,t){if(t=t||{},!(e=tt.resolve(ot.cwd(),e)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var i in r)void 0===t[i]&&(t[i]=r[i]);if(t.recurse_count>8)throw new ot.ErrnoError(32);for(var n=et.normalizeArray(e.split("/").filter((function(e){return!!e})),!1),a=ot.root,o="/",s=0;s<n.length;s++){var u=s===n.length-1;if(u&&t.parent)break;if(a=ot.lookupNode(a,n[s]),o=et.join2(o,n[s]),ot.isMountpoint(a)&&(!u||u&&t.follow_mount)&&(a=a.mounted.root),!u||t.follow)for(var d=0;ot.isLink(a.mode);){var h=ot.readlink(o);if(o=tt.resolve(et.dirname(o),h),a=ot.lookupPath(o,{recurse_count:t.recurse_count}).node,d++>40)throw new ot.ErrnoError(32)}}return{path:o,node:a}},getPath:function(e){for(var t;;){if(ot.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:function(e,t){for(var r=0,i=0;i<t.length;i++)r=(r<<5)-r+t.charCodeAt(i)|0;return(e+r>>>0)%ot.nameTable.length},hashAddNode:function(e){var t=ot.hashName(e.parent.id,e.name);e.name_next=ot.nameTable[t],ot.nameTable[t]=e},hashRemoveNode:function(e){var t=ot.hashName(e.parent.id,e.name);if(ot.nameTable[t]===e)ot.nameTable[t]=e.name_next;else for(var r=ot.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:function(e,t){var r=ot.mayLookup(e);if(r)throw new ot.ErrnoError(r,e);for(var i=ot.hashName(e.id,t),n=ot.nameTable[i];n;n=n.name_next){var a=n.name;if(n.parent.id===e.id&&a===t)return n}return ot.lookup(e,t)},createNode:function(e,t,r,i){if(!ot.FSNode){ot.FSNode=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ot.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ot.FSNode.prototype={};Object.defineProperties(ot.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return ot.isDir(this.mode)}},isDevice:{get:function(){return ot.isChrdev(this.mode)}}})}var n=new ot.FSNode(e,t,r,i);return ot.hashAddNode(n),n},destroyNode:function(e){ot.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var t=ot.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:function(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:function(e,t){return ot.ignorePermissions||(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:2},mayLookup:function(e){var t=ot.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:function(e,t){try{ot.lookupNode(e,t);return 20}catch(e){}return ot.nodePermissions(e,"wx")},mayDelete:function(e,t,r){var i;try{i=ot.lookupNode(e,t)}catch(e){return e.errno}var n=ot.nodePermissions(e,"wx");if(n)return n;if(r){if(!ot.isDir(i.mode))return 54;if(ot.isRoot(i)||ot.getPath(i)===ot.cwd())return 10}else if(ot.isDir(i.mode))return 31;return 0},mayOpen:function(e,t){return e?ot.isLink(e.mode)?32:ot.isDir(e.mode)&&("r"!==ot.flagsToPermissionString(t)||512&t)?31:ot.nodePermissions(e,ot.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(e,t){e=e||0,t=t||ot.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!ot.streams[r])return r;throw new ot.ErrnoError(33)},getStream:function(e){return ot.streams[e]},createStream:function(e,t,r){ot.FSStream||(ot.FSStream=function(){},ot.FSStream.prototype={},Object.defineProperties(ot.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var i=new ot.FSStream;for(var n in e)i[n]=e[n];e=i;var a=ot.nextfd(t,r);return e.fd=a,ot.streams[a]=e,e},closeStream:function(e){ot.streams[e]=null},chrdev_stream_ops:{open:function(e){var t=ot.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new ot.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,t){return e<<8|t},registerDevice:function(e,t){ot.devices[e]={stream_ops:t}},getDevice:function(e){return ot.devices[e]},getMounts:function(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:function(e,t){"function"==typeof e&&(t=e,e=!1),ot.syncFSRequests++,ot.syncFSRequests>1&&console.log("warning: "+ot.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=ot.getMounts(ot.root.mount),i=0;function n(e){return N(ot.syncFSRequests>0),ot.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((function(t){if(!t.type.syncfs)return a(null);t.type.syncfs(t,e,a)}))},mount:function(e,t,r){if("string"==typeof e)throw e;var i,n="/"===r,a=!r;if(n&&ot.root)throw new ot.ErrnoError(10);if(!n&&!a){var o=ot.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,ot.isMountpoint(i))throw new ot.ErrnoError(10);if(!ot.isDir(i.mode))throw new ot.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,n?ot.root=u:i&&(i.mounted=s,i.mount&&i.mount.mounts.push(s)),u},unmount:function(e){var t=ot.lookupPath(e,{follow_mount:!1});if(!ot.isMountpoint(t.node))throw new ot.ErrnoError(28);var r=t.node,i=r.mounted,n=ot.getMounts(i);Object.keys(ot.nameTable).forEach((function(e){for(var t=ot.nameTable[e];t;){var r=t.name_next;-1!==n.indexOf(t.mount)&&ot.destroyNode(t),t=r}})),r.mounted=null;var a=r.mount.mounts.indexOf(i);N(-1!==a),r.mount.mounts.splice(a,1)},lookup:function(e,t){return e.node_ops.lookup(e,t)},mknod:function(e,t,r){var i=ot.lookupPath(e,{parent:!0}).node,n=et.basename(e);if(!n||"."===n||".."===n)throw new ot.ErrnoError(28);var a=ot.mayCreate(i,n);if(a)throw new ot.ErrnoError(a);if(!i.node_ops.mknod)throw new ot.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:function(e,t){return t=void 0!==t?t:438,t&=4095,t|=32768,ot.mknod(e,t,0)},mkdir:function(e,t){return t=void 0!==t?t:511,t&=1023,t|=16384,ot.mknod(e,t,0)},mkdirTree:function(e,t){for(var r=e.split("/"),i="",n=0;n<r.length;++n)if(r[n]){i+="/"+r[n];try{ot.mkdir(i,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:function(e,t,r){return void 0===r&&(r=t,t=438),t|=8192,ot.mknod(e,t,r)},symlink:function(e,t){if(!tt.resolve(e))throw new ot.ErrnoError(44);var r=ot.lookupPath(t,{parent:!0}).node;if(!r)throw new ot.ErrnoError(44);var i=et.basename(t),n=ot.mayCreate(r,i);if(n)throw new ot.ErrnoError(n);if(!r.node_ops.symlink)throw new ot.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename:function(e,t){var r,i,n=et.dirname(e),a=et.dirname(t),o=et.basename(e),s=et.basename(t);try{r=ot.lookupPath(e,{parent:!0}).node,i=ot.lookupPath(t,{parent:!0}).node}catch(e){throw new ot.ErrnoError(10)}if(!r||!i)throw new ot.ErrnoError(44);if(r.mount!==i.mount)throw new ot.ErrnoError(75);var u,d=ot.lookupNode(r,o),h=tt.relative(e,a);if("."!==h.charAt(0))throw new ot.ErrnoError(28);if("."!==(h=tt.relative(t,n)).charAt(0))throw new ot.ErrnoError(55);try{u=ot.lookupNode(i,s)}catch(e){}if(d!==u){var l=ot.isDir(d.mode),f=ot.mayDelete(r,o,l);if(f)throw new ot.ErrnoError(f);if(f=u?ot.mayDelete(i,s,l):ot.mayCreate(i,s))throw new ot.ErrnoError(f);if(!r.node_ops.rename)throw new ot.ErrnoError(63);if(ot.isMountpoint(d)||u&&ot.isMountpoint(u))throw new ot.ErrnoError(10);if(i!==r&&(f=ot.nodePermissions(r,"w")))throw new ot.ErrnoError(f);try{ot.trackingDelegate.willMovePath&&ot.trackingDelegate.willMovePath(e,t)}catch(r){console.log("FS.trackingDelegate['willMovePath']('"+e+"', '"+t+"') threw an exception: "+r.message)}ot.hashRemoveNode(d);try{r.node_ops.rename(d,i,s)}catch(e){throw e}finally{ot.hashAddNode(d)}try{ot.trackingDelegate.onMovePath&&ot.trackingDelegate.onMovePath(e,t)}catch(r){console.log("FS.trackingDelegate['onMovePath']('"+e+"', '"+t+"') threw an exception: "+r.message)}}},rmdir:function(e){var t=ot.lookupPath(e,{parent:!0}).node,r=et.basename(e),i=ot.lookupNode(t,r),n=ot.mayDelete(t,r,!0);if(n)throw new ot.ErrnoError(n);if(!t.node_ops.rmdir)throw new ot.ErrnoError(63);if(ot.isMountpoint(i))throw new ot.ErrnoError(10);try{ot.trackingDelegate.willDeletePath&&ot.trackingDelegate.willDeletePath(e)}catch(t){console.log("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+t.message)}t.node_ops.rmdir(t,r),ot.destroyNode(i);try{ot.trackingDelegate.onDeletePath&&ot.trackingDelegate.onDeletePath(e)}catch(t){console.log("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+t.message)}},readdir:function(e){var t=ot.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ot.ErrnoError(54);return t.node_ops.readdir(t)},unlink:function(e){var t=ot.lookupPath(e,{parent:!0}).node,r=et.basename(e),i=ot.lookupNode(t,r),n=ot.mayDelete(t,r,!1);if(n)throw new ot.ErrnoError(n);if(!t.node_ops.unlink)throw new ot.ErrnoError(63);if(ot.isMountpoint(i))throw new ot.ErrnoError(10);try{ot.trackingDelegate.willDeletePath&&ot.trackingDelegate.willDeletePath(e)}catch(t){console.log("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+t.message)}t.node_ops.unlink(t,r),ot.destroyNode(i);try{ot.trackingDelegate.onDeletePath&&ot.trackingDelegate.onDeletePath(e)}catch(t){console.log("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+t.message)}},readlink:function(e){var t=ot.lookupPath(e).node;if(!t)throw new ot.ErrnoError(44);if(!t.node_ops.readlink)throw new ot.ErrnoError(28);return tt.resolve(ot.getPath(t.parent),t.node_ops.readlink(t))},stat:function(e,t){var r=ot.lookupPath(e,{follow:!t}).node;if(!r)throw new ot.ErrnoError(44);if(!r.node_ops.getattr)throw new ot.ErrnoError(63);return r.node_ops.getattr(r)},lstat:function(e){return ot.stat(e,!0)},chmod:function(e,t,r){var i;"string"==typeof e?i=ot.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ot.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:function(e,t){ot.chmod(e,t,!0)},fchmod:function(e,t){var r=ot.getStream(e);if(!r)throw new ot.ErrnoError(8);ot.chmod(r.node,t)},chown:function(e,t,r,i){var n;"string"==typeof e?n=ot.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ot.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:function(e,t,r){ot.chown(e,t,r,!0)},fchown:function(e,t,r){var i=ot.getStream(e);if(!i)throw new ot.ErrnoError(8);ot.chown(i.node,t,r)},truncate:function(e,t){if(t<0)throw new ot.ErrnoError(28);var r;"string"==typeof e?r=ot.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ot.ErrnoError(63);if(ot.isDir(r.mode))throw new ot.ErrnoError(31);if(!ot.isFile(r.mode))throw new ot.ErrnoError(28);var i=ot.nodePermissions(r,"w");if(i)throw new ot.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:function(e,t){var r=ot.getStream(e);if(!r)throw new ot.ErrnoError(8);if(0==(2097155&r.flags))throw new ot.ErrnoError(28);ot.truncate(r.node,t)},utime:function(e,t,r){var i=ot.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open:function(e,t,r,i,n){if(""===e)throw new ot.ErrnoError(44);var a;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?ot.modeStringToFlags(t):t)?4095&r|32768:0,"object"==typeof e)a=e;else{e=et.normalize(e);try{a=ot.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var o=!1;if(64&t)if(a){if(128&t)throw new ot.ErrnoError(20)}else a=ot.mknod(e,r,0),o=!0;if(!a)throw new ot.ErrnoError(44);if(ot.isChrdev(a.mode)&&(t&=-513),65536&t&&!ot.isDir(a.mode))throw new ot.ErrnoError(54);if(!o){var s=ot.mayOpen(a,t);if(s)throw new ot.ErrnoError(s)}512&t&&ot.truncate(a,0),t&=-641;var u=ot.createStream({node:a,path:ot.getPath(a),flags:t,seekable:!0,position:0,stream_ops:a.stream_ops,ungotten:[],error:!1},i,n);u.stream_ops.open&&u.stream_ops.open(u),!h.logReadFiles||1&t||(ot.readFiles||(ot.readFiles={}),e in ot.readFiles||(ot.readFiles[e]=1,console.log("FS.trackingDelegate error on read file: "+e)));try{if(ot.trackingDelegate.onOpenFile){var d=0;1!=(2097155&t)&&(d|=ot.tracking.openFlags.READ),0!=(2097155&t)&&(d|=ot.tracking.openFlags.WRITE),ot.trackingDelegate.onOpenFile(e,d)}}catch(t){console.log("FS.trackingDelegate['onOpenFile']('"+e+"', flags) threw an exception: "+t.message)}return u},close:function(e){if(ot.isClosed(e))throw new ot.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ot.closeStream(e.fd)}e.fd=null},isClosed:function(e){return null===e.fd},llseek:function(e,t,r){if(ot.isClosed(e))throw new ot.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ot.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ot.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:function(e,t,r,i,n){if(i<0||n<0)throw new ot.ErrnoError(28);if(ot.isClosed(e))throw new ot.ErrnoError(8);if(1==(2097155&e.flags))throw new ot.ErrnoError(8);if(ot.isDir(e.node.mode))throw new ot.ErrnoError(31);if(!e.stream_ops.read)throw new ot.ErrnoError(28);var a=void 0!==n;if(a){if(!e.seekable)throw new ot.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return a||(e.position+=o),o},write:function(e,t,r,i,n,a){if(i<0||n<0)throw new ot.ErrnoError(28);if(ot.isClosed(e))throw new ot.ErrnoError(8);if(0==(2097155&e.flags))throw new ot.ErrnoError(8);if(ot.isDir(e.node.mode))throw new ot.ErrnoError(31);if(!e.stream_ops.write)throw new ot.ErrnoError(28);1024&e.flags&&ot.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new ot.ErrnoError(70)}else n=e.position;var s=e.stream_ops.write(e,t,r,i,n,a);o||(e.position+=s);try{e.path&&ot.trackingDelegate.onWriteToFile&&ot.trackingDelegate.onWriteToFile(e.path)}catch(t){console.log("FS.trackingDelegate['onWriteToFile']('"+e.path+"') threw an exception: "+t.message)}return s},allocate:function(e,t,r){if(ot.isClosed(e))throw new ot.ErrnoError(8);if(t<0||r<=0)throw new ot.ErrnoError(28);if(0==(2097155&e.flags))throw new ot.ErrnoError(8);if(!ot.isFile(e.node.mode)&&!ot.isDir(e.node.mode))throw new ot.ErrnoError(43);if(!e.stream_ops.allocate)throw new ot.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:function(e,t,r,i,n,a,o){if(0!=(2&a)&&0==(2&o)&&2!=(2097155&e.flags))throw new ot.ErrnoError(2);if(1==(2097155&e.flags))throw new ot.ErrnoError(2);if(!e.stream_ops.mmap)throw new ot.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n,a,o)},msync:function(e,t,r,i,n){return e&&e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0},munmap:function(e){return 0},ioctl:function(e,t,r){if(!e.stream_ops.ioctl)throw new ot.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e,t){if((t=t||{}).flags=t.flags||"r",t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var r,i=ot.open(e,t.flags),n=ot.stat(e).size,a=new Uint8Array(n);return ot.read(i,a,0,n,0),"utf8"===t.encoding?r=j(a,0):"binary"===t.encoding&&(r=a),ot.close(i),r},writeFile:function(e,t,r){(r=r||{}).flags=r.flags||"w";var i=ot.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(V(t)+1),a=X(t,n,0,n.length);ot.write(i,n,0,a,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ot.write(i,t,0,t.byteLength,void 0,r.canOwn)}ot.close(i)},cwd:function(){return ot.currentPath},chdir:function(e){var t=ot.lookupPath(e,{follow:!0});if(null===t.node)throw new ot.ErrnoError(44);if(!ot.isDir(t.node.mode))throw new ot.ErrnoError(54);var r=ot.nodePermissions(t.node,"x");if(r)throw new ot.ErrnoError(r);ot.currentPath=t.path},createDefaultDirectories:function(){ot.mkdir("/tmp"),ot.mkdir("/home"),ot.mkdir("/home/web_user")},createDefaultDevices:function(){var e;if(ot.mkdir("/dev"),ot.registerDevice(ot.makedev(1,3),{read:function(){return 0},write:function(e,t,r,i,n){return i}}),ot.mkdev("/dev/null",ot.makedev(1,3)),rt.register(ot.makedev(5,0),rt.default_tty_ops),rt.register(ot.makedev(6,0),rt.default_tty1_ops),ot.mkdev("/dev/tty",ot.makedev(5,0)),ot.mkdev("/dev/tty1",ot.makedev(6,0)),"object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);e=function(){return crypto.getRandomValues(t),t[0]}}else if(m)try{var i=r(71);e=function(){return i.randomBytes(1)[0]}}catch(e){}e||(e=function(){Le("no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")}),ot.createDevice("/dev","random",e),ot.createDevice("/dev","urandom",e),ot.mkdir("/dev/shm"),ot.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){ot.mkdir("/proc"),ot.mkdir("/proc/self"),ot.mkdir("/proc/self/fd"),ot.mount({mount:function(){var e=ot.createNode("/proc/self","fd",16895,73);return e.node_ops={lookup:function(e,t){var r=+t,i=ot.getStream(r);if(!i)throw new ot.ErrnoError(8);var n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return i.path}}};return n.parent=n,n}},e}},{},"/proc/self/fd")},createStandardStreams:function(){h.stdin?ot.createDevice("/dev","stdin",h.stdin):ot.symlink("/dev/tty","/dev/stdin"),h.stdout?ot.createDevice("/dev","stdout",null,h.stdout):ot.symlink("/dev/tty","/dev/stdout"),h.stderr?ot.createDevice("/dev","stderr",null,h.stderr):ot.symlink("/dev/tty1","/dev/stderr");var e=ot.open("/dev/stdin","r"),t=ot.open("/dev/stdout","w"),r=ot.open("/dev/stderr","w");N(0===e.fd,"invalid handle for stdin ("+e.fd+")"),N(1===t.fd,"invalid handle for stdout ("+t.fd+")"),N(2===r.fd,"invalid handle for stderr ("+r.fd+")")},ensureErrnoError:function(){ot.ErrnoError||(ot.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){for(var t in this.errno=e,at)if(at[t]===e){this.code=t;break}},this.setErrno(e),this.message=nt[e],this.stack&&(Object.defineProperty(this,"stack",{value:(new Error).stack,writable:!0}),this.stack=qe(this.stack))},ot.ErrnoError.prototype=new Error,ot.ErrnoError.prototype.constructor=ot.ErrnoError,[44].forEach((function(e){ot.genericErrors[e]=new ot.ErrnoError(e),ot.genericErrors[e].stack="<generic error, no stack>"})))},staticInit:function(){ot.ensureErrnoError(),ot.nameTable=new Array(4096),ot.mount(it,{},"/"),ot.createDefaultDirectories(),ot.createDefaultDevices(),ot.createSpecialDirectories(),ot.filesystems={MEMFS:it}},init:function(e,t,r){N(!ot.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),ot.init.initialized=!0,ot.ensureErrnoError(),h.stdin=e||h.stdin,h.stdout=t||h.stdout,h.stderr=r||h.stderr,ot.createStandardStreams()},quit:function(){ot.init.initialized=!1;var e=h._fflush;e&&e(0);for(var t=0;t<ot.streams.length;t++){var r=ot.streams[t];r&&ot.close(r)}},getMode:function(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r},joinPath:function(e,t){var r=et.join.apply(null,e);return t&&"/"==r[0]&&(r=r.substr(1)),r},absolutePath:function(e,t){return tt.resolve(t,e)},standardizePath:function(e){return et.normalize(e)},findObject:function(e,t){var r=ot.analyzePath(e,t);return r.exists?r.object:($e(r.error),null)},analyzePath:function(e,t){try{e=(i=ot.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=ot.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=et.basename(e),i=ot.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createFolder:function(e,t,r,i){var n=et.join2("string"==typeof e?e:ot.getPath(e),t),a=ot.getMode(r,i);return ot.mkdir(n,a)},createPath:function(e,t,r,i){e="string"==typeof e?e:ot.getPath(e);for(var n=t.split("/").reverse();n.length;){var a=n.pop();if(a){var o=et.join2(e,a);try{ot.mkdir(o)}catch(e){}e=o}}return o},createFile:function(e,t,r,i,n){var a=et.join2("string"==typeof e?e:ot.getPath(e),t),o=ot.getMode(i,n);return ot.create(a,o)},createDataFile:function(e,t,r,i,n,a){var o=t?et.join2("string"==typeof e?e:ot.getPath(e),t):e,s=ot.getMode(i,n),u=ot.create(o,s);if(r){if("string"==typeof r){for(var d=new Array(r.length),h=0,l=r.length;h<l;++h)d[h]=r.charCodeAt(h);r=d}ot.chmod(u,146|s);var f=ot.open(u,"w");ot.write(f,r,0,r.length,0,a),ot.close(f),ot.chmod(u,s)}return u},createDevice:function(e,t,r,i){var n=et.join2("string"==typeof e?e:ot.getPath(e),t),a=ot.getMode(!!r,!!i);ot.createDevice.major||(ot.createDevice.major=64);var o=ot.makedev(ot.createDevice.major++,0);return ot.registerDevice(o,{open:function(e){e.seekable=!1},close:function(e){i&&i.buffer&&i.buffer.length&&i(10)},read:function(e,t,i,n,a){for(var o=0,s=0;s<n;s++){var u;try{u=r()}catch(e){throw new ot.ErrnoError(29)}if(void 0===u&&0===o)throw new ot.ErrnoError(6);if(null==u)break;o++,t[i+s]=u}return o&&(e.node.timestamp=Date.now()),o},write:function(e,t,r,n,a){for(var o=0;o<n;o++)try{i(t[r+o])}catch(e){throw new ot.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),o}}),ot.mkdev(n,a,o)},createLink:function(e,t,r,i,n){var a=et.join2("string"==typeof e?e:ot.getPath(e),t);return ot.symlink(r,a)},forceLoadFile:function(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;var t=!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!y)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=Ot(y(e.url),!0),e.usedBytes=e.contents.length}catch(e){t=!1}return t||$e(29),t},createLazyFile:function(e,t,r,i,n){function a(){this.lengthKnown=!1,this.chunks=[]}if(a.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,a=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var s=this;s.setDataGetter((function(e){var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===s.chunks[e]&&(s.chunks[e]=function(e,t){if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),"undefined"!=typeof Uint8Array&&(n.responseType="arraybuffer"),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):Ot(n.responseText||"",!0)}(t,n)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&i||(o=i=1,i=this.getter(0).length,o=i,console.log("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!p)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new a;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:o}}else s={isDevice:!1,url:r};var u=ot.createFile(e,t,s,i,n);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var d={};return Object.keys(u.stream_ops).forEach((function(e){var t=u.stream_ops[e];d[e]=function(){if(!ot.forceLoadFile(u))throw new ot.ErrnoError(29);return t.apply(null,arguments)}})),d.read=function(e,t,r,i,n){if(!ot.forceLoadFile(u))throw new ot.ErrnoError(29);var a=e.node.contents;if(n>=a.length)return 0;var o=Math.min(a.length-n,i);if(N(o>=0),a.slice)for(var s=0;s<o;s++)t[r+s]=a[n+s];else for(s=0;s<o;s++)t[r+s]=a.get(n+s);return o},u.stream_ops=d,u},createPreloadedFile:function(e,t,r,i,n,a,o,s,u,d){Browser.init();var l=t?tt.resolve(et.join2(e,t)):e,f=Ce("cp "+l);function c(r){function c(r){d&&d(),s||ot.createDataFile(e,t,r,i,n,u),a&&a(),Ne(f)}var p=!1;h.preloadPlugins.forEach((function(e){p||e.canHandle(l)&&(e.handle(r,l,c,(function(){o&&o(),Ne(f)})),p=!0)})),p||c(r)}Pe(f),"string"==typeof r?Browser.asyncLoad(r,(function(e){c(e)}),o):c(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,t,r){t=t||function(){},r=r||function(){};var i=ot.indexedDB();try{var n=i.open(ot.DB_NAME(),ot.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=function(){console.log("creating db"),n.result.createObjectStore(ot.DB_STORE_NAME)},n.onsuccess=function(){var i=n.result.transaction([ot.DB_STORE_NAME],"readwrite"),a=i.objectStore(ot.DB_STORE_NAME),o=0,s=0,u=e.length;function d(){0==s?t():r()}e.forEach((function(e){var t=a.put(ot.analyzePath(e).object.contents,e);t.onsuccess=function(){++o+s==u&&d()},t.onerror=function(){s++,o+s==u&&d()}})),i.onerror=r},n.onerror=r},loadFilesFromDB:function(e,t,r){t=t||function(){},r=r||function(){};var i=ot.indexedDB();try{var n=i.open(ot.DB_NAME(),ot.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=r,n.onsuccess=function(){var i=n.result;try{var a=i.transaction([ot.DB_STORE_NAME],"readonly")}catch(e){return void r(e)}var o=a.objectStore(ot.DB_STORE_NAME),s=0,u=0,d=e.length;function h(){0==u?t():r()}e.forEach((function(e){var t=o.get(e);t.onsuccess=function(){ot.analyzePath(e).exists&&ot.unlink(e),ot.createDataFile(et.dirname(e),et.basename(e),t.result,!0,!0,!0),++s+u==d&&h()},t.onerror=function(){u++,s+u==d&&h()}})),a.onerror=r},n.onerror=r}},st={DEFAULT_POLLMASK:5,mappings:{},umask:511,calculateAt:function(e,t){if("/"!==t[0]){var r;if(-100===e)r=ot.cwd();else{var i=ot.getStream(e);if(!i)throw new ot.ErrnoError(8);r=i.path}t=et.join2(r,t)}return t},doStat:function(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&et.normalize(t)!==et.normalize(ot.getPath(e.node)))return-54;throw e}return J[r>>2]=i.dev,J[r+4>>2]=0,J[r+8>>2]=i.ino,J[r+12>>2]=i.mode,J[r+16>>2]=i.nlink,J[r+20>>2]=i.uid,J[r+24>>2]=i.gid,J[r+28>>2]=i.rdev,J[r+32>>2]=0,je=[i.size>>>0,(Ue=i.size,+Me(Ue)>=1?Ue>0?(0|ke(+Re(Ue/4294967296),4294967295))>>>0:~~+Te((Ue-+(~~Ue>>>0))/4294967296)>>>0:0)],J[r+40>>2]=je[0],J[r+44>>2]=je[1],J[r+48>>2]=4096,J[r+52>>2]=i.blocks,J[r+56>>2]=i.atime.getTime()/1e3|0,J[r+60>>2]=0,J[r+64>>2]=i.mtime.getTime()/1e3|0,J[r+68>>2]=0,J[r+72>>2]=i.ctime.getTime()/1e3|0,J[r+76>>2]=0,je=[i.ino>>>0,(Ue=i.ino,+Me(Ue)>=1?Ue>0?(0|ke(+Re(Ue/4294967296),4294967295))>>>0:~~+Te((Ue-+(~~Ue>>>0))/4294967296)>>>0:0)],J[r+80>>2]=je[0],J[r+84>>2]=je[1],0},doMsync:function(e,t,r,i){var n=new Uint8Array(Y.subarray(e,e+r));ot.msync(t,n,0,r,i)},doMkdir:function(e,t){return"/"===(e=et.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),ot.mkdir(e,t,0),0},doMknod:function(e,t,r){switch(61440&t){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return ot.mknod(e,t,r),0},doReadlink:function(e,t,r){if(r<=0)return-28;var i=ot.readlink(e),n=Math.min(r,V(i)),a=Q[t+n];return W(i,t,r+1),Q[t+n]=a,n},doAccess:function(e,t){if(-8&t)return-28;var r;if(!(r=ot.lookupPath(e,{follow:!0}).node))return-44;var i="";return 4&t&&(i+="r"),2&t&&(i+="w"),1&t&&(i+="x"),i&&ot.nodePermissions(r,i)?-2:0},doDup:function(e,t,r){var i=ot.getStream(r);return i&&ot.close(i),ot.open(e,t,0,r,r).fd},doReadv:function(e,t,r,i){for(var n=0,a=0;a<r;a++){var o=J[t+8*a>>2],s=J[t+(8*a+4)>>2],u=ot.read(e,Q,o,s,i);if(u<0)return-1;if(n+=u,u<s)break}return n},doWritev:function(e,t,r,i){for(var n=0,a=0;a<r;a++){var o=J[t+8*a>>2],s=J[t+(8*a+4)>>2],u=ot.write(e,Q,o,s,i);if(u<0)return-1;n+=u}return n},varargs:0,get:function(e){return st.varargs+=4,J[st.varargs-4>>2]},getStr:function(){return H(st.get())},getStreamFromFD:function(e){void 0===e&&(e=st.get());var t=ot.getStream(e);if(!t)throw new ot.ErrnoError(8);return t},get64:function(){var e=st.get(),t=st.get();return N(e>=0?0===t:-1===t),e},getZero:function(){N(0===st.get())}};function ut(e,t){st.varargs=t;try{var r=st.getStreamFromFD();switch(st.get()){case 0:return(i=st.get())<0?-28:ot.open(r.path,r.flags,0,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=st.get();return r.flags|=i,0;case 12:i=st.get();return K[i+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return $e(28),-1;default:return-28}}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),-e.errno}}function dt(e,t){st.varargs=t;try{var r=st.getStreamFromFD(),i=st.get(),n=st.get();return ot.read(r,Q,i,n)}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),-e.errno}}function ht(e,t){st.varargs=t;try{var r=st.getStr(),i=st.get(),n=st.get();return ot.open(r,i,n).fd}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),-e.errno}}function lt(){}function ft(){Le()}function ct(){return void 0===ct.start&&(ct.start=Date.now()),1e3*(Date.now()-ct.start)|0}function pt(){return Q.length}function mt(e,t,r){Y.set(Y.subarray(t,t+r),e)}function gt(e){try{return D.grow(e-G.byteLength+65535>>16),te(D.buffer),1}catch(t){console.error("emscripten_realloc_buffer: Attempted to grow heap from "+G.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}function _t(e){var t=pt();N(e>t);if(e>2147418112)return M("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is 2147418112 bytes!"),!1;for(var r=Math.max(t,16777216);r<e;)(r=r<=536870912?ee(2*r,65536):Math.min(ee((3*r+2147483648)/4,65536),2147418112))===t&&T("Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only "+Q.length);return!!gt(r)||(M("Failed to grow the heap from "+t+" bytes to "+r+" bytes, not enough memory!"),!1)}var yt={};function bt(){if(!bt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:l};for(var t in yt)e[t]=yt[t];var r=[];for(var t in e)r.push(t+"="+e[t]);bt.strings=r}return bt.strings}function vt(e,t){var r=bt(),i=0;return r.forEach((function(r,n){var a=t+i;J[e+4*n>>2]=a,q(r,a),i+=r.length+1})),0}function wt(e,t){var r=bt();J[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),J[t>>2]=i,0}function Et(e){try{var t=st.getStreamFromFD(e);return ot.close(t),0}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function At(e,t){try{var r=st.getStreamFromFD(e),i=r.tty?2:ot.isDir(r.mode)?3:ot.isLink(r.mode)?7:4;return Q[t>>0]=i,0}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function St(e,t,r,i,n){try{var a=st.getStreamFromFD(e),o=4294967296*r+(t>>>0);return o<=-9007199254740992||o>=9007199254740992?-61:(ot.llseek(a,o,i),je=[a.position>>>0,(Ue=a.position,+Me(Ue)>=1?Ue>0?(0|ke(+Re(Ue/4294967296),4294967295))>>>0:~~+Te((Ue-+(~~Ue>>>0))/4294967296)>>>0:0)],J[n>>2]=je[0],J[n+4>>2]=je[1],a.getdents&&0===o&&0===i&&(a.getdents=null),0)}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function Mt(e,t,r,i){try{var n=st.getStreamFromFD(e),a=st.doWritev(n,t,r);return J[i>>2]=a,0}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function Tt(e){var t=Date.now();return J[e>>2]=t/1e3|0,J[e+4>>2]=t%1e3*1e3|0,0}W("GMT",1341232,4);function Rt(e){return(e=+e)>=0?+Re(e+.5):+Te(e-.5)}function kt(e){x(0|e)}function It(e){var t=Date.now()/1e3|0;return e&&(J[e>>2]=t),t}function Ot(e,t,r){var i=r>0?r:V(e)+1,n=new Array(i),a=X(e,n,0,n.length);return t&&(n.length=a),n}ot.staticInit();var Dt={__cxa_allocate_exception:Ye,__cxa_throw:Je,__lock:Ze,__syscall221:ut,__syscall3:dt,__syscall5:ht,__unlock:lt,abort:ft,clock:ct,emscripten_memcpy_big:mt,emscripten_resize_heap:_t,environ_get:vt,environ_sizes_get:wt,fd_close:Et,fd_fdstat_get:At,fd_seek:St,fd_write:Mt,gettimeofday:Tt,memory:D,round:Rt,setTempRet0:kt,table:C,time:It},xt=Ve(),Ct=xt.__wasm_call_ctors;xt.__wasm_call_ctors=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ct.apply(null,arguments)};var Pt=xt.WasmDecoder_Check;xt.WasmDecoder_Check=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Pt.apply(null,arguments)};var Nt=xt.WasmDecoder_Init;xt.WasmDecoder_Init=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Nt.apply(null,arguments)};var Lt=xt.WasmDecoder_Deinit;xt.WasmDecoder_Deinit=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Lt.apply(null,arguments)};var Bt=xt.WasmDecoder_OpenChannel;xt.WasmDecoder_OpenChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Bt.apply(null,arguments)};var Ft=xt.WasmDecoder_InputFlvStream;xt.WasmDecoder_InputFlvStream=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ft.apply(null,arguments)};var Ut=xt.WasmDecoder_GetFlvDecodeData;xt.WasmDecoder_GetFlvDecodeData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ut.apply(null,arguments)};var jt=xt.WasmDecoder_InputFlvStreamAndDecode;xt.WasmDecoder_InputFlvStreamAndDecode=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),jt.apply(null,arguments)};var Ht=xt.WasmDecoder_OpenVideoDecoder;xt.WasmDecoder_OpenVideoDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ht.apply(null,arguments)};var Xt=xt.WasmDecoder_OpenAudioDecoder;xt.WasmDecoder_OpenAudioDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Xt.apply(null,arguments)};var Wt=xt.WasmDecoder_DecodeVideoFrame;xt.WasmDecoder_DecodeVideoFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Wt.apply(null,arguments)};var Vt=xt.WasmDecoder_DecodeAudioFrame;xt.WasmDecoder_DecodeAudioFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Vt.apply(null,arguments)};var zt=xt.WasmDecoder_CloseChannel;xt.WasmDecoder_CloseChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),zt.apply(null,arguments)};var qt=xt.WasmDecoder_ConvertFrame2Image;xt.WasmDecoder_ConvertFrame2Image=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),qt.apply(null,arguments)};var Gt=xt.WasmDecoder_ReleaseImageData;xt.WasmDecoder_ReleaseImageData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Gt.apply(null,arguments)};var Qt=xt.WasmDecoder_CreateMP4File;xt.WasmDecoder_CreateMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Qt.apply(null,arguments)};var Yt=xt.WasmDecoder_WriteData;xt.WasmDecoder_WriteData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Yt.apply(null,arguments)};var Kt=xt.WasmDecoder_ReleaseMP4File;xt.WasmDecoder_ReleaseMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Kt.apply(null,arguments)};var Jt=xt.main;xt.main=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Jt.apply(null,arguments)};var Zt=xt.free;xt.free=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Zt.apply(null,arguments)};var $t=xt.malloc;xt.malloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),$t.apply(null,arguments)};var er=xt.__errno_location;xt.__errno_location=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),er.apply(null,arguments)};var tr=xt.fflush;xt.fflush=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),tr.apply(null,arguments)};var rr=xt._get_tzname;xt._get_tzname=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),rr.apply(null,arguments)};var ir=xt._get_daylight;xt._get_daylight=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ir.apply(null,arguments)};var nr=xt._get_timezone;xt._get_timezone=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),nr.apply(null,arguments)};var ar=xt.setThrew;xt.setThrew=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ar.apply(null,arguments)};var or=xt._ZSt18uncaught_exceptionv;xt._ZSt18uncaught_exceptionv=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),or.apply(null,arguments)};var sr=xt.stackSave;xt.stackSave=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),sr.apply(null,arguments)};var ur=xt.stackAlloc;xt.stackAlloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ur.apply(null,arguments)};var dr=xt.stackRestore;xt.stackRestore=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),dr.apply(null,arguments)};var hr=xt.__growWasmMemory;xt.__growWasmMemory=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),hr.apply(null,arguments)};var lr=xt.dynCall_ii;xt.dynCall_ii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),lr.apply(null,arguments)};var fr=xt.dynCall_viiiii;xt.dynCall_viiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),fr.apply(null,arguments)};var cr=xt.dynCall_viiiiiifi;xt.dynCall_viiiiiifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),cr.apply(null,arguments)};var pr=xt.dynCall_viiii;xt.dynCall_viiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),pr.apply(null,arguments)};var mr=xt.dynCall_viii;xt.dynCall_viii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),mr.apply(null,arguments)};var gr=xt.dynCall_iiiiiii;xt.dynCall_iiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),gr.apply(null,arguments)};var _r=xt.dynCall_iiiiii;xt.dynCall_iiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),_r.apply(null,arguments)};var yr=xt.dynCall_vii;xt.dynCall_vii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),yr.apply(null,arguments)};var br=xt.dynCall_iii;xt.dynCall_iii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),br.apply(null,arguments)};var vr=xt.dynCall_iiii;xt.dynCall_iiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),vr.apply(null,arguments)};var wr=xt.dynCall_viiiiii;xt.dynCall_viiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),wr.apply(null,arguments)};var Er=xt.dynCall_viiiiiiiii;xt.dynCall_viiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Er.apply(null,arguments)};var Ar=xt.dynCall_viiiiiiii;xt.dynCall_viiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ar.apply(null,arguments)};var Sr=xt.dynCall_iiiii;xt.dynCall_iiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Sr.apply(null,arguments)};var Mr=xt.dynCall_viiiiiiiiiiiiii;xt.dynCall_viiiiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Mr.apply(null,arguments)};var Tr=xt.dynCall_viiiiiiiiiii;xt.dynCall_viiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Tr.apply(null,arguments)};var Rr=xt.dynCall_viiiiiii;xt.dynCall_viiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Rr.apply(null,arguments)};var kr=xt.dynCall_viiiiiiiiiiii;xt.dynCall_viiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),kr.apply(null,arguments)};var Ir=xt.dynCall_vi;xt.dynCall_vi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ir.apply(null,arguments)};var Or=xt.dynCall_iiiiiiiii;xt.dynCall_iiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Or.apply(null,arguments)};var Dr=xt.dynCall_viiiifii;xt.dynCall_viiiifii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Dr.apply(null,arguments)};var xr=xt.dynCall_fii;xt.dynCall_fii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),xr.apply(null,arguments)};var Cr=xt.dynCall_viiiiiiiiii;xt.dynCall_viiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Cr.apply(null,arguments)};var Pr=xt.dynCall_dd;xt.dynCall_dd=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Pr.apply(null,arguments)};var Nr=xt.dynCall_viifi;xt.dynCall_viifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Nr.apply(null,arguments)};var Lr=xt.dynCall_fiii;xt.dynCall_fiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Lr.apply(null,arguments)};var Br=xt.dynCall_viidi;xt.dynCall_viidi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Br.apply(null,arguments)};var Fr=xt.dynCall_iiiiiiii;xt.dynCall_iiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Fr.apply(null,arguments)};var Ur=xt.dynCall_did;xt.dynCall_did=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ur.apply(null,arguments)};var jr=xt.dynCall_v;xt.dynCall_v=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),jr.apply(null,arguments)};var Hr=xt.dynCall_viiijj;xt.dynCall_viiijj=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Hr.apply(null,arguments)};var Xr=xt.dynCall_iiiiiiidiiddii;xt.dynCall_iiiiiiidiiddii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Xr.apply(null,arguments)};var Wr=xt.dynCall_jij;xt.dynCall_jij=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Wr.apply(null,arguments)};var Vr=xt.dynCall_jii;xt.dynCall_jii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Vr.apply(null,arguments)};var zr=xt.dynCall_jiji;xt.dynCall_jiji=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),zr.apply(null,arguments)};var qr=xt.dynCall_iidiiii;xt.dynCall_iidiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),qr.apply(null,arguments)},h.asm=xt;var Gr,Qr=h.___wasm_call_ctors=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.__wasm_call_ctors.apply(null,arguments)},Yr=(h._WasmDecoder_Check=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_Check.apply(null,arguments)},h._WasmDecoder_Init=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_Init.apply(null,arguments)},h._WasmDecoder_Deinit=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_Deinit.apply(null,arguments)},h._WasmDecoder_OpenChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_OpenChannel.apply(null,arguments)},h._WasmDecoder_InputFlvStream=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_InputFlvStream.apply(null,arguments)},h._WasmDecoder_GetFlvDecodeData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_GetFlvDecodeData.apply(null,arguments)},h._WasmDecoder_InputFlvStreamAndDecode=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_InputFlvStreamAndDecode.apply(null,arguments)},h._WasmDecoder_OpenVideoDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_OpenVideoDecoder.apply(null,arguments)},h._WasmDecoder_OpenAudioDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_OpenAudioDecoder.apply(null,arguments)},h._WasmDecoder_DecodeVideoFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_DecodeVideoFrame.apply(null,arguments)},h._WasmDecoder_DecodeAudioFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_DecodeAudioFrame.apply(null,arguments)},h._WasmDecoder_CloseChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_CloseChannel.apply(null,arguments)},h._WasmDecoder_ConvertFrame2Image=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_ConvertFrame2Image.apply(null,arguments)},h._WasmDecoder_ReleaseImageData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_ReleaseImageData.apply(null,arguments)},h._WasmDecoder_CreateMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_CreateMP4File.apply(null,arguments)},h._WasmDecoder_WriteData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_WriteData.apply(null,arguments)},h._WasmDecoder_ReleaseMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_ReleaseMP4File.apply(null,arguments)},h._main=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.main.apply(null,arguments)},h._free=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.free.apply(null,arguments)},h._malloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.malloc.apply(null,arguments)}),Kr=(h.___errno_location=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.__errno_location.apply(null,arguments)},h._fflush=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.fflush.apply(null,arguments)},h.__get_tzname=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._get_tzname.apply(null,arguments)},h.__get_daylight=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._get_daylight.apply(null,arguments)},h.__get_timezone=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._get_timezone.apply(null,arguments)},h._setThrew=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.setThrew.apply(null,arguments)},h.__ZSt18uncaught_exceptionv=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._ZSt18uncaught_exceptionv.apply(null,arguments)}),Jr=h.stackSave=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.stackSave.apply(null,arguments)},Zr=h.stackAlloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.stackAlloc.apply(null,arguments)},$r=h.stackRestore=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.stackRestore.apply(null,arguments)};h.__growWasmMemory=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.__growWasmMemory.apply(null,arguments)},h.dynCall_ii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_ii.apply(null,arguments)},h.dynCall_viiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiii.apply(null,arguments)},h.dynCall_viiiiiifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiifi.apply(null,arguments)},h.dynCall_viiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiii.apply(null,arguments)},h.dynCall_viii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viii.apply(null,arguments)},h.dynCall_iiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiii.apply(null,arguments)},h.dynCall_iiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiii.apply(null,arguments)},h.dynCall_vii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_vii.apply(null,arguments)},h.dynCall_iii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iii.apply(null,arguments)},h.dynCall_iiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiii.apply(null,arguments)},h.dynCall_viiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiii.apply(null,arguments)},h.dynCall_viiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiii.apply(null,arguments)},h.dynCall_viiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiii.apply(null,arguments)},h.dynCall_iiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiii.apply(null,arguments)},h.dynCall_viiiiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiiiiiii.apply(null,arguments)},h.dynCall_viiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiiii.apply(null,arguments)},h.dynCall_viiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiii.apply(null,arguments)},h.dynCall_viiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiiiii.apply(null,arguments)},h.dynCall_vi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_vi.apply(null,arguments)},h.dynCall_iiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiiiii.apply(null,arguments)},h.dynCall_viiiifii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiifii.apply(null,arguments)},h.dynCall_fii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_fii.apply(null,arguments)},h.dynCall_viiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiii.apply(null,arguments)},h.dynCall_dd=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_dd.apply(null,arguments)},h.dynCall_viifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viifi.apply(null,arguments)},h.dynCall_fiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_fiii.apply(null,arguments)},h.dynCall_viidi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viidi.apply(null,arguments)},h.dynCall_iiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiiii.apply(null,arguments)},h.dynCall_did=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_did.apply(null,arguments)},h.dynCall_v=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_v.apply(null,arguments)},h.dynCall_viiijj=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiijj.apply(null,arguments)},h.dynCall_iiiiiiidiiddii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiiidiiddii.apply(null,arguments)},h.dynCall_jij=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_jij.apply(null,arguments)},h.dynCall_jii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_jii.apply(null,arguments)},h.dynCall_jiji=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_jiji.apply(null,arguments)},h.dynCall_iidiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iidiiii.apply(null,arguments)};function ei(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}h.asm=xt,Object.getOwnPropertyDescriptor(h,"intArrayFromString")||(h.intArrayFromString=function(){Le("'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"intArrayToString")||(h.intArrayToString=function(){Le("'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.ccall=B,h.cwrap=F,Object.getOwnPropertyDescriptor(h,"setValue")||(h.setValue=function(){Le("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getValue")||(h.getValue=function(){Le("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"allocate")||(h.allocate=function(){Le("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getMemory")||(h.getMemory=function(){Le("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"AsciiToString")||(h.AsciiToString=function(){Le("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToAscii")||(h.stringToAscii=function(){Le("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF8ArrayToString")||(h.UTF8ArrayToString=function(){Le("'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF8ToString")||(h.UTF8ToString=function(){Le("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF8Array")||(h.stringToUTF8Array=function(){Le("'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF8")||(h.stringToUTF8=function(){Le("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"lengthBytesUTF8")||(h.lengthBytesUTF8=function(){Le("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF16ToString")||(h.UTF16ToString=function(){Le("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF16")||(h.stringToUTF16=function(){Le("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"lengthBytesUTF16")||(h.lengthBytesUTF16=function(){Le("'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF32ToString")||(h.UTF32ToString=function(){Le("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF32")||(h.stringToUTF32=function(){Le("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"lengthBytesUTF32")||(h.lengthBytesUTF32=function(){Le("'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"allocateUTF8")||(h.allocateUTF8=function(){Le("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackTrace")||(h.stackTrace=function(){Le("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnPreRun")||(h.addOnPreRun=function(){Le("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnInit")||(h.addOnInit=function(){Le("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnPreMain")||(h.addOnPreMain=function(){Le("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnExit")||(h.addOnExit=function(){Le("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnPostRun")||(h.addOnPostRun=function(){Le("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"writeStringToMemory")||(h.writeStringToMemory=function(){Le("'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"writeArrayToMemory")||(h.writeArrayToMemory=function(){Le("'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"writeAsciiToMemory")||(h.writeAsciiToMemory=function(){Le("'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addRunDependency")||(h.addRunDependency=function(){Le("'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"removeRunDependency")||(h.removeRunDependency=function(){Le("'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"ENV")||(h.ENV=function(){Le("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"FS")||(h.FS=function(){Le("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"FS_createFolder")||(h.FS_createFolder=function(){Le("'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createPath")||(h.FS_createPath=function(){Le("'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createDataFile")||(h.FS_createDataFile=function(){Le("'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createPreloadedFile")||(h.FS_createPreloadedFile=function(){Le("'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createLazyFile")||(h.FS_createLazyFile=function(){Le("'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createLink")||(h.FS_createLink=function(){Le("'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createDevice")||(h.FS_createDevice=function(){Le("'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_unlink")||(h.FS_unlink=function(){Le("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"GL")||(h.GL=function(){Le("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"dynamicAlloc")||(h.dynamicAlloc=function(){Le("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"loadDynamicLibrary")||(h.loadDynamicLibrary=function(){Le("'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"loadWebAssemblyModule")||(h.loadWebAssemblyModule=function(){Le("'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getLEB")||(h.getLEB=function(){Le("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getFunctionTables")||(h.getFunctionTables=function(){Le("'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"alignFunctionTables")||(h.alignFunctionTables=function(){Le("'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"registerFunctions")||(h.registerFunctions=function(){Le("'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.addFunction=I,Object.getOwnPropertyDescriptor(h,"removeFunction")||(h.removeFunction=function(){Le("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getFuncWrapper")||(h.getFuncWrapper=function(){Le("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"prettyPrint")||(h.prettyPrint=function(){Le("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"makeBigInt")||(h.makeBigInt=function(){Le("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"dynCall")||(h.dynCall=function(){Le("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getCompilerSetting")||(h.getCompilerSetting=function(){Le("'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackSave")||(h.stackSave=function(){Le("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackRestore")||(h.stackRestore=function(){Le("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackAlloc")||(h.stackAlloc=function(){Le("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"establishStackSpace")||(h.establishStackSpace=function(){Le("'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"print")||(h.print=function(){Le("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"printErr")||(h.printErr=function(){Le("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getTempRet0")||(h.getTempRet0=function(){Le("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"setTempRet0")||(h.setTempRet0=function(){Le("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.callMain=ti,Object.getOwnPropertyDescriptor(h,"abort")||(h.abort=function(){Le("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"Pointer_stringify")||(h.Pointer_stringify=function(){Le("'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"warnOnce")||(h.warnOnce=function(){Le("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.writeStackCookie=ue,h.checkStackCookie=de,h.abortStackOverflow=he,Object.getOwnPropertyDescriptor(h,"ALLOC_NORMAL")||Object.defineProperty(h,"ALLOC_NORMAL",{configurable:!0,get:function(){Le("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"ALLOC_STACK")||Object.defineProperty(h,"ALLOC_STACK",{configurable:!0,get:function(){Le("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"ALLOC_DYNAMIC")||Object.defineProperty(h,"ALLOC_DYNAMIC",{configurable:!0,get:function(){Le("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"ALLOC_NONE")||Object.defineProperty(h,"ALLOC_NONE",{configurable:!0,get:function(){Le("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"calledRun")||Object.defineProperty(h,"calledRun",{configurable:!0,get:function(){Le("'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}});function ti(e){N(0==Ie,'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'),N(0==fe.length,"cannot call main when preRun functions remain to be called");var t=h._main;try{ni(t(0,0),!0)}catch(e){if(e instanceof ei)return;if("SimulateInfiniteLoop"==e)return void(o=!0);var r=e;e&&"object"==typeof e&&e.stack&&(r=[e,e.stack]),M("exception thrown: "+r),f(1,e)}finally{!0}}function ri(e){function t(){Gr||(Gr=!0,P||(be(),ve(),h.onRuntimeInitialized&&h.onRuntimeInitialized(),ai&&ti(),Ee()))}e=e||u,Ie>0||(ue(),ye(),Ie>0||(h.setStatus?(h.setStatus("Running..."),setTimeout((function(){setTimeout((function(){h.setStatus("")}),1),t()}),1)):t(),de()))}function ii(){var e=S,t=M,r=!1;S=M=function(e){r=!0};try{var i=h._fflush;i&&i(0),["stdout","stderr"].forEach((function(e){var t=ot.analyzePath("/dev/"+e);if(t){var i=t.object.rdev,n=rt.ttys[i];n&&n.output&&n.output.length&&(r=!0)}}))}catch(e){}S=e,M=t,r&&T("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.")}function ni(e,t){ii(),t&&o&&0===e||(o?t||M("program exited (with status: "+e+"), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)"):(P=!0,e,we(),h.onExit&&h.onExit(e)),f(e,new ei(e)))}if(De=function e(){Gr||ri(),Gr||(De=e)},h.run=ri,h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);h.preInit.length>0;)h.preInit.pop()();var ai=!0;h.noInitialRun&&(ai=!1),o=!0,ri()}t.default=function(e){e.recordChunkData=null,e.recordChunkSize=0,e.recordChunkPos=0,e.exitFlag=!1,e.audioCodecId=0,e.audioSamplerate=8e3,e.audioChannelCount=1,e.videoRawData=null,e.videoPTS=0,e.audioPTS=0,e.videoLastPts=0,e.audioLastPts=0,e.audioRawData=null,e.mp4CallbackFunc=null;h.onRuntimeInitialized=function(){u=!0},e.addEventListener("message",(function(t){var r=t.data;switch(r.cmd){case s.w:d=r.url,e.audioSamplerate=r.audioSamplerate,e.audioChannelCount=r.channelCount,parseInt(e.audioSamplerate)>=8e3&&(e.audioCodecId=86018),u||l(),null==e.recordChunkData&&(e.recordChunkData=new Uint8Array(r.filesize+8388608),e.recordChunkSize=r.filesize),e.recordChunkPos=0,e.exitFlag=!1;var i={cmd:s.w};e.postMessage(i);break;case s.l:e.exitFlag=!0,e.recordChunkData&&(delete e.recordChunkData,e.recordChunkData=null),null!=e.videoRawData&&(h._free(e.videoRawData),e.videoRawData=null),null!=e.audioRawData&&(h._free(e.audioRawData),e.audioRawData=null);break;case s.C:if(null==e.recordChunkData)break;if(e.recordChunkData.byteLength<1)break;e.exitFlag=!0,u&&h._WasmDecoder_ReleaseMP4File();break;case s.q:if(e.exitFlag)break;if(u){if(null==e.videoRawData){null==e.videoRawData&&(e.videoRawData=h._malloc(8294400)),null==e.audioRawData&&(e.audioRawData=h._malloc(16384)),e.videoPTS=0,e.videoLastPts=0,e.audioPTS=0,e.audioLastPts=0,e.mp4CallbackFunc=h.addFunction((function(t,r,i,n){if(3==r){var a=h.HEAPU8.subarray(i,i+4);if(e.recordChunkData.set(a,n),e.recordChunkPos>e.recordChunkSize){e.blob=URL.createObjectURL(new Blob([e.recordChunkData],{type:"video/mp4"}));var o={cmd:s.p,type:"auto",dat:e.blob};e.postMessage(o)}else{var u=e.recordChunkData.subarray(0,e.recordChunkPos),d=new Uint8Array(u);delete e.recordChunkData,e.recordChunkData=null,e.blob=URL.createObjectURL(new Blob([d],{type:"video/mp4"}));o={cmd:s.p,type:"manual",dat:e.blob};e.postMessage(o)}}else{a=h.HEAPU8.subarray(i,i+n);e.recordChunkData.set(a,e.recordChunkPos),e.recordChunkPos+=a.length}}),"iiiii");h._WasmDecoder_CreateMP4File(r.codecId,0,0,e.audioCodecId,e.audioSamplerate,e.audioChannelCount,e.mp4CallbackFunc,e)}if(e.recordChunkPos>0||r.type){r.type;var n=1,a=e.videoPTS;if("video"==r.mediaType){if(e.videoLastPts<1)e.videoPTS=0;else{var o=r.pts-e.videoLastPts;e.videoPTS+=o}e.videoLastPts=r.pts,a=e.videoPTS}else{if(n=2,e.audioLastPts<1)e.audioPTS=0;else{var f=r.pts-e.audioLastPts;e.audioPTS+=f}e.audioLastPts=r.pts,a=e.audioPTS}h.HEAPU8.set(r.dat,e.videoRawData);h._WasmDecoder_WriteData(n,e.videoRawData,r.dat.length,r.type,a);e.recordChunkPos+r.dat.byteLength>e.recordChunkSize&&(e.exitFlag=!0,h._WasmDecoder_ReleaseMP4File())}}}}))}}.call(this,r(9),"/",r(68)(e),r(10).Buffer)},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){},function(e,t,r){(function(e){function r(e,t){for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i<e.length;i++)t(e[i],i,e)&&r.push(e[i]);return r}t.resolve=function(){for(var t="",n=!1,a=arguments.length-1;a>=-1&&!n;a--){var o=a>=0?arguments[a]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,n="/"===o.charAt(0))}return(n?"/":"")+(t=r(i(t.split("/"),(function(e){return!!e})),!n).join("/"))||"."},t.normalize=function(e){var a=t.isAbsolute(e),o="/"===n(e,-1);return(e=r(i(e.split("/"),(function(e){return!!e})),!a).join("/"))||a||(e="."),e&&o&&(e+="/"),(a?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(i(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},t.relative=function(e,r){function i(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=t.resolve(e).substr(1),r=t.resolve(r).substr(1);for(var n=i(e.split("/")),a=i(r.split("/")),o=Math.min(n.length,a.length),s=o,u=0;u<o;u++)if(n[u]!==a[u]){s=u;break}var d=[];for(u=s;u<n.length;u++)d.push("..");return(d=d.concat(a.slice(s))).join("/")},t.sep="/",t.delimiter=":",t.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,i=-1,n=!0,a=e.length-1;a>=1;--a)if(47===(t=e.charCodeAt(a))){if(!n){i=a;break}}else n=!1;return-1===i?r?"/":".":r&&1===i?"/":e.slice(0,i)},t.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,i=-1,n=!0;for(t=e.length-1;t>=0;--t)if(47===e.charCodeAt(t)){if(!n){r=t+1;break}}else-1===i&&(n=!1,i=t+1);return-1===i?"":e.slice(r,i)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},t.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,i=-1,n=!0,a=0,o=e.length-1;o>=0;--o){var s=e.charCodeAt(o);if(47!==s)-1===i&&(n=!1,i=o+1),46===s?-1===t?t=o:1!==a&&(a=1):-1!==t&&(a=-1);else if(!n){r=o+1;break}}return-1===t||-1===i||0===a||1===a&&t===i-1&&t===r+1?"":e.slice(t,i)};var n="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,r(9))},function(e,t,r){"use strict";t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=r(24),t.createHash=t.Hash=r(31),t.createHmac=t.Hmac=r(85);var i=r(160),n=Object.keys(i),a=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(n);t.getHashes=function(){return a};var o=r(88);t.pbkdf2=o.pbkdf2,t.pbkdf2Sync=o.pbkdf2Sync;var s=r(162);t.Cipher=s.Cipher,t.createCipher=s.createCipher,t.Cipheriv=s.Cipheriv,t.createCipheriv=s.createCipheriv,t.Decipher=s.Decipher,t.createDecipher=s.createDecipher,t.Decipheriv=s.Decipheriv,t.createDecipheriv=s.createDecipheriv,t.getCiphers=s.getCiphers,t.listCiphers=s.listCiphers;var u=r(177);t.DiffieHellmanGroup=u.DiffieHellmanGroup,t.createDiffieHellmanGroup=u.createDiffieHellmanGroup,t.getDiffieHellman=u.getDiffieHellman,t.createDiffieHellman=u.createDiffieHellman,t.DiffieHellman=u.DiffieHellman;var d=r(182);t.createSign=d.createSign,t.Sign=d.Sign,t.createVerify=d.createVerify,t.Verify=d.Verify,t.createECDH=r(223);var h=r(224);t.publicEncrypt=h.publicEncrypt,t.privateEncrypt=h.privateEncrypt,t.publicDecrypt=h.publicDecrypt,t.privateDecrypt=h.privateDecrypt;var l=r(227);t.randomFill=l.randomFill,t.randomFillSync=l.randomFillSync,t.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(e,t,r){"use strict";var i=r(6).Buffer,n=r(136).Transform;function a(e){n.call(this),this._block=i.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(5)(a,n),a.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(e){i=e}r(i)},a.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},a.prototype.update=function(e,t){if(function(e,t){if(!i.isBuffer(e)&&"string"!=typeof e)throw new TypeError(t+" must be a string or a buffer")}(e,"Data"),this._finalized)throw new Error("Digest already called");i.isBuffer(e)||(e=i.from(e,t));for(var r=this._block,n=0;this._blockOffset+e.length-n>=this._blockSize;){for(var a=this._blockOffset;a<this._blockSize;)r[a++]=e[n++];this._update(),this._blockOffset=0}for(;n<e.length;)r[this._blockOffset++]=e[n++];for(var o=0,s=8*e.length;s>0;++o)this._length[o]+=s,(s=this._length[o]/4294967296|0)>0&&(this._length[o]-=4294967296*s);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},a.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=a},function(e,t,r){"use strict";(function(t,i){var n;e.exports=M,M.ReadableState=S;r(8).EventEmitter;var a=function(e,t){return e.listeners(t).length},o=r(74),s=r(10).Buffer,u=t.Uint8Array||function(){};var d,h=r(137);d=h&&h.debuglog?h.debuglog("stream"):function(){};var l,f,c,p=r(138),m=r(75),g=r(76).getHighWaterMark,_=r(25).codes,y=_.ERR_INVALID_ARG_TYPE,b=_.ERR_STREAM_PUSH_AFTER_EOF,v=_.ERR_METHOD_NOT_IMPLEMENTED,w=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(5)(M,o);var E=m.errorOrDestroy,A=["error","close","destroy","pause","resume"];function S(e,t,i){n=n||r(26),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(22).StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function M(e){if(n=n||r(26),!(this instanceof M))return new M(e);var t=this instanceof n;this._readableState=new S(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function T(e,t,r,i,n){d("readableAddChunk",t);var a,o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(d("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?I(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,o);else if(n||(a=function(e,t){var r;i=t,s.isBuffer(i)||i instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));var i;return r}(o,t)),a)E(e,a);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),i)o.endEmitted?E(e,new w):R(e,o,t,!0);else if(o.ended)E(e,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?R(e,o,t,!1):D(e,o)):R(e,o,t,!1)}else i||(o.reading=!1,D(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function R(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&I(e)),D(e,t)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),M.prototype.destroy=m.destroy,M.prototype._undestroy=m.undestroy,M.prototype._destroy=function(e,t){t(e)},M.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=s.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},M.prototype.unshift=function(e){return T(this,e,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(e){l||(l=r(22).StringDecoder);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,n="";null!==i;)n+=t.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};function k(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function I(e){var t=e._readableState;d("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(O,e))}function O(e){var t=e._readableState;d("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function D(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(x,e,t))}function x(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(d("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function C(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){d("readable nexttick read 0"),e.read(0)}function N(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function F(e){var t=e._readableState;d("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(U,t,e))}function U(e,t){if(d("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function j(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}M.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):I(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&F(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",n=!0),t.ended||t.reading?d("reading or ended",n=!1):n&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=k(r,t))),null===(i=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&F(this)),null!==i&&this.emit("data",i),i},M.prototype._read=function(e){E(this,new v("_read()"))},M.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,d("pipe count=%d opts=%j",n.pipesCount,t);var o=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?u:g;function s(t,i){d("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",c),e.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",f),l=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function u(){d("onend"),e.end()}n.endEmitted?i.nextTick(o):r.once("end",o),e.on("unpipe",s);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,L(e))}}(r);e.on("drain",h);var l=!1;function f(t){d("ondata");var i=e.write(t);d("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==j(n.pipes,e))&&!l&&(d("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function c(t){d("onerror",t),g(),e.removeListener("error",c),0===a(e,"error")&&E(e,t)}function p(){e.removeListener("finish",m),g()}function m(){d("onfinish"),e.removeListener("close",p),g()}function g(){d("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",c),e.once("close",p),e.once("finish",m),e.emit("pipe",r),n.flowing||(d("pipe resume"),r.resume()),e},M.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<n;a++)i[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=j(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},M.prototype.on=function(e,t){var r=o.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,d("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(P,this))),r},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(e,t){var r=o.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(C,this),r},M.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(C,this),t},M.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(N,e,t))}(this,e)),e.paused=!1,this},M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},M.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(d("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(d("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var a=0;a<A.length;a++)e.on(A[a],this.emit.bind(this,A[a]));return this._read=function(t){d("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(M.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(140)),f(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),M._fromList=B,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(M.from=function(e,t){return void 0===c&&(c=r(141)),c(M,e,t)})}).call(this,r(13),r(9))},function(e,t,r){e.exports=r(8).EventEmitter},function(e,t,r){"use strict";(function(t){function r(e,t){n(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,a){var o=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(a?a(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(n,this,e)):t.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!a&&e?o._writableState?o._writableState.errorEmitted?t.nextTick(i,o):(o._writableState.errorEmitted=!0,t.nextTick(r,o,e)):t.nextTick(r,o,e):a?(t.nextTick(i,o),a(e)):t.nextTick(i,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this,r(9))},function(e,t,r){"use strict";var i=r(25).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,n){var a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new i(n?r:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},function(e,t,r){"use strict";(function(t,i){function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}var a;e.exports=M,M.WritableState=S;var o={deprecate:r(45)},s=r(74),u=r(10).Buffer,d=t.Uint8Array||function(){};var h,l=r(75),f=r(76).getHighWaterMark,c=r(25).codes,p=c.ERR_INVALID_ARG_TYPE,m=c.ERR_METHOD_NOT_IMPLEMENTED,g=c.ERR_MULTIPLE_CALLBACK,_=c.ERR_STREAM_CANNOT_PIPE,y=c.ERR_STREAM_DESTROYED,b=c.ERR_STREAM_NULL_VALUES,v=c.ERR_STREAM_WRITE_AFTER_END,w=c.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function A(){}function S(e,t,o){a=a||r(26),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,a=r.writecb;if("function"!=typeof a)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,a){--t.pendingcb,r?(i.nextTick(a,n),i.nextTick(D,e,t),e._writableState.errorEmitted=!0,E(e,n)):(a(n),e._writableState.errorEmitted=!0,E(e,n),D(e,t))}(e,r,n,t,a);else{var o=I(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),n?i.nextTick(R,e,r,o,a):R(e,r,o,a)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function M(e){var t=this instanceof(a=a||r(26));if(!t&&!h.call(M,this))return new M(e);this._writableState=new S(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function T(e,t,r,i,n,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y("write")):r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function R(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),D(e,t)}function k(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,u=!0;r;)a[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;a.allBuffers=u,T(e,t,!0,t.length,a,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,h=r.encoding,l=r.callback;if(T(e,t,!1,t.objectMode?1:d.length,d,h,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function O(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),D(e,t)}))}function D(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(O,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(5)(M,s),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===M&&(e&&e._writableState instanceof S)}})):h=function(e){return e instanceof this},M.prototype.pipe=function(){E(this,new _)},M.prototype.write=function(e,t,r){var n,a=this._writableState,o=!1,s=!a.objectMode&&(n=e,u.isBuffer(n)||n instanceof d);return s&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=A),a.ending?function(e,t){var r=new v;E(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var a;return null===r?a=new b:"string"==typeof r||t.objectMode||(a=new p("chunk",["string","Buffer"],r)),!a||(E(e,a),i.nextTick(n,a),!1)}(this,a,e,r))&&(a.pendingcb++,o=function(e,t,r,i,n,a){if(!r){var o=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r));return t}(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var d=t.length<t.highWaterMark;d||(t.needDrain=!0);if(t.writing||t.corked){var h=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:a,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,s,i,n,a);return d}(this,a,s,e,t,r)),o},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},M.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(e,t,r){r(new m("_write()"))},M.prototype._writev=null,M.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,D(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),M.prototype.destroy=l.destroy,M.prototype._undestroy=l.undestroy,M.prototype._destroy=function(e,t){t(e)}}).call(this,r(13),r(9))},function(e,t,r){"use strict";e.exports=h;var i=r(25).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(26);function d(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function h(e){if(!(this instanceof h))return new h(e);u.call(this,e),this._transformState={afterTransform:d.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(t,r){f(e,t,r)}))}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new o;return e.push(null)}r(5)(h,u),h.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},h.prototype._transform=function(e,t,r){r(new n("_transform()"))},h.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},h.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},h.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},function(e,t,r){var i=r(5),n=r(27),a=r(6).Buffer,o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,n.call(this,64,56)}function d(e,t,r){return r^e&(t^r)}function h(e,t,r){return e&t|r&(e|t)}function l(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function f(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function c(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}i(u,n),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,_=0;_<16;++_)r[_]=e.readInt32BE(4*_);for(;_<64;++_)r[_]=0|(((t=r[_-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[_-7]+c(r[_-15])+r[_-16];for(var y=0;y<64;++y){var b=g+f(u)+d(u,p,m)+o[y]+r[y]|0,v=l(i)+h(i,n,a)|0;g=m,m=p,p=u,u=s+b|0,s=a,a=n,n=i,i=b+v|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=a.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},function(e,t,r){var i=r(5),n=r(27),a=r(6).Buffer,o=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,n.call(this,128,112)}function d(e,t,r){return r^e&(t^r)}function h(e,t,r){return e&t|r&(e|t)}function l(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function f(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function c(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function m(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function _(e,t){return e>>>0<t>>>0?1:0}i(u,n),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,a=0|this._dh,s=0|this._eh,u=0|this._fh,y=0|this._gh,b=0|this._hh,v=0|this._al,w=0|this._bl,E=0|this._cl,A=0|this._dl,S=0|this._el,M=0|this._fl,T=0|this._gl,R=0|this._hl,k=0;k<32;k+=2)t[k]=e.readInt32BE(4*k),t[k+1]=e.readInt32BE(4*k+4);for(;k<160;k+=2){var I=t[k-30],O=t[k-30+1],D=c(I,O),x=p(O,I),C=m(I=t[k-4],O=t[k-4+1]),P=g(O,I),N=t[k-14],L=t[k-14+1],B=t[k-32],F=t[k-32+1],U=x+L|0,j=D+N+_(U,x)|0;j=(j=j+C+_(U=U+P|0,P)|0)+B+_(U=U+F|0,F)|0,t[k]=j,t[k+1]=U}for(var H=0;H<160;H+=2){j=t[H],U=t[H+1];var X=h(r,i,n),W=h(v,w,E),V=l(r,v),z=l(v,r),q=f(s,S),G=f(S,s),Q=o[H],Y=o[H+1],K=d(s,u,y),J=d(S,M,T),Z=R+G|0,$=b+q+_(Z,R)|0;$=($=($=$+K+_(Z=Z+J|0,J)|0)+Q+_(Z=Z+Y|0,Y)|0)+j+_(Z=Z+U|0,U)|0;var ee=z+W|0,te=V+X+_(ee,z)|0;b=y,R=T,y=u,T=M,u=s,M=S,s=a+$+_(S=A+Z|0,A)|0,a=n,A=E,n=i,E=w,i=r,w=v,r=$+te+_(v=Z+ee|0,Z)|0}this._al=this._al+v|0,this._bl=this._bl+w|0,this._cl=this._cl+E|0,this._dl=this._dl+A|0,this._el=this._el+S|0,this._fl=this._fl+M|0,this._gl=this._gl+T|0,this._hl=this._hl+R|0,this._ah=this._ah+r+_(this._al,v)|0,this._bh=this._bh+i+_(this._bl,w)|0,this._ch=this._ch+n+_(this._cl,E)|0,this._dh=this._dh+a+_(this._dl,A)|0,this._eh=this._eh+s+_(this._el,S)|0,this._fh=this._fh+u+_(this._fl,M)|0,this._gh=this._gh+y+_(this._gl,T)|0,this._hh=this._hh+b+_(this._hl,R)|0},u.prototype._hash=function(){var e=a.allocUnsafe(64);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},function(e,t,r){"use strict";(function(t,i){var n=r(38);e.exports=b;var a,o=r(66);b.ReadableState=y;r(8).EventEmitter;var s=function(e,t){return e.listeners(t).length},u=r(82),d=r(50).Buffer,h=t.Uint8Array||function(){};var l=Object.create(r(32));l.inherits=r(5);var f=r(149),c=void 0;c=f&&f.debuglog?f.debuglog("stream"):function(){};var p,m=r(150),g=r(83);l.inherits(b,u);var _=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var i=t instanceof(a=a||r(23));this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,o=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(p||(p=r(22).StringDecoder),this.decoder=new p(e.encoding),this.encoding=e.encoding)}function b(e){if(a=a||r(23),!(this instanceof b))return new b(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function v(e,t,r,i,n){var a,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,A(e)}(e,o)):(n||(a=function(e,t){var r;i=t,d.isBuffer(i)||i instanceof h||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,t)),a?e.emit("error",a):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===d.prototype||(t=function(e){return d.from(e)}(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?w(e,o,t,!1):M(e,o)):w(e,o,t,!1))):i||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(o)}function w(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),M(e,t)}Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(e,t){this.push(null),t(e)},b.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=d.from(e,t),t=""),r=!0),v(this,e,t,!1,r)},b.prototype.unshift=function(e){return v(this,e,null,!0,!1)},b.prototype.isPaused=function(){return!1===this._readableState.flowing},b.prototype.setEncoding=function(e){return p||(p=r(22).StringDecoder),this._readableState.decoder=new p(e),this._readableState.encoding=e,this};function E(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(c("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(S,e):S(e))}function S(e){c("emit readable"),e.emit("readable"),I(e)}function M(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(T,e,t))}function T(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(c("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function R(e){c("readable nexttick read 0"),e.read(0)}function k(e,t){t.reading||(c("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),I(e),t.flowing&&!t.reading&&e.read(0)}function I(e){var t=e._readableState;for(c("flow",t.flowing);t.flowing&&null!==e.read(););}function O(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var i;e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):i=e===t.head.data.length?t.shift():r?function(e,t){var r=t.head,i=1,n=r.data;e-=n.length;for(;r=r.next;){var a=r.data,o=e>a.length?a.length:e;if(o===a.length?n+=a:n+=a.slice(0,e),0===(e-=o)){o===a.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(o));break}++i}return t.length-=i,n}(e,t):function(e,t){var r=d.allocUnsafe(e),i=t.head,n=1;i.data.copy(r),e-=i.data.length;for(;i=i.next;){var a=i.data,o=e>a.length?a.length:e;if(a.copy(r,r.length-e,0,o),0===(e-=o)){o===a.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=a.slice(o));break}++n}return t.length-=n,r}(e,t);return i}(e,t.buffer,t.decoder),r);var r}function D(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,n.nextTick(x,t,e))}function x(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function C(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}b.prototype.read=function(e){c("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return c("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):A(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&D(this),null;var i,n=t.needReadable;return c("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&c("length less than watermark",n=!0),t.ended||t.reading?c("reading or ended",n=!1):n&&(c("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=E(r,t))),null===(i=e>0?O(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==i&&this.emit("data",i),i},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,c("pipe count=%d opts=%j",a.pipesCount,t);var u=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?h:b;function d(t,i){c("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,c("cleanup"),e.removeListener("close",_),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",g),e.removeListener("unpipe",d),r.removeListener("end",h),r.removeListener("end",b),r.removeListener("data",m),f=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function h(){c("onend"),e.end()}a.endEmitted?n.nextTick(u):r.once("end",u),e.on("unpipe",d);var l=function(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,I(e))}}(r);e.on("drain",l);var f=!1;var p=!1;function m(t){c("ondata"),p=!1,!1!==e.write(t)||p||((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==C(a.pipes,e))&&!f&&(c("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function g(t){c("onerror",t),b(),e.removeListener("error",g),0===s(e,"error")&&e.emit("error",t)}function _(){e.removeListener("finish",y),b()}function y(){c("onfinish"),e.removeListener("close",_),b()}function b(){c("unpipe"),r.unpipe(e)}return r.on("data",m),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",g),e.once("close",_),e.once("finish",y),e.emit("pipe",r),a.flowing||(c("pipe resume"),r.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<n;a++)i[a].emit("unpipe",this,r);return this}var o=C(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},b.prototype.on=function(e,t){var r=u.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&A(this):n.nextTick(R,this))}return r},b.prototype.addListener=b.prototype.on,b.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(k,e,t))}(this,e)),this},b.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},b.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(c("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(c("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var a=0;a<_.length;a++)e.on(_[a],this.emit.bind(this,_[a]));return this._read=function(t){c("wrapped _read",t),i&&(i=!1,e.resume())},this},Object.defineProperty(b.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),b._fromList=O}).call(this,r(13),r(9))},function(e,t,r){e.exports=r(8).EventEmitter},function(e,t,r){"use strict";var i=r(38);function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(i.nextTick(n,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,r){"use strict";e.exports=o;var i=r(23),n=Object.create(r(32));function a(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);i.call(this,e),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",s)}function s(){var e=this;"function"==typeof this._flush?this._flush((function(t,r){u(e,t,r)})):u(this,null,null)}function u(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}n.inherits=r(5),n.inherits(o,i),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,i.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")},o.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},o.prototype._destroy=function(e,t){var r=this;i.prototype._destroy.call(this,e,(function(e){t(e),r.emit("close")}))}},function(e,t,r){"use strict";var i=r(5),n=r(159),a=r(20),o=r(6).Buffer,s=r(86),u=r(47),d=r(48),h=o.alloc(128);function l(e,t){a.call(this,"digest"),"string"==typeof t&&(t=o.from(t));var r="sha512"===e||"sha384"===e?128:64;(this._alg=e,this._key=t,t.length>r)?t=("rmd160"===e?new u:d(e)).update(t).digest():t.length<r&&(t=o.concat([t,h],r));for(var i=this._ipad=o.allocUnsafe(r),n=this._opad=o.allocUnsafe(r),s=0;s<r;s++)i[s]=54^t[s],n[s]=92^t[s];this._hash="rmd160"===e?new u:d(e),this._hash.update(i)}i(l,a),l.prototype._update=function(e){this._hash.update(e)},l.prototype._final=function(){var e=this._hash.digest();return("rmd160"===this._alg?new u:d(this._alg)).update(this._opad).update(e).digest()},e.exports=function(e,t){return"rmd160"===(e=e.toLowerCase())||"ripemd160"===e?new l("rmd160",t):"md5"===e?new n(s,t):new l(e,t)}},function(e,t,r){var i=r(44);e.exports=function(e){return(new i).update(e).digest()}},function(e){e.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},function(e,t,r){t.pbkdf2=r(161),t.pbkdf2Sync=r(91)},function(e,t){var r=Math.pow(2,30)-1;e.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>r||t!=t)throw new TypeError("Bad key length")}},function(e,t,r){(function(t,r){var i;if(t.process&&t.process.browser)i="utf-8";else if(t.process&&t.process.version){i=parseInt(r.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else i="utf-8";e.exports=i}).call(this,r(13),r(9))},function(e,t,r){var i=r(86),n=r(47),a=r(48),o=r(6).Buffer,s=r(89),u=r(90),d=r(92),h=o.alloc(128),l={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function f(e,t,r){var s=function(e){function t(t){return a(e).update(t).digest()}return"rmd160"===e||"ripemd160"===e?function(e){return(new n).update(e).digest()}:"md5"===e?i:t}(e),u="sha512"===e||"sha384"===e?128:64;t.length>u?t=s(t):t.length<u&&(t=o.concat([t,h],u));for(var d=o.allocUnsafe(u+l[e]),f=o.allocUnsafe(u+l[e]),c=0;c<u;c++)d[c]=54^t[c],f[c]=92^t[c];var p=o.allocUnsafe(u+r+4);d.copy(p,0,0,u),this.ipad1=p,this.ipad2=d,this.opad=f,this.alg=e,this.blocksize=u,this.hash=s,this.size=l[e]}f.prototype.run=function(e,t){return e.copy(t,this.blocksize),this.hash(t).copy(this.opad,this.blocksize),this.hash(this.opad)},e.exports=function(e,t,r,i,n){s(r,i);var a=new f(n=n||"sha1",e=d(e,u,"Password"),(t=d(t,u,"Salt")).length),h=o.allocUnsafe(i),c=o.allocUnsafe(t.length+4);t.copy(c,0,0,t.length);for(var p=0,m=l[n],g=Math.ceil(i/m),_=1;_<=g;_++){c.writeUInt32BE(_,t.length);for(var y=a.run(c,a.ipad1),b=y,v=1;v<r;v++){b=a.run(b,a.ipad2);for(var w=0;w<m;w++)y[w]^=b[w]}y.copy(h,p),p+=m}return h}},function(e,t,r){var i=r(6).Buffer;e.exports=function(e,t,r){if(i.isBuffer(e))return e;if("string"==typeof e)return i.from(e,t);if(ArrayBuffer.isView(e))return i.from(e.buffer);throw new TypeError(r+" must be a string, a Buffer, a typed array or a DataView")}},function(e,t,r){"use strict";t.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},t.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},t.ip=function(e,t,r,i){for(var n=0,a=0,o=6;o>=0;o-=2){for(var s=0;s<=24;s+=8)n<<=1,n|=t>>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=e>>>s+o&1}for(o=6;o>=0;o-=2){for(s=1;s<=25;s+=8)a<<=1,a|=t>>>s+o&1;for(s=1;s<=25;s+=8)a<<=1,a|=e>>>s+o&1}r[i+0]=n>>>0,r[i+1]=a>>>0},t.rip=function(e,t,r,i){for(var n=0,a=0,o=0;o<4;o++)for(var s=24;s>=0;s-=8)n<<=1,n|=t>>>s+o&1,n<<=1,n|=e>>>s+o&1;for(o=4;o<8;o++)for(s=24;s>=0;s-=8)a<<=1,a|=t>>>s+o&1,a<<=1,a|=e>>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},t.pc1=function(e,t,r,i){for(var n=0,a=0,o=7;o>=5;o--){for(var s=0;s<=24;s+=8)n<<=1,n|=t>>s+o&1;for(s=0;s<=24;s+=8)n<<=1,n|=e>>s+o&1}for(s=0;s<=24;s+=8)n<<=1,n|=t>>s+o&1;for(o=1;o<=3;o++){for(s=0;s<=24;s+=8)a<<=1,a|=t>>s+o&1;for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1}for(s=0;s<=24;s+=8)a<<=1,a|=e>>s+o&1;r[i+0]=n>>>0,r[i+1]=a>>>0},t.r28shl=function(e,t){return e<<t&268435455|e>>>28-t};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,r,n){for(var a=0,o=0,s=i.length>>>1,u=0;u<s;u++)a<<=1,a|=e>>>i[u]&1;for(u=s;u<i.length;u++)o<<=1,o|=t>>>i[u]&1;r[n+0]=a>>>0,r[n+1]=o>>>0},t.expand=function(e,t,r){var i=0,n=0;i=(1&e)<<5|e>>>27;for(var a=23;a>=15;a-=4)i<<=6,i|=e>>>a&63;for(a=11;a>=3;a-=4)n|=e>>>a&63,n<<=6;n|=(31&e)<<1|e>>>31,t[r+0]=i>>>0,t[r+1]=n>>>0};var n=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var r=0,i=0;i<4;i++){r<<=4,r|=n[64*i+(e>>>18-6*i&63)]}for(i=0;i<4;i++){r<<=4,r|=n[256+64*i+(t>>>18-6*i&63)]}return r>>>0};var a=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,r=0;r<a.length;r++)t<<=1,t|=e>>>a[r]&1;return t>>>0},t.padSplit=function(e,t,r){for(var i=e.toString(2);i.length<t;)i="0"+i;for(var n=[],a=0;a<t;a+=r)n.push(i.slice(a,a+r));return n.join(" ")}},function(e,t,r){"use strict";var i=r(14),n=r(5),a=r(93),o=r(52);function s(){this.tmp=new Array(2),this.keys=null}function u(e){o.call(this,e);var t=new s;this._desState=t,this.deriveKeys(t,e.key)}n(u,o),e.exports=u,u.create=function(e){return new u(e)};var d=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(e,t){e.keys=new Array(32),i.equal(t.length,this.blockSize,"Invalid key length");var r=a.readUInt32BE(t,0),n=a.readUInt32BE(t,4);a.pc1(r,n,e.tmp,0),r=e.tmp[0],n=e.tmp[1];for(var o=0;o<e.keys.length;o+=2){var s=d[o>>>1];r=a.r28shl(r,s),n=a.r28shl(n,s),a.pc2(r,n,e.keys,o)}},u.prototype._update=function(e,t,r,i){var n=this._desState,o=a.readUInt32BE(e,t),s=a.readUInt32BE(e,t+4);a.ip(o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],"encrypt"===this.type?this._encrypt(n,o,s,n.tmp,0):this._decrypt(n,o,s,n.tmp,0),o=n.tmp[0],s=n.tmp[1],a.writeUInt32BE(r,o,i),a.writeUInt32BE(r,s,i+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,i=t;i<e.length;i++)e[i]=r;return!0},u.prototype._unpad=function(e){for(var t=e[e.length-1],r=e.length-t;r<e.length;r++)i.equal(e[r],t);return e.slice(0,e.length-t)},u.prototype._encrypt=function(e,t,r,i,n){for(var o=t,s=r,u=0;u<e.keys.length;u+=2){var d=e.keys[u],h=e.keys[u+1];a.expand(s,e.tmp,0),d^=e.tmp[0],h^=e.tmp[1];var l=a.substitute(d,h),f=s;s=(o^a.permute(l))>>>0,o=f}a.rip(s,o,i,n)},u.prototype._decrypt=function(e,t,r,i,n){for(var o=r,s=t,u=e.keys.length-2;u>=0;u-=2){var d=e.keys[u],h=e.keys[u+1];a.expand(o,e.tmp,0),d^=e.tmp[0],h^=e.tmp[1];var l=a.substitute(d,h),f=o;o=(s^a.permute(l))>>>0,s=f}a.rip(o,s,i,n)}},function(e,t,r){var i=r(33),n=r(6).Buffer,a=r(96);function o(e){var t=e._cipher.encryptBlockRaw(e._prev);return a(e._prev),t}t.encrypt=function(e,t){var r=Math.ceil(t.length/16),a=e._cache.length;e._cache=n.concat([e._cache,n.allocUnsafe(16*r)]);for(var s=0;s<r;s++){var u=o(e),d=a+16*s;e._cache.writeUInt32BE(u[0],d+0),e._cache.writeUInt32BE(u[1],d+4),e._cache.writeUInt32BE(u[2],d+8),e._cache.writeUInt32BE(u[3],d+12)}var h=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),i(t,h)}},function(e,t){e.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},function(e){e.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(e,t,r){var i=r(39),n=r(6).Buffer,a=r(20),o=r(5),s=r(174),u=r(33),d=r(96);function h(e,t,r,o){a.call(this);var u=n.alloc(4,0);this._cipher=new i.AES(t);var h=this._cipher.encryptBlock(u);this._ghash=new s(h),r=function(e,t,r){if(12===t.length)return e._finID=n.concat([t,n.from([0,0,0,1])]),n.concat([t,n.from([0,0,0,2])]);var i=new s(r),a=t.length,o=a%16;i.update(t),o&&(o=16-o,i.update(n.alloc(o,0))),i.update(n.alloc(8,0));var u=8*a,h=n.alloc(8);h.writeUIntBE(u,0,8),i.update(h),e._finID=i.state;var l=n.from(e._finID);return d(l),l}(this,r,h),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}o(h,a),h.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=n.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},h.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()},h.prototype.getAuthTag=function(){if(this._decrypt||!n.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},h.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},h.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length},e.exports=h},function(e,t,r){var i=r(39),n=r(6).Buffer,a=r(20);function o(e,t,r,o){a.call(this),this._cipher=new i.AES(t),this._prev=n.from(r),this._cache=n.allocUnsafe(0),this._secCache=n.allocUnsafe(0),this._decrypt=o,this._mode=e}r(5)(o,a),o.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},o.prototype._final=function(){this._cipher.scrub()},e.exports=o},function(e,t,r){var i=r(24);e.exports=y,y.simpleSieve=g,y.fermatTest=_;var n=r(11),a=new n(24),o=new(r(101)),s=new n(1),u=new n(2),d=new n(5),h=(new n(16),new n(8),new n(10)),l=new n(3),f=(new n(7),new n(11)),c=new n(4),p=(new n(12),null);function m(){if(null!==p)return p;var e=[];e[0]=2;for(var t=1,r=3;r<1048576;r+=2){for(var i=Math.ceil(Math.sqrt(r)),n=0;n<t&&e[n]<=i&&r%e[n]!=0;n++);t!==n&&e[n]<=i||(e[t++]=r)}return p=e,e}function g(e){for(var t=m(),r=0;r<t.length;r++)if(0===e.modn(t[r]))return 0===e.cmpn(t[r]);return!0}function _(e){var t=n.mont(e);return 0===u.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)}function y(e,t){if(e<16)return new n(2===t||5===t?[140,123]:[140,39]);var r,p;for(t=new n(t);;){for(r=new n(i(Math.ceil(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),t.cmp(u)){if(!t.cmp(d))for(;r.mod(h).cmp(l);)r.iadd(c)}else for(;r.mod(a).cmp(f);)r.iadd(c);if(g(p=r.shrn(1))&&g(r)&&_(p)&&_(r)&&o.test(p)&&o.test(r))return r}}},function(e,t,r){var i=r(11),n=r(56);function a(e){this.rand=e||new n.Rand}e.exports=a,a.create=function(e){return new a(e)},a.prototype._randbelow=function(e){var t=e.bitLength(),r=Math.ceil(t/8);do{var n=new i(this.rand.generate(r))}while(n.cmp(e)>=0);return n},a.prototype._randrange=function(e,t){var r=t.sub(e);return e.add(this._randbelow(r))},a.prototype.test=function(e,t,r){var n=e.bitLength(),a=i.mont(e),o=new i(1).toRed(a);t||(t=Math.max(1,n/48|0));for(var s=e.subn(1),u=0;!s.testn(u);u++);for(var d=e.shrn(u),h=s.toRed(a);t>0;t--){var l=this._randrange(new i(2),s);r&&r(l);var f=l.toRed(a).redPow(d);if(0!==f.cmp(o)&&0!==f.cmp(h)){for(var c=1;c<u;c++){if(0===(f=f.redSqr()).cmp(o))return!1;if(0===f.cmp(h))break}if(c===u)return!1}}return!0},a.prototype.getDivisor=function(e,t){var r=e.bitLength(),n=i.mont(e),a=new i(1).toRed(n);t||(t=Math.max(1,r/48|0));for(var o=e.subn(1),s=0;!o.testn(s);s++);for(var u=e.shrn(s),d=o.toRed(n);t>0;t--){var h=this._randrange(new i(2),o),l=e.gcd(h);if(0!==l.cmpn(1))return l;var f=h.toRed(n).redPow(u);if(0!==f.cmp(a)&&0!==f.cmp(d)){for(var c=1;c<s;c++){if(0===(f=f.redSqr()).cmp(a))return f.fromRed().subn(1).gcd(e);if(0===f.cmp(d))break}if(c===s)return(f=f.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},function(e,t,r){"use strict";(function(t,i){var n;e.exports=M,M.ReadableState=S;r(8).EventEmitter;var a=function(e,t){return e.listeners(t).length},o=r(103),s=r(10).Buffer,u=t.Uint8Array||function(){};var d,h=r(184);d=h&&h.debuglog?h.debuglog("stream"):function(){};var l,f,c,p=r(185),m=r(104),g=r(105).getHighWaterMark,_=r(28).codes,y=_.ERR_INVALID_ARG_TYPE,b=_.ERR_STREAM_PUSH_AFTER_EOF,v=_.ERR_METHOD_NOT_IMPLEMENTED,w=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(5)(M,o);var E=m.errorOrDestroy,A=["error","close","destroy","pause","resume"];function S(e,t,i){n=n||r(29),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(22).StringDecoder),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function M(e){if(n=n||r(29),!(this instanceof M))return new M(e);var t=this instanceof n;this._readableState=new S(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function T(e,t,r,i,n){d("readableAddChunk",t);var a,o=e._readableState;if(null===t)o.reading=!1,function(e,t){if(d("onEofChunk"),t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?I(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}(e,o);else if(n||(a=function(e,t){var r;i=t,s.isBuffer(i)||i instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],t));var i;return r}(o,t)),a)E(e,a);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),i)o.endEmitted?E(e,new w):R(e,o,t,!0);else if(o.ended)E(e,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?R(e,o,t,!1):D(e,o)):R(e,o,t,!1)}else i||(o.reading=!1,D(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function R(e,t,r,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&I(e)),D(e,t)}Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),M.prototype.destroy=m.destroy,M.prototype._undestroy=m.undestroy,M.prototype._destroy=function(e,t){t(e)},M.prototype.push=function(e,t){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=s.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},M.prototype.unshift=function(e){return T(this,e,null,!0,!1)},M.prototype.isPaused=function(){return!1===this._readableState.flowing},M.prototype.setEncoding=function(e){l||(l=r(22).StringDecoder);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,n="";null!==i;)n+=t.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};function k(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=1073741824?e=1073741824:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function I(e){var t=e._readableState;d("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(O,e))}function O(e){var t=e._readableState;d("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function D(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(x,e,t))}function x(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(d("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function C(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function P(e){d("readable nexttick read 0"),e.read(0)}function N(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function F(e){var t=e._readableState;d("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(U,t,e))}function U(e,t){if(d("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function j(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}M.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?F(this):I(this),null;if(0===(e=k(e,t))&&t.ended)return 0===t.length&&F(this),null;var i,n=t.needReadable;return d("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",n=!0),t.ended||t.reading?d("reading or ended",n=!1):n&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=k(r,t))),null===(i=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&F(this)),null!==i&&this.emit("data",i),i},M.prototype._read=function(e){E(this,new v("_read()"))},M.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,d("pipe count=%d opts=%j",n.pipesCount,t);var o=(!t||!1!==t.end)&&e!==i.stdout&&e!==i.stderr?u:g;function s(t,i){d("onunpipe"),t===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,d("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",h),e.removeListener("error",c),e.removeListener("unpipe",s),r.removeListener("end",u),r.removeListener("end",g),r.removeListener("data",f),l=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function u(){d("onend"),e.end()}n.endEmitted?i.nextTick(o):r.once("end",o),e.on("unpipe",s);var h=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,L(e))}}(r);e.on("drain",h);var l=!1;function f(t){d("ondata");var i=e.write(t);d("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==j(n.pipes,e))&&!l&&(d("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function c(t){d("onerror",t),g(),e.removeListener("error",c),0===a(e,"error")&&E(e,t)}function p(){e.removeListener("finish",m),g()}function m(){d("onfinish"),e.removeListener("close",p),g()}function g(){d("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",c),e.once("close",p),e.once("finish",m),e.emit("pipe",r),n.flowing||(d("pipe resume"),r.resume()),e},M.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<n;a++)i[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=j(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},M.prototype.on=function(e,t){var r=o.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,d("on readable",n.length,n.reading),n.length?I(this):n.reading||i.nextTick(P,this))),r},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(e,t){var r=o.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(C,this),r},M.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(C,this),t},M.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(N,e,t))}(this,e)),e.paused=!1,this},M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},M.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;for(var n in e.on("end",(function(){if(d("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(n){(d("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(t.push(n)||(i=!0,e.pause()))})),e)void 0===this[n]&&"function"==typeof e[n]&&(this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n));for(var a=0;a<A.length;a++)e.on(A[a],this.emit.bind(this,A[a]));return this._read=function(t){d("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(M.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=r(187)),f(this)}),Object.defineProperty(M.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(M.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(M.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),M._fromList=B,Object.defineProperty(M.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(M.from=function(e,t){return void 0===c&&(c=r(188)),c(M,e,t)})}).call(this,r(13),r(9))},function(e,t,r){e.exports=r(8).EventEmitter},function(e,t,r){"use strict";(function(t){function r(e,t){n(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}e.exports={destroy:function(e,a){var o=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(a?a(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(n,this,e)):t.nextTick(n,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!a&&e?o._writableState?o._writableState.errorEmitted?t.nextTick(i,o):(o._writableState.errorEmitted=!0,t.nextTick(r,o,e)):t.nextTick(r,o,e):a?(t.nextTick(i,o),a(e)):t.nextTick(i,o)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this,r(9))},function(e,t,r){"use strict";var i=r(28).codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,n){var a=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new i(n?r:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},function(e,t,r){"use strict";(function(t,i){function n(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var i=e.entry;e.entry=null;for(;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}var a;e.exports=M,M.WritableState=S;var o={deprecate:r(45)},s=r(103),u=r(10).Buffer,d=t.Uint8Array||function(){};var h,l=r(104),f=r(105).getHighWaterMark,c=r(28).codes,p=c.ERR_INVALID_ARG_TYPE,m=c.ERR_METHOD_NOT_IMPLEMENTED,g=c.ERR_MULTIPLE_CALLBACK,_=c.ERR_STREAM_CANNOT_PIPE,y=c.ERR_STREAM_DESTROYED,b=c.ERR_STREAM_NULL_VALUES,v=c.ERR_STREAM_WRITE_AFTER_END,w=c.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function A(){}function S(e,t,o){a=a||r(29),e=e||{},"boolean"!=typeof o&&(o=t instanceof a),this.objectMode=!!e.objectMode,o&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,a=r.writecb;if("function"!=typeof a)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,a){--t.pendingcb,r?(i.nextTick(a,n),i.nextTick(D,e,t),e._writableState.errorEmitted=!0,E(e,n)):(a(n),e._writableState.errorEmitted=!0,E(e,n),D(e,t))}(e,r,n,t,a);else{var o=I(r)||e.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),n?i.nextTick(R,e,r,o,a):R(e,r,o,a)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function M(e){var t=this instanceof(a=a||r(29));if(!t&&!h.call(M,this))return new M(e);this._writableState=new S(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function T(e,t,r,i,n,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y("write")):r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function R(e,t,r,i){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),D(e,t)}function k(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,a=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,u=!0;r;)a[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;a.allBuffers=u,T(e,t,!0,t.length,a,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new n(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,h=r.encoding,l=r.callback;if(T(e,t,!1,t.objectMode?1:d.length,d,h,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function O(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),D(e,t)}))}function D(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(O,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(5)(M,s),S.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(S.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===M&&(e&&e._writableState instanceof S)}})):h=function(e){return e instanceof this},M.prototype.pipe=function(){E(this,new _)},M.prototype.write=function(e,t,r){var n,a=this._writableState,o=!1,s=!a.objectMode&&(n=e,u.isBuffer(n)||n instanceof d);return s&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof r&&(r=A),a.ending?function(e,t){var r=new v;E(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var a;return null===r?a=new b:"string"==typeof r||t.objectMode||(a=new p("chunk",["string","Buffer"],r)),!a||(E(e,a),i.nextTick(n,a),!1)}(this,a,e,r))&&(a.pendingcb++,o=function(e,t,r,i,n,a){if(!r){var o=function(e,t,r){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r));return t}(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var d=t.length<t.highWaterMark;d||(t.needDrain=!0);if(t.writing||t.corked){var h=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:a,next:null},h?h.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,s,i,n,a);return d}(this,a,s,e,t,r)),o},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},M.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),M.prototype._write=function(e,t,r){r(new m("_write()"))},M.prototype._writev=null,M.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,D(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),M.prototype.destroy=l.destroy,M.prototype._undestroy=l.undestroy,M.prototype._destroy=function(e,t){t(e)}}).call(this,r(13),r(9))},function(e,t,r){"use strict";e.exports=h;var i=r(28).codes,n=i.ERR_METHOD_NOT_IMPLEMENTED,a=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=i.ERR_TRANSFORM_WITH_LENGTH_0,u=r(29);function d(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new a);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function h(e){if(!(this instanceof h))return new h(e);u.call(this,e),this._transformState={afterTransform:d.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(t,r){f(e,t,r)}))}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new o;return e.push(null)}r(5)(h,u),h.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},h.prototype._transform=function(e,t,r){r(new n("_transform()"))},h.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}},h.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},h.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},function(e,t,r){"use strict";var i=t;function n(e){return 1===e.length?"0"+e:e}function a(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}i.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var n=e.charCodeAt(i),a=n>>8,o=255&n;a?r.push(a,o):r.push(o)}return r},i.zero2=n,i.toHex=a,i.encode=function(e,t){return"hex"===t?a(e):e}},function(e,t,r){"use strict";var i=t;i.base=r(41),i.short=r(195),i.mont=r(196),i.edwards=r(197)},function(e,t,r){"use strict";var i=r(18).rotr32;function n(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,i){return 0===e?n(t,r,i):1===e||3===e?o(t,r,i):2===e?a(t,r,i):void 0},t.ch32=n,t.maj32=a,t.p32=o,t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},function(e,t,r){"use strict";var i=r(18),n=r(34),a=r(110),o=r(14),s=i.sum32,u=i.sum32_4,d=i.sum32_5,h=a.ch32,l=a.maj32,f=a.s0_256,c=a.s1_256,p=a.g0_256,m=a.g1_256,g=n.BlockHash,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function y(){if(!(this instanceof y))return new y;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=_,this.W=new Array(64)}i.inherits(y,g),e.exports=y,y.blockSize=512,y.outSize=256,y.hmacStrength=192,y.padLength=64,y.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=u(m(r[i-2]),r[i-7],p(r[i-15]),r[i-16]);var n=this.h[0],a=this.h[1],g=this.h[2],_=this.h[3],y=this.h[4],b=this.h[5],v=this.h[6],w=this.h[7];for(o(this.k.length===r.length),i=0;i<r.length;i++){var E=d(w,c(y),h(y,b,v),this.k[i],r[i]),A=s(f(n),l(n,a,g));w=v,v=b,b=y,y=s(_,E),_=g,g=a,a=n,n=s(E,A)}this.h[0]=s(this.h[0],n),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],_),this.h[4]=s(this.h[4],y),this.h[5]=s(this.h[5],b),this.h[6]=s(this.h[6],v),this.h[7]=s(this.h[7],w)},y.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var i=r(18),n=r(34),a=r(14),o=i.rotr64_hi,s=i.rotr64_lo,u=i.shr64_hi,d=i.shr64_lo,h=i.sum64,l=i.sum64_hi,f=i.sum64_lo,c=i.sum64_4_hi,p=i.sum64_4_lo,m=i.sum64_5_hi,g=i.sum64_5_lo,_=n.BlockHash,y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function b(){if(!(this instanceof b))return new b;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=y,this.W=new Array(160)}function v(e,t,r,i,n){var a=e&r^~e&n;return a<0&&(a+=4294967296),a}function w(e,t,r,i,n,a){var o=t&i^~t&a;return o<0&&(o+=4294967296),o}function E(e,t,r,i,n){var a=e&r^e&n^r&n;return a<0&&(a+=4294967296),a}function A(e,t,r,i,n,a){var o=t&i^t&a^i&a;return o<0&&(o+=4294967296),o}function S(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function M(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function T(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=4294967296),r}function R(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function k(e,t){var r=o(e,t,1)^o(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function I(e,t){var r=s(e,t,1)^s(e,t,8)^d(e,t,7);return r<0&&(r+=4294967296),r}function O(e,t){var r=o(e,t,19)^o(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}function D(e,t){var r=s(e,t,19)^s(t,e,29)^d(e,t,6);return r<0&&(r+=4294967296),r}i.inherits(b,_),e.exports=b,b.blockSize=1024,b.outSize=512,b.hmacStrength=192,b.padLength=128,b.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=O(r[i-4],r[i-3]),a=D(r[i-4],r[i-3]),o=r[i-14],s=r[i-13],u=k(r[i-30],r[i-29]),d=I(r[i-30],r[i-29]),h=r[i-32],l=r[i-31];r[i]=c(n,a,o,s,u,d,h,l),r[i+1]=p(n,a,o,s,u,d,h,l)}},b.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],u=this.h[4],d=this.h[5],c=this.h[6],p=this.h[7],_=this.h[8],y=this.h[9],b=this.h[10],k=this.h[11],I=this.h[12],O=this.h[13],D=this.h[14],x=this.h[15];a(this.k.length===r.length);for(var C=0;C<r.length;C+=2){var P=D,N=x,L=T(_,y),B=R(_,y),F=v(_,y,b,k,I),U=w(_,y,b,k,I,O),j=this.k[C],H=this.k[C+1],X=r[C],W=r[C+1],V=m(P,N,L,B,F,U,j,H,X,W),z=g(P,N,L,B,F,U,j,H,X,W);P=S(i,n),N=M(i,n),L=E(i,n,o,s,u),B=A(i,n,o,s,u,d);var q=l(P,N,L,B),G=f(P,N,L,B);D=I,x=O,I=b,O=k,b=_,k=y,_=l(c,p,V,z),y=f(p,p,V,z),c=u,p=d,u=o,d=s,o=i,s=n,i=l(V,z,q,G),n=f(V,z,q,G)}h(this.h,0,i,n),h(this.h,2,o,s),h(this.h,4,u,d),h(this.h,6,c,p),h(this.h,8,_,y),h(this.h,10,b,k),h(this.h,12,I,O),h(this.h,14,D,x)},b.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(212).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function d(e,t,r,n){for(var a=0,o=0,s=Math.min(e.length,r),u=t;u<s;u++){var d=e.charCodeAt(u)-48;a*=n,o=d>=49?d-49+10:d>=17?d-17+10:d,i(d>=0&&o<n,"Invalid character"),a+=o}return a}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,o,s=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this._strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,o=a%i,s=Math.min(a,a-o)+r,u=0,h=r;h<s;h+=i)u=d(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var l=1;for(u=d(e,h,e.length,t),h=0;h<o;h++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype._move=function(e){h(e,this)},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){a.prototype.inspect=l}else a.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|a)).toString(16);a=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==a||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],h=p[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(h).toString(e);r=(l=l.idivn(h)).isZero()?m+r:f[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var d=1;d<i;d++){for(var h=u>>>26,l=67108863&u,f=Math.min(d,t.length-1),c=Math.max(0,d-e.length+1);c<=f;c++){var p=d-c|0;h+=(o=(n=0|e.words[p])*(a=0|t.words[c])+l)/67108864|0,l=67108863&o}r.words[d]=0|l,u=0|h}return 0!==u?r.words[d]=0|u:r.length--,r._strip()}a.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},a.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,a=0;n<this.length;n++){var o=this.words[n]<<a|i;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},a.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,a=0;n<this.length;n++){var o=this.words[n]<<a|i;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},a.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},a.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},a.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)a=(t=(0|r.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,a,o=e.words,s=t.words,u=r.words,d=0,h=0|o[0],l=8191&h,f=h>>>13,c=0|o[1],p=8191&c,m=c>>>13,g=0|o[2],_=8191&g,y=g>>>13,b=0|o[3],v=8191&b,w=b>>>13,E=0|o[4],A=8191&E,S=E>>>13,M=0|o[5],T=8191&M,R=M>>>13,k=0|o[6],I=8191&k,O=k>>>13,D=0|o[7],x=8191&D,C=D>>>13,P=0|o[8],N=8191&P,L=P>>>13,B=0|o[9],F=8191&B,U=B>>>13,j=0|s[0],H=8191&j,X=j>>>13,W=0|s[1],V=8191&W,z=W>>>13,q=0|s[2],G=8191&q,Q=q>>>13,Y=0|s[3],K=8191&Y,J=Y>>>13,Z=0|s[4],$=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],ae=8191&ne,oe=ne>>>13,se=0|s[7],ue=8191&se,de=se>>>13,he=0|s[8],le=8191&he,fe=he>>>13,ce=0|s[9],pe=8191&ce,me=ce>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(d+(i=Math.imul(l,H))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(f,H)|0))<<13)|0;d=((a=Math.imul(f,X))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,X))+Math.imul(m,H)|0,a=Math.imul(m,X);var _e=(d+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(f,V)|0))<<13)|0;d=((a=a+Math.imul(f,z)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(_,H),n=(n=Math.imul(_,X))+Math.imul(y,H)|0,a=Math.imul(y,X),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,z)|0;var ye=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(f,G)|0))<<13)|0;d=((a=a+Math.imul(f,Q)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,X))+Math.imul(w,H)|0,a=Math.imul(w,X),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,z)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,Q)|0;var be=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(f,K)|0))<<13)|0;d=((a=a+Math.imul(f,J)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,X))+Math.imul(S,H)|0,a=Math.imul(S,X),i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,z)|0)+Math.imul(w,V)|0,a=a+Math.imul(w,z)|0,i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Q)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,Q)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,J)|0;var ve=(d+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(f,$)|0))<<13)|0;d=((a=a+Math.imul(f,ee)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,X))+Math.imul(R,H)|0,a=Math.imul(R,X),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,z)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,Q)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,Q)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(y,K)|0,a=a+Math.imul(y,J)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(f,re)|0))<<13)|0;d=((a=a+Math.imul(f,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(I,H),n=(n=Math.imul(I,X))+Math.imul(O,H)|0,a=Math.imul(O,X),i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,z)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,z)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,Q)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,J)|0,i=i+Math.imul(_,$)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Ee=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,oe)|0)+Math.imul(f,ae)|0))<<13)|0;d=((a=a+Math.imul(f,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(x,H),n=(n=Math.imul(x,X))+Math.imul(C,H)|0,a=Math.imul(C,X),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(O,V)|0,a=a+Math.imul(O,z)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,Q)|0,i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(S,K)|0,a=a+Math.imul(S,J)|0,i=i+Math.imul(v,$)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(w,$)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(y,re)|0,a=a+Math.imul(y,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Ae=(d+(i=i+Math.imul(l,ue)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(f,ue)|0))<<13)|0;d=((a=a+Math.imul(f,de)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(N,H),n=(n=Math.imul(N,X))+Math.imul(L,H)|0,a=Math.imul(L,X),i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,z)|0)+Math.imul(C,V)|0,a=a+Math.imul(C,z)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,Q)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,J)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,i=i+Math.imul(v,re)|0,n=(n=n+Math.imul(v,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(y,ae)|0,a=a+Math.imul(y,oe)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ue)|0,a=a+Math.imul(m,de)|0;var Se=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,fe)|0)+Math.imul(f,le)|0))<<13)|0;d=((a=a+Math.imul(f,fe)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(F,H),n=(n=Math.imul(F,X))+Math.imul(U,H)|0,a=Math.imul(U,X),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,V)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,Q)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,Q)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,J)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(S,re)|0,a=a+Math.imul(S,ie)|0,i=i+Math.imul(v,ae)|0,n=(n=n+Math.imul(v,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(y,ue)|0,a=a+Math.imul(y,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,fe)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,fe)|0;var Me=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(f,pe)|0))<<13)|0;d=((a=a+Math.imul(f,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,z))+Math.imul(U,V)|0,a=Math.imul(U,z),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,Q)|0)+Math.imul(L,G)|0,a=a+Math.imul(L,Q)|0,i=i+Math.imul(x,K)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,J)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,ee)|0)+Math.imul(O,$)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(A,ae)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,i=i+Math.imul(v,ue)|0,n=(n=n+Math.imul(v,de)|0)+Math.imul(w,ue)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,fe)|0)+Math.imul(y,le)|0,a=a+Math.imul(y,fe)|0;var Te=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,Q))+Math.imul(U,G)|0,a=Math.imul(U,Q),i=i+Math.imul(N,K)|0,n=(n=n+Math.imul(N,J)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,J)|0,i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,ee)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(I,re)|0,n=(n=n+Math.imul(I,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,de)|0)+Math.imul(S,ue)|0,a=a+Math.imul(S,de)|0,i=i+Math.imul(v,le)|0,n=(n=n+Math.imul(v,fe)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,fe)|0;var Re=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(y,pe)|0))<<13)|0;d=((a=a+Math.imul(y,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,J))+Math.imul(U,K)|0,a=Math.imul(U,J),i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,ee)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,ee)|0,i=i+Math.imul(x,re)|0,n=(n=n+Math.imul(x,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(I,ae)|0,n=(n=n+Math.imul(I,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,i=i+Math.imul(T,ue)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(A,le)|0,n=(n=n+Math.imul(A,fe)|0)+Math.imul(S,le)|0,a=a+Math.imul(S,fe)|0;var ke=(d+(i=i+Math.imul(v,pe)|0)|0)+((8191&(n=(n=n+Math.imul(v,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(F,$),n=(n=Math.imul(F,ee))+Math.imul(U,$)|0,a=Math.imul(U,ee),i=i+Math.imul(N,re)|0,n=(n=n+Math.imul(N,ie)|0)+Math.imul(L,re)|0,a=a+Math.imul(L,ie)|0,i=i+Math.imul(x,ae)|0,n=(n=n+Math.imul(x,oe)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,oe)|0,i=i+Math.imul(I,ue)|0,n=(n=n+Math.imul(I,de)|0)+Math.imul(O,ue)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,fe)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,fe)|0;var Ie=(d+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(S,pe)|0))<<13)|0;d=((a=a+Math.imul(S,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(F,re),n=(n=Math.imul(F,ie))+Math.imul(U,re)|0,a=Math.imul(U,ie),i=i+Math.imul(N,ae)|0,n=(n=n+Math.imul(N,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,i=i+Math.imul(x,ue)|0,n=(n=n+Math.imul(x,de)|0)+Math.imul(C,ue)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(I,le)|0,n=(n=n+Math.imul(I,fe)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,fe)|0;var Oe=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(F,ae),n=(n=Math.imul(F,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),i=i+Math.imul(N,ue)|0,n=(n=n+Math.imul(N,de)|0)+Math.imul(L,ue)|0,a=a+Math.imul(L,de)|0,i=i+Math.imul(x,le)|0,n=(n=n+Math.imul(x,fe)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,fe)|0;var De=(d+(i=i+Math.imul(I,pe)|0)|0)+((8191&(n=(n=n+Math.imul(I,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(F,ue),n=(n=Math.imul(F,de))+Math.imul(U,ue)|0,a=Math.imul(U,de),i=i+Math.imul(N,le)|0,n=(n=n+Math.imul(N,fe)|0)+Math.imul(L,le)|0,a=a+Math.imul(L,fe)|0;var xe=(d+(i=i+Math.imul(x,pe)|0)|0)+((8191&(n=(n=n+Math.imul(x,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(F,le),n=(n=Math.imul(F,fe))+Math.imul(U,le)|0,a=Math.imul(U,fe);var Ce=(d+(i=i+Math.imul(N,pe)|0)|0)+((8191&(n=(n=n+Math.imul(N,me)|0)+Math.imul(L,pe)|0))<<13)|0;d=((a=a+Math.imul(L,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Pe=(d+(i=Math.imul(F,pe))|0)+((8191&(n=(n=Math.imul(F,me))+Math.imul(U,pe)|0))<<13)|0;return d=((a=Math.imul(U,me))+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u[0]=ge,u[1]=_e,u[2]=ye,u[3]=be,u[4]=ve,u[5]=we,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=Me,u[10]=Te,u[11]=Re,u[12]=ke,u[13]=Ie,u[14]=Oe,u[15]=De,u[16]=xe,u[17]=Ce,u[18]=Pe,0!==d&&(u[19]=d,r.length++),r};function _(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var o=n;n=0;for(var s=67108863&i,u=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=u;d++){var h=a-d,l=(0|e.words[h])*(0|t.words[d]),f=67108863&l;s=67108863&(f=f+s|0),n+=(o=(o=o+(l/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function y(e,t,r){return _(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(g=m),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?_(this,e,t):y(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},b.prototype.permute=function(e,t,r,i,n,a){for(var o=0;o<a;o++)i[o]=t[e[o]],n[o]=r[e[o]]},b.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),d=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var l=u,f=d,c=0;c<o;c++){var p=r[h+c],m=i[h+c],g=r[h+c+o],_=i[h+c+o],y=l*g-f*_;_=l*_+f*g,g=y,r[h+c]=p+g,i[h+c]=m+_,r[h+c+o]=p-g,i[h+c+o]=m-_,c!==s&&(y=u*l-d*f,f=u*f+d*l,l=y)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},b.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,o=0;o<t;o++)a+=0|e[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===a),i(0==(-8192&a))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),o=new Array(i),s=new Array(i),u=new Array(i),d=new Array(i),h=new Array(i),l=new Array(i),f=r.words;f.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,d,i),this.transform(o,a,s,u,i,n),this.transform(d,a,h,l,i,n);for(var c=0;c<i;c++){var p=s[c]*h[c]-u[c]*l[c];u[c]=s[c]*l[c]+u[c]*h[c],s[c]=p}return this.conjugate(s,u,i),this.transform(s,u,f,a,i,n),this.conjugate(f,a,i),this.normalize13b(f,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),y(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var a=(0|this.words[n])*e,o=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(n-=o,n=Math.max(0,n),u){for(var d=0;d<o;d++)u.words[d]=this.words[d];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,d=0;d<this.length;d++)this.words[d]=this.words[d+o];else this.words[0]=0,this.length=1;var h=0;for(d=this.length-1;d>=0&&(0!==h||d>=n);d--){var l=0|this.words[d];this.words[d]=h<<26-a|l>>>a,h=l&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,o=e.length+r;this._expand(o);var s=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)s=(a=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&a;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(a=-(0|this.words[n])+s)>>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var d=0;d<s.length;d++)s.words[d]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var l=u-1;l>=0;l--){var f=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(f=Math.min(f/o|0,67108863),i._ishlnsubmul(n,f,l);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=f)}return s&&s._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%e;return t?-n:n},a.prototype.modn=function(e){return this.modrn(e)},a.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var h=r.clone(),l=t.clone();!t.isZero();){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),o.isub(u)):(r.isub(t),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,f=1;0==(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(n=0===t.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new T(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function R(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(E,w),E.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(4194303&a)<<4|n>>>22,n=a}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(A,w),n(S,w),n(M,w),M.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new A;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return v[e]=t,t},T.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},T.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),d=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new a(2*h*h).toRed(this);0!==this.pow(h,d).cmp(u);)h.redIAdd(u);for(var l=this.pow(h,n),f=this.pow(e,n.addn(1).iushrn(1)),c=this.pow(e,n),p=o;0!==c.cmp(s);){for(var m=c,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var _=this.pow(l,new a(1).iushln(p-g-1));f=f.redMul(_),l=_.redSqr(),c=c.redMul(l),p=g}return f},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],h=u-1;h>=0;h--){var l=d>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new R(e)},n(R,T),R.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},R.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},R.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},R.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},R.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(55)(e))},function(e,t,r){"use strict";var i=t;i.bignum=r(11),i.define=r(214).define,i.base=r(217),i.constants=r(218),i.decoders=r(117),i.encoders=r(115)},function(e,t,r){"use strict";var i=t;i.der=r(116),i.pem=r(215)},function(e,t,r){"use strict";var i=r(5),n=r(62).Buffer,a=r(63),o=r(65);function s(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new u,this.tree._init(e.body)}function u(e){a.call(this,"der",e)}function d(e){return e<10?"0"+e:e}e.exports=s,s.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},i(u,a),u.prototype._encodeComposite=function(e,t,r,i){var a=function(e,t,r,i){var n;"seqof"===e?e="seq":"setof"===e&&(e="set");if(o.tagByName.hasOwnProperty(e))n=o.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);n=e}if(n>=31)return i.error("Multi-octet tag encoding unsupported");t||(n|=32);return n|=o.tagClassByName[r||"universal"]<<6}(e,t,r,this.reporter);if(i.length<128){var s=n.alloc(2);return s[0]=a,s[1]=i.length,this._createEncoderBuffer([s,i])}for(var u=1,d=i.length;d>=256;d>>=8)u++;var h=n.alloc(2+u);h[0]=a,h[1]=128|u;for(var l=1+u,f=i.length;f>0;l--,f>>=8)h[l]=255&f;return this._createEncoderBuffer([h,i])},u.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=n.alloc(2*e.length),i=0;i<e.length;i++)r.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},u.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(var i=0;i<e.length;i++)e[i]|=0}else if(Array.isArray(e)){e=e.slice();for(var a=0;a<e.length;a++)e[a]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var o=0,s=0;s<e.length;s++){var u=e[s];for(o++;u>=128;u>>=7)o++}for(var d=n.alloc(o),h=d.length-1,l=e.length-1;l>=0;l--){var f=e[l];for(d[h--]=127&f;(f>>=7)>0;)d[h--]=128|127&f}return this._createEncoderBuffer(d)},u.prototype._encodeTime=function(e,t){var r,i=new Date(e);return"gentime"===t?r=[d(i.getUTCFullYear()),d(i.getUTCMonth()+1),d(i.getUTCDate()),d(i.getUTCHours()),d(i.getUTCMinutes()),d(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[d(i.getUTCFullYear()%100),d(i.getUTCMonth()+1),d(i.getUTCDate()),d(i.getUTCHours()),d(i.getUTCMinutes()),d(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!n.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=n.from(r)}if(n.isBuffer(e)){var i=e.length;0===e.length&&i++;var a=n.alloc(i);return e.copy(a),0===e.length&&(a[0]=0),this._createEncoderBuffer(a)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var o=1,s=e;s>=256;s>>=8)o++;for(var u=new Array(o),d=u.length-1;d>=0;d--)u[d]=255&e,e>>=8;return 128&u[0]&&u.unshift(0),this._createEncoderBuffer(n.from(u))},u.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},u.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},u.prototype._skipDefault=function(e,t,r){var i,n=this._baseState;if(null===n.default)return!1;var a=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,r).join()),a.length!==n.defaultBuffer.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==n.defaultBuffer[i])return!1;return!0}},function(e,t,r){"use strict";var i=t;i.der=r(118),i.pem=r(216)},function(e,t,r){"use strict";var i=r(5),n=r(11),a=r(35).DecoderBuffer,o=r(63),s=r(65);function u(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new d,this.tree._init(e.body)}function d(e){o.call(this,"der",e)}function h(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=s.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=e.readUInt8(t),e.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:s.tag[r]}}function l(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return e.error("length octect is too long");i=0;for(var a=0;a<n;a++){i<<=8;var o=e.readUInt8(r);if(e.isError(o))return o;i|=o}return i}e.exports=u,u.prototype.decode=function(e,t){return a.isDecoderBuffer(e)||(e=new a(e,t)),this.tree._decode(e,t)},i(d,o),d.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;var i=e.save(),n=h(e,'Failed to peek tag: "'+t+'"');return e.isError(n)?n:(e.restore(i),n.tag===t||n.tagStr===t||n.tagStr+"of"===t||r)},d.prototype._decodeTag=function(e,t,r){var i=h(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var n=l(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(n))return n;if(!r&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==n)return e.skip(n,'Failed to match body of: "'+t+'"');var a=e.save(),o=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(o)?o:(n=e.offset-a.offset,e.restore(a),e.skip(n,'Failed to match body of: "'+t+'"'))},d.prototype._skipUntilEnd=function(e,t){for(;;){var r=h(e,t);if(e.isError(r))return r;var i=l(e,r.primitive,t);if(e.isError(i))return i;var n=void 0;if(n=r.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(n))return n;if("end"===r.tagStr)break}},d.prototype._decodeList=function(e,t,r,i){for(var n=[];!e.isEmpty();){var a=this._peekTag(e,"end");if(e.isError(a))return a;var o=r.decode(e,"der",i);if(e.isError(o)&&a)break;n.push(o)}return n},d.prototype._decodeStr=function(e,t){if("bitstr"===t){var r=e.readUInt8();return e.isError(r)?r:{unused:r,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var n="",a=0;a<i.length/2;a++)n+=String.fromCharCode(i.readUInt16BE(2*a));return n}if("numstr"===t){var o=e.raw().toString("ascii");return this._isNumstr(o)?o:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},d.prototype._decodeObjid=function(e,t,r){for(var i,n=[],a=0,o=0;!e.isEmpty();)a<<=7,a|=127&(o=e.readUInt8()),0==(128&o)&&(n.push(a),a=0);128&o&&n.push(a);var s=n[0]/40|0,u=n[0]%40;if(i=r?n:[s,u].concat(n.slice(1)),t){var d=t[i.join(" ")];void 0===d&&(d=t[i.join(".")]),void 0!==d&&(i=d)}return i},d.prototype._decodeTime=function(e,t){var r,i,n,a,o,s,u=e.raw().toString();if("gentime"===t)r=0|u.slice(0,4),i=0|u.slice(4,6),n=0|u.slice(6,8),a=0|u.slice(8,10),o=0|u.slice(10,12),s=0|u.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");r=0|u.slice(0,2),i=0|u.slice(2,4),n=0|u.slice(4,6),a=0|u.slice(6,8),o=0|u.slice(8,10),s=0|u.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,n,a,o,s,0)},d.prototype._decodeNull=function(){return null},d.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},d.prototype._decodeInt=function(e,t){var r=e.raw(),i=new n(r);return t&&(i=t[i.toString(10)]||i),i},d.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},function(e){e.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},function(e,t,r){var i=r(31),n=r(6).Buffer;function a(e){var t=n.allocUnsafe(4);return t.writeUInt32BE(e,0),t}e.exports=function(e,t){for(var r,o=n.alloc(0),s=0;o.length<t;)r=a(s++),o=n.concat([o,i("sha1").update(e).update(r).digest()]);return o.slice(0,t)}},function(e,t){e.exports=function(e,t){for(var r=e.length,i=-1;++i<r;)e[i]^=t[i];return e}},function(e,t,r){var i=r(11),n=r(6).Buffer;e.exports=function(e,t){return n.from(e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed().toArray())}},function(e,t,r){"use strict";(function(t){var i,n=(i=r(127))&&"object"==typeof i&&"default"in i?i.default:i;e.exports=function(e){for(var r,i=(r=e,n.atob?n.atob(r):t.from(r,"base64").toString("binary")),a=new Uint8Array(i.length),o=0;o<i.length;o++)a[o]=i.charCodeAt(o);return a}}).call(this,r(10).Buffer)},function(e,t,r){(function(t,r){
- /*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license Licensed under MIT license
- * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
- * @version v4.2.8+1e68dce6
- */
- var i;i=function(){"use strict";function e(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,a=void 0,o=void 0,s=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(m):_())},u="undefined"!=typeof window?window:void 0,d=u||{},h=d.MutationObserver||d.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function c(){var e=setTimeout;return function(){return e(m,1)}}var p=new Array(1e3);function m(){for(var e=0;e<n;e+=2)(0,p[e])(p[e+1]),p[e]=void 0,p[e+1]=void 0;n=0}var g,_=void 0;function y(e,t){var r=this,i=new this.constructor(w);void 0===i[v]&&D(i);var n=r._state;if(n){var a=arguments[n-1];s((function(){return I(n,i,a,r._result)}))}else R(r,i,e,t);return i}function b(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(w);return A(t,e),t}l?_=function(){return t.nextTick(m)}:h?_=function(){var e=0,t=new h(m),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}():f?((g=new MessageChannel).port1.onmessage=m,_=function(){return g.port2.postMessage(0)}):_=void 0===u?function(){try{var e=Function("return this")().require("vertx");return void 0!==(a=e.runOnLoop||e.runOnContext)?function(){a(m)}:c()}catch(e){return c()}}():c();var v=Math.random().toString(36).substring(2);function w(){}function E(t,r,i){r.constructor===t.constructor&&i===y&&r.constructor.resolve===b?function(e,t){1===t._state?M(e,t._result):2===t._state?T(e,t._result):R(t,void 0,(function(t){return A(e,t)}),(function(t){return T(e,t)}))}(t,r):void 0===i?M(t,r):e(i)?function(e,t,r){s((function(e){var i=!1,n=function(e,t,r,i){try{e.call(t,r,i)}catch(e){return e}}(r,t,(function(r){i||(i=!0,t!==r?A(e,r):M(e,r))}),(function(t){i||(i=!0,T(e,t))}),e._label);!i&&n&&(i=!0,T(e,n))}),e)}(t,r,i):M(t,r)}function A(e,t){if(e===t)T(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(i=t),null===i||"object"!==n&&"function"!==n)M(e,t);else{var r=void 0;try{r=t.then}catch(t){return void T(e,t)}E(e,t,r)}var i,n}function S(e){e._onerror&&e._onerror(e._result),k(e)}function M(e,t){void 0===e._state&&(e._result=t,e._state=1,0!==e._subscribers.length&&s(k,e))}function T(e,t){void 0===e._state&&(e._state=2,e._result=t,s(S,e))}function R(e,t,r,i){var n=e._subscribers,a=n.length;e._onerror=null,n[a]=t,n[a+1]=r,n[a+2]=i,0===a&&e._state&&s(k,e)}function k(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i=void 0,n=void 0,a=e._result,o=0;o<t.length;o+=3)i=t[o],n=t[o+r],i?I(r,i,n,a):n(a);e._subscribers.length=0}}function I(t,r,i,n){var a=e(i),o=void 0,s=void 0,u=!0;if(a){try{o=i(n)}catch(e){u=!1,s=e}if(r===o)return void T(r,new TypeError("A promises callback cannot return that same promise."))}else o=n;void 0!==r._state||(a&&u?A(r,o):!1===u?T(r,s):1===t?M(r,o):2===t&&T(r,o))}var O=0;function D(e){e[v]=O++,e._state=void 0,e._result=void 0,e._subscribers=[]}var x=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(w),this.promise[v]||D(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?M(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&M(this.promise,this._result))):T(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;void 0===this._state&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,i=r.resolve;if(i===b){var n=void 0,a=void 0,o=!1;try{n=e.then}catch(e){o=!0,a=e}if(n===y&&void 0!==e._state)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(r===C){var s=new r(w);o?T(s,a):E(s,e,n),this._willSettleAt(s,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,r){var i=this.promise;void 0===i._state&&(this._remaining--,2===e?T(i,r):this._result[t]=r),0===this._remaining&&M(i,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;R(e,void 0,(function(e){return r._settledAt(1,t,e)}),(function(e){return r._settledAt(2,t,e)}))},e}(),C=function(){function t(e){this[v]=O++,this._result=this._state=void 0,this._subscribers=[],w!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){A(e,t)}),(function(t){T(e,t)}))}catch(t){T(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var r=this.constructor;return e(t)?this.then((function(e){return r.resolve(t()).then((function(){return e}))}),(function(e){return r.resolve(t()).then((function(){throw e}))})):this.then(t,t)},t}();return C.prototype.then=y,C.all=function(e){return new x(this,e).promise},C.race=function(e){var t=this;return i(e)?new t((function(r,i){for(var n=e.length,a=0;a<n;a++)t.resolve(e[a]).then(r,i)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},C.resolve=b,C.reject=function(e){var t=new this(w);return T(t,e),t},C._setScheduler=function(e){o=e},C._setAsap=function(e){s=e},C._asap=s,C.polyfill=function(){var e=void 0;if(void 0!==r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=C},C.Promise=C,C},e.exports=i()}).call(this,r(9),r(13))},function(e,t,r){"use strict";t.byteLength=function(e){var t=d(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,i=d(e),o=i[0],s=i[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,o,s)),h=0,l=s>0?o-4:o;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[h++]=255&t);1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,a=[],o=0,s=r-n;o<s;o+=16383)a.push(h(e,o,o+16383>s?s:o+16383));1===n?(t=e[r-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"="));return a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s<u;++s)i[s]=o[s],n[o.charCodeAt(s)]=s;function d(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function h(e,t,r){for(var n,a,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(i[(a=n)>>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(e,t){
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
- t.read=function(e,t,r,i,n){var a,o,s=8*n-i-1,u=(1<<s)-1,d=u>>1,h=-7,l=r?n-1:0,f=r?-1:1,c=e[t+l];for(l+=f,a=c&(1<<-h)-1,c>>=-h,h+=s;h>0;a=256*a+e[t+l],l+=f,h-=8);for(o=a&(1<<-h)-1,a>>=-h,h+=i;h>0;o=256*o+e[t+l],l+=f,h-=8);if(0===a)a=1-d;else{if(a===u)return o?NaN:1/0*(c?-1:1);o+=Math.pow(2,i),a-=d}return(c?-1:1)*o*Math.pow(2,a-i)},t.write=function(e,t,r,i,n,a){var o,s,u,d=8*a-n-1,h=(1<<d)-1,l=h>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,c=i?0:a-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(o++,u/=2),o+l>=h?(s=0,o=h):o+l>=1?(s=(t*u-1)*Math.pow(2,n),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,n),o=0));n>=8;e[r+c]=255&s,c+=p,s/=256,n-=8);for(o=o<<n|s,d+=n;d>0;e[r+c]=255&o,c+=p,o/=256,d-=8);e[r+c-p]|=128*m}},function(e,t,r){(function(t){var r;r="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=r}).call(this,r(13))},function(e,t,r){var i=r(129),n=r(130);"string"==typeof(n=n.__esModule?n.default:n)&&(n=[[e.i,n,""]]);var a={insert:"head",singleton:!1};i(n,a);e.exports=n.locals||{}},function(e,t,r){"use strict";var i,n=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}(),o=[];function s(e){for(var t=-1,r=0;r<o.length;r++)if(o[r].identifier===e){t=r;break}return t}function u(e,t){for(var r={},i=[],n=0;n<e.length;n++){var a=e[n],u=t.base?a[0]+t.base:a[0],d=r[u]||0,h="".concat(u," ").concat(d);r[u]=d+1;var l=s(h),f={css:a[1],media:a[2],sourceMap:a[3]};-1!==l?(o[l].references++,o[l].updater(f)):o.push({identifier:h,updater:g(f,t),references:1}),i.push(h)}return i}function d(e){var t=document.createElement("style"),i=e.attributes||{};if(void 0===i.nonce){var n=r.nc;n&&(i.nonce=n)}if(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),"function"==typeof e.insert)e.insert(t);else{var o=a(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var h,l=(h=[],function(e,t){return h[e]=t,h.filter(Boolean).join("\n")});function f(e,t,r,i){var n=r?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(e.styleSheet)e.styleSheet.cssText=l(t,n);else{var a=document.createTextNode(n),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function c(e,t,r){var i=r.css,n=r.media,a=r.sourceMap;if(n?e.setAttribute("media",n):e.removeAttribute("media"),a&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}var p=null,m=0;function g(e,t){var r,i,n;if(t.singleton){var a=m++;r=p||(p=d(t)),i=f.bind(null,r,a,!1),n=f.bind(null,r,a,!0)}else r=d(t),i=c.bind(null,r,t),n=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else n()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=n());var r=u(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var i=0;i<r.length;i++){var n=s(r[i]);o[n].references--}for(var a=u(e,t),d=0;d<r.length;d++){var h=s(r[d]);0===o[h].references&&(o[h].updater(),o.splice(h,1))}r=a}}}},function(e,t,r){var i=r(131),n=r(132),a=r(133),o=r(134),s=r(135);t=i(!1);var u=n(a),d=n(o),h=n(s);t.push([e.i,'@font-face {\n font-family: "iconfont"; /* Project id 3440216 */\n src: url('+u+") format('woff2'),\n url("+d+") format('woff'),\n url("+h+') format(\'truetype\');\n}\n\n.iconfont {\n font-family: "iconfont" !important;\n font-size: 16px;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-xiangji:before {\n content: "\\e62e";\n}\n\n.icon-luxiang2:before {\n content: "\\e777";\n}\n\n.icon-xiangji1:before {\n content: "\\e6e5";\n}\n\n.icon-luxiang:before {\n content: "\\e62c";\n}\n\n.icon-snapshot:before {\n content: "\\e9f2";\n}\n\n.icon-shengyin1:before {\n content: "\\e8c0";\n}\n\n.icon-xiaoping:before {\n content: "\\e8bf";\n}\n\n.icon-jingyin:before {\n content: "\\e8bb";\n}\n\n.icon-quanping1:before {\n content: "\\e8ba";\n}\n\n.icon-bofang:before {\n content: "\\e8ad";\n}\n\n.icon-zanting:before {\n content: "\\e8ab";\n}\n\n',""]),e.exports=t},function(e,t,r){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r=e[1]||"",i=e[3];if(!i)return r;if(t&&"function"==typeof btoa){var n=(o=i,s=btoa(unescape(encodeURIComponent(JSON.stringify(o)))),u="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(u," */")),a=i.sources.map((function(e){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(e," */")}));return[r].concat(a).concat([n]).join("\n")}var o,s,u;return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,i){"string"==typeof e&&(e=[[null,e,""]]);var n={};if(i)for(var a=0;a<this.length;a++){var o=this[a][0];null!=o&&(n[o]=!0)}for(var s=0;s<e.length;s++){var u=[].concat(e[s]);i&&n[u[0]]||(r&&(u[2]?u[2]="".concat(r," and ").concat(u[2]):u[2]=r),t.push(u))}},t}},function(e,t,r){"use strict";e.exports=function(e,t){return t||(t={}),"string"!=typeof(e=e&&e.__esModule?e.default:e)?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e)}},function(e,t,r){"use strict";r.r(t),t.default="data:font/woff2;base64,d09GMgABAAAAAAlMAAsAAAAAEOAAAAj+AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACEPAqSaI80ATYCJAMwCxoABCAFhGcHgRwbUA4RFazfI/viwDz9UwQQaoWtoxI6Bg55+g1tP7RnvwfPf/u1+2bmi2LWVJvZ6XgjtG1I/hWTrIlQaRs6YhbiDuGmXdA1ghR8XlGgbrB5NUDFqClVKpPk35N/p0yNwUwMmAq8awBQ1G5/7pVjClADbnNLFNuMi1B8cvb1rw/9KFeSLg37Do6lfi0D5GNrm8tH3Vf2KinaBvxAi0ywjYdRNuANSAbAM7FNLsykdcwCM31tXAUBfFrJhDE8bQ4O4pSpvwuUwkLMFEhjJdXabALuXIxpqRBcns3d0gBZB2xQC4wrALDmn1++QayMAygsDcR+Rpp0DSD9WuX7KeJ/AtA3wFKO14GWVoAFaKDxyqRy2K4+AMwYGj3br0tmMQ8gH8H8u82b6rXm9as3Fq/Tu9V72HvC99P/f1N9yHu8azFTyJdqKfIz/5snaBQBPh4uDjYWiA2IHSJnmxU8ZaoWYjxHAyECzis0Q8O7pRkKPpxCAnC2QogPziEI8cA5DCEuOMchxAHnBJphw+dPlG+Gfk3JxQAGAFqT5AGI4gkAJnRbBLgx2OGaEcodh6GBApbfFB6G+SkBT4i5hKoQCSrjYrAfF06FWApxRAjKF3O5/rGECclHikEoCgkEFj3CErARownFYQafCeO0y0XcuUO53aTHo6cObCG2HkTo2+S1UdseMQ6Rp67BPOrKCcBITl5F+PT10xCkH9vrdEJM0lFKHGmAYwkc3wQeBWUGyNjl72LNEeoYeXyUDpfoEfqgQiJhEVuCxALqkFLKJreHyhDjMvNVMj1uXQ8bWEI2TG2UGi5hszt3CJeL9nhIt7uePkocjNPcQO30uy6nLuwgdl6kL+8md13CKRsEkYsWjY2JxYR1MmWzyZYdRugxwgpT68VWU68utsYqlLp2K2tuP4xg9MGtQHxesAmhJWNyn4CRiBfDEEKFSN2zFCQJETd6KXsNbGDtxwkFkIsQOvigXsIkpVbxnTviQ4UvhQJJB1x7XZLtyPHng6nFACRWI0zZ2JSyctRtkAV38AKXvsBjXAUiDSgVb3S5Sh8I6dKDy2lJqX2CoW2N2rIl4WMS1O0pw+gkPAg2UdIK52T98M3ry5dG2KSY645l48rxy/YHu+54P/j6fdtWhXo8kMfgxm2kc7/kaNUG6dZ9UtvSZTIPaaYObbvEMx5GEOOmvZsBK7HvkRpgIwICjbbDwCeaRiCZjFZAMAODhkeG75eWDI8RdqrNBQixfnfAOnembY+dMF6+Eydw/enpvt1uw8Y98sUrqtYv37o3NLQaIh37gnAc/sJEAMxTEP3YficEGY8nhssPLuKD80HlIljDNay+XkQjjfn6SjDwQ+jD28lthwav3EPdIG4mbDi8HSJvmVPmuvpkeBSm7ICTbH62WTkhLunA8gHH/s9eeIIQASeyFs4o8zeCFVeQuOJCQFS+RpNfrYiOXx3fXlMmbTSoDI3SAKDjg56nt/8Q+KpSkgOUnwdmBH6uDPgvYCZXreMTPMWEi4XYv08Rq5iquc+94+z6vmmPVcKFKKWWhSdo5ZFB3XHklMpEdcVh6Xg9h2OQvXjbTMg1KfFdHFZXXDjfY0bx+JZZc9DjIHIq4gQSXprY8enCaf1abT+tHXDwERADiP75dbgmX63Or1AX5KsqA8HcKkWkvQgjxusStInaBB0w/+pZkZGzSkEEvyyeJ1I4SX0r/ZYqfYL9kSY2jbItbCZL8e7nLSwOu9nIaogI2lkiZVsQC5u/gk5Yf1Q1HKFCTqyYkK4KUpeVsPqVAwoknKfK4W0dTZj22BtaHWRUrHTKvfIltAKbG3YiWSB6uCRKzm+U0zvkAAoHYwzqmRIAUTWA3eV/LDTyq/29giJ+FvI9yqXrBjPW1nOZU3LKomeHnO1jo0/RJGEL37uWbeHkis+IujnNcDOnm/sSzuU0X+3Csg8EY1tgC+hSSerOipll03ukfdIXumK8sGhqV4A5yje7fGZpq6pT9Y3UlFuTndiQ1GKpMdbOD0LpHxsEa4cPKsJCtdrQQkV0/ML4tta30B2HdVl66oe0GSVhxnDmicPaC3FNA7KAasmlyfjA8eZ/xlkT7L6mOGta06YoCB0kstfsUkRHTM6iaCvZHWJSd+3qYnYnVySWrvrcF37Z9NWr2I5huoNXj9Zte7ux6b281I2ZfOVFh/KI0nFRWeLbhcR+KLGKNufdx3lKwCB982KfTpsX33f9xmDej/EjFy/N0w43Xh/5QP480NFflPBl+ZWAJQFXEtaVXQlcEhjcoU3FeRPmzqkfh8Z1vvrKfCU8f79Jk1iWXMkw16mKp00rDXlLV569zkIWhirb1/S44D2c9cVtivDvk/aIqRw4P/2qJVB5b5nymHLZXSX+9d77JQ7RanDkzWhI8DzHiHt0i2N+cPl8+5aR8OH/7TcgZATs/OLT9Gn6o3zqPnV/zVxvrDl2EFoOeaOy6Z/lKyh7rJ2KtfejoGWh+rm46TP7qCK0Ee8LaZrTWGi2L2VQdiXwn8nGJY8lck3zQ/2YN4PuH4DQ6DST5suo/8lc7zgzKcCuys1sxN7My4zCnuooMxO7tp8qgZMcZBZ2ax8yi70nMjGzR5lLscz5MKKGn/6ri/yNzrpz/XVCU2bVguO6cFEItcAIklPJHNJsLRCaur7RlMH4kHOAORXgy2EwVtTn8vgc3Dw2dWzMzUtrFA5loOtyysEgp77GIqAdbOT01Pg0oNs+IA8z0IjxA1DN26gRstlco4g5Ao2c82CQ46mxKOQN2Mj5t8ZnCsL2FlCtGXMQh+osjD+Ihskrnvpsry6sCaXK8XRSImzQN13Rd3Hk5BDrlHcYVD144QXO0+O5lBiy8OyMNpNq3retr1unMbxUB3GotqEF469lNEx+aM2/vqsLa0JhIp9KKSGZsge9RsdAXtjE6vJKkss7DJSUHjQIwRJzz1ulS9LNINcvNjujjWmAM++1NJTnspvzc5ePm81n1604SAgp0WLEElscccUT/9e+iURwhyJSmOM2rbF02Bak/WY6x7YQ5jKx7kyoo/CL1LencY4UNnMk1+61Ik2C+npkj5XGP5IuRVUFAA=="},function(e,t,r){"use strict";r.r(t),t.default="data:font/woff;base64,d09GRgABAAAAAAu8AAsAAAAAEOAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAARAAAAGA8QUzCY21hcAAAAYgAAACxAAACPClWH55nbHlmAAACPAAABzUAAAloxhXGamhlYWQAAAl0AAAALwAAADYgyzh9aGhlYQAACaQAAAAcAAAAJAfeA41obXR4AAAJwAAAAA8AAAAwMAAAAGxvY2EAAAnQAAAAGgAAABoQiA60bWF4cAAACewAAAAfAAAAIAEjAONuYW1lAAAKDAAAAUAAAAJnEKM8sHBvc3QAAAtMAAAAbQAAAJwZ7sqZeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGFhYJzAwMrAwNTJdIaBgaEfQjO+ZjBi5ACKMrAyM2AFAWmuKQwHnum8/MTc8L+BgYH5DgOQZGBEUcQEAINZDYF4nOWRSw6CQBBEa+TjBxcuDPEQhOPJRTyBKxPCBWABl2FotlwAq6ddaPQG9uRN0pVM96QKQAIgIgWJAfeAg9adqgt6hEPQY1zZn3GiEvvCl36cKqmlkU6GeVlX4ENtpTf1qxynvJ8cl7DdcfIGGfftscMWqf7OpT8m/Fsdw317dZk6bWhmvjQ0Lz8amulUGfQUUhv6VhpDc5XWoOOQzqD3kN5gCpDBYB6YFwPJE/6/RgEAAAB4nH0WbWwU1/HNe3e7e7f3wd7H7u2aO3O7vl2bs+/wfewajD/4ONwEYhtsAhiHJES0SlWgNBhSA5JTfkVYalO1UqUKJSL9SEkqVSWtquAkppUqkaShREqqplIqVVXlorYiSP3HrTvvjlIURb3bN2/2zbx5M/PmY0mA4I8tM0JEEidrSTchoFWVvFL1gnnRQsQSKzlIxcAsQW0YNDMGqRxUK27Npm9vWb67sDwKD/n/Gr1I37t4vTxRLk8c4qCsOio+Zn8/IwvNBbqwMLPg1+A96x4dwYzq9Dpqf2MDV6GtxypdJSapEJeMoB62EId6rQRWHg9NK/zYfGUYhkDLwTDUlZrNUgISbURdJKnppFP3CqiuYNo1l32yxowfMjdZzd9Ym0yc6RDOh+Jmp6L4XXrzz3pXl07zetdvT55sekYB7HqhQM+HILxpwBw08fFpex7YFAYlp8D3lJyf0C1Lh79w6B8c+2RsQwF31Qtc/SAhqx8GCCuSTtJHNpExMolWVDpptaJ2UiWF5qCyZUBtR6DquSNUE2NgOdzJfP3zHI32ogcKFTXVsoleXKcGSldVUwDo1KW7CxkrwJGrpWhWkqL1YDqyzB5dlpOC960dc43G3CIHO0oTpdLELAeQ6CgU3EKBFbPi7FpVFJuXtS4UYYj0UY7M6hKFvU/LUWh+SNeHQ0cXGnMXTjUapy7MNfaWJg5O9pXGHxsvFbmv6jYhMtp8g73NPBIhOnHIAGmQPeQp8k3yC/IO+Qjtb5vTNo09aJRo2kOclIM4pAQP+bxhDCy01DIFUQj+n42fYU22Y2CYx0cO0qLrudWKpmoqBo0oWP1Vswy2o22o9acEMAVcVZHTrTu1Fl8n3ogj4FUgLwryarYVbOnmDgI/o4h7slxFi19Bew2CfTt7e3ce4KA3V83lqpsruVzlS0GJhsIioKiAyFjEVoOSFIwboQD8sPf+hr4c593Md80EJIpsaUGShFiHFBjzM45rFDOwklmvw/hQak0yFmY0FMlAJBPYV6f15p24riZgZY0aiEdE3TktAwvO7IpKwUg8oMV9LShlk8cFURSOi3Hx/SjHoqgF3O7duZ+fjgASqG81m0WQOysFWSAs0FBQDErdQTmYSEmyFIsIb30+//QDLM18uQv26eW1Rq8e68mHouE1obj//UxEEWnJUDFu4Y85xf9JPJ6Ij8prIslhBk+JAaD9jhBQIgOK/rIkbE0VpLCUDm8VpOOI4IO5hGP1RfYRO0JUkiXrSY0Mke1knOzjdcHBP167KKj8kvG2Pbdec/Km6OWA3c8gDAVW0ZggOkgPJjlv3naT+YonliBoOknX01BGgXF5eVVgPyvNznzt5F+ndpvWhl0Pf/nYPw8/4Q3s98935RePvPxGd2Oy0d0C341EllLChc3T+/27S9GUKPl/t9R1cK7FBxP3qRBoUUGzVOode/gLmrZj757jJ24dPNDXp23bcuTp048/Gb2jzPt/674nubsB58F/Y5396UM966/5V3UM38ff9V/lXC8A7LhHgEab0K6bqzfZCiuTDOklW8k29E8rO7QcTfGILoGLb3XXsUWblxVMJzTadvi6W+OuaiXhIHhujhfZGJTBoq8noqLsJCZPb9lyejLhqJHk4eOBjd5L8awTL1er5VhRDoliaHvzmtHX0dFnTN1SuvSOQuzWFL0RthMJOdz93KWfX3quOyx3dYmlK8e+Onvg2+GetVS2j379qB0LxAOqJg7+yL9tFI0lHFcizEg3v5I0AvKVe/1g9dfsTTaMVVUmCtEI8appbExgpa10PlmtV+v5ZB0bVH3bzWf8Jdj+zO9h2535d/yl+XnYvngdGrR+41Tz3etn4Ys3/KU5lCmgzEvsDptCiQYpkTrZjBFFgoBZXdGAl1hQ0ylRcx0XYwIrjodBI+LCcKsPtYJOTcawYo0A4ytxamFhyvLSNAiaynsT+87dH0cNM8pmooblf9yg4xpArRzvzk4c9jayvjHb2fLs7oSD+SMrsuokkrf1gjLxvmWUDHym/xGzO3bjZtOIoiDLoEcHp2PRR2obh47ZMmR7flWeeezE4amxjecbMz/4RrccSSTs5k6xYMnhMB14PdVB5aFnjV7jLUzJX8qBjuRLLV9ewxo98oAvueMsxr3YA2nuWIZeVaw3z0Dh8pkzl/0/0ZlX5udfAXN+xf/4LPzhtXPnXoOeJjkLNomivJ+y59keQglDr4okjHJjre+HLOlBv7qEJJUQVHF4ODQWAud++ebNHCtqSuUOq9fs/+IUO/2LtNy8Waal5gdP0Grzd5TSDc0PXtCLlaLeAnTRcV0H66PXfNX2PDtTNEAvGvTfTQ1OwlwbjjczcAJOX2y/Tej39uLsr7iP1Cnovbrj+oveLhdwd7WoE7SErC6zJ9koWtGJOWS12wQWe5d/aOQ/8w7OdDqXS3MAn95H2Whn+u5KurMzzTIc/g//D3HDy8cAAAB4nGNgZGBgAOI5bJ1a8fw2Xxm4WRhA4N7VX3YI+v98FgbmVCCXg4EJJAoALh4K8AB4nGNgZGBgbvjfwBDDwgACQJKRARXwAABHEgJ1eJxjYWBgYCEBAwAFEAAxAAAAAAAARACmASACTALgA0wDdgPyBBoEhAS0AAB4nGNgZGBg4GG4zsDLAAJMQMwFhAwM/8F8BgAfuAIHAHichZE9bsJAEIWfwZAElChKpDRpVikoEsn8lEipUKCnoAez5ke211ovSNQ5TY6QE+QI6Whzikh52EMDRbza2W/evpkdyQDusIeH8rvnLtnDJbOSK7jAo3CV+pOwT34WrqGJnnCd+qtwAy94E26yY8YOnn/FrIV3YQ+3+BCu4AafwlXqX8I++Vu4hgf8CNep/wo3MPGuhZtoeeHA6qnTczXbqVVo0sik7niO9WITT+2pPNE2X5lUdYPOURrpVNtjm3y76DkXqciaRA15q+PYqMyatQ5dsHQu67fbkehBaBIMYKExhWOcQ2GGHeMKIQxSREV0Z/mY7gU2iFlp/3VP6LbIqR9yhS4CdM5cI7rSwnk6TY4tX+tRdXQrbsuahDSUWs1JYrLiDzzcramE1AMsi6oMfbS5ohN/UMyQ/AHYk29XeJxti0sOgzAQQ8dQmAToYdIbBYmGQdWEKiBRTs932beyn2zK6KKi/zTIkOOBAiUYBhYVajR4Ei/iNQxiPvOZXuYWjm9jkvox9XGyqe80/ETdsYmjaOBBTmO/s9dDuLKN7/3Eq9dp70Qb9Y0jUwAAAA=="},function(e,t,r){"use strict";r.r(t),t.default="data:font/ttf;base64,AAEAAAALAIAAAwAwR1NVQiCLJXoAAAE4AAAAVE9TLzI8QUzCAAABjAAAAGBjbWFwKVYfngAAAhwAAAI8Z2x5ZsYVxmoAAAR0AAAJaGhlYWQgyzh9AAAA4AAAADZoaGVhB94DjQAAALwAAAAkaG10eDAAAAAAAAHsAAAAMGxvY2EQiA60AAAEWAAAABptYXhwASMA4wAAARgAAAAgbmFtZRCjPLAAAA3cAAACZ3Bvc3QZ7sqZAAAQRAAAAJwAAQAAA4D/gABcBAAAAAAABAAAAQAAAAAAAAAAAAAAAAAAAAwAAQAAAAEAAJwGiSpfDzz1AAsEAAAAAADe1fo+AAAAAN7V+j4AAP+fBAADZQAAAAgAAgAAAAAAAAABAAAADADXAA0AAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAQEAAGQAAUAAAKJAswAAACPAokCzAAAAesAMgEIAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAwOYs6fIDgP+AAAAD3ACAAAAAAQAAAAAAAAAAAAAAAAACBAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAABQAAAAMAAAAsAAAABAAAAagAAQAAAAAAogADAAEAAAAsAAMACgAAAagABAB2AAAAFAAQAAMABOYs5i7m5ed36Kvorei76MDp8v//AADmLOYu5uXnd+ir6K3ouui/6fL//wAAAAAAAAAAAAAAAAAAAAAAAAABABQAFAAUABQAFAAUABQAFgAYAAAABAABAAMAAgALAAoACQAIAAcABgAFAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAACUAAAAAAAAAAsAAOYsAADmLAAAAAQAAOYuAADmLgAAAAEAAOblAADm5QAAAAMAAOd3AADndwAAAAIAAOirAADoqwAAAAsAAOitAADorQAAAAoAAOi6AADougAAAAkAAOi7AADouwAAAAgAAOi/AADovwAAAAcAAOjAAADowAAAAAYAAOnyAADp8gAAAAUAAAAAAEQApgEgAkwC4ANMA3YD8gQaBIQEtAAAAAQAAAAAA8ADAAAHAA8AHAAoAAABFzMRIREzNwUhByMRIREjBzIeARQOASIuATQ+ARciDgEUHgEzMjY0JgK/QcD8gMBAAUn+7kCdAsydyS9PLy9PXk8vL08vFicWFicWIjExAwCA/YACgIBagP40AcwjL09eTy8vT15PL1oWJywnFjFFMAAAAAAEAAAAAAP/Av8AIgAyADYAPwAAASYGDwE1NC4BIyEiDgEVERQeATMhMj4BPQEXHgE+ATURNCYDFAYjISImNRE0NjMhMhYVEyc1NyUyHgEGIiY0NgPeECIPXiI6I/3DIzoiIjojAj0jOiJeDyIfERH+JBn93xkkJBkCIRkkxnR0/TcaJQEmNSUlAoMJAQo6OCI7IiI7Iv4CIjsiIjsiODoKAREeEQGYER7+EhkjIxkB4hkjIxn+W0feRzAlNSUlNSUAAAAABQAA/9UEAAMrAB8ALQA6AEcAUAAAATIfAjMyFh8CERQGDwEhIiYvARE0Nj8BMzc2PwIXBw4BIycRIREjIiYvAQcyHgEUDgEiLgE0PgEXIg4BFB4BMj4BNC4BJTIWFAYiJjQ2Ap0gFgQuuxYiBgEBHxkI/IAYIwQBHxkIuy4NHQgIDTUFFQzAA1bACxMGN5BGdUVFdYx1RUV1Ri5PLi5PXE8uLk8BEhslJTYlJQMrHQdcHBYHB/2qFyQEAR8aBwJWFyQEAVwZCAIBVWkLDQH91QIqCgltgEV1i3ZFRXaLdUVVLk9bUC0uTl1OLismNSUlNSYAAAsAAP/PA78DNwAMABkAJwA4AEUAUgBjAI8AtQDKANYAAAEiLgE0PgEyHgEUDgEDIg4BFB4BMj4BNC4BByImPQE0PgEeAQ8BFAY3Ii4BNz4BMzIWFAYjIgYHBgUiLgE0PgEyHgEUDgEDIg4BFB4BMj4BNC4BByIuATc+ATMyFhQGIyIGBwYTISImNRE0PgEzITIeARUHNjc2MzIXFhcWFREUBwYjMTMiLwEmJxcwNDEUBgEiBhURFBYzITI2NSc0NjMyFxYfARE0JwYHDgEHBiMiJjU3NCYjBSImPQE0NjsBMhYUBisBIgYdARQGNyMiJjQ2OwEyFhQGAQUtSywsS1lLLCxLLB4zHh4zPDIeHjJnBQgCCQoHAQEHBgQHAwMMJhYFCAgFDxoJBAGlLEssLEtZSywsSy0eMh4eMjwzHh4zWgQIAgMMJhUGCAgGDhsIBEf+GCc2GisYAegYKhkBTj0UEBMOCgMCCQwYAQwYBFc1AjX98g8ZFhIB6BAWBA8MBxkndwsBAwVaTA0IBQwPBBcP/hcFCB0TbwYHBwZvBw8Hzg0GBwcGDQUICAHwLEtYSywsS1hLLAESHjM8Mx0dMzwzHnwIBQMECgYCCQUHBQgoBQsFEhQICwgODAa+LEtYSywsS1hLLAESHjM8Mx0dMzwzHlQFCwUSFAgLCA4MBv0hLyQBVxkvHBosGQ4pIQkNChAJD/6bGAwRBwIuGhYBJTIB2R4R/qkPDxIPQAsQDBM+AwFjBwQBAjEnBgQRDDgRGaMIBkIUJQgKCBUKQgYIbwgKCAgKCAAAAAgAAP+fA9YDZQAWAB0AKgA0AD0ARABOAFcAAAEmJyYnJgYHBgcGFhcWFxY2NzY3NjU0JyEiBzceAQMUDgEiLgE0PgEyHgEDMhcDBgcnNjc2BRMWFxYXISY2EyEyNwcuAQUiJxM2NxcGBwYlAyYnJichFgYDsC5cWnJ05FNRIiMwTEpqbu1iYDc4WP6DJCGMZaO6KEVQRSgoRVBFKJUMDLwUBos8VFj+/LwNFAcI/ukjFiABfSQhjGWjAU8MDLwUBos8VFgBBLwNFAcIARcjFgI3bkpIFxdGVVJvcepbWS0tF0NBZWl3X2EN8hF6/uYoRSgoRVBFKChFAYMB/rogJvFJKSrB/rsZFAcGX8v+qw3yEXqRAQFGICbxSSkqwQFFGRQHBl/LAAAABAAA/9ED6AMvABgALABCAEMAAAEuATc+ARceAhQOAQcGLgE2Nz4BNTYnJgcmND4BFx4BFAYHBiYnLgE2NzY0ASIuAT0BND4BOwE3Nh4BFREUDgEvASMCtBINBwsnElB3QUF3UBInFgwTYm8EOTegDx0nDy8zMy8OKwsJBwcJRP3BGi0bGy0aU+oRJBkbJQ7qUwLPCiYSEgsKKIGisqKBKAoLJCQHLrNucFxZkgopHAILJm15bSYOBA8EFhcHO6b+8BorGrwaKxqzDAMaFf1sExoEC7MAAAAABAAA/8IDvQM+AAUACwARABcAADczFTMRIQEjFSMVIRMzNTM1IRM1IxEhNUPRc/68AURz0AFD8nrK/rx6egFEjMkBRQI1z3b9y8l8AWbP/rx1AAAABgAA/6ID8gNTAAsAGgAuADUAPABOAAAFASY0NjIXARYUBiIBFhUUBxc2JzYmJyYOARQ3FhcWBxQHFz4BNTQuAScmBgcGFhMOAR4BPwEDNTQuAQ8CIyIOAR0BFB4BOwEXFj4BPQEDlPynDRoiDQNaDRoj/tpFAk4XAQE0Lw8oHU9iNzkDLUcmJ0F4URInCwgOCxELFicSE/AZJRFPziMaLhoaLhpU7A4mG1EDWg0iGg38pw0jGgJtO1QODU00OT1uJgsBHSm4L1pdcWJTRzmDRVqkgigLDBISJv1LByUjCwoKAji0FBsCCz14GiwavhosGbYLBBsToAAEAAD/wQO/Az8ABQALABEAFwAANyMRITUjAzM1MzUpARUzFTMRAyMVIREjvXsBJap7e6r+2wJaqHp6qAEieuj+2nwB16x9fawBKf0AfAEmAA0AAP+tA4kDUgACAAMABgAHAAoACwAOAA8AHAAdACkANQA2AAATEQkBMxEJATcRCQEXAwkBJxQeATI+ATQuASIOARUBIgYUFhcWPgE1NCYBIgYUFhcWPgIuASOfAi/90S8CLv3SYAIz/c0CAgIw/dKRGSsyKxkZKzIrGQKMJzY2JxorGDf9qyY3NyYYKxoBGSsaAvX9FwF0AXX9FwF0AXVO/RgBcQF3nf0XAXQBdU8ZKxkZKzIrGRkrGf7oNk01AgEZLBknNv6MN0w2AQEZKzMrGQAAAgAA/8ADYQNAAA8AHwAAASMiBhURFBY7ATI2NRE0JiEjIgYVERQWOwEyNjURNCYBJ1QVHh4VVBUeHgHxVBUeHhVUFR4eA0AfFfzoFR8fFQMYFR8fFfzoFR8fFQMYFR8AAAASAN4AAQAAAAAAAAATAAAAAQAAAAAAAQAIABMAAQAAAAAAAgAHABsAAQAAAAAAAwAIACIAAQAAAAAABAAIACoAAQAAAAAABQALADIAAQAAAAAABgAIAD0AAQAAAAAACgArAEUAAQAAAAAACwATAHAAAwABBAkAAAAmAIMAAwABBAkAAQAQAKkAAwABBAkAAgAOALkAAwABBAkAAwAQAMcAAwABBAkABAAQANcAAwABBAkABQAWAOcAAwABBAkABgAQAP0AAwABBAkACgBWAQ0AAwABBAkACwAmAWNDcmVhdGVkIGJ5IGljb25mb250aWNvbmZvbnRSZWd1bGFyaWNvbmZvbnRpY29uZm9udFZlcnNpb24gMS4waWNvbmZvbnRHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AGkAYwBvAG4AZgBvAG4AdABSAGUAZwB1AGwAYQByAGkAYwBvAG4AZgBvAG4AdABpAGMAbwBuAGYAbwBuAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG4AZgBvAG4AdABHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQAHeGlhbmdqaQhsdXhpYW5nMgh4aWFuZ2ppMQdsdXhpYW5nCHNuYXBzaG90CXNoZW5neWluMQh4aWFvcGluZwdqaW5neWluCXF1YW5waW5nMQZib2ZhbmcHemFudGluZwAA"},function(e,t,r){(t=e.exports=r(73)).Stream=t,t.Readable=t,t.Writable=r(77),t.Duplex=r(26),t.Transform=r(78),t.PassThrough=r(142),t.finished=r(46),t.pipeline=r(143)},function(e,t){},function(e,t,r){"use strict";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=r(10).Buffer,s=r(139).inspect,u=s&&s.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,d;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,i,n=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=n,i=s,o.prototype.copy.call(t,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,a=e>n.length?n.length:e;if(a===n.length?i+=n:i+=n.slice(0,e),0==(e-=a)){a===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,a=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,a),0==(e-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),d&&a(t,d),e}()},function(e,t){},function(e,t,r){"use strict";(function(t){var i;function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(46),o=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),d=Symbol("ended"),h=Symbol("lastPromise"),l=Symbol("handlePromise"),f=Symbol("stream");function c(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var r=e[f].read();null!==r&&(e[h]=null,e[o]=null,e[s]=null,t(c(r,!1)))}}function m(e){t.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),_=Object.setPrototypeOf((n(i={get stream(){return this[f]},next:function(){var e=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[d])return Promise.resolve(c(void 0,!0));if(this[f].destroyed)return new Promise((function(r,i){t.nextTick((function(){e[u]?i(e[u]):r(c(void 0,!0))}))}));var i,n=this[h];if(n)i=new Promise(function(e,t){return function(r,i){e.then((function(){t[d]?r(c(void 0,!0)):t[l](r,i)}),i)}}(n,this));else{var a=this[f].read();if(null!==a)return Promise.resolve(c(a,!1));i=new Promise(this[l])}return this[h]=i,i}},Symbol.asyncIterator,(function(){return this})),n(i,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(c(void 0,!0))}))}))})),i),g);e.exports=function(e){var t,r=Object.create(_,(n(t={},f,{value:e,writable:!0}),n(t,o,{value:null,writable:!0}),n(t,s,{value:null,writable:!0}),n(t,u,{value:null,writable:!0}),n(t,d,{value:e._readableState.endEmitted,writable:!0}),n(t,l,{value:function(e,t){var i=r[f].read();i?(r[h]=null,r[o]=null,r[s]=null,e(c(i,!1))):(r[o]=e,r[s]=t)},writable:!0}),t));return r[h]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[s];return null!==t&&(r[h]=null,r[o]=null,r[s]=null,t(e)),void(r[u]=e)}var i=r[o];null!==i&&(r[h]=null,r[o]=null,r[s]=null,i(c(void 0,!0))),r[d]=!0})),e.on("readable",m.bind(null,r)),r}}).call(this,r(9))},function(e,t){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(e,t,r){"use strict";e.exports=n;var i=r(78);function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}r(5)(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){"use strict";var i;var n=r(25).codes,a=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e,t,n,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var s=!1;e.on("close",(function(){s=!0})),void 0===i&&(i=r(46)),i(e,{readable:t,writable:n},(function(e){if(e)return a(e);s=!0,a()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void a(t||new o("pipe"))}}function d(e){e()}function h(e,t){return e.pipe(t)}function l(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n=l(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new a("streams");var o=t.map((function(e,r){var a=r<t.length-1;return u(e,a,r>0,(function(e){i||(i=e),e&&o.forEach(d),a||(o.forEach(d),n(i))}))}));return t.reduce(h)}},function(e,t,r){var i=r(5),n=r(27),a=r(6).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function d(e){return e<<30|e>>>2}function h(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var f=0;f<80;++f){var c=~~(f/20),p=0|((t=i)<<5|t>>>27)+h(c,n,a,s)+u+r[f]+o[c];u=s,s=a,a=d(n),n=i,i=p}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=a.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var i=r(5),n=r(27),a=r(6).Buffer,o=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,n.call(this,64,56)}function d(e){return e<<5|e>>>27}function h(e){return e<<30|e>>>2}function l(e,t,r,i){return 0===e?t&r|~t&i:2===e?t&r|t&i|r&i:t^r^i}i(u,n),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,u=0|this._e,f=0;f<16;++f)r[f]=e.readInt32BE(4*f);for(;f<80;++f)r[f]=(t=r[f-3]^r[f-8]^r[f-14]^r[f-16])<<1|t>>>31;for(var c=0;c<80;++c){var p=~~(c/20),m=d(i)+l(p,n,a,s)+u+r[c]+o[p]|0;u=s,s=a,a=h(n),n=i,i=m}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=a.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},function(e,t,r){var i=r(5),n=r(79),a=r(27),o=r(6).Buffer,s=new Array(64);function u(){this.init(),this._w=s,a.call(this,64,56)}i(u,n),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=o.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},function(e,t,r){var i=r(5),n=r(80),a=r(27),o=r(6).Buffer,s=new Array(160);function u(){this.init(),this._w=s,a.call(this,128,112)}i(u,n),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=o.allocUnsafe(48);function t(t,r,i){e.writeInt32BE(t,i),e.writeInt32BE(r,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},function(e,t,r){e.exports=n;var i=r(8).EventEmitter;function n(){i.call(this)}r(5)(n,i),n.Readable=r(49),n.Writable=r(155),n.Duplex=r(156),n.Transform=r(157),n.PassThrough=r(158),n.Stream=n,n.prototype.pipe=function(e,t){var r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function a(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",a),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var o=!1;function s(){o||(o=!0,e.end())}function u(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function d(e){if(h(),0===i.listenerCount(this,"error"))throw e}function h(){r.removeListener("data",n),e.removeListener("drain",a),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",d),e.removeListener("error",d),r.removeListener("end",h),r.removeListener("close",h),e.removeListener("close",h)}return r.on("error",d),e.on("error",d),r.on("end",h),r.on("close",h),e.on("close",h),e.emit("pipe",r),e}},function(e,t){},function(e,t,r){"use strict";var i=r(50).Buffer,n=r(151);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},e.prototype.concat=function(e){if(0===this.length)return i.alloc(0);if(1===this.length)return this.head.data;for(var t,r,n,a=i.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,r=a,n=s,t.copy(r,n),s+=o.data.length,o=o.next;return a},e}(),n&&n.inspect&&n.inspect.custom&&(e.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,r){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(n.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new a(n.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(153),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(13))},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var i,n,a,o,s,u=1,d={},h=!1,l=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){p(e.data)},i=function(e){a.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,i=function(e){var t=l.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):i=function(e){setTimeout(p,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),i=function(t){e.postMessage(o+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var n={callback:e,args:t};return d[u]=n,i(u),u++},f.clearImmediate=c}function c(e){delete d[e]}function p(e){if(h)setTimeout(p,0,e);else{var t=d[e];if(t){h=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{c(e),h=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(13),r(9))},function(e,t,r){"use strict";e.exports=a;var i=r(84),n=Object.create(r(32));function a(e){if(!(this instanceof a))return new a(e);i.call(this,e)}n.inherits=r(5),n.inherits(a,i),a.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){e.exports=r(51)},function(e,t,r){e.exports=r(23)},function(e,t,r){e.exports=r(49).Transform},function(e,t,r){e.exports=r(49).PassThrough},function(e,t,r){"use strict";var i=r(5),n=r(6).Buffer,a=r(20),o=n.alloc(128);function s(e,t){a.call(this,"digest"),"string"==typeof t&&(t=n.from(t)),this._alg=e,this._key=t,t.length>64?t=e(t):t.length<64&&(t=n.concat([t,o],64));for(var r=this._ipad=n.allocUnsafe(64),i=this._opad=n.allocUnsafe(64),s=0;s<64;s++)r[s]=54^t[s],i[s]=92^t[s];this._hash=[r]}i(s,a),s.prototype._update=function(e){this._hash.push(e)},s.prototype._final=function(){var e=this._alg(n.concat(this._hash));return this._alg(n.concat([this._opad,e]))},e.exports=s},function(e,t,r){e.exports=r(87)},function(e,t,r){(function(t){var i,n,a=r(6).Buffer,o=r(89),s=r(90),u=r(91),d=r(92),h=t.crypto&&t.crypto.subtle,l={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},f=[];function c(){return n||(n=t.process&&t.process.nextTick?t.process.nextTick:t.queueMicrotask?t.queueMicrotask:t.setImmediate?t.setImmediate:t.setTimeout)}function p(e,t,r,i,n){return h.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then((function(e){return h.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:n}},e,i<<3)})).then((function(e){return a.from(e)}))}e.exports=function(e,r,n,m,g,_){"function"==typeof g&&(_=g,g=void 0);var y=l[(g=g||"sha1").toLowerCase()];if(y&&"function"==typeof t.Promise){if(o(n,m),e=d(e,s,"Password"),r=d(r,s,"Salt"),"function"!=typeof _)throw new Error("No callback provided to pbkdf2");!function(e,t){e.then((function(e){c()((function(){t(null,e)}))}),(function(e){c()((function(){t(e)}))}))}(function(e){if(t.process&&!t.process.browser)return Promise.resolve(!1);if(!h||!h.importKey||!h.deriveBits)return Promise.resolve(!1);if(void 0!==f[e])return f[e];var r=p(i=i||a.alloc(8),i,10,128,e).then((function(){return!0})).catch((function(){return!1}));return f[e]=r,r}(y).then((function(t){return t?p(e,r,n,m,y):u(e,r,n,m,g)})),_)}else c()((function(){var t;try{t=u(e,r,n,m,g)}catch(e){return _(e)}_(null,t)}))}}).call(this,r(13))},function(e,t,r){var i=r(163),n=r(53),a=r(54),o=r(176),s=r(40);function u(e,t,r){if(e=e.toLowerCase(),a[e])return n.createCipheriv(e,t,r);if(o[e])return new i({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function d(e,t,r){if(e=e.toLowerCase(),a[e])return n.createDecipheriv(e,t,r);if(o[e])return new i({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}t.createCipher=t.Cipher=function(e,t){var r,i;if(e=e.toLowerCase(),a[e])r=a[e].key,i=a[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,i=o[e].iv}var n=s(t,!1,r,i);return u(e,n.key,n.iv)},t.createCipheriv=t.Cipheriv=u,t.createDecipher=t.Decipher=function(e,t){var r,i;if(e=e.toLowerCase(),a[e])r=a[e].key,i=a[e].iv;else{if(!o[e])throw new TypeError("invalid suite type");r=8*o[e].key,i=o[e].iv}var n=s(t,!1,r,i);return d(e,n.key,n.iv)},t.createDecipheriv=t.Decipheriv=d,t.listCiphers=t.getCiphers=function(){return Object.keys(o).concat(n.getCiphers())}},function(e,t,r){var i=r(20),n=r(164),a=r(5),o=r(6).Buffer,s={"des-ede3-cbc":n.CBC.instantiate(n.EDE),"des-ede3":n.EDE,"des-ede-cbc":n.CBC.instantiate(n.EDE),"des-ede":n.EDE,"des-cbc":n.CBC.instantiate(n.DES),"des-ecb":n.DES};function u(e){i.call(this);var t,r=e.mode.toLowerCase(),n=s[r];t=e.decrypt?"decrypt":"encrypt";var a=e.key;o.isBuffer(a)||(a=o.from(a)),"des-ede"!==r&&"des-ede-cbc"!==r||(a=o.concat([a,a.slice(0,8)]));var u=e.iv;o.isBuffer(u)||(u=o.from(u)),this._des=n.create({key:a,iv:u,type:t})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],e.exports=u,a(u,i),u.prototype._update=function(e){return o.from(this._des.update(e))},u.prototype._final=function(){return o.from(this._des.final())}},function(e,t,r){"use strict";t.utils=r(93),t.Cipher=r(52),t.DES=r(94),t.CBC=r(165),t.EDE=r(166)},function(e,t,r){"use strict";var i=r(14),n=r(5),a={};function o(e){i.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}t.instantiate=function(e){function t(t){e.call(this,t),this._cbcInit()}n(t,e);for(var r=Object.keys(a),i=0;i<r.length;i++){var o=r[i];t.prototype[o]=a[o]}return t.create=function(e){return new t(e)},t},a._cbcInit=function(){var e=new o(this.options.iv);this._cbcState=e},a._update=function(e,t,r,i){var n=this._cbcState,a=this.constructor.super_.prototype,o=n.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)o[s]^=e[t+s];a._update.call(this,o,0,r,i);for(s=0;s<this.blockSize;s++)o[s]=r[i+s]}else{a._update.call(this,e,t,r,i);for(s=0;s<this.blockSize;s++)r[i+s]^=o[s];for(s=0;s<this.blockSize;s++)o[s]=e[t+s]}}},function(e,t,r){"use strict";var i=r(14),n=r(5),a=r(52),o=r(94);function s(e,t){i.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),a=t.slice(16,24);this.ciphers="encrypt"===e?[o.create({type:"encrypt",key:r}),o.create({type:"decrypt",key:n}),o.create({type:"encrypt",key:a})]:[o.create({type:"decrypt",key:a}),o.create({type:"encrypt",key:n}),o.create({type:"decrypt",key:r})]}function u(e){a.call(this,e);var t=new s(this.type,this.options.key);this._edeState=t}n(u,a),e.exports=u,u.create=function(e){return new u(e)},u.prototype._update=function(e,t,r,i){var n=this._edeState;n.ciphers[0]._update(e,t,r,i),n.ciphers[1]._update(r,i,r,i),n.ciphers[2]._update(r,i,r,i)},u.prototype._pad=o.prototype._pad,u.prototype._unpad=o.prototype._unpad},function(e,t,r){var i=r(54),n=r(98),a=r(6).Buffer,o=r(99),s=r(20),u=r(39),d=r(40);function h(e,t,r){s.call(this),this._cache=new f,this._cipher=new u.AES(t),this._prev=a.from(r),this._mode=e,this._autopadding=!0}r(5)(h,s),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return a.concat(i)};var l=a.alloc(16,16);function f(){this.cache=a.allocUnsafe(0)}function c(e,t,r){var s=i[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof t&&(t=a.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);if("string"==typeof r&&(r=a.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new o(s.module,t,r):"auth"===s.type?new n(s.module,t,r):new h(s.module,t,r)}h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(l))throw this._cipher.scrub(),new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},f.prototype.add=function(e){this.cache=a.concat([this.cache,e])},f.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},f.prototype.flush=function(){for(var e=16-this.cache.length,t=a.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return a.concat([this.cache,t])},t.createCipheriv=c,t.createCipher=function(e,t){var r=i[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=d(t,!1,r.key,r.iv);return c(e,n.key,n.iv)}},function(e,t){t.encrypt=function(e,t){return e._cipher.encryptBlock(t)},t.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},function(e,t,r){var i=r(33);t.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},t.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},function(e,t,r){var i=r(6).Buffer,n=r(33);function a(e,t,r){var a=t.length,o=n(t,e._cache);return e._cache=e._cache.slice(a),e._prev=i.concat([e._prev,r?t:o]),o}t.encrypt=function(e,t,r){for(var n,o=i.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=i.allocUnsafe(0)),!(e._cache.length<=t.length)){o=i.concat([o,a(e,t,r)]);break}n=e._cache.length,o=i.concat([o,a(e,t.slice(0,n),r)]),t=t.slice(n)}return o}},function(e,t,r){var i=r(6).Buffer;function n(e,t,r){var n=e._cipher.encryptBlock(e._prev)[0]^t;return e._prev=i.concat([e._prev.slice(1),i.from([r?t:n])]),n}t.encrypt=function(e,t,r){for(var a=t.length,o=i.allocUnsafe(a),s=-1;++s<a;)o[s]=n(e,t[s],r);return o}},function(e,t,r){var i=r(6).Buffer;function n(e,t,r){for(var i,n,o=-1,s=0;++o<8;)i=t&1<<7-o?128:0,s+=(128&(n=e._cipher.encryptBlock(e._prev)[0]^i))>>o%8,e._prev=a(e._prev,r?i:n);return s}function a(e,t){var r=e.length,n=-1,a=i.allocUnsafe(e.length);for(e=i.concat([e,i.from([t])]);++n<r;)a[n]=e[n]<<1|e[n+1]>>7;return a}t.encrypt=function(e,t,r){for(var a=t.length,o=i.allocUnsafe(a),s=-1;++s<a;)o[s]=n(e,t[s],r);return o}},function(e,t,r){(function(e){var i=r(33);function n(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}t.encrypt=function(t,r){for(;t._cache.length<r.length;)t._cache=e.concat([t._cache,n(t)]);var a=t._cache.slice(0,r.length);return t._cache=t._cache.slice(r.length),i(r,a)}}).call(this,r(10).Buffer)},function(e,t,r){var i=r(6).Buffer,n=i.alloc(16,0);function a(e){var t=i.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=i.alloc(16,0),this.cache=i.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},o.prototype._multiply=function(){for(var e,t,r,i=[(e=this.h).readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)],n=[0,0,0,0],o=-1;++o<128;){for(0!=(this.state[~~(o/8)]&1<<7-o%8)&&(n[0]^=i[0],n[1]^=i[1],n[2]^=i[2],n[3]^=i[3]),r=0!=(1&i[3]),t=3;t>0;t--)i[t]=i[t]>>>1|(1&i[t-1])<<31;i[0]=i[0]>>>1,r&&(i[0]=i[0]^225<<24)}this.state=a(n)},o.prototype.update=function(e){var t;for(this.cache=i.concat([this.cache,e]);this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(i.concat([this.cache,n],16)),this.ghash(a([0,e,0,t])),this.state},e.exports=o},function(e,t,r){var i=r(98),n=r(6).Buffer,a=r(54),o=r(99),s=r(20),u=r(39),d=r(40);function h(e,t,r){s.call(this),this._cache=new l,this._last=void 0,this._cipher=new u.AES(t),this._prev=n.from(r),this._mode=e,this._autopadding=!0}function l(){this.cache=n.allocUnsafe(0)}function f(e,t,r){var s=a[e.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=n.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=n.from(t)),t.length!==s.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===s.type?new o(s.module,t,r,!0):"auth"===s.type?new i(s.module,t,r,!0):new h(s.module,t,r)}r(5)(h,s),h.prototype._update=function(e){var t,r;this._cache.add(e);for(var i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return n.concat(i)},h.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");var r=-1;for(;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(16===t)return;return e.slice(0,16-t)}(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},h.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},l.prototype.add=function(e){this.cache=n.concat([this.cache,e])},l.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},l.prototype.flush=function(){if(this.cache.length)return this.cache},t.createDecipher=function(e,t){var r=a[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=d(t,!1,r.key,r.iv);return f(e,i.key,i.iv)},t.createDecipheriv=f},function(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},function(e,t,r){(function(e){var i=r(100),n=r(180),a=r(181);var o={binary:!0,hex:!0,base64:!0};t.DiffieHellmanGroup=t.createDiffieHellmanGroup=t.getDiffieHellman=function(t){var r=new e(n[t].prime,"hex"),i=new e(n[t].gen,"hex");return new a(r,i)},t.createDiffieHellman=t.DiffieHellman=function t(r,n,s,u){return e.isBuffer(n)||void 0===o[n]?t(r,"binary",n,s):(n=n||"binary",u=u||"binary",s=s||new e([2]),e.isBuffer(s)||(s=new e(s,u)),"number"==typeof r?new a(i(r,s),s,!0):(e.isBuffer(r)||(r=new e(r,n)),new a(r,s,!0)))}}).call(this,r(10).Buffer)},function(e,t){},function(e,t){},function(e){e.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(e,t,r){(function(t){var i=r(11),n=new(r(101)),a=new i(24),o=new i(11),s=new i(10),u=new i(3),d=new i(7),h=r(100),l=r(24);function f(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._pub=new i(e),this}function c(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this._priv=new i(e),this}e.exports=m;var p={};function m(e,t,r){this.setGenerator(t),this.__prime=new i(e),this._prime=i.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=f,this.setPrivateKey=c):this._primeCode=8}function g(e,r){var i=new t(e.toArray());return r?i.toString(r):i}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var r=t.toString("hex"),i=[r,e.toString(16)].join("_");if(i in p)return p[i];var l,f=0;if(e.isEven()||!h.simpleSieve||!h.fermatTest(e)||!n.test(e))return f+=1,f+="02"===r||"05"===r?8:4,p[i]=f,f;switch(n.test(e.shrn(1))||(f+=2),r){case"02":e.mod(a).cmp(o)&&(f+=8);break;case"05":(l=e.mod(s)).cmp(u)&&l.cmp(d)&&(f+=8);break;default:f+=4}return p[i]=f,f}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new i(l(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(e){var r=(e=(e=new i(e)).toRed(this._prime)).redPow(this._priv).fromRed(),n=new t(r.toArray()),a=this.getPrime();if(n.length<a.length){var o=new t(a.length-n.length);o.fill(0),n=t.concat([o,n])}return n},m.prototype.getPublicKey=function(e){return g(this._pub,e)},m.prototype.getPrivateKey=function(e){return g(this._priv,e)},m.prototype.getPrime=function(e){return g(this.__prime,e)},m.prototype.getGenerator=function(e){return g(this._gen,e)},m.prototype.setGenerator=function(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this.__gen=e,this._gen=new i(e),this}}).call(this,r(10).Buffer)},function(e,t,r){var i=r(6).Buffer,n=r(31),a=r(183),o=r(5),s=r(191),u=r(222),d=r(87);function h(e){a.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function l(e){a.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hash=n(t.hash),this._tag=t.id,this._signType=t.sign}function f(e){return new h(e)}function c(e){return new l(e)}Object.keys(d).forEach((function(e){d[e].id=i.from(d[e].id,"hex"),d[e.toLowerCase()]=d[e]})),o(h,a.Writable),h.prototype._write=function(e,t,r){this._hash.update(e),r()},h.prototype.update=function(e,t){return"string"==typeof e&&(e=i.from(e,t)),this._hash.update(e),this},h.prototype.sign=function(e,t){this.end();var r=this._hash.digest(),i=s(r,e,this._hashType,this._signType,this._tag);return t?i.toString(t):i},o(l,a.Writable),l.prototype._write=function(e,t,r){this._hash.update(e),r()},l.prototype.update=function(e,t){return"string"==typeof e&&(e=i.from(e,t)),this._hash.update(e),this},l.prototype.verify=function(e,t,r){"string"==typeof t&&(t=i.from(t,r)),this.end();var n=this._hash.digest();return u(t,n,e,this._signType,this._tag)},e.exports={Sign:f,Verify:c,createSign:f,createVerify:c}},function(e,t,r){(t=e.exports=r(102)).Stream=t,t.Readable=t,t.Writable=r(106),t.Duplex=r(29),t.Transform=r(107),t.PassThrough=r(189),t.finished=r(57),t.pipeline=r(190)},function(e,t){},function(e,t,r){"use strict";function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=r(10).Buffer,s=r(186).inspect,u=s&&s.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r,d;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,i,n=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,r=n,i=s,o.prototype.copy.call(t,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,i=t.data;for(e-=i.length;t=t.next;){var n=t.data,a=e>n.length?n.length:e;if(a===n.length?i+=n:i+=n.slice(0,e),0==(e-=a)){a===n.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,i=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var n=r.data,a=e>n.length?n.length:e;if(n.copy(t,t.length-e,0,a),0==(e-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),d&&a(t,d),e}()},function(e,t){},function(e,t,r){"use strict";(function(t){var i;function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(57),o=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),d=Symbol("ended"),h=Symbol("lastPromise"),l=Symbol("handlePromise"),f=Symbol("stream");function c(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var r=e[f].read();null!==r&&(e[h]=null,e[o]=null,e[s]=null,t(c(r,!1)))}}function m(e){t.nextTick(p,e)}var g=Object.getPrototypeOf((function(){})),_=Object.setPrototypeOf((n(i={get stream(){return this[f]},next:function(){var e=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[d])return Promise.resolve(c(void 0,!0));if(this[f].destroyed)return new Promise((function(r,i){t.nextTick((function(){e[u]?i(e[u]):r(c(void 0,!0))}))}));var i,n=this[h];if(n)i=new Promise(function(e,t){return function(r,i){e.then((function(){t[d]?r(c(void 0,!0)):t[l](r,i)}),i)}}(n,this));else{var a=this[f].read();if(null!==a)return Promise.resolve(c(a,!1));i=new Promise(this[l])}return this[h]=i,i}},Symbol.asyncIterator,(function(){return this})),n(i,"return",(function(){var e=this;return new Promise((function(t,r){e[f].destroy(null,(function(e){e?r(e):t(c(void 0,!0))}))}))})),i),g);e.exports=function(e){var t,r=Object.create(_,(n(t={},f,{value:e,writable:!0}),n(t,o,{value:null,writable:!0}),n(t,s,{value:null,writable:!0}),n(t,u,{value:null,writable:!0}),n(t,d,{value:e._readableState.endEmitted,writable:!0}),n(t,l,{value:function(e,t){var i=r[f].read();i?(r[h]=null,r[o]=null,r[s]=null,e(c(i,!1))):(r[o]=e,r[s]=t)},writable:!0}),t));return r[h]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[s];return null!==t&&(r[h]=null,r[o]=null,r[s]=null,t(e)),void(r[u]=e)}var i=r[o];null!==i&&(r[h]=null,r[o]=null,r[s]=null,i(c(void 0,!0))),r[d]=!0})),e.on("readable",m.bind(null,r)),r}}).call(this,r(9))},function(e,t){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(e,t,r){"use strict";e.exports=n;var i=r(107);function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}r(5)(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},function(e,t,r){"use strict";var i;var n=r(28).codes,a=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e,t,n,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var s=!1;e.on("close",(function(){s=!0})),void 0===i&&(i=r(57)),i(e,{readable:t,writable:n},(function(e){if(e)return a(e);s=!0,a()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void a(t||new o("pipe"))}}function d(e){e()}function h(e,t){return e.pipe(t)}function l(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}e.exports=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n=l(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new a("streams");var o=t.map((function(e,r){var a=r<t.length-1;return u(e,a,r>0,(function(e){i||(i=e),e&&o.forEach(d),a||(o.forEach(d),n(i))}))}));return t.reduce(h)}},function(e,t,r){var i=r(6).Buffer,n=r(85),a=r(58),o=r(59).ec,s=r(113),u=r(42),d=r(119);function h(e,t,r,a){if((e=i.from(e.toArray())).length<t.byteLength()){var o=i.alloc(t.byteLength()-e.length);e=i.concat([o,e])}var s=r.length,u=function(e,t){e=(e=l(e,t)).mod(t);var r=i.from(e.toArray());if(r.length<t.byteLength()){var n=i.alloc(t.byteLength()-r.length);r=i.concat([n,r])}return r}(r,t),d=i.alloc(s);d.fill(1);var h=i.alloc(s);return h=n(a,h).update(d).update(i.from([0])).update(e).update(u).digest(),d=n(a,h).update(d).digest(),{k:h=n(a,h).update(d).update(i.from([1])).update(e).update(u).digest(),v:d=n(a,h).update(d).digest()}}function l(e,t){var r=new s(e),i=(e.length<<3)-t.bitLength();return i>0&&r.ishrn(i),r}function f(e,t,r){var a,o;do{for(a=i.alloc(0);8*a.length<e.bitLength();)t.v=n(r,t.k).update(t.v).digest(),a=i.concat([a,t.v]);o=l(a,e),t.k=n(r,t.k).update(t.v).update(i.from([0])).digest(),t.v=n(r,t.k).update(t.v).digest()}while(-1!==o.cmp(e));return o}function c(e,t,r,i){return e.toRed(s.mont(r)).redPow(t).fromRed().mod(i)}e.exports=function(e,t,r,n,p){var m=u(t);if(m.curve){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");return function(e,t){var r=d[t.curve.join(".")];if(!r)throw new Error("unknown curve "+t.curve.join("."));var n=new o(r).keyFromPrivate(t.privateKey).sign(e);return i.from(n.toDER())}(e,m)}if("dsa"===m.type){if("dsa"!==n)throw new Error("wrong private key type");return function(e,t,r){var n,a=t.params.priv_key,o=t.params.p,u=t.params.q,d=t.params.g,p=new s(0),m=l(e,u).mod(u),g=!1,_=h(a,u,e,r);for(;!1===g;)n=f(u,_,r),p=c(d,n,o,u),0===(g=n.invm(u).imul(m.add(a.mul(p))).mod(u)).cmpn(0)&&(g=!1,p=new s(0));return function(e,t){e=e.toArray(),t=t.toArray(),128&e[0]&&(e=[0].concat(e));128&t[0]&&(t=[0].concat(t));var r=[48,e.length+t.length+4,2,e.length];return r=r.concat(e,[2,t.length],t),i.from(r)}(p,g)}(e,m,r)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong private key type");e=i.concat([p,e]);for(var g=m.modulus.byteLength(),_=[0,1];e.length+_.length+1<g;)_.push(255);_.push(0);for(var y=-1;++y<e.length;)_.push(e[y]);return a(_,m)},e.exports.getKey=h,e.exports.makeKey=f},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(193).Buffer}catch(e){}function s(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function u(e,t,r){var i=s(e,r);return r-1>=t&&(i|=s(e,r-1)<<4),i}function d(e,t,r,n){for(var a=0,o=0,s=Math.min(e.length,r),u=t;u<s;u++){var d=e.charCodeAt(u)-48;a*=n,o=d>=49?d-49+10:d>=17?d-17+10:d,i(d>=0&&o<n,"Invalid character"),a+=o}return a}function h(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,o,s=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)o=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)o=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this._strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=u(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=u(e,t,i)<<a,this.words[o]|=67108863&n,a>=18?(a-=18,o+=1,this.words[o]|=n>>>26):a+=8;this._strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,o=a%i,s=Math.min(a,a-o)+r,u=0,h=r;h<s;h+=i)u=d(e,h,h+i,t),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var l=1;for(u=d(e,h,e.length,t),h=0;h<o;h++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype._move=function(e){h(e,this)},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){a.prototype.inspect=l}else a.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<n|a)).toString(16);a=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==a||o!==this.length-1?f[6-u.length]+u+r:u+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var d=c[e],h=p[e];r="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modrn(h).toString(e);r=(l=l.idivn(h)).isZero()?m+r:f[d-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],o=n*a,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var d=1;d<i;d++){for(var h=u>>>26,l=67108863&u,f=Math.min(d,t.length-1),c=Math.max(0,d-e.length+1);c<=f;c++){var p=d-c|0;h+=(o=(n=0|e.words[p])*(a=0|t.words[c])+l)/67108864|0,l=67108863&o}r.words[d]=0|l,u=0|h}return 0!==u?r.words[d]=0|u:r.length--,r._strip()}a.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},a.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,a=0;n<this.length;n++){var o=this.words[n]<<a|i;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===a?(r<e.length&&(e[r++]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},a.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,a=0;n<this.length;n++){var o=this.words[n]<<a|i;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),i=0,a=0):(i=o>>>24,a+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},a.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},a.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},a.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},a.prototype.iadd=function(e){var t,r,i;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var n=0,a=0;a<i.length;a++)t=(0|r.words[a])+(0|i.words[a])+n,this.words[a]=67108863&t,n=t>>>26;for(;0!==n&&a<r.length;a++)t=(0|r.words[a])+n,this.words[a]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,i,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)a=(t=(0|r.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&t;for(;0!==a&&o<r.length;o++)a=(t=(0|r.words[o])+a)>>26,this.words[o]=67108863&t;if(0===a&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(e){return this.clone().isub(e)};var g=function(e,t,r){var i,n,a,o=e.words,s=t.words,u=r.words,d=0,h=0|o[0],l=8191&h,f=h>>>13,c=0|o[1],p=8191&c,m=c>>>13,g=0|o[2],_=8191&g,y=g>>>13,b=0|o[3],v=8191&b,w=b>>>13,E=0|o[4],A=8191&E,S=E>>>13,M=0|o[5],T=8191&M,R=M>>>13,k=0|o[6],I=8191&k,O=k>>>13,D=0|o[7],x=8191&D,C=D>>>13,P=0|o[8],N=8191&P,L=P>>>13,B=0|o[9],F=8191&B,U=B>>>13,j=0|s[0],H=8191&j,X=j>>>13,W=0|s[1],V=8191&W,z=W>>>13,q=0|s[2],G=8191&q,Q=q>>>13,Y=0|s[3],K=8191&Y,J=Y>>>13,Z=0|s[4],$=8191&Z,ee=Z>>>13,te=0|s[5],re=8191&te,ie=te>>>13,ne=0|s[6],ae=8191&ne,oe=ne>>>13,se=0|s[7],ue=8191&se,de=se>>>13,he=0|s[8],le=8191&he,fe=he>>>13,ce=0|s[9],pe=8191&ce,me=ce>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(d+(i=Math.imul(l,H))|0)+((8191&(n=(n=Math.imul(l,X))+Math.imul(f,H)|0))<<13)|0;d=((a=Math.imul(f,X))+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,i=Math.imul(p,H),n=(n=Math.imul(p,X))+Math.imul(m,H)|0,a=Math.imul(m,X);var _e=(d+(i=i+Math.imul(l,V)|0)|0)+((8191&(n=(n=n+Math.imul(l,z)|0)+Math.imul(f,V)|0))<<13)|0;d=((a=a+Math.imul(f,z)|0)+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,i=Math.imul(_,H),n=(n=Math.imul(_,X))+Math.imul(y,H)|0,a=Math.imul(y,X),i=i+Math.imul(p,V)|0,n=(n=n+Math.imul(p,z)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,z)|0;var ye=(d+(i=i+Math.imul(l,G)|0)|0)+((8191&(n=(n=n+Math.imul(l,Q)|0)+Math.imul(f,G)|0))<<13)|0;d=((a=a+Math.imul(f,Q)|0)+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,i=Math.imul(v,H),n=(n=Math.imul(v,X))+Math.imul(w,H)|0,a=Math.imul(w,X),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,z)|0)+Math.imul(y,V)|0,a=a+Math.imul(y,z)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,G)|0,a=a+Math.imul(m,Q)|0;var be=(d+(i=i+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,J)|0)+Math.imul(f,K)|0))<<13)|0;d=((a=a+Math.imul(f,J)|0)+(n>>>13)|0)+(be>>>26)|0,be&=67108863,i=Math.imul(A,H),n=(n=Math.imul(A,X))+Math.imul(S,H)|0,a=Math.imul(S,X),i=i+Math.imul(v,V)|0,n=(n=n+Math.imul(v,z)|0)+Math.imul(w,V)|0,a=a+Math.imul(w,z)|0,i=i+Math.imul(_,G)|0,n=(n=n+Math.imul(_,Q)|0)+Math.imul(y,G)|0,a=a+Math.imul(y,Q)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,K)|0,a=a+Math.imul(m,J)|0;var ve=(d+(i=i+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,ee)|0)+Math.imul(f,$)|0))<<13)|0;d=((a=a+Math.imul(f,ee)|0)+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,i=Math.imul(T,H),n=(n=Math.imul(T,X))+Math.imul(R,H)|0,a=Math.imul(R,X),i=i+Math.imul(A,V)|0,n=(n=n+Math.imul(A,z)|0)+Math.imul(S,V)|0,a=a+Math.imul(S,z)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,Q)|0)+Math.imul(w,G)|0,a=a+Math.imul(w,Q)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,J)|0)+Math.imul(y,K)|0,a=a+Math.imul(y,J)|0,i=i+Math.imul(p,$)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0;var we=(d+(i=i+Math.imul(l,re)|0)|0)+((8191&(n=(n=n+Math.imul(l,ie)|0)+Math.imul(f,re)|0))<<13)|0;d=((a=a+Math.imul(f,ie)|0)+(n>>>13)|0)+(we>>>26)|0,we&=67108863,i=Math.imul(I,H),n=(n=Math.imul(I,X))+Math.imul(O,H)|0,a=Math.imul(O,X),i=i+Math.imul(T,V)|0,n=(n=n+Math.imul(T,z)|0)+Math.imul(R,V)|0,a=a+Math.imul(R,z)|0,i=i+Math.imul(A,G)|0,n=(n=n+Math.imul(A,Q)|0)+Math.imul(S,G)|0,a=a+Math.imul(S,Q)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(w,K)|0,a=a+Math.imul(w,J)|0,i=i+Math.imul(_,$)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,ee)|0,i=i+Math.imul(p,re)|0,n=(n=n+Math.imul(p,ie)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ie)|0;var Ee=(d+(i=i+Math.imul(l,ae)|0)|0)+((8191&(n=(n=n+Math.imul(l,oe)|0)+Math.imul(f,ae)|0))<<13)|0;d=((a=a+Math.imul(f,oe)|0)+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,i=Math.imul(x,H),n=(n=Math.imul(x,X))+Math.imul(C,H)|0,a=Math.imul(C,X),i=i+Math.imul(I,V)|0,n=(n=n+Math.imul(I,z)|0)+Math.imul(O,V)|0,a=a+Math.imul(O,z)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(R,G)|0,a=a+Math.imul(R,Q)|0,i=i+Math.imul(A,K)|0,n=(n=n+Math.imul(A,J)|0)+Math.imul(S,K)|0,a=a+Math.imul(S,J)|0,i=i+Math.imul(v,$)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(w,$)|0,a=a+Math.imul(w,ee)|0,i=i+Math.imul(_,re)|0,n=(n=n+Math.imul(_,ie)|0)+Math.imul(y,re)|0,a=a+Math.imul(y,ie)|0,i=i+Math.imul(p,ae)|0,n=(n=n+Math.imul(p,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Ae=(d+(i=i+Math.imul(l,ue)|0)|0)+((8191&(n=(n=n+Math.imul(l,de)|0)+Math.imul(f,ue)|0))<<13)|0;d=((a=a+Math.imul(f,de)|0)+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,i=Math.imul(N,H),n=(n=Math.imul(N,X))+Math.imul(L,H)|0,a=Math.imul(L,X),i=i+Math.imul(x,V)|0,n=(n=n+Math.imul(x,z)|0)+Math.imul(C,V)|0,a=a+Math.imul(C,z)|0,i=i+Math.imul(I,G)|0,n=(n=n+Math.imul(I,Q)|0)+Math.imul(O,G)|0,a=a+Math.imul(O,Q)|0,i=i+Math.imul(T,K)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(R,K)|0,a=a+Math.imul(R,J)|0,i=i+Math.imul(A,$)|0,n=(n=n+Math.imul(A,ee)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,ee)|0,i=i+Math.imul(v,re)|0,n=(n=n+Math.imul(v,ie)|0)+Math.imul(w,re)|0,a=a+Math.imul(w,ie)|0,i=i+Math.imul(_,ae)|0,n=(n=n+Math.imul(_,oe)|0)+Math.imul(y,ae)|0,a=a+Math.imul(y,oe)|0,i=i+Math.imul(p,ue)|0,n=(n=n+Math.imul(p,de)|0)+Math.imul(m,ue)|0,a=a+Math.imul(m,de)|0;var Se=(d+(i=i+Math.imul(l,le)|0)|0)+((8191&(n=(n=n+Math.imul(l,fe)|0)+Math.imul(f,le)|0))<<13)|0;d=((a=a+Math.imul(f,fe)|0)+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,i=Math.imul(F,H),n=(n=Math.imul(F,X))+Math.imul(U,H)|0,a=Math.imul(U,X),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,z)|0)+Math.imul(L,V)|0,a=a+Math.imul(L,z)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,Q)|0)+Math.imul(C,G)|0,a=a+Math.imul(C,Q)|0,i=i+Math.imul(I,K)|0,n=(n=n+Math.imul(I,J)|0)+Math.imul(O,K)|0,a=a+Math.imul(O,J)|0,i=i+Math.imul(T,$)|0,n=(n=n+Math.imul(T,ee)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,ee)|0,i=i+Math.imul(A,re)|0,n=(n=n+Math.imul(A,ie)|0)+Math.imul(S,re)|0,a=a+Math.imul(S,ie)|0,i=i+Math.imul(v,ae)|0,n=(n=n+Math.imul(v,oe)|0)+Math.imul(w,ae)|0,a=a+Math.imul(w,oe)|0,i=i+Math.imul(_,ue)|0,n=(n=n+Math.imul(_,de)|0)+Math.imul(y,ue)|0,a=a+Math.imul(y,de)|0,i=i+Math.imul(p,le)|0,n=(n=n+Math.imul(p,fe)|0)+Math.imul(m,le)|0,a=a+Math.imul(m,fe)|0;var Me=(d+(i=i+Math.imul(l,pe)|0)|0)+((8191&(n=(n=n+Math.imul(l,me)|0)+Math.imul(f,pe)|0))<<13)|0;d=((a=a+Math.imul(f,me)|0)+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,i=Math.imul(F,V),n=(n=Math.imul(F,z))+Math.imul(U,V)|0,a=Math.imul(U,z),i=i+Math.imul(N,G)|0,n=(n=n+Math.imul(N,Q)|0)+Math.imul(L,G)|0,a=a+Math.imul(L,Q)|0,i=i+Math.imul(x,K)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(C,K)|0,a=a+Math.imul(C,J)|0,i=i+Math.imul(I,$)|0,n=(n=n+Math.imul(I,ee)|0)+Math.imul(O,$)|0,a=a+Math.imul(O,ee)|0,i=i+Math.imul(T,re)|0,n=(n=n+Math.imul(T,ie)|0)+Math.imul(R,re)|0,a=a+Math.imul(R,ie)|0,i=i+Math.imul(A,ae)|0,n=(n=n+Math.imul(A,oe)|0)+Math.imul(S,ae)|0,a=a+Math.imul(S,oe)|0,i=i+Math.imul(v,ue)|0,n=(n=n+Math.imul(v,de)|0)+Math.imul(w,ue)|0,a=a+Math.imul(w,de)|0,i=i+Math.imul(_,le)|0,n=(n=n+Math.imul(_,fe)|0)+Math.imul(y,le)|0,a=a+Math.imul(y,fe)|0;var Te=(d+(i=i+Math.imul(p,pe)|0)|0)+((8191&(n=(n=n+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;d=((a=a+Math.imul(m,me)|0)+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,i=Math.imul(F,G),n=(n=Math.imul(F,Q))+Math.imul(U,G)|0,a=Math.imul(U,Q),i=i+Math.imul(N,K)|0,n=(n=n+Math.imul(N,J)|0)+Math.imul(L,K)|0,a=a+Math.imul(L,J)|0,i=i+Math.imul(x,$)|0,n=(n=n+Math.imul(x,ee)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,ee)|0,i=i+Math.imul(I,re)|0,n=(n=n+Math.imul(I,ie)|0)+Math.imul(O,re)|0,a=a+Math.imul(O,ie)|0,i=i+Math.imul(T,ae)|0,n=(n=n+Math.imul(T,oe)|0)+Math.imul(R,ae)|0,a=a+Math.imul(R,oe)|0,i=i+Math.imul(A,ue)|0,n=(n=n+Math.imul(A,de)|0)+Math.imul(S,ue)|0,a=a+Math.imul(S,de)|0,i=i+Math.imul(v,le)|0,n=(n=n+Math.imul(v,fe)|0)+Math.imul(w,le)|0,a=a+Math.imul(w,fe)|0;var Re=(d+(i=i+Math.imul(_,pe)|0)|0)+((8191&(n=(n=n+Math.imul(_,me)|0)+Math.imul(y,pe)|0))<<13)|0;d=((a=a+Math.imul(y,me)|0)+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,i=Math.imul(F,K),n=(n=Math.imul(F,J))+Math.imul(U,K)|0,a=Math.imul(U,J),i=i+Math.imul(N,$)|0,n=(n=n+Math.imul(N,ee)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,ee)|0,i=i+Math.imul(x,re)|0,n=(n=n+Math.imul(x,ie)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ie)|0,i=i+Math.imul(I,ae)|0,n=(n=n+Math.imul(I,oe)|0)+Math.imul(O,ae)|0,a=a+Math.imul(O,oe)|0,i=i+Math.imul(T,ue)|0,n=(n=n+Math.imul(T,de)|0)+Math.imul(R,ue)|0,a=a+Math.imul(R,de)|0,i=i+Math.imul(A,le)|0,n=(n=n+Math.imul(A,fe)|0)+Math.imul(S,le)|0,a=a+Math.imul(S,fe)|0;var ke=(d+(i=i+Math.imul(v,pe)|0)|0)+((8191&(n=(n=n+Math.imul(v,me)|0)+Math.imul(w,pe)|0))<<13)|0;d=((a=a+Math.imul(w,me)|0)+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,i=Math.imul(F,$),n=(n=Math.imul(F,ee))+Math.imul(U,$)|0,a=Math.imul(U,ee),i=i+Math.imul(N,re)|0,n=(n=n+Math.imul(N,ie)|0)+Math.imul(L,re)|0,a=a+Math.imul(L,ie)|0,i=i+Math.imul(x,ae)|0,n=(n=n+Math.imul(x,oe)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,oe)|0,i=i+Math.imul(I,ue)|0,n=(n=n+Math.imul(I,de)|0)+Math.imul(O,ue)|0,a=a+Math.imul(O,de)|0,i=i+Math.imul(T,le)|0,n=(n=n+Math.imul(T,fe)|0)+Math.imul(R,le)|0,a=a+Math.imul(R,fe)|0;var Ie=(d+(i=i+Math.imul(A,pe)|0)|0)+((8191&(n=(n=n+Math.imul(A,me)|0)+Math.imul(S,pe)|0))<<13)|0;d=((a=a+Math.imul(S,me)|0)+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,i=Math.imul(F,re),n=(n=Math.imul(F,ie))+Math.imul(U,re)|0,a=Math.imul(U,ie),i=i+Math.imul(N,ae)|0,n=(n=n+Math.imul(N,oe)|0)+Math.imul(L,ae)|0,a=a+Math.imul(L,oe)|0,i=i+Math.imul(x,ue)|0,n=(n=n+Math.imul(x,de)|0)+Math.imul(C,ue)|0,a=a+Math.imul(C,de)|0,i=i+Math.imul(I,le)|0,n=(n=n+Math.imul(I,fe)|0)+Math.imul(O,le)|0,a=a+Math.imul(O,fe)|0;var Oe=(d+(i=i+Math.imul(T,pe)|0)|0)+((8191&(n=(n=n+Math.imul(T,me)|0)+Math.imul(R,pe)|0))<<13)|0;d=((a=a+Math.imul(R,me)|0)+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,i=Math.imul(F,ae),n=(n=Math.imul(F,oe))+Math.imul(U,ae)|0,a=Math.imul(U,oe),i=i+Math.imul(N,ue)|0,n=(n=n+Math.imul(N,de)|0)+Math.imul(L,ue)|0,a=a+Math.imul(L,de)|0,i=i+Math.imul(x,le)|0,n=(n=n+Math.imul(x,fe)|0)+Math.imul(C,le)|0,a=a+Math.imul(C,fe)|0;var De=(d+(i=i+Math.imul(I,pe)|0)|0)+((8191&(n=(n=n+Math.imul(I,me)|0)+Math.imul(O,pe)|0))<<13)|0;d=((a=a+Math.imul(O,me)|0)+(n>>>13)|0)+(De>>>26)|0,De&=67108863,i=Math.imul(F,ue),n=(n=Math.imul(F,de))+Math.imul(U,ue)|0,a=Math.imul(U,de),i=i+Math.imul(N,le)|0,n=(n=n+Math.imul(N,fe)|0)+Math.imul(L,le)|0,a=a+Math.imul(L,fe)|0;var xe=(d+(i=i+Math.imul(x,pe)|0)|0)+((8191&(n=(n=n+Math.imul(x,me)|0)+Math.imul(C,pe)|0))<<13)|0;d=((a=a+Math.imul(C,me)|0)+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,i=Math.imul(F,le),n=(n=Math.imul(F,fe))+Math.imul(U,le)|0,a=Math.imul(U,fe);var Ce=(d+(i=i+Math.imul(N,pe)|0)|0)+((8191&(n=(n=n+Math.imul(N,me)|0)+Math.imul(L,pe)|0))<<13)|0;d=((a=a+Math.imul(L,me)|0)+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Pe=(d+(i=Math.imul(F,pe))|0)+((8191&(n=(n=Math.imul(F,me))+Math.imul(U,pe)|0))<<13)|0;return d=((a=Math.imul(U,me))+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u[0]=ge,u[1]=_e,u[2]=ye,u[3]=be,u[4]=ve,u[5]=we,u[6]=Ee,u[7]=Ae,u[8]=Se,u[9]=Me,u[10]=Te,u[11]=Re,u[12]=ke,u[13]=Ie,u[14]=Oe,u[15]=De,u[16]=xe,u[17]=Ce,u[18]=Pe,0!==d&&(u[19]=d,r.length++),r};function _(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,a=0;a<r.length-1;a++){var o=n;n=0;for(var s=67108863&i,u=Math.min(a,t.length-1),d=Math.max(0,a-e.length+1);d<=u;d++){var h=a-d,l=(0|e.words[h])*(0|t.words[d]),f=67108863&l;s=67108863&(f=f+s|0),n+=(o=(o=o+(l/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[a]=s,i=o,o=n}return 0!==i?r.words[a]=i:r.length--,r._strip()}function y(e,t,r){return _(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(g=m),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?_(this,e,t):y(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},b.prototype.permute=function(e,t,r,i,n,a){for(var o=0;o<a;o++)i[o]=t[e[o]],n[o]=r[e[o]]},b.prototype.transform=function(e,t,r,i,n,a){this.permute(a,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),d=Math.sin(2*Math.PI/s),h=0;h<n;h+=s)for(var l=u,f=d,c=0;c<o;c++){var p=r[h+c],m=i[h+c],g=r[h+c+o],_=i[h+c+o],y=l*g-f*_;_=l*_+f*g,g=y,r[h+c]=p+g,i[h+c]=m+_,r[h+c+o]=p-g,i[h+c+o]=m-_,c!==s&&(y=u*l-d*f,f=u*f+d*l,l=y)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},b.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},b.prototype.convert13b=function(e,t,r,n){for(var a=0,o=0;o<t;o++)a+=0|e[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===a),i(0==(-8192&a))},b.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),a=this.stub(i),o=new Array(i),s=new Array(i),u=new Array(i),d=new Array(i),h=new Array(i),l=new Array(i),f=r.words;f.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,d,i),this.transform(o,a,s,u,i,n),this.transform(d,a,h,l,i,n);for(var c=0;c<i;c++){var p=s[c]*h[c]-u[c]*l[c];u[c]=s[c]*l[c]+u[c]*h[c],s[c]=p}return this.conjugate(s,u,i),this.transform(s,u,f,a,i,n),this.conjugate(f,a,i),this.normalize13b(f,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},a.prototype.mul=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},a.prototype.mulf=function(e){var t=new a(null);return t.words=new Array(this.length+e.length),y(this,e,t)},a.prototype.imul=function(e){return this.clone().mulTo(e,this)},a.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var a=(0|this.words[n])*e,o=(67108863&a)+(67108863&r);r>>=26,r+=a/67108864|0,r+=o>>>26,this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,this.length++),t?this.ineg():this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new a(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},a.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var s=this.words[t]&a,u=(0|this.words[t])-s<<r;this.words[t]=u|o,o=s>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},a.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},a.prototype.iushrn=function(e,t,r){var n;i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,u=r;if(n-=o,n=Math.max(0,n),u){for(var d=0;d<o;d++)u.words[d]=this.words[d];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,d=0;d<this.length;d++)this.words[d]=this.words[d+o];else this.words[0]=0,this.length=1;var h=0;for(d=this.length-1;d>=0&&(0!==h||d>=n);d--){var l=0|this.words[d];this.words[d]=h<<26-a|l>>>a,h=l&s}return u&&0!==h&&(u.words[u.length++]=h),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,n=1<<t;return!(this.length<=r)&&!!(this.words[r]&n)},a.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var n=67108863^67108863>>>t<<t;this.words[this.length-1]&=n}return this._strip()},a.prototype.maskn=function(e){return this.clone().imaskn(e)},a.prototype.iaddn=function(e){return i("number"==typeof e),i(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},a.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(i("number"==typeof e),i(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},a.prototype.addn=function(e){return this.clone().iaddn(e)},a.prototype.subn=function(e){return this.clone().isubn(e)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(e,t,r){var n,a,o=e.length+r;this._expand(o);var s=0;for(n=0;n<e.length;n++){a=(0|this.words[n+r])+s;var u=(0|e.words[n])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&a}for(;n<this.length-r;n++)s=(a=(0|this.words[n+r])+s)>>26,this.words[n+r]=67108863&a;if(0===s)return this._strip();for(i(-1===s),s=0,n=0;n<this.length;n++)s=(a=-(0|this.words[n])+s)>>26,this.words[n]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),i=this.clone(),n=e,o=0|n.words[n.length-1];0!==(r=26-this._countBits(o))&&(n=n.ushln(r),i.iushln(r),o=0|n.words[n.length-1]);var s,u=i.length-n.length;if("mod"!==t){(s=new a(null)).length=u+1,s.words=new Array(s.length);for(var d=0;d<s.length;d++)s.words[d]=0}var h=i.clone()._ishlnsubmul(n,1,u);0===h.negative&&(i=h,s&&(s.words[u]=1));for(var l=u-1;l>=0;l--){var f=67108864*(0|i.words[n.length+l])+(0|i.words[n.length+l-1]);for(f=Math.min(f/o|0,67108863),i._ishlnsubmul(n,f,l);0!==i.negative;)f--,i.negative=0,i._ishlnsubmul(n,1,l),i.isZero()||(i.negative^=1);s&&(s.words[l]=f)}return s&&s._strip(),i._strip(),"div"!==t&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},a.prototype.divmod=function(e,t,r){return i(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(n=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(n=s.div.neg()),{div:n,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modrn(e.words[0]))}:this._wordDiv(e,t);var n,o,s},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),a=r.cmp(i);return a<0||1===n&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=(1<<26)%e,n=0,a=this.length-1;a>=0;a--)n=(r*n+(0|this.words[a]))%e;return t?-n:n},a.prototype.modn=function(e){return this.modrn(e)},a.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var a=(0|this.words[n])+67108864*r;this.words[n]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new a(1),o=new a(0),s=new a(0),u=new a(1),d=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++d;for(var h=r.clone(),l=t.clone();!t.isZero();){for(var f=0,c=1;0==(t.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(l)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(h),u.isub(l)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(s),o.isub(u)):(r.isub(t),s.isub(n),u.isub(o))}return{a:s,b:u,gcd:r.iushln(d)}},a.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n,o=new a(1),s=new a(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var d=0,h=1;0==(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var l=0,f=1;0==(r.words[0]&f)&&l<26;++l,f<<=1);if(l>0)for(r.iushrn(l);l-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(n=0===t.cmpn(1)?o:s).cmpn(0)<0&&n.iadd(e),n},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var a=t;t=r,r=a}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var a=n,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},a.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},a.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new T(e)},a.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function R(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(E,w),E.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var n=e.words[9];for(t.words[t.length++]=4194303&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(4194303&a)<<4|n>>>22,n=a}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(A,w),n(S,w),n(M,w),M.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=19*(0|e.words[r])+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new E;else if("p224"===e)t=new A;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return v[e]=t,t},T.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){i(0==(e.negative|t.negative),"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(h(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},T.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var s=new a(1).toRed(this),u=s.redNeg(),d=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new a(2*h*h).toRed(this);0!==this.pow(h,d).cmp(u);)h.redIAdd(u);for(var l=this.pow(h,n),f=this.pow(e,n.addn(1).iushrn(1)),c=this.pow(e,n),p=o;0!==c.cmp(s);){for(var m=c,g=0;0!==m.cmp(s);g++)m=m.redSqr();i(g<p);var _=this.pow(l,new a(1).iushln(p-g-1));f=f.redMul(_),l=_.redSqr(),c=c.redMul(l),p=g}return f},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new a(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),i=t.length-1;i>=0;i--){for(var d=t.words[i],h=u-1;h>=0;h--){var l=d>>h&1;n!==r[0]&&(n=this.sqr(n)),0!==l||0!==o?(o<<=1,o|=l,(4===++s||0===i&&0===h)&&(n=this.mul(n,r[o]),s=0,o=0)):s=0}u=26}return n},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new R(e)},n(R,T),R.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},R.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},R.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},R.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},R.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,r(55)(e))},function(e,t){},function(e){e.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny <fedor@indutny.com>","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(e,t,r){"use strict";var i=r(15),n=r(11),a=r(5),o=r(41),s=i.assert;function u(e){o.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function d(e,t,r,i){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(e,t,r,i){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(u,o),e.exports=u,u.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var a=this._getEndoRoots(this.n);0===this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))?r=a[0]:(r=a[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new n(e.a,16),b:new n(e.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),a=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,i,a,o,s,u,d,h,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),f=e,c=this.n.clone(),p=new n(1),m=new n(0),g=new n(0),_=new n(1),y=0;0!==f.cmpn(0);){var b=c.div(f);d=c.sub(b.mul(f)),h=g.sub(b.mul(p));var v=_.sub(b.mul(m));if(!i&&d.cmp(l)<0)t=u.neg(),r=p,i=d.neg(),a=h;else if(i&&2==++y)break;u=d,c=f,f=d,g=p,p=h,_=m,m=v}o=d.neg(),s=h;var w=i.sqr().add(a.sqr());return o.sqr().add(s.sqr()).cmp(w)>=0&&(o=t,s=r),i.negative&&(i=i.neg(),a=a.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:i,b:a},{a:o,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),s=a.mul(i.a),u=n.mul(r.b),d=a.mul(i.b);return{k1:e.sub(o).sub(s),k2:u.add(d).neg()}},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var a=i.fromRed().isOdd();return(t&&!a||!t&&a)&&(i=i.redNeg()),this.point(e,i)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],u=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),u=u.neg(!0)),i[2*a]=s,i[2*a+1]=u,n[2*a]=o.k1,n[2*a+1]=o.k2}for(var d=this._wnafMulAdd(1,i,n,2*a,r),h=0;h<2*a;h++)i[h]=null,n[h]=null;return d},a(d,o.BasePoint),u.prototype.point=function(e,t,r){return new d(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return d.fromJSON(this,e,t)},d.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},d.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},d.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(n))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(n))}},i},d.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},d.prototype.isInfinity=function(){return this.inf},d.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},d.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),a=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},d.prototype.getX=function(){return this.x.fromRed()},d.prototype.getY=function(){return this.y.fromRed()},d.prototype.mul=function(e){return e=new n(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},d.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},d.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},d.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},d.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},d.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(h,o.BasePoint),u.prototype.jpoint=function(e,t,r){return new h(this,e,t,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),s=i.redSub(n),u=a.redSub(o);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=s.redSqr(),h=d.redMul(s),l=i.redMul(d),f=u.redSqr().redIAdd(h).redISub(l).redISub(l),c=u.redMul(l.redISub(f)).redISub(a.redMul(h)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,c,p)},h.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(i),s=n.redSub(a);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),d=u.redMul(o),h=r.redMul(u),l=s.redSqr().redIAdd(d).redISub(h).redISub(h),f=s.redMul(h.redISub(l)).redISub(n.redMul(d)),c=this.z.redMul(o);return this.curve.jpoint(l,f,c)},h.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,a=this.x,o=this.y,s=this.z,u=s.redSqr().redSqr(),d=o.redAdd(o);for(t=0;t<e;t++){var h=a.redSqr(),l=d.redSqr(),f=l.redSqr(),c=h.redAdd(h).redIAdd(h).redIAdd(i.redMul(u)),p=a.redMul(l),m=c.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),_=c.redMul(g);_=_.redIAdd(_).redISub(f);var y=d.redMul(s);t+1<e&&(u=u.redMul(f)),a=m,s=y,d=_}return this.curve.jpoint(a,d.redMul(n),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i),u=s.redSqr().redISub(o).redISub(o),d=a.redIAdd(a);d=(d=d.redIAdd(d)).redIAdd(d),e=u,t=s.redMul(o.redISub(u)).redISub(d),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),l=this.y.redSqr(),f=l.redSqr(),c=this.x.redAdd(l).redSqr().redISub(h).redISub(f);c=c.redIAdd(c);var p=h.redAdd(h).redIAdd(h),m=p.redSqr(),g=f.redIAdd(f);g=(g=g.redIAdd(g)).redIAdd(g),e=m.redISub(c).redISub(c),t=p.redMul(c.redISub(e)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},h.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),a=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(a);o=o.redIAdd(o);var s=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),u=s.redSqr().redISub(o).redISub(o);e=u;var d=a.redIAdd(a);d=(d=d.redIAdd(d)).redIAdd(d),t=s.redMul(o.redISub(u)).redISub(d),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),l=this.y.redSqr(),f=this.x.redMul(l),c=this.x.redSub(h).redMul(this.x.redAdd(h));c=c.redAdd(c).redIAdd(c);var p=f.redIAdd(f),m=(p=p.redIAdd(p)).redAdd(p);e=c.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(l).redISub(h);var g=l.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),t=c.redMul(p.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,r)},h.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),a=t.redSqr(),o=r.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(n)),u=t.redAdd(t),d=(u=u.redIAdd(u)).redMul(o),h=s.redSqr().redISub(d.redAdd(d)),l=d.redISub(h),f=o.redSqr();f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var c=s.redMul(l).redISub(f),p=r.redAdd(r).redMul(i);return this.curve.jpoint(h,c,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),a=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i),s=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(a)).redSqr(),u=i.redIAdd(i);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var d=n.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(u),h=t.redMul(d);h=(h=h.redIAdd(h)).redIAdd(h);var l=this.x.redMul(s).redISub(h);l=(l=l.redIAdd(l)).redIAdd(l);var f=this.y.redMul(d.redMul(u.redISub(d)).redISub(o.redMul(s)));f=(f=(f=f.redIAdd(f)).redIAdd(f)).redIAdd(f);var c=this.z.redAdd(o).redSqr().redISub(r).redISub(s);return this.curve.jpoint(l,f,c)},h.prototype.mul=function(e,t){return e=new n(e,t),this.curve._wnafMul(this,e)},h.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)},h.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,r){"use strict";var i=r(11),n=r(5),a=r(41),o=r(15);function s(e){a.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(e,t,r){a.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(s,a),e.exports=s,s.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(u,a.BasePoint),s.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},s.prototype.point=function(e,t){return new u(this,e,t)},s.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(e,t){return new u(e,t[0],t[1]||e.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(r),o=n.redMul(i),s=t.z.redMul(a.redAdd(o).redSqr()),u=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var a=n.length-1;a>=0;a--)0===n[a]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,r){"use strict";var i=r(15),n=r(11),a=r(5),o=r(41),s=i.assert;function u(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new n(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function d(e,t,r,i,a){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(t,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=a&&new n(a,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}a(u,o),e.exports=u,u.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},u.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},u.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},u.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),a=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(t&&!u||!t&&u)&&(s=s.redNeg()),this.point(e,s)},u.prototype.pointFromY=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),a=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var s=o.redSqrt();if(0!==s.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},u.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},a(d,o.BasePoint),u.prototype.pointFromJSON=function(e){return d.fromJSON(this,e)},u.prototype.point=function(e,t,r,i){return new d(this,e,t,r,i)},d.fromJSON=function(e,t){return new d(e,t[0],t[1],t[2])},d.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},d.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},d.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),o=a.redSub(r),s=i.redSub(t),u=n.redMul(o),d=a.redMul(s),h=n.redMul(s),l=o.redMul(a);return this.curve.point(u,d,l,h)},d.prototype._projDbl=function(){var e,t,r,i,n,a,o=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var d=(i=this.curve._mulA(s)).redAdd(u);this.zOne?(e=o.redSub(s).redSub(u).redMul(d.redSub(this.curve.two)),t=d.redMul(i.redSub(u)),r=d.redSqr().redSub(d).redSub(d)):(n=this.z.redSqr(),a=d.redSub(n).redISub(n),e=o.redSub(s).redISub(u).redMul(a),t=d.redMul(i.redSub(u)),r=d.redMul(a))}else i=s.redAdd(u),n=this.curve._mulC(this.z).redSqr(),a=i.redSub(n).redSub(n),e=this.curve._mulC(o.redISub(i)).redMul(a),t=this.curve._mulC(i).redMul(s.redISub(u)),r=i.redMul(a);return this.curve.point(e,t,r)},d.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},d.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),a=r.redSub(t),o=n.redSub(i),s=n.redAdd(i),u=r.redAdd(t),d=a.redMul(o),h=s.redMul(u),l=a.redMul(u),f=o.redMul(s);return this.curve.point(d,h,f,l)},d.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),a=this.x.redMul(e.x),o=this.y.redMul(e.y),s=this.curve.d.redMul(a).redMul(o),u=n.redSub(s),d=n.redAdd(s),h=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(o),l=i.redMul(u).redMul(h);return this.curve.twisted?(t=i.redMul(d).redMul(o.redSub(this.curve._mulA(a))),r=u.redMul(d)):(t=i.redMul(d).redMul(o.redSub(a)),r=this.curve._mulC(u).redMul(d)),this.curve.point(l,t,r)},d.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},d.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},d.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},d.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},d.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},d.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},d.prototype.getX=function(){return this.normalize(),this.x.fromRed()},d.prototype.getY=function(){return this.normalize(),this.y.fromRed()},d.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},d.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},d.prototype.toP=d.prototype.normalize,d.prototype.mixedAdd=d.prototype.add},function(e,t,r){"use strict";t.sha1=r(199),t.sha224=r(200),t.sha256=r(111),t.sha384=r(201),t.sha512=r(112)},function(e,t,r){"use strict";var i=r(18),n=r(34),a=r(110),o=i.rotl32,s=i.sum32,u=i.sum32_5,d=a.ft_1,h=n.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function f(){if(!(this instanceof f))return new f;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}i.inherits(f,h),e.exports=f,f.blockSize=512,f.outSize=160,f.hmacStrength=80,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=o(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],a=this.h[1],h=this.h[2],f=this.h[3],c=this.h[4];for(i=0;i<r.length;i++){var p=~~(i/20),m=u(o(n,5),d(p,a,h,f),c,r[i],l[p]);c=f,f=h,h=o(a,30),a=n,n=m}this.h[0]=s(this.h[0],n),this.h[1]=s(this.h[1],a),this.h[2]=s(this.h[2],h),this.h[3]=s(this.h[3],f),this.h[4]=s(this.h[4],c)},f.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},function(e,t,r){"use strict";var i=r(18),n=r(111);function a(){if(!(this instanceof a))return new a;n.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}i.inherits(a,n),e.exports=a,a.blockSize=512,a.outSize=224,a.hmacStrength=192,a.padLength=64,a.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},function(e,t,r){"use strict";var i=r(18),n=r(112);function a(){if(!(this instanceof a))return new a;n.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}i.inherits(a,n),e.exports=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},function(e,t,r){"use strict";var i=r(18),n=r(34),a=i.rotl32,o=i.sum32,s=i.sum32_3,u=i.sum32_4,d=n.BlockHash;function h(){if(!(this instanceof h))return new h;d.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function f(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function c(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}i.inherits(h,d),t.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],d=this.h[3],h=this.h[4],y=r,b=i,v=n,w=d,E=h,A=0;A<80;A++){var S=o(a(u(r,l(A,i,n,d),e[p[A]+t],f(A)),g[A]),h);r=h,h=d,d=a(n,10),n=i,i=S,S=o(a(u(y,l(79-A,b,v,w),e[m[A]+t],c(A)),_[A]),E),y=E,E=w,w=a(v,10),v=b,b=S}S=s(this.h[1],n,w),this.h[1]=s(this.h[2],d,E),this.h[2]=s(this.h[3],h,y),this.h[3]=s(this.h[4],r,b),this.h[4]=s(this.h[0],i,v),this.h[0]=S},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],_=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(e,t,r){"use strict";var i=r(18),n=r(14);function a(e,t,r){if(!(this instanceof a))return new a(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}e.exports=a,a.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},a.prototype.update=function(e,t){return this.inner.update(e,t),this},a.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},function(e,t){e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(e,t,r){"use strict";var i=r(11),n=r(206),a=r(15),o=r(60),s=r(56),u=a.assert,d=r(207),h=r(208);function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=l,l.prototype.keyPair=function(e){return new d(this,e)},l.prototype.keyFromPrivate=function(e,t){return d.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return d.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),a=this.n.sub(new i(2));;){var o=new i(t.generate(r));if(!(o.cmp(a)>0))return o.iaddn(1),this.keyFromPrivate(o)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(e,t,r,a){"object"==typeof r&&(a=r,r=null),a||(a={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new i(e,16));for(var o=this.n.byteLength(),s=t.getPrivate().toArray("be",o),u=e.toArray("be",o),d=new n({hash:this.hash,entropy:s,nonce:u,pers:a.pers,persEnc:a.persEnc||"utf8"}),l=this.n.sub(new i(1)),f=0;;f++){var c=a.k?a.k(f):new i(d.generate(this.n.byteLength()));if(!((c=this._truncateToN(c,!0)).cmpn(1)<=0||c.cmp(l)>=0)){var p=this.g.mul(c);if(!p.isInfinity()){var m=p.getX(),g=m.umod(this.n);if(0!==g.cmpn(0)){var _=c.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(_=_.umod(this.n)).cmpn(0)){var y=(p.getY().isOdd()?1:0)|(0!==m.cmp(g)?2:0);return a.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),y^=1),new h({r:g,s:_,recoveryParam:y})}}}}}},l.prototype.verify=function(e,t,r,n){e=this._truncateToN(new i(e,16)),r=this.keyFromPublic(r,n);var a=(t=new h(t,"hex")).r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s,u=o.invm(this.n),d=u.mul(e).umod(this.n),l=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(d,r.getPublic(),l)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(d,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},l.prototype.recoverPubKey=function(e,t,r,n){u((3&r)===r,"The recovery param is more than two bits"),t=new h(t,n);var a=this.n,o=new i(e),s=t.r,d=t.s,l=1&r,f=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");s=f?this.curve.pointFromX(s.add(this.curve.n),l):this.curve.pointFromX(s,l);var c=t.r.invm(a),p=a.sub(o).mul(c).umod(a),m=d.mul(c).umod(a);return this.g.mulAdd(p,s,m)},l.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new h(t,i)).recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var a;try{a=this.recoverPubKey(e,t,n)}catch(e){continue}if(a.eq(r))return n}throw new Error("Unable to find valid recovery factor")}},function(e,t,r){"use strict";var i=r(61),n=r(108),a=r(14);function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");a(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=o,o.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},o.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},o.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=n.toArray(e,t),r=n.toArray(r,i),a(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var o=a.slice(0,e);return this._update(r),this._reseed++,n.encode(o,t)}},function(e,t,r){"use strict";var i=r(11),n=r(15).assert;function a(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=a,a.fromPublic=function(e,t,r){return t instanceof a?t:new a(e,{pub:t,pubEnc:r})},a.fromPrivate=function(e,t,r){return t instanceof a?t:new a(e,{priv:t,privEnc:r})},a.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},a.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},a.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},a.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},a.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||n(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},a.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},a.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},a.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},a.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(e,t,r){"use strict";var i=r(11),n=r(15),a=n.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(a(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4)return!1;for(var n=0,a=0,o=t.place;a<i;a++,o++)n<<=8,n|=e[o],n>>>=0;return!(n<=127)&&(t.place=o,n)}function d(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function h(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=o,o.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var a=u(e,r);if(!1===a)return!1;if(a+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;var d=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var h=u(e,r);if(!1===h)return!1;if(e.length!==h+r.place)return!1;var l=e.slice(r.place,h+r.place);if(0===d[0]){if(!(128&d[1]))return!1;d=d.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new i(d),this.s=new i(l),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=d(t),r=d(r);!(r[0]||128&r[1]);)r=r.slice(1);var i=[2];h(i,t.length),(i=i.concat(t)).push(2),h(i,r.length);var a=i.concat(r),o=[48];return h(o,a.length),o=o.concat(a),n.encode(o,e)}},function(e,t,r){"use strict";var i=r(61),n=r(60),a=r(15),o=a.assert,s=a.parseBytes,u=r(210),d=r(211);function h(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof h))return new h(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=h,h.prototype.sign=function(e,t){e=s(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),a=this.encodePoint(n),o=this.hashInt(a,r.pubBytes(),e).mul(r.priv()),u=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:u,Rencoded:a})},h.prototype.verify=function(e,t,r){e=s(e),t=this.makeSignature(t);var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(a)},h.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return a.intFromLE(e.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(e){return u.fromPublic(this,e)},h.prototype.keyFromSecret=function(e){return u.fromSecret(this,e)},h.prototype.makeSignature=function(e){return e instanceof d?e:new d(this,e)},h.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},h.prototype.decodePoint=function(e){var t=(e=a.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=0!=(128&e[t]),n=a.intFromLE(r);return this.curve.pointFromY(n,i)},h.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(e){return a.intFromLE(e)},h.prototype.isPoint=function(e){return e instanceof this.pointClass}},function(e,t,r){"use strict";var i=r(15),n=i.assert,a=i.parseBytes,o=i.cachedProperty;function s(e,t){this.eddsa=e,this._secret=a(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=a(t.pub)}s.fromPublic=function(e,t){return t instanceof s?t:new s(e,{pub:t})},s.fromSecret=function(e,t){return t instanceof s?t:new s(e,{secret:t})},s.prototype.secret=function(){return this._secret},o(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),o(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),o(s,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i})),o(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),o(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),o(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(e){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},s.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},s.prototype.getSecret=function(e){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},s.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=s},function(e,t,r){"use strict";var i=r(11),n=r(15),a=n.assert,o=n.cachedProperty,s=n.parseBytes;function u(e,t){this.eddsa=e,"object"!=typeof t&&(t=s(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),a(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}o(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),o(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),o(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),o(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},e.exports=u},function(e,t){},function(e,t,r){"use strict";var i=r(114);t.certificate=r(219);var n=i.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));t.RSAPrivateKey=n;var a=i.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));t.RSAPublicKey=a;var o=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));t.PublicKey=o;var s=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),u=i.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));t.PrivateKey=u;var d=i.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));t.EncryptedPrivateKey=d;var h=i.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));t.DSAPrivateKey=h,t.DSAparam=i.define("DSAparam",(function(){this.int()}));var l=i.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(f),this.key("publicKey").optional().explicit(1).bitstr())}));t.ECPrivateKey=l;var f=i.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));t.signature=i.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(e,t,r){"use strict";var i=r(115),n=r(117),a=r(5);function o(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new o(e,t)},o.prototype._createNamed=function(e){var t=this.name;function r(e){this._initNamed(e,t)}return a(r,e),r.prototype._initNamed=function(t,r){e.call(this,t,r)},new r(this)},o.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n[e])),this.decoders[e]},o.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},o.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(i[e])),this.encoders[e]},o.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},function(e,t,r){"use strict";var i=r(5),n=r(116);function a(e){n.call(this,e),this.enc="pem"}i(a,n),e.exports=a,a.prototype.encode=function(e,t){for(var r=n.prototype.encode.call(this,e).toString("base64"),i=["-----BEGIN "+t.label+"-----"],a=0;a<r.length;a+=64)i.push(r.slice(a,a+64));return i.push("-----END "+t.label+"-----"),i.join("\n")}},function(e,t,r){"use strict";var i=r(5),n=r(62).Buffer,a=r(118);function o(e){a.call(this,e),this.enc="pem"}i(o,a),e.exports=o,o.prototype.decode=function(e,t){for(var r=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,u=-1,d=0;d<r.length;d++){var h=r[d].match(o);if(null!==h&&h[2]===i){if(-1!==s){if("END"!==h[1])break;u=d;break}if("BEGIN"!==h[1])break;s=d}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+i);var l=r.slice(s+1,u).join("");l.replace(/[^a-z0-9+/=]+/gi,"");var f=n.from(l,"base64");return a.prototype.decode.call(this,f,t)}},function(e,t,r){"use strict";var i=t;i.Reporter=r(64).Reporter,i.DecoderBuffer=r(35).DecoderBuffer,i.EncoderBuffer=r(35).EncoderBuffer,i.Node=r(63)},function(e,t,r){"use strict";var i=t;i._reverse=function(e){var t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);var i=e[r];t[i]=r})),t},i.der=r(65)},function(e,t,r){"use strict";var i=r(114),n=i.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),a=i.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),o=i.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),s=i.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())})),u=i.define("RelativeDistinguishedName",(function(){this.setof(a)})),d=i.define("RDNSequence",(function(){this.seqof(u)})),h=i.define("Name",(function(){this.choice({rdnSequence:this.use(d)})})),l=i.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(n),this.key("notAfter").use(n))})),f=i.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),c=i.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(o),this.key("issuer").use(h),this.key("validity").use(l),this.key("subject").use(h),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(f).optional())})),p=i.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(c),this.key("signatureAlgorithm").use(o),this.key("signatureValue").bitstr())}));e.exports=p},function(e){e.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')},function(e,t,r){var i=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,n=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,a=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,o=r(40),s=r(53),u=r(6).Buffer;e.exports=function(e,t){var r,d=e.toString(),h=d.match(i);if(h){var l="aes"+h[1],f=u.from(h[2],"hex"),c=u.from(h[3].replace(/[\r\n]/g,""),"base64"),p=o(t,f.slice(0,8),parseInt(h[1],10)).key,m=[],g=s.createDecipheriv(l,p,f);m.push(g.update(c)),m.push(g.final()),r=u.concat(m)}else{var _=d.match(a);r=u.from(_[2].replace(/[\r\n]/g,""),"base64")}return{tag:d.match(n)[1],data:r}}},function(e,t,r){var i=r(6).Buffer,n=r(113),a=r(59).ec,o=r(42),s=r(119);function u(e,t){if(e.cmpn(0)<=0)throw new Error("invalid sig");if(e.cmp(t)>=t)throw new Error("invalid sig")}e.exports=function(e,t,r,d,h){var l=o(r);if("ec"===l.type){if("ecdsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");return function(e,t,r){var i=s[r.data.algorithm.curve.join(".")];if(!i)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var n=new a(i),o=r.data.subjectPrivateKey.data;return n.verify(t,e,o)}(e,t,l)}if("dsa"===l.type){if("dsa"!==d)throw new Error("wrong public key type");return function(e,t,r){var i=r.data.p,a=r.data.q,s=r.data.g,d=r.data.pub_key,h=o.signature.decode(e,"der"),l=h.s,f=h.r;u(l,a),u(f,a);var c=n.mont(i),p=l.invm(a);return 0===s.toRed(c).redPow(new n(t).mul(p).mod(a)).fromRed().mul(d.toRed(c).redPow(f.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(f)}(e,t,l)}if("rsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");t=i.concat([h,t]);for(var f=l.modulus.byteLength(),c=[1],p=0;t.length+c.length+2<f;)c.push(255),p++;c.push(0);for(var m=-1;++m<t.length;)c.push(t[m]);c=i.from(c);var g=n.mont(l.modulus);e=(e=new n(e).toRed(g)).redPow(new n(l.publicExponent)),e=i.from(e.fromRed().toArray());var _=p<8?1:0;for(f=Math.min(e.length,c.length),e.length!==c.length&&(_=1),m=-1;++m<f;)_|=e[m]^c[m];return 0===_}},function(e,t,r){(function(t){var i=r(59),n=r(11);e.exports=function(e){return new o(e)};var a={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function o(e){this.curveType=a[e],this.curveType||(this.curveType={name:e}),this.curve=new i.ec(this.curveType.name),this.keys=void 0}function s(e,r,i){Array.isArray(e)||(e=e.toArray());var n=new t(e);if(i&&n.length<i){var a=new t(i-n.length);a.fill(0),n=t.concat([a,n])}return r?n.toString(r):n}a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1,o.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},o.prototype.computeSecret=function(e,r,i){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),i,this.curveType.byteLength)},o.prototype.getPublicKey=function(e,t){var r=this.keys.getPublic("compressed"===t,!0);return"hybrid"===t&&(r[r.length-1]%2?r[0]=7:r[0]=6),s(r,e)},o.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},o.prototype.setPublicKey=function(e,r){return r=r||"utf8",t.isBuffer(e)||(e=new t(e,r)),this.keys._importPublic(e),this},o.prototype.setPrivateKey=function(e,r){r=r||"utf8",t.isBuffer(e)||(e=new t(e,r));var i=new n(e);return i=i.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(i),this}}).call(this,r(10).Buffer)},function(e,t,r){t.publicEncrypt=r(225),t.privateDecrypt=r(226),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}},function(e,t,r){var i=r(42),n=r(24),a=r(31),o=r(120),s=r(121),u=r(11),d=r(122),h=r(58),l=r(6).Buffer;e.exports=function(e,t,r){var f;f=e.padding?e.padding:r?1:4;var c,p=i(e);if(4===f)c=function(e,t){var r=e.modulus.byteLength(),i=t.length,d=a("sha1").update(l.alloc(0)).digest(),h=d.length,f=2*h;if(i>r-f-2)throw new Error("message too long");var c=l.alloc(r-i-f-2),p=r-h-1,m=n(h),g=s(l.concat([d,c,l.alloc(1,1),t],p),o(m,p)),_=s(m,o(g,h));return new u(l.concat([l.alloc(1),_,g],r))}(p,t);else if(1===f)c=function(e,t,r){var i,a=t.length,o=e.modulus.byteLength();if(a>o-11)throw new Error("message too long");i=r?l.alloc(o-a-3,255):function(e){var t,r=l.allocUnsafe(e),i=0,a=n(2*e),o=0;for(;i<e;)o===a.length&&(a=n(2*e),o=0),(t=a[o++])&&(r[i++]=t);return r}(o-a-3);return new u(l.concat([l.from([0,r?1:2]),i,l.alloc(1),t],o))}(p,t,r);else{if(3!==f)throw new Error("unknown padding");if((c=new u(t)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return r?h(c,p):d(c,p)}},function(e,t,r){var i=r(42),n=r(120),a=r(121),o=r(11),s=r(58),u=r(31),d=r(122),h=r(6).Buffer;e.exports=function(e,t,r){var l;l=e.padding?e.padding:r?1:4;var f,c=i(e),p=c.modulus.byteLength();if(t.length>p||new o(t).cmp(c.modulus)>=0)throw new Error("decryption error");f=r?d(new o(t),c):s(t,c);var m=h.alloc(p-f.length);if(f=h.concat([m,f],p),4===l)return function(e,t){var r=e.modulus.byteLength(),i=u("sha1").update(h.alloc(0)).digest(),o=i.length;if(0!==t[0])throw new Error("decryption error");var s=t.slice(1,o+1),d=t.slice(o+1),l=a(s,n(d,o)),f=a(d,n(l,r-o-1));if(function(e,t){e=h.from(e),t=h.from(t);var r=0,i=e.length;e.length!==t.length&&(r++,i=Math.min(e.length,t.length));var n=-1;for(;++n<i;)r+=e[n]^t[n];return r}(i,f.slice(0,o)))throw new Error("decryption error");var c=o;for(;0===f[c];)c++;if(1!==f[c++])throw new Error("decryption error");return f.slice(c)}(c,f);if(1===l)return function(e,t,r){var i=t.slice(0,2),n=2,a=0;for(;0!==t[n++];)if(n>=t.length){a++;break}var o=t.slice(2,n-1);("0002"!==i.toString("hex")&&!r||"0001"!==i.toString("hex")&&r)&&a++;o.length<8&&a++;if(a)throw new Error("decryption error");return t.slice(n)}(0,f,r);if(3===l)return f;throw new Error("unknown padding")}},function(e,t,r){"use strict";(function(e,i){function n(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var a=r(6),o=r(24),s=a.Buffer,u=a.kMaxLength,d=e.crypto||e.msCrypto,h=Math.pow(2,32)-1;function l(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>h||e<0)throw new TypeError("offset must be a uint32");if(e>u||e>t)throw new RangeError("offset out of range")}function f(e,t,r){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>h||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>u)throw new RangeError("buffer too small")}function c(e,t,r,n){if(i.browser){var a=e.buffer,s=new Uint8Array(a,t,r);return d.getRandomValues(s),n?void i.nextTick((function(){n(null,e)})):e}if(!n)return o(r).copy(e,t),e;o(r,(function(r,i){if(r)return n(r);i.copy(e,t),n(null,e)}))}d&&d.getRandomValues||!i.browser?(t.randomFill=function(t,r,i,n){if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof r)n=r,r=0,i=t.length;else if("function"==typeof i)n=i,i=t.length-r;else if("function"!=typeof n)throw new TypeError('"cb" argument must be a function');return l(r,t.length),f(i,r,t.length),c(t,r,i,n)},t.randomFillSync=function(t,r,i){void 0===r&&(r=0);if(!(s.isBuffer(t)||t instanceof e.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');l(r,t.length),void 0===i&&(i=t.length-r);return f(i,r,t.length),c(t,r,i)}):(t.randomFill=n,t.randomFillSync=n)}).call(this,r(13),r(9))},function(e,t,r){"use strict";r.r(t);r(0);var i=r(19),n=r(43),a=r(36),o=r(2);t.default=function(e){var t=null,r=function(t,r){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:r}})}.bind(this);function s(t,r){var i={msg:o.a.INIT_SEGMENT,data:{type:t,data:r}};e.postMessage(i,[r.data])}function u(t,r){var i={msg:o.a.MEDIA_SEGMENT,data:{type:t,data:r}};e.postMessage(i,[r.data])}function d(){var t={msg:o.a.LOADING_COMPLETE};e.postMessage(t)}function h(){var t={msg:o.a.RECOVERED_EARLY_EOF};e.postMessage(t)}function l(t){var r={msg:o.a.MEDIA_INFO,data:t};e.postMessage(r)}function f(t){var r={msg:o.a.METADATA_ARRIVED,data:t};e.postMessage(r)}function c(t){var r={msg:o.a.SCRIPTDATA_ARRIVED,data:t};e.postMessage(r)}function p(t){var r={msg:o.a.STATISTICS_INFO,data:t};e.postMessage(r)}function m(t,r){e.postMessage({msg:o.a.IO_ERROR,data:{type:t,info:r}})}function g(t,r){e.postMessage({msg:o.a.DEMUX_ERROR,data:{type:t,info:r}})}function _(t){e.postMessage({msg:o.a.RECOMMEND_SEEKPOINT,data:t})}n.a.install(),e.addEventListener("message",(function(n){switch(n.data.cmd){case"init":(t=new a.a(n.data.param[0],n.data.param[1])).on(o.a.IO_ERROR,m.bind(this)),t.on(o.a.DEMUX_ERROR,g.bind(this)),t.on(o.a.INIT_SEGMENT,s.bind(this)),t.on(o.a.MEDIA_SEGMENT,u.bind(this)),t.on(o.a.LOADING_COMPLETE,d.bind(this)),t.on(o.a.RECOVERED_EARLY_EOF,h.bind(this)),t.on(o.a.MEDIA_INFO,l.bind(this)),t.on(o.a.METADATA_ARRIVED,f.bind(this)),t.on(o.a.SCRIPTDATA_ARRIVED,c.bind(this)),t.on(o.a.STATISTICS_INFO,p.bind(this)),t.on(o.a.RECOMMEND_SEEKPOINT,_.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(n.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var y=n.data.param;i.a.applyConfig(y),!0===y.enableCallback?i.a.addLogListener(r):i.a.removeLogListener(r)}}))}},function(e,t,r){"use strict";r.r(t),function(e,i,n,a){r.d(t,"EasyPlayerWasmModule",(function(){return c})),r.d(t,"EasyLoadWasmModule",(function(){return p})),r.d(t,"EasyModuleInitialized",(function(){return m}));var o,s=r(1),u=!1,d="",h=void 0!==h?h:{};function l(){var t,s={};for(t in h)h.hasOwnProperty(t)&&(s[t]=h[t]);var u=[],l="./this.program",f=function(e,t){throw t},c=!1,p=!1,m=!1,g=!1,_=!1;if(c="object"==typeof window,p="function"==typeof importScripts,g="object"==typeof e&&"object"==typeof e.versions&&"string"==typeof e.versions.node,m=g&&!c&&!p,_=!c&&!m&&!p,h.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var y,b,v,w,E="";function A(e){return h.locateFile?h.locateFile(e,E):E+e}if(m)E=i+"/",y=function(e,t){var i;return v||(v=r(69)),w||(w=r(70)),e=w.normalize(e),i=v.readFileSync(e),t?i:i.toString()},b=function(e){var t=y(e,!0);return t.buffer||(t=new Uint8Array(t)),N(t.buffer),t},e.argv.length>1&&(l=e.argv[1].replace(/\\/g,"/")),u=e.argv.slice(2),n.exports=h,e.on("uncaughtException",(function(e){if(!(e instanceof ei))throw e})),e.on("unhandledRejection",Le),f=function(t){e.exit(t)},h.inspect=function(){return"[Emscripten Module object]"};else if(_)"undefined"!=typeof read&&(y=function(e){return read(e)}),b=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(N("object"==typeof(t=read(e,"binary"))),t)},"undefined"!=typeof scriptArgs?u=scriptArgs:void 0!==arguments&&(u=arguments),"function"==typeof quit&&(f=function(e){quit(e)}),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print);else{if(!c&&!p)throw new Error("environment detection error");p?E=self.location.href:document.currentScript&&(E=document.currentScript.src),E=0!==E.indexOf("blob:")?E.substr(0,E.lastIndexOf("/")+1):"",y=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},p&&(b=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),function(e,t,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)},function(e){document.title=e}}var S=h.print||console.log.bind(console),M=h.printErr||console.warn.bind(console);for(t in s)s.hasOwnProperty(t)&&(h[t]=s[t]);function T(e){T.shown||(T.shown={}),T.shown[e]||(T.shown[e]=1,M(e))}function R(e,t){var r=[1,0,1,96],i=t.slice(0,1),n=t.slice(1),a={i:127,j:126,f:125,d:124};r.push(n.length);for(var o=0;o<n.length;++o)r.push(a[n[o]]);"v"==i?r.push(0):r=r.concat([1,a[i]]),r[1]=r.length-2;var s=new Uint8Array([0,97,115,109,1,0,0,0].concat(r,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0])),u=new WebAssembly.Module(s);return new WebAssembly.Instance(u,{e:{f:e}}).exports.f}function k(e,t){var r=C,i=r.length;try{r.grow(1)}catch(e){if(!e instanceof RangeError)throw e;throw"Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."}try{r.set(i,e)}catch(a){if(!a instanceof TypeError)throw a;N(void 0!==t,"Missing signature argument to addFunction");var n=R(e,t);r.set(i,n)}return i}function I(e,t){return N(void 0!==e),k(e,t)}s=null,h.arguments&&(u=h.arguments),Object.getOwnPropertyDescriptor(h,"arguments")||Object.defineProperty(h,"arguments",{configurable:!0,get:function(){Le("Module.arguments has been replaced with plain arguments_")}}),h.thisProgram&&(l=h.thisProgram),Object.getOwnPropertyDescriptor(h,"thisProgram")||Object.defineProperty(h,"thisProgram",{configurable:!0,get:function(){Le("Module.thisProgram has been replaced with plain thisProgram")}}),h.quit&&(f=h.quit),Object.getOwnPropertyDescriptor(h,"quit")||Object.defineProperty(h,"quit",{configurable:!0,get:function(){Le("Module.quit has been replaced with plain quit_")}}),N(void 0===h.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),N(void 0===h.read,"Module.read option was removed (modify read_ in JS)"),N(void 0===h.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),N(void 0===h.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),N(void 0===h.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),Object.getOwnPropertyDescriptor(h,"read")||Object.defineProperty(h,"read",{configurable:!0,get:function(){Le("Module.read has been replaced with plain read_")}}),Object.getOwnPropertyDescriptor(h,"readAsync")||Object.defineProperty(h,"readAsync",{configurable:!0,get:function(){Le("Module.readAsync has been replaced with plain readAsync")}}),Object.getOwnPropertyDescriptor(h,"readBinary")||Object.defineProperty(h,"readBinary",{configurable:!0,get:function(){Le("Module.readBinary has been replaced with plain readBinary")}}),Jr=$r=Zr=function(){Le("cannot use the stack before compiled code is ready to run, and has provided stack access")};var O,D,x=function(e){e};h.wasmBinary&&(O=h.wasmBinary),Object.getOwnPropertyDescriptor(h,"wasmBinary")||Object.defineProperty(h,"wasmBinary",{configurable:!0,get:function(){Le("Module.wasmBinary has been replaced with plain wasmBinary")}}),h.noExitRuntime&&(o=h.noExitRuntime),Object.getOwnPropertyDescriptor(h,"noExitRuntime")||Object.defineProperty(h,"noExitRuntime",{configurable:!0,get:function(){Le("Module.noExitRuntime has been replaced with plain noExitRuntime")}}),"object"!=typeof WebAssembly&&Le("No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.");var C=new WebAssembly.Table({initial:2542,maximum:2552,element:"anyfunc"}),P=!1;function N(e,t){e||Le("Assertion failed: "+t)}function L(e){var t=h["_"+e];return N(t,"Cannot call unknown function "+e+", make sure it is exported"),t}function B(e,t,r,i,n){var a={string:function(e){var t=0;if(null!=e&&0!==e){var r=1+(e.length<<2);W(e,t=Zr(r),r)}return t},array:function(e){var t=Zr(e.length);return z(e,t),t}};var o=L(e),s=[],u=0;if(N("array"!==t,'Return type should not be "array".'),i)for(var d=0;d<i.length;d++){var h=a[r[d]];h?(0===u&&(u=Jr()),s[d]=h(i[d])):s[d]=i[d]}var l=o.apply(null,s);return l=function(e){return"string"===t?H(e):"boolean"===t?Boolean(e):e}(l),0!==u&&$r(u),l}function F(e,t,r,i){return function(){return B(e,t,r,arguments)}}var U="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function j(e,t,r){for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.subarray&&U)return U.decode(e.subarray(t,n));for(var a="";t<n;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if(224==(240&o)?o=(15&o)<<12|s<<6|u:(240!=(248&o)&&T("Invalid UTF-8 leading byte 0x"+o.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),o=(7&o)<<18|s<<12|u<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var d=o-65536;a+=String.fromCharCode(55296|d>>10,56320|1023&d)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}function H(e,t){return e?j(Y,e,t):""}function X(e,t,r,i){if(!(i>0))return 0;for(var n=r,a=r+i-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o);if(s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;s>=2097152&&T("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."),t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-n}function W(e,t,r){return N("number"==typeof r,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),X(e,Y,t,r)}function V(e){for(var t=0,r=0;r<e.length;++r){var i=e.charCodeAt(r);i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++r)),i<=127?++t:t+=i<=2047?2:i<=65535?3:4}return t}"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");function z(e,t){N(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),Q.set(e,t)}function q(e,t,r){for(var i=0;i<e.length;++i)N(e.charCodeAt(i)==e.charCodeAt(i)&255),Q[t++>>0]=e.charCodeAt(i);r||(Q[t>>0]=0)}var G,Q,Y,K,J,Z,$=65536;function ee(e,t){return e%t>0&&(e+=t-e%t),e}function te(e){G=e,h.HEAP8=Q=new Int8Array(e),h.HEAP16=K=new Int16Array(e),h.HEAP32=J=new Int32Array(e),h.HEAPU8=Y=new Uint8Array(e),h.HEAPU16=new Uint16Array(e),h.HEAPU32=Z=new Uint32Array(e),h.HEAPF32=new Float32Array(e),h.HEAPF64=new Float64Array(e)}var re=6584208,ie=1341328,ne=6584208,ae=1341168;N(re%16==0,"stack must start aligned"),N(ne%16==0,"heap must start aligned");var oe=5242880;h.TOTAL_STACK&&N(oe===h.TOTAL_STACK,"the stack size can no longer be determined at runtime");var se=h.TOTAL_MEMORY||67108864;function ue(){N(0==(3&ie)),Z[1+(ie>>2)]=34821223,Z[2+(ie>>2)]=2310721022,J[0]=1668509029}function de(){var e=Z[1+(ie>>2)],t=Z[2+(ie>>2)];34821223==e&&2310721022==t||Le("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x"+t.toString(16)+" "+e.toString(16)),1668509029!==J[0]&&Le("Runtime error: The application has corrupted its heap memory area (address zero)!")}function he(e){Le("Stack overflow! Attempted to allocate "+e+" bytes on the stack, but stack has only "+(ie-Jr()+e)+" bytes available!")}function le(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?h.dynCall_v(r):h.dynCall_vi(r,t.arg):r(void 0===t.arg?null:t.arg)}else t()}}Object.getOwnPropertyDescriptor(h,"TOTAL_MEMORY")||Object.defineProperty(h,"TOTAL_MEMORY",{configurable:!0,get:function(){Le("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY")}}),N(se>=oe,"TOTAL_MEMORY should be larger than TOTAL_STACK, was "+se+"! (TOTAL_STACK="+oe+")"),N("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&void 0!==Int32Array.prototype.subarray&&void 0!==Int32Array.prototype.set,"JS engine does not provide full typed array support"),(D=h.wasmMemory?h.wasmMemory:new WebAssembly.Memory({initial:se/$}))&&(G=D.buffer),N((se=G.byteLength)%$==0),te(G),J[ae>>2]=ne,function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian!"}();var fe=[],ce=[],pe=[],me=[],ge=!1,_e=!1;function ye(){if(h.preRun)for("function"==typeof h.preRun&&(h.preRun=[h.preRun]);h.preRun.length;)Ae(h.preRun.shift());le(fe)}function be(){de(),N(!ge),ge=!0,h.noFSInit||ot.init.initialized||ot.init(),rt.init(),le(ce)}function ve(){de(),ot.ignorePermissions=!1,le(pe)}function we(){de(),_e=!0}function Ee(){if(de(),h.postRun)for("function"==typeof h.postRun&&(h.postRun=[h.postRun]);h.postRun.length;)Se(h.postRun.shift());le(me)}function Ae(e){fe.unshift(e)}function Se(e){me.unshift(e)}N(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),N(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var Me=Math.abs,Te=Math.ceil,Re=Math.floor,ke=Math.min,Ie=0,Oe=null,De=null,xe={};function Ce(e){for(var t=e;;){if(!xe[e])return e;e=t+Math.random()}return e}function Pe(e){Ie++,h.monitorRunDependencies&&h.monitorRunDependencies(Ie),e?(N(!xe[e]),xe[e]=1,null===Oe&&"undefined"!=typeof setInterval&&(Oe=setInterval((function(){if(P)return clearInterval(Oe),void(Oe=null);var e=!1;for(var t in xe)e||(e=!0,M("still waiting on run dependencies:")),M("dependency: "+t);e&&M("(end of list)")}),1e4))):M("warning: run dependency added without ID")}function Ne(e){if(Ie--,h.monitorRunDependencies&&h.monitorRunDependencies(Ie),e?(N(xe[e]),delete xe[e]):M("warning: run dependency removed without ID"),0==Ie&&(null!==Oe&&(clearInterval(Oe),Oe=null),De)){var t=De;De=null,t()}}function Le(e){throw h.onAbort&&h.onAbort(e),S(e+=""),M(e),P=!0,1,e="abort("+e+") at "+Qe(),new WebAssembly.RuntimeError(e)}h.preloadedImages={},h.preloadedAudios={};var Be="data:application/octet-stream;base64,";function Fe(e){return String.prototype.startsWith?e.startsWith(Be):0===e.indexOf(Be)}var Ue,je,He=d+"EasyPlayer.wasm";function Xe(){try{if(O)return new Uint8Array(O);if(b)return b(He);throw"both async and sync fetching of the wasm failed"}catch(e){Le(e)}}function We(){return O||!c&&!p||"function"!=typeof fetch?new Promise((function(e,t){e(Xe())})):fetch(He,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+He+"'";return e.arrayBuffer()})).catch((function(){return Xe()}))}function Ve(){var e={env:Dt,wasi_unstable:Dt};function t(e,t){var r=e.exports;h.asm=r,Ne("wasm-instantiate")}Pe("wasm-instantiate");var r=h;function i(e){N(h===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(e.instance)}function n(t){return We().then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){M("failed to asynchronously prepare wasm: "+e),Le(e)}))}if(h.instantiateWasm)try{return h.instantiateWasm(e,t)}catch(e){return M("Module.instantiateWasm callback failed with error: "+e),!1}return function(){if(O||"function"!=typeof WebAssembly.instantiateStreaming||Fe(He)||"function"!=typeof fetch)return n(i);fetch(He,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(i,(function(e){M("wasm streaming compile failed: "+e),M("falling back to ArrayBuffer instantiation"),n(i)}))}))}(),{}}function ze(e){return T("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function qe(e){return e.replace(/\b_Z[\w\d_]+/g,(function(e){var t=ze(e);return e===t?e:t+" ["+e+"]"}))}function Ge(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function Qe(){var e=Ge();return h.extraStackTrace&&(e+="\n"+h.extraStackTrace()),qe(e)}function Ye(e){return Yr(e)}Fe(He)||(He=A(He)),ce.push({func:function(){Qr()}});var Ke={};function Je(e,t,r){throw Ke[e]={ptr:e,adjusted:[e],type:t,destructor:r,refcount:0,caught:!1,rethrown:!1},e,"uncaught_exception"in Kr?Kr.uncaught_exceptions++:Kr.uncaught_exceptions=1,e+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function Ze(){}function $e(e){return h.___errno_location?J[h.___errno_location()>>2]=e:M("failed to set errno from JS"),e}var et={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,t){for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:function(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=et.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=et.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:function(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)},extname:function(e){return et.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return et.normalize(e.join("/"))},join2:function(e,t){return et.normalize(e+"/"+t)}},tt={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ot.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t="/"===i.charAt(0)}return(t?"/":"")+(e=et.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||"."},relative:function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=tt.resolve(e).substr(1),t=tt.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),a=Math.min(i.length,n.length),o=a,s=0;s<a;s++)if(i[s]!==n[s]){o=s;break}var u=[];for(s=o;s<i.length;s++)u.push("..");return(u=u.concat(n.slice(o))).join("/")}},rt={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){rt.ttys[e]={input:[],output:[],ops:t},ot.registerDevice(e,rt.stream_ops)},stream_ops:{open:function(e){var t=rt.ttys[e.node.rdev];if(!t)throw new ot.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ot.ErrnoError(60);for(var a=0,o=0;o<i;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new ot.ErrnoError(29)}if(void 0===s&&0===a)throw new ot.ErrnoError(6);if(null==s)break;a++,t[r+o]=s}return a&&(e.node.timestamp=Date.now()),a},write:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.put_char)throw new ot.ErrnoError(60);try{for(var a=0;a<i;a++)e.tty.ops.put_char(e.tty,t[r+a])}catch(e){throw new ot.ErrnoError(29)}return i&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:function(t){if(!t.input.length){var r=null;if(m){var i=a.alloc?a.alloc(256):new a(256),n=0;try{n=v.readSync(e.stdin.fd,i,0,256,null)}catch(e){if(-1==e.toString().indexOf("EOF"))throw e;n=0}r=n>0?i.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&null!==(r=readline())&&(r+="\n");if(!r)return null;t.input=Ot(r,!0)}return t.input.shift()},put_char:function(e,t){null===t||10===t?(S(j(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(S(j(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(M(j(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(M(j(e.output,0)),e.output=[])}}},it={ops_table:null,mount:function(e){return it.createNode(null,"/",16895,0)},createNode:function(e,t,r,i){if(ot.isBlkdev(r)||ot.isFIFO(r))throw new ot.ErrnoError(63);it.ops_table||(it.ops_table={dir:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr,lookup:it.node_ops.lookup,mknod:it.node_ops.mknod,rename:it.node_ops.rename,unlink:it.node_ops.unlink,rmdir:it.node_ops.rmdir,readdir:it.node_ops.readdir,symlink:it.node_ops.symlink},stream:{llseek:it.stream_ops.llseek}},file:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr},stream:{llseek:it.stream_ops.llseek,read:it.stream_ops.read,write:it.stream_ops.write,allocate:it.stream_ops.allocate,mmap:it.stream_ops.mmap,msync:it.stream_ops.msync}},link:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr,readlink:it.node_ops.readlink},stream:{}},chrdev:{node:{getattr:it.node_ops.getattr,setattr:it.node_ops.setattr},stream:ot.chrdev_stream_ops}});var n=ot.createNode(e,t,r,i);return ot.isDir(n.mode)?(n.node_ops=it.ops_table.dir.node,n.stream_ops=it.ops_table.dir.stream,n.contents={}):ot.isFile(n.mode)?(n.node_ops=it.ops_table.file.node,n.stream_ops=it.ops_table.file.stream,n.usedBytes=0,n.contents=null):ot.isLink(n.mode)?(n.node_ops=it.ops_table.link.node,n.stream_ops=it.ops_table.link.stream):ot.isChrdev(n.mode)&&(n.node_ops=it.ops_table.chrdev.node,n.stream_ops=it.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n),n},getFileDataAsRegularArray:function(e){if(e.contents&&e.contents.subarray){for(var t=[],r=0;r<e.usedBytes;++r)t.push(e.contents[r]);return t}return e.contents},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t){if(0==t)return e.contents=null,void(e.usedBytes=0);if(!e.contents||e.contents.subarray){var r=e.contents;return e.contents=new Uint8Array(new ArrayBuffer(t)),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),void(e.usedBytes=t)}if(e.contents||(e.contents=[]),e.contents.length>t)e.contents.length=t;else for(;e.contents.length<t;)e.contents.push(0);e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=ot.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ot.isDir(e.mode)?t.size=4096:ot.isFile(e.mode)?t.size=e.usedBytes:ot.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&it.resizeFileStorage(e,t.size)},lookup:function(e,t){throw ot.genericErrors[44]},mknod:function(e,t,r,i){return it.createNode(e,t,r,i)},rename:function(e,t,r){if(ot.isDir(e.mode)){var i;try{i=ot.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ot.ErrnoError(55)}delete e.parent.contents[e.name],e.name=r,t.contents[r]=e,e.parent=t},unlink:function(e,t){delete e.contents[t]},rmdir:function(e,t){var r=ot.lookupNode(e,t);for(var i in r.contents)throw new ot.ErrnoError(55);delete e.contents[t]},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=it.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!ot.isLink(e.mode))throw new ot.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var a=e.node.contents;if(n>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-n,i);if(N(o>=0),o>8&&a.subarray)t.set(a.subarray(n,n+o),r);else for(var s=0;s<o;s++)t[r+s]=a[n+s];return o},write:function(e,t,r,i,n,a){if(a&&T("file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)"),a=!1,!i)return 0;var o=e.node;if(o.timestamp=Date.now(),t.subarray&&(!o.contents||o.contents.subarray)){if(a)return N(0===n,"canOwn must imply no weird position inside the file"),o.contents=t.subarray(r,r+i),o.usedBytes=i,i;if(0===o.usedBytes&&0===n)return o.contents=new Uint8Array(t.subarray(r,r+i)),o.usedBytes=i,i;if(n+i<=o.usedBytes)return o.contents.set(t.subarray(r,r+i),n),i}if(it.expandFileStorage(o,n+i),o.contents.subarray&&t.subarray)o.contents.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)o.contents[n+s]=t[r+s];return o.usedBytes=Math.max(o.usedBytes,n+i),i},llseek:function(e,t,r){var i=t;if(1===r?i+=e.position:2===r&&ot.isFile(e.node.mode)&&(i+=e.node.usedBytes),i<0)throw new ot.ErrnoError(28);return i},allocate:function(e,t,r){it.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap:function(e,t,r,i,n,a,o){if(!ot.isFile(e.node.mode))throw new ot.ErrnoError(43);var s,u,d=e.node.contents;if(2&o||d.buffer!==t&&d.buffer!==t.buffer){(n>0||n+i<e.node.usedBytes)&&(d=d.subarray?d.subarray(n,n+i):Array.prototype.slice.call(d,n,n+i)),u=!0;var h=t.buffer==Q.buffer;if(!(s=Yr(i)))throw new ot.ErrnoError(48);(h?Q:t).set(d,s)}else u=!1,s=d.byteOffset;return{ptr:s,allocated:u}},msync:function(e,t,r,i,n){if(!ot.isFile(e.node.mode))throw new ot.ErrnoError(43);if(2&n)return 0;it.stream_ops.write(e,t,0,i,r,!1);return 0}}},nt={0:"Success",1:"Arg list too long",2:"Permission denied",3:"Address already in use",4:"Address not available",5:"Address family not supported by protocol family",6:"No more processes",7:"Socket already connected",8:"Bad file number",9:"Trying to read unreadable message",10:"Mount device busy",11:"Operation canceled",12:"No children",13:"Connection aborted",14:"Connection refused",15:"Connection reset by peer",16:"File locking deadlock error",17:"Destination address required",18:"Math arg out of domain of func",19:"Quota exceeded",20:"File exists",21:"Bad address",22:"File too large",23:"Host is unreachable",24:"Identifier removed",25:"Illegal byte sequence",26:"Connection already in progress",27:"Interrupted system call",28:"Invalid argument",29:"I/O error",30:"Socket is already connected",31:"Is a directory",32:"Too many symbolic links",33:"Too many open files",34:"Too many links",35:"Message too long",36:"Multihop attempted",37:"File or path name too long",38:"Network interface is not configured",39:"Connection reset by network",40:"Network is unreachable",41:"Too many open files in system",42:"No buffer space available",43:"No such device",44:"No such file or directory",45:"Exec format error",46:"No record locks available",47:"The link has been severed",48:"Not enough core",49:"No message of desired type",50:"Protocol not available",51:"No space left on device",52:"Function not implemented",53:"Socket is not connected",54:"Not a directory",55:"Directory not empty",56:"State not recoverable",57:"Socket operation on non-socket",59:"Not a typewriter",60:"No such device or address",61:"Value too large for defined data type",62:"Previous owner died",63:"Not super-user",64:"Broken pipe",65:"Protocol error",66:"Unknown protocol",67:"Protocol wrong type for socket",68:"Math result not representable",69:"Read only file system",70:"Illegal seek",71:"No such process",72:"Stale file handle",73:"Connection timed out",74:"Text file busy",75:"Cross-device link",100:"Device not a stream",101:"Bad font file fmt",102:"Invalid slot",103:"Invalid request code",104:"No anode",105:"Block device required",106:"Channel number out of range",107:"Level 3 halted",108:"Level 3 reset",109:"Link number out of range",110:"Protocol driver not attached",111:"No CSI structure available",112:"Level 2 halted",113:"Invalid exchange",114:"Invalid request descriptor",115:"Exchange full",116:"No data (for no delay io)",117:"Timer expired",118:"Out of streams resources",119:"Machine is not on the network",120:"Package not installed",121:"The object is remote",122:"Advertise error",123:"Srmount error",124:"Communication error on send",125:"Cross mount point (not really error)",126:"Given log. name not unique",127:"f.d. invalid for this operation",128:"Remote address changed",129:"Can access a needed shared lib",130:"Accessing a corrupted shared lib",131:".lib section in a.out corrupted",132:"Attempting to link in too many libs",133:"Attempting to exec a shared library",135:"Streams pipe error",136:"Too many users",137:"Socket type not supported",138:"Not supported",139:"Protocol family not supported",140:"Can't send after socket shutdown",141:"Too many references",142:"Host is down",148:"No medium (in tape drive)",156:"Level 2 not synchronized"},at={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},ot={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof ot.ErrnoError))throw e+" : "+Qe();return $e(e.errno)},lookupPath:function(e,t){if(t=t||{},!(e=tt.resolve(ot.cwd(),e)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var i in r)void 0===t[i]&&(t[i]=r[i]);if(t.recurse_count>8)throw new ot.ErrnoError(32);for(var n=et.normalizeArray(e.split("/").filter((function(e){return!!e})),!1),a=ot.root,o="/",s=0;s<n.length;s++){var u=s===n.length-1;if(u&&t.parent)break;if(a=ot.lookupNode(a,n[s]),o=et.join2(o,n[s]),ot.isMountpoint(a)&&(!u||u&&t.follow_mount)&&(a=a.mounted.root),!u||t.follow)for(var d=0;ot.isLink(a.mode);){var h=ot.readlink(o);if(o=tt.resolve(et.dirname(o),h),a=ot.lookupPath(o,{recurse_count:t.recurse_count}).node,d++>40)throw new ot.ErrnoError(32)}}return{path:o,node:a}},getPath:function(e){for(var t;;){if(ot.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:function(e,t){for(var r=0,i=0;i<t.length;i++)r=(r<<5)-r+t.charCodeAt(i)|0;return(e+r>>>0)%ot.nameTable.length},hashAddNode:function(e){var t=ot.hashName(e.parent.id,e.name);e.name_next=ot.nameTable[t],ot.nameTable[t]=e},hashRemoveNode:function(e){var t=ot.hashName(e.parent.id,e.name);if(ot.nameTable[t]===e)ot.nameTable[t]=e.name_next;else for(var r=ot.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:function(e,t){var r=ot.mayLookup(e);if(r)throw new ot.ErrnoError(r,e);for(var i=ot.hashName(e.id,t),n=ot.nameTable[i];n;n=n.name_next){var a=n.name;if(n.parent.id===e.id&&a===t)return n}return ot.lookup(e,t)},createNode:function(e,t,r,i){if(!ot.FSNode){ot.FSNode=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ot.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},ot.FSNode.prototype={};Object.defineProperties(ot.FSNode.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return ot.isDir(this.mode)}},isDevice:{get:function(){return ot.isChrdev(this.mode)}}})}var n=new ot.FSNode(e,t,r,i);return ot.hashAddNode(n),n},destroyNode:function(e){ot.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var t=ot.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:function(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:function(e,t){return ot.ignorePermissions||(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:2},mayLookup:function(e){var t=ot.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:function(e,t){try{ot.lookupNode(e,t);return 20}catch(e){}return ot.nodePermissions(e,"wx")},mayDelete:function(e,t,r){var i;try{i=ot.lookupNode(e,t)}catch(e){return e.errno}var n=ot.nodePermissions(e,"wx");if(n)return n;if(r){if(!ot.isDir(i.mode))return 54;if(ot.isRoot(i)||ot.getPath(i)===ot.cwd())return 10}else if(ot.isDir(i.mode))return 31;return 0},mayOpen:function(e,t){return e?ot.isLink(e.mode)?32:ot.isDir(e.mode)&&("r"!==ot.flagsToPermissionString(t)||512&t)?31:ot.nodePermissions(e,ot.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(e,t){e=e||0,t=t||ot.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!ot.streams[r])return r;throw new ot.ErrnoError(33)},getStream:function(e){return ot.streams[e]},createStream:function(e,t,r){ot.FSStream||(ot.FSStream=function(){},ot.FSStream.prototype={},Object.defineProperties(ot.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}}));var i=new ot.FSStream;for(var n in e)i[n]=e[n];e=i;var a=ot.nextfd(t,r);return e.fd=a,ot.streams[a]=e,e},closeStream:function(e){ot.streams[e]=null},chrdev_stream_ops:{open:function(e){var t=ot.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new ot.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,t){return e<<8|t},registerDevice:function(e,t){ot.devices[e]={stream_ops:t}},getDevice:function(e){return ot.devices[e]},getMounts:function(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:function(e,t){"function"==typeof e&&(t=e,e=!1),ot.syncFSRequests++,ot.syncFSRequests>1&&console.log("warning: "+ot.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=ot.getMounts(ot.root.mount),i=0;function n(e){return N(ot.syncFSRequests>0),ot.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((function(t){if(!t.type.syncfs)return a(null);t.type.syncfs(t,e,a)}))},mount:function(e,t,r){if("string"==typeof e)throw e;var i,n="/"===r,a=!r;if(n&&ot.root)throw new ot.ErrnoError(10);if(!n&&!a){var o=ot.lookupPath(r,{follow_mount:!1});if(r=o.path,i=o.node,ot.isMountpoint(i))throw new ot.ErrnoError(10);if(!ot.isDir(i.mode))throw new ot.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,n?ot.root=u:i&&(i.mounted=s,i.mount&&i.mount.mounts.push(s)),u},unmount:function(e){var t=ot.lookupPath(e,{follow_mount:!1});if(!ot.isMountpoint(t.node))throw new ot.ErrnoError(28);var r=t.node,i=r.mounted,n=ot.getMounts(i);Object.keys(ot.nameTable).forEach((function(e){for(var t=ot.nameTable[e];t;){var r=t.name_next;-1!==n.indexOf(t.mount)&&ot.destroyNode(t),t=r}})),r.mounted=null;var a=r.mount.mounts.indexOf(i);N(-1!==a),r.mount.mounts.splice(a,1)},lookup:function(e,t){return e.node_ops.lookup(e,t)},mknod:function(e,t,r){var i=ot.lookupPath(e,{parent:!0}).node,n=et.basename(e);if(!n||"."===n||".."===n)throw new ot.ErrnoError(28);var a=ot.mayCreate(i,n);if(a)throw new ot.ErrnoError(a);if(!i.node_ops.mknod)throw new ot.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:function(e,t){return t=void 0!==t?t:438,t&=4095,t|=32768,ot.mknod(e,t,0)},mkdir:function(e,t){return t=void 0!==t?t:511,t&=1023,t|=16384,ot.mknod(e,t,0)},mkdirTree:function(e,t){for(var r=e.split("/"),i="",n=0;n<r.length;++n)if(r[n]){i+="/"+r[n];try{ot.mkdir(i,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:function(e,t,r){return void 0===r&&(r=t,t=438),t|=8192,ot.mknod(e,t,r)},symlink:function(e,t){if(!tt.resolve(e))throw new ot.ErrnoError(44);var r=ot.lookupPath(t,{parent:!0}).node;if(!r)throw new ot.ErrnoError(44);var i=et.basename(t),n=ot.mayCreate(r,i);if(n)throw new ot.ErrnoError(n);if(!r.node_ops.symlink)throw new ot.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename:function(e,t){var r,i,n=et.dirname(e),a=et.dirname(t),o=et.basename(e),s=et.basename(t);try{r=ot.lookupPath(e,{parent:!0}).node,i=ot.lookupPath(t,{parent:!0}).node}catch(e){throw new ot.ErrnoError(10)}if(!r||!i)throw new ot.ErrnoError(44);if(r.mount!==i.mount)throw new ot.ErrnoError(75);var u,d=ot.lookupNode(r,o),h=tt.relative(e,a);if("."!==h.charAt(0))throw new ot.ErrnoError(28);if("."!==(h=tt.relative(t,n)).charAt(0))throw new ot.ErrnoError(55);try{u=ot.lookupNode(i,s)}catch(e){}if(d!==u){var l=ot.isDir(d.mode),f=ot.mayDelete(r,o,l);if(f)throw new ot.ErrnoError(f);if(f=u?ot.mayDelete(i,s,l):ot.mayCreate(i,s))throw new ot.ErrnoError(f);if(!r.node_ops.rename)throw new ot.ErrnoError(63);if(ot.isMountpoint(d)||u&&ot.isMountpoint(u))throw new ot.ErrnoError(10);if(i!==r&&(f=ot.nodePermissions(r,"w")))throw new ot.ErrnoError(f);try{ot.trackingDelegate.willMovePath&&ot.trackingDelegate.willMovePath(e,t)}catch(r){console.log("FS.trackingDelegate['willMovePath']('"+e+"', '"+t+"') threw an exception: "+r.message)}ot.hashRemoveNode(d);try{r.node_ops.rename(d,i,s)}catch(e){throw e}finally{ot.hashAddNode(d)}try{ot.trackingDelegate.onMovePath&&ot.trackingDelegate.onMovePath(e,t)}catch(r){console.log("FS.trackingDelegate['onMovePath']('"+e+"', '"+t+"') threw an exception: "+r.message)}}},rmdir:function(e){var t=ot.lookupPath(e,{parent:!0}).node,r=et.basename(e),i=ot.lookupNode(t,r),n=ot.mayDelete(t,r,!0);if(n)throw new ot.ErrnoError(n);if(!t.node_ops.rmdir)throw new ot.ErrnoError(63);if(ot.isMountpoint(i))throw new ot.ErrnoError(10);try{ot.trackingDelegate.willDeletePath&&ot.trackingDelegate.willDeletePath(e)}catch(t){console.log("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+t.message)}t.node_ops.rmdir(t,r),ot.destroyNode(i);try{ot.trackingDelegate.onDeletePath&&ot.trackingDelegate.onDeletePath(e)}catch(t){console.log("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+t.message)}},readdir:function(e){var t=ot.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ot.ErrnoError(54);return t.node_ops.readdir(t)},unlink:function(e){var t=ot.lookupPath(e,{parent:!0}).node,r=et.basename(e),i=ot.lookupNode(t,r),n=ot.mayDelete(t,r,!1);if(n)throw new ot.ErrnoError(n);if(!t.node_ops.unlink)throw new ot.ErrnoError(63);if(ot.isMountpoint(i))throw new ot.ErrnoError(10);try{ot.trackingDelegate.willDeletePath&&ot.trackingDelegate.willDeletePath(e)}catch(t){console.log("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+t.message)}t.node_ops.unlink(t,r),ot.destroyNode(i);try{ot.trackingDelegate.onDeletePath&&ot.trackingDelegate.onDeletePath(e)}catch(t){console.log("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+t.message)}},readlink:function(e){var t=ot.lookupPath(e).node;if(!t)throw new ot.ErrnoError(44);if(!t.node_ops.readlink)throw new ot.ErrnoError(28);return tt.resolve(ot.getPath(t.parent),t.node_ops.readlink(t))},stat:function(e,t){var r=ot.lookupPath(e,{follow:!t}).node;if(!r)throw new ot.ErrnoError(44);if(!r.node_ops.getattr)throw new ot.ErrnoError(63);return r.node_ops.getattr(r)},lstat:function(e){return ot.stat(e,!0)},chmod:function(e,t,r){var i;"string"==typeof e?i=ot.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ot.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:function(e,t){ot.chmod(e,t,!0)},fchmod:function(e,t){var r=ot.getStream(e);if(!r)throw new ot.ErrnoError(8);ot.chmod(r.node,t)},chown:function(e,t,r,i){var n;"string"==typeof e?n=ot.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ot.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:function(e,t,r){ot.chown(e,t,r,!0)},fchown:function(e,t,r){var i=ot.getStream(e);if(!i)throw new ot.ErrnoError(8);ot.chown(i.node,t,r)},truncate:function(e,t){if(t<0)throw new ot.ErrnoError(28);var r;"string"==typeof e?r=ot.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ot.ErrnoError(63);if(ot.isDir(r.mode))throw new ot.ErrnoError(31);if(!ot.isFile(r.mode))throw new ot.ErrnoError(28);var i=ot.nodePermissions(r,"w");if(i)throw new ot.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:function(e,t){var r=ot.getStream(e);if(!r)throw new ot.ErrnoError(8);if(0==(2097155&r.flags))throw new ot.ErrnoError(28);ot.truncate(r.node,t)},utime:function(e,t,r){var i=ot.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open:function(e,t,r,i,n){if(""===e)throw new ot.ErrnoError(44);var a;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?ot.modeStringToFlags(t):t)?4095&r|32768:0,"object"==typeof e)a=e;else{e=et.normalize(e);try{a=ot.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var o=!1;if(64&t)if(a){if(128&t)throw new ot.ErrnoError(20)}else a=ot.mknod(e,r,0),o=!0;if(!a)throw new ot.ErrnoError(44);if(ot.isChrdev(a.mode)&&(t&=-513),65536&t&&!ot.isDir(a.mode))throw new ot.ErrnoError(54);if(!o){var s=ot.mayOpen(a,t);if(s)throw new ot.ErrnoError(s)}512&t&&ot.truncate(a,0),t&=-641;var u=ot.createStream({node:a,path:ot.getPath(a),flags:t,seekable:!0,position:0,stream_ops:a.stream_ops,ungotten:[],error:!1},i,n);u.stream_ops.open&&u.stream_ops.open(u),!h.logReadFiles||1&t||(ot.readFiles||(ot.readFiles={}),e in ot.readFiles||(ot.readFiles[e]=1,console.log("FS.trackingDelegate error on read file: "+e)));try{if(ot.trackingDelegate.onOpenFile){var d=0;1!=(2097155&t)&&(d|=ot.tracking.openFlags.READ),0!=(2097155&t)&&(d|=ot.tracking.openFlags.WRITE),ot.trackingDelegate.onOpenFile(e,d)}}catch(t){console.log("FS.trackingDelegate['onOpenFile']('"+e+"', flags) threw an exception: "+t.message)}return u},close:function(e){if(ot.isClosed(e))throw new ot.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ot.closeStream(e.fd)}e.fd=null},isClosed:function(e){return null===e.fd},llseek:function(e,t,r){if(ot.isClosed(e))throw new ot.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ot.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ot.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:function(e,t,r,i,n){if(i<0||n<0)throw new ot.ErrnoError(28);if(ot.isClosed(e))throw new ot.ErrnoError(8);if(1==(2097155&e.flags))throw new ot.ErrnoError(8);if(ot.isDir(e.node.mode))throw new ot.ErrnoError(31);if(!e.stream_ops.read)throw new ot.ErrnoError(28);var a=void 0!==n;if(a){if(!e.seekable)throw new ot.ErrnoError(70)}else n=e.position;var o=e.stream_ops.read(e,t,r,i,n);return a||(e.position+=o),o},write:function(e,t,r,i,n,a){if(i<0||n<0)throw new ot.ErrnoError(28);if(ot.isClosed(e))throw new ot.ErrnoError(8);if(0==(2097155&e.flags))throw new ot.ErrnoError(8);if(ot.isDir(e.node.mode))throw new ot.ErrnoError(31);if(!e.stream_ops.write)throw new ot.ErrnoError(28);1024&e.flags&&ot.llseek(e,0,2);var o=void 0!==n;if(o){if(!e.seekable)throw new ot.ErrnoError(70)}else n=e.position;var s=e.stream_ops.write(e,t,r,i,n,a);o||(e.position+=s);try{e.path&&ot.trackingDelegate.onWriteToFile&&ot.trackingDelegate.onWriteToFile(e.path)}catch(t){console.log("FS.trackingDelegate['onWriteToFile']('"+e.path+"') threw an exception: "+t.message)}return s},allocate:function(e,t,r){if(ot.isClosed(e))throw new ot.ErrnoError(8);if(t<0||r<=0)throw new ot.ErrnoError(28);if(0==(2097155&e.flags))throw new ot.ErrnoError(8);if(!ot.isFile(e.node.mode)&&!ot.isDir(e.node.mode))throw new ot.ErrnoError(43);if(!e.stream_ops.allocate)throw new ot.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:function(e,t,r,i,n,a,o){if(0!=(2&a)&&0==(2&o)&&2!=(2097155&e.flags))throw new ot.ErrnoError(2);if(1==(2097155&e.flags))throw new ot.ErrnoError(2);if(!e.stream_ops.mmap)throw new ot.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n,a,o)},msync:function(e,t,r,i,n){return e&&e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0},munmap:function(e){return 0},ioctl:function(e,t,r){if(!e.stream_ops.ioctl)throw new ot.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e,t){if((t=t||{}).flags=t.flags||"r",t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var r,i=ot.open(e,t.flags),n=ot.stat(e).size,a=new Uint8Array(n);return ot.read(i,a,0,n,0),"utf8"===t.encoding?r=j(a,0):"binary"===t.encoding&&(r=a),ot.close(i),r},writeFile:function(e,t,r){(r=r||{}).flags=r.flags||"w";var i=ot.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(V(t)+1),a=X(t,n,0,n.length);ot.write(i,n,0,a,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ot.write(i,t,0,t.byteLength,void 0,r.canOwn)}ot.close(i)},cwd:function(){return ot.currentPath},chdir:function(e){var t=ot.lookupPath(e,{follow:!0});if(null===t.node)throw new ot.ErrnoError(44);if(!ot.isDir(t.node.mode))throw new ot.ErrnoError(54);var r=ot.nodePermissions(t.node,"x");if(r)throw new ot.ErrnoError(r);ot.currentPath=t.path},createDefaultDirectories:function(){ot.mkdir("/tmp"),ot.mkdir("/home"),ot.mkdir("/home/web_user")},createDefaultDevices:function(){var e;if(ot.mkdir("/dev"),ot.registerDevice(ot.makedev(1,3),{read:function(){return 0},write:function(e,t,r,i,n){return i}}),ot.mkdev("/dev/null",ot.makedev(1,3)),rt.register(ot.makedev(5,0),rt.default_tty_ops),rt.register(ot.makedev(6,0),rt.default_tty1_ops),ot.mkdev("/dev/tty",ot.makedev(5,0)),ot.mkdev("/dev/tty1",ot.makedev(6,0)),"object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);e=function(){return crypto.getRandomValues(t),t[0]}}else if(m)try{var i=r(71);e=function(){return i.randomBytes(1)[0]}}catch(e){}e||(e=function(){Le("no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")}),ot.createDevice("/dev","random",e),ot.createDevice("/dev","urandom",e),ot.mkdir("/dev/shm"),ot.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){ot.mkdir("/proc"),ot.mkdir("/proc/self"),ot.mkdir("/proc/self/fd"),ot.mount({mount:function(){var e=ot.createNode("/proc/self","fd",16895,73);return e.node_ops={lookup:function(e,t){var r=+t,i=ot.getStream(r);if(!i)throw new ot.ErrnoError(8);var n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return i.path}}};return n.parent=n,n}},e}},{},"/proc/self/fd")},createStandardStreams:function(){h.stdin?ot.createDevice("/dev","stdin",h.stdin):ot.symlink("/dev/tty","/dev/stdin"),h.stdout?ot.createDevice("/dev","stdout",null,h.stdout):ot.symlink("/dev/tty","/dev/stdout"),h.stderr?ot.createDevice("/dev","stderr",null,h.stderr):ot.symlink("/dev/tty1","/dev/stderr");var e=ot.open("/dev/stdin","r"),t=ot.open("/dev/stdout","w"),r=ot.open("/dev/stderr","w");N(0===e.fd,"invalid handle for stdin ("+e.fd+")"),N(1===t.fd,"invalid handle for stdout ("+t.fd+")"),N(2===r.fd,"invalid handle for stderr ("+r.fd+")")},ensureErrnoError:function(){ot.ErrnoError||(ot.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){for(var t in this.errno=e,at)if(at[t]===e){this.code=t;break}},this.setErrno(e),this.message=nt[e],this.stack&&(Object.defineProperty(this,"stack",{value:(new Error).stack,writable:!0}),this.stack=qe(this.stack))},ot.ErrnoError.prototype=new Error,ot.ErrnoError.prototype.constructor=ot.ErrnoError,[44].forEach((function(e){ot.genericErrors[e]=new ot.ErrnoError(e),ot.genericErrors[e].stack="<generic error, no stack>"})))},staticInit:function(){ot.ensureErrnoError(),ot.nameTable=new Array(4096),ot.mount(it,{},"/"),ot.createDefaultDirectories(),ot.createDefaultDevices(),ot.createSpecialDirectories(),ot.filesystems={MEMFS:it}},init:function(e,t,r){N(!ot.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),ot.init.initialized=!0,ot.ensureErrnoError(),h.stdin=e||h.stdin,h.stdout=t||h.stdout,h.stderr=r||h.stderr,ot.createStandardStreams()},quit:function(){ot.init.initialized=!1;var e=h._fflush;e&&e(0);for(var t=0;t<ot.streams.length;t++){var r=ot.streams[t];r&&ot.close(r)}},getMode:function(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r},joinPath:function(e,t){var r=et.join.apply(null,e);return t&&"/"==r[0]&&(r=r.substr(1)),r},absolutePath:function(e,t){return tt.resolve(t,e)},standardizePath:function(e){return et.normalize(e)},findObject:function(e,t){var r=ot.analyzePath(e,t);return r.exists?r.object:($e(r.error),null)},analyzePath:function(e,t){try{e=(i=ot.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=ot.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=et.basename(e),i=ot.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createFolder:function(e,t,r,i){var n=et.join2("string"==typeof e?e:ot.getPath(e),t),a=ot.getMode(r,i);return ot.mkdir(n,a)},createPath:function(e,t,r,i){e="string"==typeof e?e:ot.getPath(e);for(var n=t.split("/").reverse();n.length;){var a=n.pop();if(a){var o=et.join2(e,a);try{ot.mkdir(o)}catch(e){}e=o}}return o},createFile:function(e,t,r,i,n){var a=et.join2("string"==typeof e?e:ot.getPath(e),t),o=ot.getMode(i,n);return ot.create(a,o)},createDataFile:function(e,t,r,i,n,a){var o=t?et.join2("string"==typeof e?e:ot.getPath(e),t):e,s=ot.getMode(i,n),u=ot.create(o,s);if(r){if("string"==typeof r){for(var d=new Array(r.length),h=0,l=r.length;h<l;++h)d[h]=r.charCodeAt(h);r=d}ot.chmod(u,146|s);var f=ot.open(u,"w");ot.write(f,r,0,r.length,0,a),ot.close(f),ot.chmod(u,s)}return u},createDevice:function(e,t,r,i){var n=et.join2("string"==typeof e?e:ot.getPath(e),t),a=ot.getMode(!!r,!!i);ot.createDevice.major||(ot.createDevice.major=64);var o=ot.makedev(ot.createDevice.major++,0);return ot.registerDevice(o,{open:function(e){e.seekable=!1},close:function(e){i&&i.buffer&&i.buffer.length&&i(10)},read:function(e,t,i,n,a){for(var o=0,s=0;s<n;s++){var u;try{u=r()}catch(e){throw new ot.ErrnoError(29)}if(void 0===u&&0===o)throw new ot.ErrnoError(6);if(null==u)break;o++,t[i+s]=u}return o&&(e.node.timestamp=Date.now()),o},write:function(e,t,r,n,a){for(var o=0;o<n;o++)try{i(t[r+o])}catch(e){throw new ot.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),o}}),ot.mkdev(n,a,o)},createLink:function(e,t,r,i,n){var a=et.join2("string"==typeof e?e:ot.getPath(e),t);return ot.symlink(r,a)},forceLoadFile:function(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;var t=!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!y)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=Ot(y(e.url),!0),e.usedBytes=e.contents.length}catch(e){t=!1}return t||$e(29),t},createLazyFile:function(e,t,r,i,n){function a(){this.lengthKnown=!1,this.chunks=[]}if(a.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,a=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,o=1048576;n||(o=i);var s=this;s.setDataGetter((function(e){var t=e*o,n=(e+1)*o-1;if(n=Math.min(n,i-1),void 0===s.chunks[e]&&(s.chunks[e]=function(e,t){if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==o&&n.setRequestHeader("Range","bytes="+e+"-"+t),"undefined"!=typeof Uint8Array&&(n.responseType="arraybuffer"),n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):Ot(n.responseText||"",!0)}(t,n)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&i||(o=i=1,i=this.getter(0).length,o=i,console.log("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=o,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!p)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var o=new a;Object.defineProperties(o,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:o}}else s={isDevice:!1,url:r};var u=ot.createFile(e,t,s,i,n);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var d={};return Object.keys(u.stream_ops).forEach((function(e){var t=u.stream_ops[e];d[e]=function(){if(!ot.forceLoadFile(u))throw new ot.ErrnoError(29);return t.apply(null,arguments)}})),d.read=function(e,t,r,i,n){if(!ot.forceLoadFile(u))throw new ot.ErrnoError(29);var a=e.node.contents;if(n>=a.length)return 0;var o=Math.min(a.length-n,i);if(N(o>=0),a.slice)for(var s=0;s<o;s++)t[r+s]=a[n+s];else for(s=0;s<o;s++)t[r+s]=a.get(n+s);return o},u.stream_ops=d,u},createPreloadedFile:function(e,t,r,i,n,a,o,s,u,d){Browser.init();var l=t?tt.resolve(et.join2(e,t)):e,f=Ce("cp "+l);function c(r){function c(r){d&&d(),s||ot.createDataFile(e,t,r,i,n,u),a&&a(),Ne(f)}var p=!1;h.preloadPlugins.forEach((function(e){p||e.canHandle(l)&&(e.handle(r,l,c,(function(){o&&o(),Ne(f)})),p=!0)})),p||c(r)}Pe(f),"string"==typeof r?Browser.asyncLoad(r,(function(e){c(e)}),o):c(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,t,r){t=t||function(){},r=r||function(){};var i=ot.indexedDB();try{var n=i.open(ot.DB_NAME(),ot.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=function(){console.log("creating db"),n.result.createObjectStore(ot.DB_STORE_NAME)},n.onsuccess=function(){var i=n.result.transaction([ot.DB_STORE_NAME],"readwrite"),a=i.objectStore(ot.DB_STORE_NAME),o=0,s=0,u=e.length;function d(){0==s?t():r()}e.forEach((function(e){var t=a.put(ot.analyzePath(e).object.contents,e);t.onsuccess=function(){++o+s==u&&d()},t.onerror=function(){s++,o+s==u&&d()}})),i.onerror=r},n.onerror=r},loadFilesFromDB:function(e,t,r){t=t||function(){},r=r||function(){};var i=ot.indexedDB();try{var n=i.open(ot.DB_NAME(),ot.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=r,n.onsuccess=function(){var i=n.result;try{var a=i.transaction([ot.DB_STORE_NAME],"readonly")}catch(e){return void r(e)}var o=a.objectStore(ot.DB_STORE_NAME),s=0,u=0,d=e.length;function h(){0==u?t():r()}e.forEach((function(e){var t=o.get(e);t.onsuccess=function(){ot.analyzePath(e).exists&&ot.unlink(e),ot.createDataFile(et.dirname(e),et.basename(e),t.result,!0,!0,!0),++s+u==d&&h()},t.onerror=function(){u++,s+u==d&&h()}})),a.onerror=r},n.onerror=r}},st={DEFAULT_POLLMASK:5,mappings:{},umask:511,calculateAt:function(e,t){if("/"!==t[0]){var r;if(-100===e)r=ot.cwd();else{var i=ot.getStream(e);if(!i)throw new ot.ErrnoError(8);r=i.path}t=et.join2(r,t)}return t},doStat:function(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&et.normalize(t)!==et.normalize(ot.getPath(e.node)))return-54;throw e}return J[r>>2]=i.dev,J[r+4>>2]=0,J[r+8>>2]=i.ino,J[r+12>>2]=i.mode,J[r+16>>2]=i.nlink,J[r+20>>2]=i.uid,J[r+24>>2]=i.gid,J[r+28>>2]=i.rdev,J[r+32>>2]=0,je=[i.size>>>0,(Ue=i.size,+Me(Ue)>=1?Ue>0?(0|ke(+Re(Ue/4294967296),4294967295))>>>0:~~+Te((Ue-+(~~Ue>>>0))/4294967296)>>>0:0)],J[r+40>>2]=je[0],J[r+44>>2]=je[1],J[r+48>>2]=4096,J[r+52>>2]=i.blocks,J[r+56>>2]=i.atime.getTime()/1e3|0,J[r+60>>2]=0,J[r+64>>2]=i.mtime.getTime()/1e3|0,J[r+68>>2]=0,J[r+72>>2]=i.ctime.getTime()/1e3|0,J[r+76>>2]=0,je=[i.ino>>>0,(Ue=i.ino,+Me(Ue)>=1?Ue>0?(0|ke(+Re(Ue/4294967296),4294967295))>>>0:~~+Te((Ue-+(~~Ue>>>0))/4294967296)>>>0:0)],J[r+80>>2]=je[0],J[r+84>>2]=je[1],0},doMsync:function(e,t,r,i){var n=new Uint8Array(Y.subarray(e,e+r));ot.msync(t,n,0,r,i)},doMkdir:function(e,t){return"/"===(e=et.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),ot.mkdir(e,t,0),0},doMknod:function(e,t,r){switch(61440&t){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return ot.mknod(e,t,r),0},doReadlink:function(e,t,r){if(r<=0)return-28;var i=ot.readlink(e),n=Math.min(r,V(i)),a=Q[t+n];return W(i,t,r+1),Q[t+n]=a,n},doAccess:function(e,t){if(-8&t)return-28;var r;if(!(r=ot.lookupPath(e,{follow:!0}).node))return-44;var i="";return 4&t&&(i+="r"),2&t&&(i+="w"),1&t&&(i+="x"),i&&ot.nodePermissions(r,i)?-2:0},doDup:function(e,t,r){var i=ot.getStream(r);return i&&ot.close(i),ot.open(e,t,0,r,r).fd},doReadv:function(e,t,r,i){for(var n=0,a=0;a<r;a++){var o=J[t+8*a>>2],s=J[t+(8*a+4)>>2],u=ot.read(e,Q,o,s,i);if(u<0)return-1;if(n+=u,u<s)break}return n},doWritev:function(e,t,r,i){for(var n=0,a=0;a<r;a++){var o=J[t+8*a>>2],s=J[t+(8*a+4)>>2],u=ot.write(e,Q,o,s,i);if(u<0)return-1;n+=u}return n},varargs:0,get:function(e){return st.varargs+=4,J[st.varargs-4>>2]},getStr:function(){return H(st.get())},getStreamFromFD:function(e){void 0===e&&(e=st.get());var t=ot.getStream(e);if(!t)throw new ot.ErrnoError(8);return t},get64:function(){var e=st.get(),t=st.get();return N(e>=0?0===t:-1===t),e},getZero:function(){N(0===st.get())}};function ut(e,t){st.varargs=t;try{var r=st.getStreamFromFD();switch(st.get()){case 0:return(i=st.get())<0?-28:ot.open(r.path,r.flags,0,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=st.get();return r.flags|=i,0;case 12:i=st.get();return K[i+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return $e(28),-1;default:return-28}}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),-e.errno}}function dt(e,t){st.varargs=t;try{var r=st.getStreamFromFD(),i=st.get(),n=st.get();return ot.read(r,Q,i,n)}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),-e.errno}}function ht(e,t){st.varargs=t;try{var r=st.getStr(),i=st.get(),n=st.get();return ot.open(r,i,n).fd}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),-e.errno}}function lt(){}function ft(){Le()}function ct(){return void 0===ct.start&&(ct.start=Date.now()),1e3*(Date.now()-ct.start)|0}function pt(){return Q.length}function mt(e,t,r){Y.set(Y.subarray(t,t+r),e)}function gt(e){try{return D.grow(e-G.byteLength+65535>>16),te(D.buffer),1}catch(t){console.error("emscripten_realloc_buffer: Attempted to grow heap from "+G.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}function _t(e){var t=pt();N(e>t);if(e>2147418112)return M("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is 2147418112 bytes!"),!1;for(var r=Math.max(t,16777216);r<e;)(r=r<=536870912?ee(2*r,65536):Math.min(ee((3*r+2147483648)/4,65536),2147418112))===t&&T("Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only "+Q.length);return!!gt(r)||(M("Failed to grow the heap from "+t+" bytes to "+r+" bytes, not enough memory!"),!1)}var yt={};function bt(){if(!bt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:l};for(var t in yt)e[t]=yt[t];var r=[];for(var t in e)r.push(t+"="+e[t]);bt.strings=r}return bt.strings}function vt(e,t){var r=bt(),i=0;return r.forEach((function(r,n){var a=t+i;J[e+4*n>>2]=a,q(r,a),i+=r.length+1})),0}function wt(e,t){var r=bt();J[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),J[t>>2]=i,0}function Et(e){try{var t=st.getStreamFromFD(e);return ot.close(t),0}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function At(e,t){try{var r=st.getStreamFromFD(e),i=r.tty?2:ot.isDir(r.mode)?3:ot.isLink(r.mode)?7:4;return Q[t>>0]=i,0}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function St(e,t,r,i,n){try{var a=st.getStreamFromFD(e),o=4294967296*r+(t>>>0);return o<=-9007199254740992||o>=9007199254740992?-61:(ot.llseek(a,o,i),je=[a.position>>>0,(Ue=a.position,+Me(Ue)>=1?Ue>0?(0|ke(+Re(Ue/4294967296),4294967295))>>>0:~~+Te((Ue-+(~~Ue>>>0))/4294967296)>>>0:0)],J[n>>2]=je[0],J[n+4>>2]=je[1],a.getdents&&0===o&&0===i&&(a.getdents=null),0)}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function Mt(e,t,r,i){try{var n=st.getStreamFromFD(e),a=st.doWritev(n,t,r);return J[i>>2]=a,0}catch(e){return void 0!==ot&&e instanceof ot.ErrnoError||Le(e),e.errno}}function Tt(e){var t=Date.now();return J[e>>2]=t/1e3|0,J[e+4>>2]=t%1e3*1e3|0,0}W("GMT",1341232,4);function Rt(e){return(e=+e)>=0?+Re(e+.5):+Te(e-.5)}function kt(e){x(0|e)}function It(e){var t=Date.now()/1e3|0;return e&&(J[e>>2]=t),t}function Ot(e,t,r){var i=r>0?r:V(e)+1,n=new Array(i),a=X(e,n,0,n.length);return t&&(n.length=a),n}ot.staticInit();var Dt={__cxa_allocate_exception:Ye,__cxa_throw:Je,__lock:Ze,__syscall221:ut,__syscall3:dt,__syscall5:ht,__unlock:lt,abort:ft,clock:ct,emscripten_memcpy_big:mt,emscripten_resize_heap:_t,environ_get:vt,environ_sizes_get:wt,fd_close:Et,fd_fdstat_get:At,fd_seek:St,fd_write:Mt,gettimeofday:Tt,memory:D,round:Rt,setTempRet0:kt,table:C,time:It},xt=Ve(),Ct=xt.__wasm_call_ctors;xt.__wasm_call_ctors=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ct.apply(null,arguments)};var Pt=xt.WasmDecoder_Check;xt.WasmDecoder_Check=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Pt.apply(null,arguments)};var Nt=xt.WasmDecoder_Init;xt.WasmDecoder_Init=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Nt.apply(null,arguments)};var Lt=xt.WasmDecoder_Deinit;xt.WasmDecoder_Deinit=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Lt.apply(null,arguments)};var Bt=xt.WasmDecoder_OpenChannel;xt.WasmDecoder_OpenChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Bt.apply(null,arguments)};var Ft=xt.WasmDecoder_InputFlvStream;xt.WasmDecoder_InputFlvStream=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ft.apply(null,arguments)};var Ut=xt.WasmDecoder_GetFlvDecodeData;xt.WasmDecoder_GetFlvDecodeData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ut.apply(null,arguments)};var jt=xt.WasmDecoder_InputFlvStreamAndDecode;xt.WasmDecoder_InputFlvStreamAndDecode=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),jt.apply(null,arguments)};var Ht=xt.WasmDecoder_OpenVideoDecoder;xt.WasmDecoder_OpenVideoDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ht.apply(null,arguments)};var Xt=xt.WasmDecoder_OpenAudioDecoder;xt.WasmDecoder_OpenAudioDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Xt.apply(null,arguments)};var Wt=xt.WasmDecoder_DecodeVideoFrame;xt.WasmDecoder_DecodeVideoFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Wt.apply(null,arguments)};var Vt=xt.WasmDecoder_DecodeAudioFrame;xt.WasmDecoder_DecodeAudioFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Vt.apply(null,arguments)};var zt=xt.WasmDecoder_CloseChannel;xt.WasmDecoder_CloseChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),zt.apply(null,arguments)};var qt=xt.WasmDecoder_ConvertFrame2Image;xt.WasmDecoder_ConvertFrame2Image=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),qt.apply(null,arguments)};var Gt=xt.WasmDecoder_ReleaseImageData;xt.WasmDecoder_ReleaseImageData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Gt.apply(null,arguments)};var Qt=xt.WasmDecoder_CreateMP4File;xt.WasmDecoder_CreateMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Qt.apply(null,arguments)};var Yt=xt.WasmDecoder_WriteData;xt.WasmDecoder_WriteData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Yt.apply(null,arguments)};var Kt=xt.WasmDecoder_ReleaseMP4File;xt.WasmDecoder_ReleaseMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Kt.apply(null,arguments)};var Jt=xt.main;xt.main=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Jt.apply(null,arguments)};var Zt=xt.free;xt.free=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Zt.apply(null,arguments)};var $t=xt.malloc;xt.malloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),$t.apply(null,arguments)};var er=xt.__errno_location;xt.__errno_location=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),er.apply(null,arguments)};var tr=xt.fflush;xt.fflush=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),tr.apply(null,arguments)};var rr=xt._get_tzname;xt._get_tzname=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),rr.apply(null,arguments)};var ir=xt._get_daylight;xt._get_daylight=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ir.apply(null,arguments)};var nr=xt._get_timezone;xt._get_timezone=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),nr.apply(null,arguments)};var ar=xt.setThrew;xt.setThrew=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ar.apply(null,arguments)};var or=xt._ZSt18uncaught_exceptionv;xt._ZSt18uncaught_exceptionv=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),or.apply(null,arguments)};var sr=xt.stackSave;xt.stackSave=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),sr.apply(null,arguments)};var ur=xt.stackAlloc;xt.stackAlloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),ur.apply(null,arguments)};var dr=xt.stackRestore;xt.stackRestore=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),dr.apply(null,arguments)};var hr=xt.__growWasmMemory;xt.__growWasmMemory=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),hr.apply(null,arguments)};var lr=xt.dynCall_ii;xt.dynCall_ii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),lr.apply(null,arguments)};var fr=xt.dynCall_viiiii;xt.dynCall_viiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),fr.apply(null,arguments)};var cr=xt.dynCall_viiiiiifi;xt.dynCall_viiiiiifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),cr.apply(null,arguments)};var pr=xt.dynCall_viiii;xt.dynCall_viiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),pr.apply(null,arguments)};var mr=xt.dynCall_viii;xt.dynCall_viii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),mr.apply(null,arguments)};var gr=xt.dynCall_iiiiiii;xt.dynCall_iiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),gr.apply(null,arguments)};var _r=xt.dynCall_iiiiii;xt.dynCall_iiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),_r.apply(null,arguments)};var yr=xt.dynCall_vii;xt.dynCall_vii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),yr.apply(null,arguments)};var br=xt.dynCall_iii;xt.dynCall_iii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),br.apply(null,arguments)};var vr=xt.dynCall_iiii;xt.dynCall_iiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),vr.apply(null,arguments)};var wr=xt.dynCall_viiiiii;xt.dynCall_viiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),wr.apply(null,arguments)};var Er=xt.dynCall_viiiiiiiii;xt.dynCall_viiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Er.apply(null,arguments)};var Ar=xt.dynCall_viiiiiiii;xt.dynCall_viiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ar.apply(null,arguments)};var Sr=xt.dynCall_iiiii;xt.dynCall_iiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Sr.apply(null,arguments)};var Mr=xt.dynCall_viiiiiiiiiiiiii;xt.dynCall_viiiiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Mr.apply(null,arguments)};var Tr=xt.dynCall_viiiiiiiiiii;xt.dynCall_viiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Tr.apply(null,arguments)};var Rr=xt.dynCall_viiiiiii;xt.dynCall_viiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Rr.apply(null,arguments)};var kr=xt.dynCall_viiiiiiiiiiii;xt.dynCall_viiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),kr.apply(null,arguments)};var Ir=xt.dynCall_vi;xt.dynCall_vi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ir.apply(null,arguments)};var Or=xt.dynCall_iiiiiiiii;xt.dynCall_iiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Or.apply(null,arguments)};var Dr=xt.dynCall_viiiifii;xt.dynCall_viiiifii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Dr.apply(null,arguments)};var xr=xt.dynCall_fii;xt.dynCall_fii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),xr.apply(null,arguments)};var Cr=xt.dynCall_viiiiiiiiii;xt.dynCall_viiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Cr.apply(null,arguments)};var Pr=xt.dynCall_dd;xt.dynCall_dd=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Pr.apply(null,arguments)};var Nr=xt.dynCall_viifi;xt.dynCall_viifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Nr.apply(null,arguments)};var Lr=xt.dynCall_fiii;xt.dynCall_fiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Lr.apply(null,arguments)};var Br=xt.dynCall_viidi;xt.dynCall_viidi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Br.apply(null,arguments)};var Fr=xt.dynCall_iiiiiiii;xt.dynCall_iiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Fr.apply(null,arguments)};var Ur=xt.dynCall_did;xt.dynCall_did=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Ur.apply(null,arguments)};var jr=xt.dynCall_v;xt.dynCall_v=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),jr.apply(null,arguments)};var Hr=xt.dynCall_viiijj;xt.dynCall_viiijj=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Hr.apply(null,arguments)};var Xr=xt.dynCall_iiiiiiidiiddii;xt.dynCall_iiiiiiidiiddii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Xr.apply(null,arguments)};var Wr=xt.dynCall_jij;xt.dynCall_jij=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Wr.apply(null,arguments)};var Vr=xt.dynCall_jii;xt.dynCall_jii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),Vr.apply(null,arguments)};var zr=xt.dynCall_jiji;xt.dynCall_jiji=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),zr.apply(null,arguments)};var qr=xt.dynCall_iidiiii;xt.dynCall_iidiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),qr.apply(null,arguments)},h.asm=xt;var Gr,Qr=h.___wasm_call_ctors=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.__wasm_call_ctors.apply(null,arguments)},Yr=(h._WasmDecoder_Check=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_Check.apply(null,arguments)},h._WasmDecoder_Init=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_Init.apply(null,arguments)},h._WasmDecoder_Deinit=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_Deinit.apply(null,arguments)},h._WasmDecoder_OpenChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_OpenChannel.apply(null,arguments)},h._WasmDecoder_InputFlvStream=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_InputFlvStream.apply(null,arguments)},h._WasmDecoder_GetFlvDecodeData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_GetFlvDecodeData.apply(null,arguments)},h._WasmDecoder_InputFlvStreamAndDecode=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_InputFlvStreamAndDecode.apply(null,arguments)},h._WasmDecoder_OpenVideoDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_OpenVideoDecoder.apply(null,arguments)},h._WasmDecoder_OpenAudioDecoder=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_OpenAudioDecoder.apply(null,arguments)},h._WasmDecoder_DecodeVideoFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_DecodeVideoFrame.apply(null,arguments)},h._WasmDecoder_DecodeAudioFrame=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_DecodeAudioFrame.apply(null,arguments)},h._WasmDecoder_CloseChannel=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_CloseChannel.apply(null,arguments)},h._WasmDecoder_ConvertFrame2Image=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_ConvertFrame2Image.apply(null,arguments)},h._WasmDecoder_ReleaseImageData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_ReleaseImageData.apply(null,arguments)},h._WasmDecoder_CreateMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_CreateMP4File.apply(null,arguments)},h._WasmDecoder_WriteData=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_WriteData.apply(null,arguments)},h._WasmDecoder_ReleaseMP4File=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.WasmDecoder_ReleaseMP4File.apply(null,arguments)},h._main=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.main.apply(null,arguments)},h._free=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.free.apply(null,arguments)},h._malloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.malloc.apply(null,arguments)}),Kr=(h.___errno_location=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.__errno_location.apply(null,arguments)},h._fflush=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.fflush.apply(null,arguments)},h.__get_tzname=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._get_tzname.apply(null,arguments)},h.__get_daylight=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._get_daylight.apply(null,arguments)},h.__get_timezone=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._get_timezone.apply(null,arguments)},h._setThrew=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.setThrew.apply(null,arguments)},h.__ZSt18uncaught_exceptionv=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm._ZSt18uncaught_exceptionv.apply(null,arguments)}),Jr=h.stackSave=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.stackSave.apply(null,arguments)},Zr=h.stackAlloc=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.stackAlloc.apply(null,arguments)},$r=h.stackRestore=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.stackRestore.apply(null,arguments)};h.__growWasmMemory=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.__growWasmMemory.apply(null,arguments)},h.dynCall_ii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_ii.apply(null,arguments)},h.dynCall_viiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiii.apply(null,arguments)},h.dynCall_viiiiiifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiifi.apply(null,arguments)},h.dynCall_viiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiii.apply(null,arguments)},h.dynCall_viii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viii.apply(null,arguments)},h.dynCall_iiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiii.apply(null,arguments)},h.dynCall_iiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiii.apply(null,arguments)},h.dynCall_vii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_vii.apply(null,arguments)},h.dynCall_iii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iii.apply(null,arguments)},h.dynCall_iiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiii.apply(null,arguments)},h.dynCall_viiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiii.apply(null,arguments)},h.dynCall_viiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiii.apply(null,arguments)},h.dynCall_viiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiii.apply(null,arguments)},h.dynCall_iiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiii.apply(null,arguments)},h.dynCall_viiiiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiiiiiii.apply(null,arguments)},h.dynCall_viiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiiii.apply(null,arguments)},h.dynCall_viiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiii.apply(null,arguments)},h.dynCall_viiiiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiiiii.apply(null,arguments)},h.dynCall_vi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_vi.apply(null,arguments)},h.dynCall_iiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiiiii.apply(null,arguments)},h.dynCall_viiiifii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiifii.apply(null,arguments)},h.dynCall_fii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_fii.apply(null,arguments)},h.dynCall_viiiiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiiiiiiiii.apply(null,arguments)},h.dynCall_dd=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_dd.apply(null,arguments)},h.dynCall_viifi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viifi.apply(null,arguments)},h.dynCall_fiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_fiii.apply(null,arguments)},h.dynCall_viidi=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viidi.apply(null,arguments)},h.dynCall_iiiiiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiiii.apply(null,arguments)},h.dynCall_did=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_did.apply(null,arguments)},h.dynCall_v=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_v.apply(null,arguments)},h.dynCall_viiijj=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_viiijj.apply(null,arguments)},h.dynCall_iiiiiiidiiddii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iiiiiiidiiddii.apply(null,arguments)},h.dynCall_jij=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_jij.apply(null,arguments)},h.dynCall_jii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_jii.apply(null,arguments)},h.dynCall_jiji=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_jiji.apply(null,arguments)},h.dynCall_iidiiii=function(){return N(ge,"you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),N(!_e,"the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),h.asm.dynCall_iidiiii.apply(null,arguments)};function ei(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}h.asm=xt,Object.getOwnPropertyDescriptor(h,"intArrayFromString")||(h.intArrayFromString=function(){Le("'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"intArrayToString")||(h.intArrayToString=function(){Le("'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.ccall=B,h.cwrap=F,Object.getOwnPropertyDescriptor(h,"setValue")||(h.setValue=function(){Le("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getValue")||(h.getValue=function(){Le("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"allocate")||(h.allocate=function(){Le("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getMemory")||(h.getMemory=function(){Le("'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"AsciiToString")||(h.AsciiToString=function(){Le("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToAscii")||(h.stringToAscii=function(){Le("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF8ArrayToString")||(h.UTF8ArrayToString=function(){Le("'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF8ToString")||(h.UTF8ToString=function(){Le("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF8Array")||(h.stringToUTF8Array=function(){Le("'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF8")||(h.stringToUTF8=function(){Le("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"lengthBytesUTF8")||(h.lengthBytesUTF8=function(){Le("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF16ToString")||(h.UTF16ToString=function(){Le("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF16")||(h.stringToUTF16=function(){Le("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"lengthBytesUTF16")||(h.lengthBytesUTF16=function(){Le("'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"UTF32ToString")||(h.UTF32ToString=function(){Le("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stringToUTF32")||(h.stringToUTF32=function(){Le("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"lengthBytesUTF32")||(h.lengthBytesUTF32=function(){Le("'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"allocateUTF8")||(h.allocateUTF8=function(){Le("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackTrace")||(h.stackTrace=function(){Le("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnPreRun")||(h.addOnPreRun=function(){Le("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnInit")||(h.addOnInit=function(){Le("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnPreMain")||(h.addOnPreMain=function(){Le("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnExit")||(h.addOnExit=function(){Le("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addOnPostRun")||(h.addOnPostRun=function(){Le("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"writeStringToMemory")||(h.writeStringToMemory=function(){Le("'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"writeArrayToMemory")||(h.writeArrayToMemory=function(){Le("'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"writeAsciiToMemory")||(h.writeAsciiToMemory=function(){Le("'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"addRunDependency")||(h.addRunDependency=function(){Le("'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"removeRunDependency")||(h.removeRunDependency=function(){Le("'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"ENV")||(h.ENV=function(){Le("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"FS")||(h.FS=function(){Le("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"FS_createFolder")||(h.FS_createFolder=function(){Le("'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createPath")||(h.FS_createPath=function(){Le("'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createDataFile")||(h.FS_createDataFile=function(){Le("'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createPreloadedFile")||(h.FS_createPreloadedFile=function(){Le("'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createLazyFile")||(h.FS_createLazyFile=function(){Le("'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createLink")||(h.FS_createLink=function(){Le("'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_createDevice")||(h.FS_createDevice=function(){Le("'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"FS_unlink")||(h.FS_unlink=function(){Le("'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}),Object.getOwnPropertyDescriptor(h,"GL")||(h.GL=function(){Le("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"dynamicAlloc")||(h.dynamicAlloc=function(){Le("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"loadDynamicLibrary")||(h.loadDynamicLibrary=function(){Le("'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"loadWebAssemblyModule")||(h.loadWebAssemblyModule=function(){Le("'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getLEB")||(h.getLEB=function(){Le("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getFunctionTables")||(h.getFunctionTables=function(){Le("'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"alignFunctionTables")||(h.alignFunctionTables=function(){Le("'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"registerFunctions")||(h.registerFunctions=function(){Le("'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.addFunction=I,Object.getOwnPropertyDescriptor(h,"removeFunction")||(h.removeFunction=function(){Le("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getFuncWrapper")||(h.getFuncWrapper=function(){Le("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"prettyPrint")||(h.prettyPrint=function(){Le("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"makeBigInt")||(h.makeBigInt=function(){Le("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"dynCall")||(h.dynCall=function(){Le("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getCompilerSetting")||(h.getCompilerSetting=function(){Le("'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackSave")||(h.stackSave=function(){Le("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackRestore")||(h.stackRestore=function(){Le("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"stackAlloc")||(h.stackAlloc=function(){Le("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"establishStackSpace")||(h.establishStackSpace=function(){Le("'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"print")||(h.print=function(){Le("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"printErr")||(h.printErr=function(){Le("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"getTempRet0")||(h.getTempRet0=function(){Le("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"setTempRet0")||(h.setTempRet0=function(){Le("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.callMain=ti,Object.getOwnPropertyDescriptor(h,"abort")||(h.abort=function(){Le("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"Pointer_stringify")||(h.Pointer_stringify=function(){Le("'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),Object.getOwnPropertyDescriptor(h,"warnOnce")||(h.warnOnce=function(){Le("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}),h.writeStackCookie=ue,h.checkStackCookie=de,h.abortStackOverflow=he,Object.getOwnPropertyDescriptor(h,"ALLOC_NORMAL")||Object.defineProperty(h,"ALLOC_NORMAL",{configurable:!0,get:function(){Le("'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"ALLOC_STACK")||Object.defineProperty(h,"ALLOC_STACK",{configurable:!0,get:function(){Le("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"ALLOC_DYNAMIC")||Object.defineProperty(h,"ALLOC_DYNAMIC",{configurable:!0,get:function(){Le("'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"ALLOC_NONE")||Object.defineProperty(h,"ALLOC_NONE",{configurable:!0,get:function(){Le("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")}}),Object.getOwnPropertyDescriptor(h,"calledRun")||Object.defineProperty(h,"calledRun",{configurable:!0,get:function(){Le("'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")}});function ti(e){N(0==Ie,'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'),N(0==fe.length,"cannot call main when preRun functions remain to be called");var t=h._main;try{ni(t(0,0),!0)}catch(e){if(e instanceof ei)return;if("SimulateInfiniteLoop"==e)return void(o=!0);var r=e;e&&"object"==typeof e&&e.stack&&(r=[e,e.stack]),M("exception thrown: "+r),f(1,e)}finally{!0}}function ri(e){function t(){Gr||(Gr=!0,P||(be(),ve(),h.onRuntimeInitialized&&h.onRuntimeInitialized(),ai&&ti(),Ee()))}e=e||u,Ie>0||(ue(),ye(),Ie>0||(h.setStatus?(h.setStatus("Running..."),setTimeout((function(){setTimeout((function(){h.setStatus("")}),1),t()}),1)):t(),de()))}function ii(){var e=S,t=M,r=!1;S=M=function(e){r=!0};try{var i=h._fflush;i&&i(0),["stdout","stderr"].forEach((function(e){var t=ot.analyzePath("/dev/"+e);if(t){var i=t.object.rdev,n=rt.ttys[i];n&&n.output&&n.output.length&&(r=!0)}}))}catch(e){}S=e,M=t,r&&T("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.")}function ni(e,t){ii(),t&&o&&0===e||(o?t||M("program exited (with status: "+e+"), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)"):(P=!0,e,we(),h.onExit&&h.onExit(e)),f(e,new ei(e)))}if(De=function e(){Gr||ri(),Gr||(De=e)},h.run=ri,h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);h.preInit.length>0;)h.preInit.pop()();var ai=!0;h.noInitialRun&&(ai=!1),o=!0,ri()}var f=function(e){e.isFlvStream=!0,e.enableAudio=!1,e.pause=!1,e.exitFlag=!1,e.needMoreData=!1,e.wasmDecoderId=-1,e.wasmInitVideoDecoder=!1,e.wasmInitAudioDecoder=!1,e.videoQueue=[],e.audioQueue=[],e.videoFrameNum=0,e.videoRawData=null,e.audioRawData=null,e.videoPacketData=null,e.audioPacketData=null,e.findKeyFrame=!0,e.videoIntervalHandle=-1,e.videoIntervalValue=39,e.audioIntervalHandle=-1,e.audioIntervalValue=80,e.lastPTS=0,e.ptsCount=0,e.maxCacheFrameNum=0,e.calcDelayFlag=!0,e.procVideoFlag=!1,e.procAudioFlag=!1;var t=function(){null==e.videoRawData&&(e.videoRawData=h._malloc(16588800)),null==e.audioRawData&&(e.audioRawData=h._malloc(16384)),null==e.videoPacketData&&(e.videoPacketData=h._malloc(1048576)),null==e.audioPacketData&&(e.audioPacketData=h._malloc(2048)),e.wasmDecoderId<0&&(e.wasmDecoderId=h._WasmDecoder_OpenChannel())},r=function(t,r,i,n,a,o,u,d,l,f){if(e.procVideoFlag)return-1;e.procVideoFlag=!0,h.HEAPU8.set(d,e.videoPacketData);var c,p=s.G,m=0;if(p==s.G?m=0:p==s.E?m=2:p==s.F&&(m=26),1==t&&e.videoFrameNum>0&&(e.videoFrameNum-=1),1==t&&!e.wasmInitVideoDecoder&&i)0==h._WasmDecoder_OpenVideoDecoder(e.wasmDecoderId,r,0,0,m)&&(e.wasmInitVideoDecoder=!0);else if(2==t&&!e.wasmInitAudioDecoder){0==h._WasmDecoder_OpenAudioDecoder(e.wasmDecoderId,r,a,u,o)&&(e.wasmInitAudioDecoder=!0)}var g=null;if(1==t&&e.wasmInitVideoDecoder?g=h._WasmDecoder_DecodeVideoFrame(e.wasmDecoderId,e.videoPacketData,l,0,0,e.videoRawData,0):2==t&&e.wasmInitAudioDecoder&&e.enableAudio&&(g=h._WasmDecoder_DecodeAudioFrame(e.wasmDecoderId,e.videoPacketData,l,e.audioRawData,0)),0!=g&&null!=g){var _=h.HEAPU32[g/4],y=(h.HEAPU32[g/4+1],h.HEAPU32[g/4+2]),b=(h.HEAPU32[g/4+3],h.HEAPU32[g/4+4]),v=h.HEAPU32[g/4+5],w=(h.HEAPU32[g/4+6],h.HEAPU32[g/4+7]),E=h.HEAPU32[g/4+8],A=h.HEAPU32[g/4+9],S=h.HEAPU32[g/4+10],M=h.HEAPU32[g/4+11],T=(h.HEAPU32[g/4+12],h.HEAPU32[g/4+13]);if(y<1)return void(e.procVideoFlag=!1);if(1==_){0==m?c=b*v*3/2:2==m?c=b*v*3:(25==m||26==m)&&(c=b*v*4);var R=h.HEAPU8.subarray(e.videoRawData,e.videoRawData+c),k=new Uint8Array(R),I={cmd:s.q,workerId:s.a,mediaType:1,ts:T,width:b,height:v,framesize:l,rawsize:c,fps:w,interval:E,playTimeSec:n,frameNum:e.videoFrameNum,dat:k,sei:f};if(e.postMessage(I,[I.dat.buffer]),b>=1920&&v>=720)return e.procVideoFlag=!1,1}else if(2==_){R=h.HEAPU8.subarray(e.audioRawData,e.audioRawData+y),k=new Uint8Array(R);var O=0;8==M?O=0:16==M?O=1:32==M&&(O=2);I={cmd:s.q,workerId:s.a,mediaType:2,fmt:O,ch:A,samplerate:S,ts:T,framesize:y,dat:k};e.postMessage(I,[I.dat.buffer])}}return e.procVideoFlag=!1,0},i=function(t,r,i,n,a,o){(h.HEAPU8.set(a,e.audioPacketData),e.wasmInitAudioDecoder)||0==h._WasmDecoder_OpenAudioDecoder(e.wasmDecoderId,t,r,n,i)&&(e.wasmInitAudioDecoder=!0);var u=null;if(e.wasmInitAudioDecoder&&e.enableAudio&&(u=h._WasmDecoder_DecodeAudioFrame(e.wasmDecoderId,e.audioPacketData,o,e.audioRawData,0)),0!=u&&null!=u){h.HEAPU32[u/4],h.HEAPU32[u/4+1];var d=h.HEAPU32[u/4+2],l=(h.HEAPU32[u/4+3],h.HEAPU32[u/4+4],h.HEAPU32[u/4+5],h.HEAPU32[u/4+6],h.HEAPU32[u/4+7],h.HEAPU32[u/4+8],h.HEAPU32[u/4+9]),f=h.HEAPU32[u/4+10],c=h.HEAPU32[u/4+11],p=(h.HEAPU32[u/4+12],h.HEAPU32[u/4+13]);if(d<1)return;var m=h.HEAPU8.subarray(e.audioRawData,e.audioRawData+d),g=new Uint8Array(m),_=0;8==c?_=0:16==c?_=1:32==c&&(_=2);var y={cmd:s.q,workerId:s.a,mediaType:2,fmt:_,ch:l,samplerate:f,ts:p,framesize:d,dat:g};e.postMessage(y,[y.dat.buffer])}},n=function(){if(e.wasmDecoderId<0&&t(),e.wasmDecoderId>0&&e.videoQueue.length>0&&!e.pause){var i=null,n=-1;if(e.isFlvStream){if(e.findKeyFrame)for(;e.videoQueue.length>0;){if((i=e.videoQueue[0]).frameType&&e.videoQueue.length<120){e.findKeyFrame=!1;break}e.videoQueue.shift()}else e.videoQueue.length>120&&(e.findKeyFrame=!0);e.videoQueue.length>0&&(null==i&&(i=e.videoQueue[0]),n=r(i.mediaType,i.codecId,i.frameType,i.playTimeSec,i.samplerate,i.channelNum,i.bitPerSample,i.dat,i.dat.length,i.sei))}else i=e.videoQueue[0],n=r(i.mediaType,i.codecId,i.frameType,i.playTimeSec,i.samplerate,i.channelNum,i.bitPerSample,i.dat,i.dat.length);n>=0&&e.videoQueue.shift(),e.videoQueue.length>e.maxCacheFrameNum&&e.videoQueue.length}},a=function(){if(!(e.wasmDecoderId<0)&&e.wasmDecoderId>0)for(;e.audioQueue.length>0&&!e.pause;)if(!e.pause){var t=e.audioQueue[0];e.enableAudio&&i(t.codecId,t.samplerate,t.channelNum,t.bitPerSample,t.dat,t.dat.length),e.audioQueue.shift()}};h.onRuntimeInitialized=function(){e.videoIntervalHandle<0&&(e.videoIntervalHandle=setInterval(n,e.videoIntervalValue)),e.audioIntervalHandle<0&&(e.audioIntervalHandle=setInterval(a,e.audioIntervalValue));var t={cmd:s.n};e.postMessage(t),u=!0},h.onExit=function(){};var c=function(t){if(t>e.lastPTS)if(e.lastPTS>0){if(e.videoQueue.length%5==0){var r=e.ptsCount/5;e.videoQueue.length<=e.maxCacheFrameNum&&function(t){if(u){var r=t;(r<5||r>500)&&(r=40),r!=e.videoIntervalValue&&(e.videoIntervalHandle>=0&&(clearInterval(e.videoIntervalHandle),e.videoIntervalHandle=-1),e.videoIntervalValue=Math.floor(r),e.videoIntervalHandle=setInterval(n,e.videoIntervalValue))}}(r),e.ptsCount=t-e.lastPTS}else e.ptsCount+=t-e.lastPTS;e.lastPTS=t}else e.lastPTS=t,e.ptsCount=40;else e.lastPTS=t,e.ptsCount=40};e.addEventListener("message",(function(r){var i=r.data;switch(i.cmd){case s.w:d=i.url,e.isFlvStream=i.isFlv,u||l();break;case s.l:e.exitFlag=!0,f=null,e.videoIntervalHandle>=0&&(clearInterval(e.videoIntervalHandle),e.videoIntervalHandle=-1),e.audioIntervalHandle>=0&&(clearInterval(e.audioIntervalHandle),e.audioIntervalHandle=-1),e.wasmDecoderId>0&&(h._WasmDecoder_CloseChannel(e.wasmDecoderId),e.wasmDecoderId=-1),null!=e.videoRawData&&(h._free(e.videoRawData),e.videoRawData=null),null!=e.audioRawData&&(h._free(e.audioRawData),e.audioRawData=null),null!=e.videoPacketData&&(h._free(e.videoPacketData),e.videoPacketData=null),null!=e.audioPacketData&&(h._free(e.audioPacketData),e.audioPacketData=null),e.videoQueue.clear,e.videoQueue=[],e.videoQueue.length=0,e.videoFrameNum=0,e.audioQueue.clear,e.audioQueue=[],e.audioQueue.length=0,delete h.HEAP8,delete h.HEAP16,delete h.HEAP32,delete h.HEAPF32,delete h.HEAPF64,delete h.HEAPU8,delete h.HEAPU16,delete h.HEAPU32,delete h.buffer,h.HEAP8=null,h.HEAP16=null,h.HEAP32=null,h.HEAPF32=null,h.HEAPF64=null,h.HEAPU8=null,h.HEAPU16=null,h.HEAPU32=null,h.buffer=null,o=!1,h.callMain("exit"),h=null;var n={cmd:s.l,workerId:s.a};e.postMessage(n),close();break;case s.v:e.enableAudio=!0;break;case s.k:e.enableAudio=!1;break;case s.x:e.pause=!0;break;case s.A:e.pause=!1;break;case s.B:e.videoQueue.clear,e.videoQueue=[],e.videoQueue.length=0,e.videoFrameNum=0,e.audioQueue.clear,e.audioQueue=[],e.audioQueue.length=0;break;case s.D:e.updateIntervalTime(i.interval);break;case s.q:if(e.exitFlag)break;u?e.isFlvStream?(e.wasmDecoderId<0&&t(),e.wasmDecoderId>0?1==i.mediaType?e.videoIntervalHandle>=0&&(e.videoQueue.push(i),e.maxCacheFrameNum=5):2==i.mediaType&&e.audioIntervalHandle>=0&&!e.findKeyFrame&&e.audioQueue.push(i):e.videoQueue.length<100&&1==i.mediaType&&i.frameType&&e.videoIntervalHandle>=0&&(e.videoQueue.push(i),e.videoQueue.length>=5&&e.videoQueue.shift())):(1==i.mediaType?e.videoIntervalHandle>=0&&(e.videoQueue.push(i),c(i.samplerate),e.videoFrameNum+=1,e.calcDelayFlag&&e.maxCacheFrameNum<e.videoQueue.length?e.maxCacheFrameNum=e.videoQueue.length:e.calcDelayFlag&&(e.calcDelayFlag=!1)):2==i.mediaType&&e.audioIntervalHandle>=0&&e.audioQueue.push(i),e.needMoreData=!1):e.isFlvStream&&e.videoQueue.length<5?1==i.mediaType&&i.frameType&&e.videoIntervalHandle>=0&&(e.videoQueue.push(i),e.videoQueue.length>=5&&e.videoQueue.shift()):!e.isFlvStream&&e.videoQueue.length<1e3&&(1==i.mediaType?e.videoIntervalHandle>=0&&(e.videoQueue.push(i),c(i.samplerate),e.videoFrameNum+=1,e.calcDelayFlag&&e.maxCacheFrameNum<e.videoQueue.length?e.maxCacheFrameNum=e.videoQueue.length:e.calcDelayFlag&&(e.calcDelayFlag=!1)):2==i.mediaType&&e.audioIntervalHandle>=0&&e.audioQueue.push(i))}}))};t.default=f;var c=h,p=l,m=u}.call(this,r(9),"/",r(68)(e),r(10).Buffer)},function(e,t,r){"use strict";r.r(t);var i=r(43),n=r(37),a={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,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};function o(){return Object.assign({},a)}var s=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new n.a({},o()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.a({},o()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var r=e.videoElement.canPlayType(t);return"probably"===r||"maybe"==r},e.getFeatureList=function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}(),u=r(3),d=(r(128),r(8)),h=r.n(d),l=r(0),f=r(7),c={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"},p=r(21),m=r.n(p),g=r(19),_=r(36),y=r(2),b=r(17),v=r(1),w={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full",UPDATE_PLAY_INFO:"update_play_info",CHANGE_SPEED:"change_speed",SOURCE_ENDED:"source_ended",RECORDING_END:"recording_end"},E=function(){function e(e){this.gl=e,this.texture=null}var t=e.prototype;return t.create=function(){var e=this.gl;this.texture=e.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE)},t.bind=function(e,t,r){this.gl.activeTexture([this.gl.TEXTURE0,this.gl.TEXTURE1,this.gl.TEXTURE2,this.gl.TEXTURE3][e]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),this.gl.uniform1i(this.gl.getUniformLocation(t,r),e)},t.fill=function(e,t,r){this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,e,t,0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,r)},e}(),A=function(){function e(e){this.enableTextTexture=0,this.canvas=e,this.gl=null,this.program=null,this.gl=e.getContext("webgl")||e.getContext("experimental-webgl"),this.yuv_vertex_shader_source=["attribute highp vec4 aVertexPosition;","attribute vec2 aTextureCoord;","varying highp vec2 vTextureCoord;","void main(void) {"," gl_Position = aVertexPosition;"," vTextureCoord = aTextureCoord;","}"],this.yuv_fragment_shader_source=["precision highp float;","varying lowp vec2 vTextureCoord;","uniform sampler2D YTexture;","uniform sampler2D UTexture;","uniform sampler2D VTexture;","uniform sampler2D TTexture;","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) {"," gl_FragColor = mix(vec4( texture2D(YTexture, vTextureCoord).x, texture2D(UTexture, vTextureCoord).x, texture2D(VTexture, vTextureCoord).x, 1) * YUV2RGB, texture2D(TTexture, vTextureCoord), 0.1);","}"],this.vertex_shader_source="\n attribute vec4 apos;\n void main(){\n gl_Position = apos;\n }",this.frag_shader_source="\n void main(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n }",this.yuv_program=null,this.sei_program=null,this.index=0}var t=e.prototype;return t.initSEIProgram=function(){var e=this.gl,t=e.createShader(e.VERTEX_SHADER),r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(t,this.vertex_shader_source),e.shaderSource(r,this.frag_shader_source),e.compileShader(t),e.compileShader(r),this.sei_program=e.createProgram(),e.attachShader(this.sei_program,t),e.attachShader(this.sei_program,r),e.linkProgram(this.sei_program)},t.drawSEI=function(e){var t=this.gl,r=[];if(null!==e)try{if("string"==typeof e&&(e=JSON.parse(e)),!e||!e.length)return;e.forEach((function(e){var t=parseFloat((2*e.x1-1).toFixed(3)),i=parseFloat((1-2*e.y1).toFixed(3)),n=parseFloat((2*e.x2-1).toFixed(3)),a=parseFloat((1-2*e.y2).toFixed(3));r=[].concat(r,[t,i,t,a,n,a,n,i],[t-.001,i+.001,t-.001,a-.001,n+.001,a-.001,n+.001,i+.001])}));var i=new Float32Array(r);if(!i.length)return;t.useProgram(this.sei_program);var n=t.getAttribLocation(this.sei_program,"apos"),a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n);for(var o=0;o<i.length/2;o+=4)t.drawArrays(t.LINE_LOOP,o,4)}catch(e){}},t.initYUVProgram=function(){var e=this.gl;if(!this.gl)return console.log("[ER] WebGL not supported.");e.pixelStorei(e.UNPACK_ALIGNMENT,1),this.yuv_program=e.createProgram();var t=e.createShader(e.VERTEX_SHADER),r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(t,this.yuv_vertex_shader_source.join("\n")),e.shaderSource(r,this.yuv_fragment_shader_source.join("\n")),e.compileShader(t),e.compileShader(r),e.attachShader(this.yuv_program,t),e.attachShader(this.yuv_program,r),e.linkProgram(this.yuv_program)},t.drawYUV=function(e,t,r,i,n){var a=this.gl;if(a.useProgram(this.yuv_program),!a.getProgramParameter(this.yuv_program,a.LINK_STATUS))return console.log("[ER] Shader link failed.");var o=a.getAttribLocation(this.yuv_program,"aVertexPosition");a.enableVertexAttribArray(o);var s=a.getAttribLocation(this.yuv_program,"aTextureCoord");a.enableVertexAttribArray(s);var u=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0]),a.STATIC_DRAW),a.vertexAttribPointer(o,3,a.FLOAT,!1,0,0);var d=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,d),a.bufferData(a.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),a.STATIC_DRAW),a.vertexAttribPointer(s,2,a.FLOAT,!1,0,0),a.y=new E(a),a.y.create(0,null),a.u=new E(a),a.u.create(0,null),a.v=new E(a),a.v.create(0,null),a.y.bind(0,this.yuv_program,"YTexture"),a.u.bind(1,this.yuv_program,"UTexture"),a.v.bind(2,this.yuv_program,"VTexture"),a.y.fill(t,r,e.subarray(0,i)),a.u.fill(t>>1,r>>1,e.subarray(i,i+n)),a.v.fill(t>>1,r>>1,e.subarray(i+n,e.length)),a.drawArrays(a.TRIANGLE_STRIP,0,4)},t.initGL=function(){this.initYUVProgram(),this.initSEIProgram()},t.renderFrame=function(e,t,r,i,n,a){if(!this.gl)return console.log("[ER] Render frame failed due to WebGL not supported.");var o=this.gl;o.viewport(0,0,o.canvas.width,o.canvas.height),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),e&&(this.drawYUV(e,t,r,i,n),this.drawSEI(a))},t.renderVideoFrame=function(e,t,r,i){if(this.gl&&e)if(t<1||r<1){var n=this.gl,a=new Uint8Array(n.canvas.width*n.canvas.height*3/2),o=0,s=n.canvas.width*n.canvas.height,u=n.canvas.width*n.canvas.height*5/4,d=a.byteLength;for(o=s;o<u;o++)a[o]=128;for(o=u;o<d;o++)a[o]=128;var h=n.canvas.width*n.canvas.height,l=n.canvas.width/2*(n.canvas.height/2);this.renderFrame(a,n.canvas.width,n.canvas.height,h,l,i)}else{var f=t*r,c=t/2*(r/2);this.renderFrame(e,t,r,f,c,i)}},t.destroy=function(){this.gl&&(this.gl.deleteTexture(this.gl.y.texture),this.gl.deleteTexture(this.gl.u.texture),this.gl.deleteTexture(this.gl.v.texture),this.yuv_program=null,this.sei_program=null,this.gl=null)},e}(),S=function(){function e(){this._pause=!1,this.stopFlag=!1,this.bufferSourcePtr=null}var t=e.prototype;return t.destroy=function(){this.interval&&clearInterval(this.interval),this.samples=null,this.audioCtx.close(),this.audioCtx=null},t.init=function(e){this.option=Object.assign({},{encoding:"16bitInt",channels:2,sampleRate:8e3,flushingTime:1e3},e,{sampleRate:8e3===e.sampleRate?16e3:e.sampleRate}),this.samples=new Float32Array,this.flush=this.flush.bind(this),this.interval=setInterval(this.flush,this.option.flushingTime),this.maxValue=this.getMaxValue(),this.typedArray=this.getTypedArray(),this.createContext()},t.getMaxValue=function(){var e={"8bitInt":128,"16bitInt":32768,"32bitInt":2147483648,"32bitFloat":1};return e[this.option.encoding]?e[this.option.encoding]:e["16bitInt"]},t.getTypedArray=function(){var e={"8bitInt":Int8Array,"16bitInt":Int16Array,"32bitInt":Int32Array,"32bitFloat":Float32Array};return e[this.option.encoding]?e[this.option.encoding]:e["16bitInt"]},t.createContext=function(){this.audioCtx=new(window.AudioContext||window.webkitAudioContext),this.gainNode=this.audioCtx.createGain(),this.gainNode.gain.value=1,this.gainNode.connect(this.audioCtx.destination),this.startTime=this.audioCtx.currentTime},t.isTypedArray=function(e){return e.byteLength&&e.buffer&&e.buffer.constructor==ArrayBuffer},t.feed=function(e){if(this.isTypedArray(e)){e=this.getFormatedValue(e);var t=new Float32Array(this.samples.length+e.length);t.set(this.samples,0),t.set(e,this.samples.length),this.samples=t}},t.getFormatedValue=function(e){e=new this.typedArray(e.buffer);var t,r=new Float32Array(e.length);for(t=0;t<e.length;t++)r[t]=e[t]/this.maxValue;return r},t.volume=function(e){this.gainNode.gain.value=e},t.flush=function(){if(null!=this.samples&&this.samples.length){var e,t,r,i,n,a=this.audioCtx.createBufferSource(),o=this.samples.length/this.option.channels,s=this.audioCtx.createBuffer(this.option.channels,o,this.option.sampleRate);for(t=0;t<this.option.channels;t++)for(e=s.getChannelData(t),r=t,n=50,i=0;i<o;i++)e[i]=this.samples[r],i<50&&(e[i]=e[i]*i/50),i>=o-51&&(e[i]=e[i]*n--/50),r+=this.option.channels;this.startTime<this.audioCtx.currentTime&&(this.startTime=this.audioCtx.currentTime),a.buffer=s,a.connect(this.gainNode),a.start(this.startTime),this.startTime+=s.duration,this.samples=new Float32Array}},t.getTimestamp=function(){return this.audioCtx?this.audioCtx.currentTime:0},t.play=function(e){if(null!=this.audioCtx&&!this._pause){if("running"!==this.audioCtx.state)return this.audioCtx.resume();if(this.isTypedArray(e)&&(e=this.getFormatedValue(e)).length){this.stopFlag=!1;var t,r,i,n,a,o,s=this.audioCtx.createBufferSource(),u=e.length/this.option.channels;try{t=this.audioCtx.createBuffer(this.option.channels,u,this.option.sampleRate)}catch(e){console.log("audioBuffer",e)}for(i=0;i<this.option.channels;i++)for(r=t.getChannelData(i),n=i,o=50,a=0;a<u;a++)r[a]=e[n],a<50&&(r[a]=r[a]*a/50),a>=u-51&&(r[a]=r[a]*o--/50),n+=this.option.channels;this.startTime<this.audioCtx.currentTime&&(this.startTime=this.audioCtx.currentTime),s.buffer=t,s.connect(this.gainNode),s.start(this.startTime),this.startTime+=t.duration,this.bufferSourcePtr=s}}},t.clearAudioBuffer=function(){this.stopFlag=!0,this.bufferSourcePtr&&this.bufferSourcePtr.stop(0)},t.pause=function(){this._pause=!0,null!=this.audioCtx&&"running"===this.audioCtx.state&&this.audioCtx.suspend()},t.resume=function(){this._pause=!1,null!=this.audioCtx&&"suspended"===this.audioCtx.state&&this.audioCtx.resume()},e}();function M(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */M=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},n=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,i){var n=t&&t.prototype instanceof l?t:l,a=Object.create(n.prototype),o=new A(i||[]);return a._invoke=function(e,t,r){var i="suspendedStart";return function(n,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===n)throw a;return T()}for(r.method=n,r.arg=a;;){var o=r.delegate;if(o){var s=v(o,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var u=d(e,t,r);if("normal"===u.type){if(i=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i="completed",r.method="throw",r.arg=u.arg)}}}(e,r,o),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function l(){}function f(){}function c(){}var p={};s(p,n,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(S([])));g&&g!==t&&r.call(g,n)&&(p=g);var _=c.prototype=l.prototype=Object.create(p);function y(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(n,a){function o(){return new t((function(i,o){!function i(n,a,o,s){var u=d(e[n],e,a);if("throw"!==u.type){var h=u.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(l).then((function(e){h.value=e,o(h)}),(function(e){return i("throw",e,o,s)}))}s(u.arg)}(n,a,i,o)}))}return i=i?i.then(o,o):o()}}function v(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,v(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var n=i.arg;return n?n.done?(t[e.resultName]=n.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):n:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function S(e){if(e){var t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function t(){for(;++i<e.length;)if(r.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:T}}function T(){return{value:void 0,done:!0}}return f.prototype=c,s(_,"constructor",c),s(c,"constructor",f),f.displayName=s(c,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,s(e,o,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},y(b.prototype),s(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,i,n,a){void 0===a&&(a=Promise);var o=new b(u(t,r,i,n),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},y(_),s(_,o,"Generator"),s(_,n,(function(){return this})),s(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var i=t.pop();if(i in e)return r.value=i,r.done=!1,r}return r.done=!0,r}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function i(r,i){return o.type="throw",o.arg=e,t.next=r,i&&(t.method="next",t.arg=void 0),!!i}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;E(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function T(e,t,r,i,n,a,o){try{var s=e[a](o),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(i,n)}var R=function(){function e(e,t,r){var i=this;if(this.TAG="Transmuxer",this._emitter=new h.a,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=m()(228),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)},g.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:g.a.getConfig()})}catch(r){l.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new _.a(e,t)}else this._controller=new _.a(e,t);if(this._controller){var n=this._controller;n.on(y.a.IO_ERROR,this._onIOError.bind(this)),n.on(y.a.DEMUX_ERROR,this._onDemuxError.bind(this)),n.on(y.a.INIT_SEGMENT,this._onInitSegment.bind(this)),n.on(y.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),n.on(y.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),n.on(y.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),n.on(y.a.MEDIA_INFO,this._onMediaInfo.bind(this)),n.on(y.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),n.on(y.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),n.on(y.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),n.on(y.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this)),n.on(y.a.SEI_DATA,this._onReceiveSEIData.bind(this)),n.on(y.a.AUDIO_ERROR,this._onAudioError.bind(this)),n.on(y.a.SOCKET_CLOSE,(function(){return i._emitter.emit(w.SOURCE_ENDED)})),n.on(y.a.RECORDING,(function(e){i._emitter.emit(y.a.RECORDING,e)})),n.on("loaderChunkArrival",(function(e){return i._emitter.emit("loaderChunkArrival",e)})),n.on("hls_error",(function(){return i._emitter.emit("hls_error")}))}this._wasmDecodeWoker=null,this._wasmRecordingWoker=null,this._mediaCanvas=null,this._mediaElement=r,this._webGLPlayer=null,this._isH265=!1,this._totalDuration=0,this._initDuration=0,this._currentPlayTime=0,this.snapshotTimer=null,this.loadingCompleteTimer=null,this._wasmMuted=!0,this._isFlv=e.url.includes(".flv"),this._videoRecordFindKeyframe=!0,this._videoRecordFileName="record.mp4",this._wasmVideoRecordWorker=null,this._videoRecordiInitFlag=!1,this._wasmAudioPlayer=null,this._wasmAudioFmt=0,this._wasmAudioSamplerate=0,this._wasmAudioChannelNum=1,this._wasmInitAudioPlayer=!1,this._wasmRecordingCb=null}var t=e.prototype;return t.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),g.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._wasmDecodeWoker&&(this._wasmDecodeWoker.removeAllListeners&&this._wasmDecodeWoker.removeAllListeners(),this._wasmDecodeWoker.postMessage({cmd:v.l}),this._wasmDecodeWoker&&this._wasmDecodeWoker.terminate(),this._wasmDecodeWoker=null),this._wasmRecordingWoker&&(this._wasmRecordingWoker.removeAllListeners&&this._wasmRecordingWoker.removeAllListeners(),this._wasmRecordingWoker.postMessage({cmd:v.l}),this._wasmRecordingWoker&&this._wasmRecordingWoker.terminate(),this._wasmRecordingWoker=null),this._emitter.removeAllListeners(),this._emitter=null,this._mediaCanvas&&this._mediaCanvas.parentNode.removeChild(this._mediaCanvas),this._mediaCanvas=null,this._mediaElement=null,this._webGLPlayer=null,this.snapshotTimer&&clearTimeout(this.snapshotTimer),this.loadingCompleteTimer&&clearTimeout(this.loadingCompleteTimer),this.snapshotTimer=null,this.loadingCompleteTimer=null,this._wasmAudioPlayer=null,this._wasmRecordingCb=null},t.on=function(e,t){this._emitter.addListener(e,t)},t.off=function(e,t){this._emitter.removeListener(e,t)},t.hasWorker=function(){return null!=this._worker},t.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):(this._controller.setReceiveH265MediaFrame(this._onReceiveH265MediaFrame.bind(this)),this._controller.start())},t.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},t.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},t.pause=function(){if(this._isH265){var e={cmd:v.x};this._wasmDecodeWoker&&void 0!==this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(e)}else this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},t.resume=function(){if(this._isH265){var e={cmd:v.A};this._wasmDecodeWoker&&void 0!==this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(e)}else this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},t._onInitSegment=function(e,t){var r=this;Promise.resolve().then((function(){r._emitter.emit(y.a.INIT_SEGMENT,e,t)}))},t._onMediaSegment=function(e,t){var r=this;Promise.resolve().then((function(){r._emitter.emit(y.a.MEDIA_SEGMENT,e,t)}))},t._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(y.a.LOADING_COMPLETE)}))},t._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(y.a.RECOVERED_EARLY_EOF)}))},t._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.a.MEDIA_INFO,e)}))},t._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.a.METADATA_ARRIVED,e)}))},t._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.a.SCRIPTDATA_ARRIVED,e)}))},t._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.a.STATISTICS_INFO,e)}))},t._onIOError=function(e,t){var r=this;Promise.resolve().then((function(){r._emitter.emit(y.a.IO_ERROR,e,t)}))},t._onDemuxError=function(e,t){var r=this;Promise.resolve().then((function(){r._emitter.emit(y.a.DEMUX_ERROR,e,t)}))},t._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.a.RECOMMEND_SEEKPOINT,e)}))},t._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(y.a.RECOMMEND_SEEKPOINT,e)}))},t._encodedH265=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(y.a.IS_ENCODED_H265,e._isH265)}))},t._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},t._onWorkerMessage=function(e){var t=e.data,r=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case y.a.INIT_SEGMENT:case y.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,r.type,r.data);break;case y.a.LOADING_COMPLETE:case y.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case y.a.MEDIA_INFO:Object.setPrototypeOf(r,b.a.prototype),this._emitter.emit(t.msg,r);break;case y.a.METADATA_ARRIVED:case y.a.SCRIPTDATA_ARRIVED:case y.a.STATISTICS_INFO:this._emitter.emit(t.msg,r);break;case y.a.IO_ERROR:case y.a.DEMUX_ERROR:this._emitter.emit(t.msg,r.type,r.info);break;case y.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,r);break;case"logcat_callback":l.a.emitter.emit("log",r.type,r.logcat)}},t._onReceiveSEIData=function(e){this._emitter.emit(y.a.SEI_DATA,e)},t._onAudioError=function(){this._emitter.emit(y.a.AUDIO_ERROR)},t._creatCanvas=function(){var e=this;this._mediaElement.parentNode.style.position="relative";var t=document.createElement("canvas");t.style="width:100%;height:100%;position:absolute;top:0px;left:0px;display:none",this._mediaCanvas=t,this._mediaElement.parentNode.appendChild(this._mediaCanvas),this._mediaCanvas.ondblclick=function(){return e._emitter.emit(y.a.ON_DBL_CLICK)}},t._onReceiveH265MediaFrame=function(){var e,t=(e=M().mark((function e(t,r,i,n,a,o,s,u,d,h,l,f){var c,p,m,g;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isH265||(this._isH265=!0,this._encodedH265(),this._creatCanvas()),!(n<1)||r||1!==s){e.next=3;break}return e.abrupt("return");case 3:if(2===i&&(this._wasmAudioSamplerate=d||0,this._wasmAudioChannelNum=h),null!==this._wasmDecodeWoker){e.next=7;break}return e.next=7,this._createWasmDecodeWorker();case 7:if(!this._wasmDecodeWoker){e.next=15;break}if(c=new Uint8Array(o),p={cmd:v.q,mediaType:i,codecId:n,frameType:a,samplerate:d,channelNum:h,bitPerSample:l,playTimeSec:u,dat:c,sei:f},this._wasmDecodeWoker.postMessage(p,[p.dat.buffer]),this._videoRecordiInitFlag){e.next=13;break}return e.abrupt("return");case 13:1==a&&(this._videoRecordFindKeyframe=!1),this._wasmVideoRecordWorker&&!this._videoRecordFindKeyframe&&(m=new Uint8Array(o),g={cmd:v.q,mediaType:"video",type:1==a,dat:m,pts:u},1===i?(g.mediaType="video",g.codecId="0xAE"):2===i&&(g.mediaType="audio"),this._wasmVideoRecordWorker.postMessage(g,[g.dat.buffer]));case 15:case"end":return e.stop()}}),e,this)})),function(){var t=this,r=arguments;return new Promise((function(i,n){var a=e.apply(t,r);function o(e){T(a,i,n,o,s,"next",e)}function s(e){T(a,i,n,o,s,"throw",e)}o(void 0)}))});return function(e,r,i,n,a,o,s,u,d,h,l,f){return t.apply(this,arguments)}}(),t._createWasmDecodeWorker=function(){if("undefined"!=typeof Worker)try{"none"===this._mediaCanvas.style.display&&(this._mediaCanvas.style.display="block"),this._wasmDecodeWoker=m()(229);var e=v.g(),t=window.localStorage.getItem("electron_config");if(e.startsWith("app://./"))if(t)e=JSON.parse(t).baseURL+"/";else e="http://demo.easycvr.com:4443/";var r={url:e,isFlv:this._isFlv,cmd:v.w};this._wasmDecodeWoker.postMessage(r),this._wasmDecodeWoker.addEventListener("message",this._onWasmWorkerMessage.bind(this)),this._wasmDecodeWoker.onerror=function(e){}}catch(e){this._wasmDecodeWoker=null}else this._wasmDecodeWoker=null;this._wasmDecodeWoker&&null==this._webGLPlayer&&(this._webGLPlayer=new A(this._mediaCanvas),this._webGLPlayer&&this._webGLPlayer.initGL({preserveDrawingBuffer:!1}))},t._onWasmWorkerMessage=function(e){var t=e.data;switch(t.cmd){case v.o:case v.l:break;case v.n:this._wasmMuted||this._openWasmAudio();break;case v.q:if(t.workerId===v.a)if(1===t.mediaType){if(this._mediaCanvas&&(this._mediaCanvas.width=t.width),this._mediaCanvas&&(this._mediaCanvas.height=t.height),t.playTimeSec>0){var r=Math.floor((t.playTimeSec+1e3)/1e3);this._currentPlayTime!==r&&(this._initDuration>0&&(this._currentPlayTime+=r-this._initDuration),this._initDuration!==r&&(this._initDuration=r,this._emitter&&this._emitter.emit(w.UPDATE_PLAY_INFO)))}this._webGLPlayer&&this._webGLPlayer.renderVideoFrame(t.dat,t.width,t.height,t.sei)}else 2===t.mediaType&&(null===this._wasmAudioPlayer?this._creatWasmAudioPlayer(t.fmt,t.samplerate>=16e3?2:t.ch,t.samplerate):(this._wasmAudioFmt=t.fmt,this._wasmAudioSamplerate=t.samplerate,this._wasmAudioChannelNum=t.ch,44100==this._wasmAudioSamplerate&&(this._wasmAudioFmt=1)),!this._wasmMuted&&this._wasmAudioPlayer&&this._wasmInitAudioPlayer&&this._wasmAudioPlayer.play(t.dat));break;case v.m:break;case v.w:this._videoRecordiInitFlag=!0,this._videoRecordFindKeyframe=!0;break;case v.p:this._videoRecordiInitFlag=!1;var i=document.createElement("a");i.style.display="none",i.href=t.dat,i.download=this._videoRecordFileName,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(i.href),document.body.removeChild(i),this._videoRecordFindKeyframe=!1,this._wasmVideoRecordWorker.terminate(),this._wasmVideoRecordWorker=null,this._wasmRecordingCb(),this._wasmRecordingCb=null}},t._creatWasmAudioPlayer=function(e,t,r){if(null===this._wasmAudioPlayer){1;var i="16bitInt";i="16bitInt",this._wasmAudioPlayer=new S,this._wasmAudioPlayer.init({encoding:i,channels:t,sampleRate:r,flushingTime:1e3}),this._wasmInitAudioPlayer=!0}},t._getCurrentPlayTime=function(){return this._currentPlayTime},t._getTotalDuration=function(){if(this._controller)return this._controller._getHLSTotalDuration()},t._seekToSecs=function(e,t){var r={cmd:v.B,type:t,time:e};this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(r),this._controller._seekToSecs(e,t)},t.saveLocalSnapshot=function(e){var t=this,r=this._mediaCanvas.toDataURL("image/jpg",1);if(r.length<786432)return this.snapshotTimer=setTimeout((function(){return t.saveLocalSnapshot(e)}),40);this.snapshotTimer&&clearTimeout(this.snapshotTimer),this.snapshotTimer=null;var i=document.createElement("a");i.download=(e||"easy-player")+"-"+(new Date).getTime(),i.href=r,document.body.appendChild(i),i.click(),i.remove()},t.saveImageDateURL=function(){return this._mediaCanvas.toDataURL("image/jpg",1)},t.videoRecording=function(e,t,r,i){if(i&&(this._wasmRecordingCb=i),this._wasmDecodeWoker)if(1===r){if(this._videoRecordFileName=e,this._videoRecordingCB=i,null===this._wasmVideoRecordWorker){this._videoRecordFindKeyframe=!0;try{this._wasmVideoRecordWorker=m()(67),this.onwmsg=this._onWasmWorkerMessage.bind(this);var n={cmd:v.w,url:v.g(),filesize:t,audioSamplerate:this._wasmAudioSamplerate,channelCount:this._wasmAudioChannelNum};this._wasmVideoRecordWorker.postMessage(n),this._wasmVideoRecordWorker.addEventListener("message",this.onwmsg)}catch(e){this._wasmVideoRecordWorker&&this._wasmVideoRecordWorker.terminate(),this._wasmVideoRecordWorker=null}}}else this._videoRecordiInitFlag=!1,this._wasmVideoRecordWorker&&(this._wasmVideoRecordWorker.postMessage({cmd:v.C}),this._videoRecordFindKeyframe=!0);else{if(!this._controller)return;this._controller.videoRecording(e,t,r,i)}},t._openWasmAudio=function(){this._wasmDecodeWoker&&(this._wasmDecodeWoker.postMessage({cmd:v.v}),this._wasmMuted=!1,null===this._wasmAudioPlayer&&(this._wasmAudioSamplerate>0?(console.log("_openWasmAudio...."),this._creatWasmAudioPlayer(this._wasmAudioFmt,this._wasmAudioSamplerate>=16e3?2:this._wasmAudioChannelNum,this._wasmAudioSamplerate)):console.log("采样率无效")))},t._closeWasmAudio=function(){this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage({cmd:v.k}),this._wasmAudioPlayer&&this._wasmInitAudioPlayer&&this._wasmAudioPlayer.clearAudioBuffer(),this._wasmMuted=!1},e}(),k=r(16),I=r(4),O=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new h.a,this._config.isLive&&null==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 k.a,this._pause=!1,this._hlsSeekTime=0,this._lastPlayTime=0,this._currentPlayTime=0,this._audioError=!1}var t=e.prototype;return t.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},t.on=function(e,t){this._emitter.addListener(e,t)},t.off=function(e,t){this._emitter.removeListener(e,t)},t.attachMediaElement=function(e){var t=this;if(this._mediaSource)throw new I.a("MediaSource has been attached to an HTMLMediaElement!");var r=this._mediaSource=new window.MediaSource;r.addEventListener("sourceopen",this.e.onSourceOpen),r.addEventListener("sourceended",this.e.onSourceEnded),r.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),this._mediaElement.src=this._mediaSourceObjectURL,e.addEventListener("timeupdate",(function(){var r=Math.floor(e.currentTime);t._hlsSeekTime>0&&(r=r-self._lastPlayTime+self._hlsSeekTime),t._currentPlayTime!==r&&(t._currentPlayTime=r,t._emitter&&t._emitter.emit(w.UPDATE_PLAY_INFO,{currentTime:t._currentPlayTime,duration:t._mediaElement.duration}))}),!1)},t.getCurrentPlayTime=function(){return this._currentPlayTime},t.getTotalDuration=function(){return this._mediaElement.duration},t.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var r=this._pendingSegments[t];r.splice(0,r.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var i=this._sourceBuffers[t];if(i){if("closed"!==e.readyState){try{e.removeSourceBuffer(i)}catch(e){l.a.e(this.TAG,e.message)}i.removeEventListener("error",this.e.onSourceBufferError),i.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(e){l.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)},t.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var r=e,i=""+r.container;r.codec&&r.codec.length>0&&(i+=";codecs="+r.codec);var n=!1;if(this._lastInitSegments[r.type]=r,i!==this._mimeTypes[r.type]){if(this._mimeTypes[r.type])l.a.v(this.TAG,"Notice: "+r.type+" mimeType changed, origin: "+this._mimeTypes[r.type]+", target: "+i);else{n=!0;try{var a=this._sourceBuffers[r.type]=this._mediaSource.addSourceBuffer(i);a.addEventListener("error",this.e.onSourceBufferError),a.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(e){return l.a.e(this.TAG,e.message),void this._emitter.emit(w.ERROR,{code:e.code,msg:e.message})}}this._mimeTypes[r.type]=i}t||this._pendingSegments[r.type].push(r),n||this._sourceBuffers[r.type]&&!this._sourceBuffers[r.type].updating&&this._doAppendSegments(),f.a.safari&&"audio/mpeg"===r.container&&r.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=r.mediaDuration/1e3,this._updateMediaSourceDuration())},t.appendMediaSegment=function(e){if("audio"!==e.type||!this._audioError){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var r=this._sourceBuffers[t.type];!r||r.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()}},t.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var r=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{r.abort()}catch(e){l.a.e(this.TAG,e.message)}this._idrList.clear();var i=this._pendingSegments[t];if(i.splice(0,i.length),"closed"!==this._mediaSource.readyState){for(var n=0;n<r.buffered.length;n++){var a=r.buffered.start(n),o=r.buffered.end(n);this._pendingRemoveRanges[t].push({start:a,end:o})}if(r.updating||this._doRemoveRanges(),f.a.safari){var s=this._lastInitSegments[t];s&&(this._pendingSegments[t].push(s),r.updating||this._doAppendSegments())}}}},t.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},t.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},t._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var r=this._sourceBuffers[t];if(r){var i=r.buffered;if(i.length>=1&&e-i.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},t._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var r=this._sourceBuffers[t];if(r){for(var i=r.buffered,n=!1,a=0;a<i.length;a++){var o=i.start(a),s=i.end(a);if(o<=e&&e<s+3){if(e-o>=this._config.autoCleanupMaxBackwardDuration){n=!0;var u=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:o,end:u})}}else s<e&&(n=!0,this._pendingRemoveRanges[t].push({start:o,end:s}))}n&&!r.updating&&this._doRemoveRanges()}}},t._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,r=this._pendingMediaDuration;r>0&&(isNaN(t)||r>t)&&(l.a.v(this.TAG,"Update MediaSource duration from "+t+" to "+r),this._mediaSource.duration=r),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},t._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],r=this._pendingRemoveRanges[e];r.length&&!t.updating;){var i=r.shift();t.remove(i.start,i.end)}},t._removerAudioSourceBuffer=function(){this._audioError=!0;var e=this._sourceBuffers.audio;e&&(this._mediaSource.removeSourceBuffer(e),e.removeEventListener("error",this.e.onSourceBufferError),e.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd),this._sourceBuffers.audio=null)},t._doAppendSegments=function(){var e=this._pendingSegments;for(var t in v.d()&&!this._pause&&"flv"===this._config.streamType&&this.AdjustPlayTimeToEnd(),e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var r=e[t].shift();if(r.timestampOffset){var i=this._sourceBuffers[t].timestampOffset,n=r.timestampOffset/1e3;Math.abs(i-n)>.1&&(l.a.v(this.TAG,"Update MPEG audio timestampOffset from "+i+" to "+n),this._sourceBuffers[t].timestampOffset=n),delete r.timestampOffset}if(!r.data||0===r.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(r.data),this._isBufferFull=!1,"video"===t&&r.hasOwnProperty("info")&&this._idrList.appendArray(r.info.syncPoints)}catch(e){if(this._pendingSegments[t].unshift(r),22===e.code)this._isBufferFull||this._emitter.emit(w.BUFFER_FULL),this._isBufferFull=!0;else try{this._emitter.emit(w.ERROR,{code:11,msg:e.message})}catch(e){}}}},t._onSourceOpen=function(){if(l.a.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(w.SOURCE_OPEN)},t._onSourceEnded=function(){this._emitter.emit(w.SOURCE_ENDED),l.a.v(this.TAG,"MediaSource onSourceEnded")},t._onSourceClose=function(){l.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))},t._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},t._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},t._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(w.UPDATE_END)},t._onSourceBufferError=function(e){l.a.e(this.TAG,"SourceBuffer Error: "+e)},t.pause=function(){this._pause=!0},t.resume=function(){this._pause=!1},t.AdjustPlayTimeToEnd=function(){if(null!=this._emitter&&null!=this._emitter){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers)if("video"===t){var r=this._sourceBuffers[t];if(r&&!r.updating){var i=r.buffered;if(i.length>0){var n=i.end(i.length-1);n-e>2?this._mediaElement.currentTime=n:this._lastSpeed>0&&(this._lastSpeed=0,this._emitter.emit(w.CHANGE_SPEED,{speed:0}))}}}}},e}(),D=r(12),x={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},C={NETWORK_EXCEPTION:u.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:u.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:u.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:u.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:D.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:D.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:D.a.CODEC_UNSUPPORTED};function P(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var N=function(){function e(e,t){this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new h.a;var r=e.url,i=e.muted,n=e.recordMaxFileSize;r.includes(".flv")&&(this._type="flv"),r.includes(".m3u8")&&(this._type="hls"),this._config=o(),s.supportMSEH264Playback()?t.decodeType=t.decodeType?t.decodeType:"auto":t.decodeType="soft","object"==typeof t&&(this._config=Object.assign(this._config,t)),!0===e.isLive&&(this._config.isLive=!0),this._recordFileName=t.recordFileName,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=Object.assign(e,{type:this.type}),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 a=f.a.chrome&&(f.a.version.major<50||50===f.a.version.major&&f.a.version.build<2661);this._alwaysSeekKeyframe=!!(a||f.a.msedge||f.a.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1),this.videoToolsTimer=null,this.playing=!0,this.mute=!0,this.kbpsEle=null,this.audioBtnEle=null,this.playBtnEle=null,this.luXiangEle=null,this.timeTrackEle=null,this.isFullScreen=!1,this.progressBarEle=null,this.progressBarLabelEle=null,this._webRecording={enable:0},this._recording=!1,this._fullScreenBtnEle=null,this._muted=i,this._recordHlsOffset=0,this._recordMaxFileSize=n?1024*n*1024:209715200,this._recordHlsArrayBuffer=[],this._isEncodedH265=!s.supportMSEH264Playback(),this._mobile=this._isMobile(),this.isiOS=!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),this.switchPlay=this._switchPlay,this.switchAudio=this._switchAudio,this.recordSwitch=this._recordSwitch,this.saveLocalSnapshot=this._saveLocalSnapshot,this.saveImageDateURL=this._saveImageDateURL}var t,r,i,n=e.prototype;return n.destroy=function(){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,this.videoToolsTimer&&clearTimeout(this.videoToolsTimer),this.kbpsEle=null,this.timeTrackEle=null,this.audioBtnEle=null,this.playBtnEle=null,this.progressBarEle=null,this.videoToolsTimer=null,this.progressBarLabelEle=null,this._fullScreenBtnEle=null;var e=document.getElementsByClassName("video-tools")[0];e&&e.parentNode&&e.parentNode.removeChild(e),this._recordHlsOffset=0,this._recordHlsArrayBuffer=[],this._isEncodedH265=!1,this.switchAudio=null,this.saveLocalSnapshot=null,this.recordSwitch=null},n.on=function(e,t){var r=this;e===c.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){r._emitter.emit(c.MEDIA_INFO,r.mediaInfo)})):e===c.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){r._emitter.emit(c.STATISTICS_INFO,r.statisticsInfo)})),this._emitter.addListener(e,t)},n.off=function(e,t){this._emitter.removeListener(e,t)},n.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,s.supportMSEH264Playback()){if(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 O(this._config),this._msectl.on(w.UPDATE_PLAY_INFO,this._onmseUpdatePlayInfo.bind(this)),this._msectl.on(w.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(w.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(w.SOURCE_ENDED,(function(){1===t._webRecording.enable&&(t._webRecording.enable=0,t.startWebVideoRecord(0),setTimeout((function(){return t._emitter.emit(w.SOURCE_ENDED)}),1e3))})),this._msectl.on(w.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(w.ERROR,(function(e){t._emitter.emit(c.ERROR,x.MEDIA_ERROR,C.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(e){}this._mediaElement.muted=this._muted}else console.log("ios 设备")},n.detachMediaElement=function(){this._mediaElement&&(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.detachMediaElement(),this._msectl.destroy(),this._msectl=null)},n.load=function(){var e=this;if(s.supportMSEH264Playback()){if(!this._mediaElement)throw new I.a("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new I.a("FlvPlayer.load() has been called, please call unload() first!");if(this._hasPendingLoad)return;if(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened)return void(this._hasPendingLoad=!0);this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0)}this._transmuxer=new R(this._mediaDataSource,this._config,this._mediaElement),this._transmuxer.on(y.a.INIT_SEGMENT,(function(t,r){e._msectl.appendInitSegment(r)})),this._transmuxer.on(y.a.ON_DBL_CLICK,(function(){return e._requestFullScreen()})),this._transmuxer.on(y.a.MEDIA_SEGMENT,(function(t,r){if(e._msectl.appendMediaSegment(r),e._config.lazyLoad&&!e._config.isLive){var i=e._mediaElement.currentTime;r.info.endDts>=1e3*(i+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(l.a.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(y.a.IS_ENCODED_H265,(function(t){e._isEncodedH265=t,setTimeout((function(){return e._emitter.emit(y.a.IS_ENCODED_H265)}),1500),e._render265VideoTools()})),this._transmuxer.on(y.a.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(c.LOADING_COMPLETE)})),this._transmuxer.on(y.a.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(c.RECOVERED_EARLY_EOF)})),this._transmuxer.on(y.a.IO_ERROR,(function(t,r){e._emitter.emit(c.ERROR,x.NETWORK_ERROR,t,r)})),this._transmuxer.on(y.a.DEMUX_ERROR,(function(t,r){e._emitter.emit(c.ERROR,x.MEDIA_ERROR,t,{code:-1,msg:r})})),this._transmuxer.on(y.a.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(c.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(y.a.METADATA_ARRIVED,(function(t){e._emitter.emit(c.METADATA_ARRIVED,t)})),this._transmuxer.on(y.a.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(c.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(y.a.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(c.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(y.a.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.on(w.SOURCE_ENDED,(function(){return e._emitter.emit(w.SOURCE_ENDED)})),this._transmuxer.on(w.UPDATE_PLAY_INFO,this._onmseUpdatePlayInfo.bind(this)),this._transmuxer.on(y.a.AUDIO_ERROR,this._onAudioError.bind(this)),this._transmuxer.on("loaderChunkArrival",(function(t){if(null!==t){var r=e._mediaDataSource.url;if(r&&r.includes(".m3u8"))if(e._recording){if(0===e._recordHlsArrayBuffer.length&&(e._recordHlsArrayBuffer=new Uint8Array(e._recordMaxFileSize)),e._recordHlsOffset+t.byteLength>e._recordMaxFileSize)return e.downRecord(),e._recording=!1,void(e.luXiangEle.style.color=e._recording?"red":"white");e._recordHlsArrayBuffer.set(new Int8Array(t),e._recordHlsOffset),e._recordHlsOffset+=t.byteLength}else{if(0===e._recordHlsArrayBuffer.length||0===e._recordHlsArrayBuffer.byteLength)return;e.downRecord()}}})),this._transmuxer.on("hls_error",(function(){1===e._webRecording.enable&&(e._webRecording.enable=0,e.downRecord()),setTimeout((function(){return e._emitter.emit(y.a.SOURCE_ENDED)}),1500)})),this._transmuxer.open(),this._muted||console.log("this._transmuxer",this._transmuxer)},n.downRecord=function(){var e=this._recordFileName?this._recordFileName+"-"+this.dateFormat(new Date,"YYYYMMDDhhmmss"):""+this.dateFormat(new Date,"YYYYMMDDhhmmss"),t=this._recordHlsArrayBuffer.slice(0,this._recordHlsOffset),r=document.createElement("a");r.style.display="none",r.href=URL.createObjectURL(new Blob([t],{type:"video/mp4"})),r.download=e+".mp4",document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(r.href),document.body.removeChild(r),this._recordHlsOffset=0,this._recordHlsArrayBuffer=[]},n.dateFormat=function(e,t){var r,i={"Y+":e.getFullYear().toString(),"M+":(e.getMonth()+1).toString(),"D+":e.getDate().toString(),"h+":e.getHours().toString(),"m+":e.getMinutes().toString(),"s+":e.getSeconds().toString()};for(var n in i)(r=new RegExp("("+n+")").exec(t))&&(t=t.replace(r[1],1===r[1].length?i[n]:i[n].padStart(r[1].length,"0")));return t},n.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},n.play=function(){return this._mediaElement.play()},n.resume=function(){this._mediaElement&&this._mediaElement.play(),this._isEncodedH265&&this._transmuxer&&this._transmuxer.resume()},n.pause=function(){var e=this._mediaElement;e.offsetWidth,e.offsetHeight;this._mediaElement&&this._mediaElement.pause(),this._isEncodedH265&&this._transmuxer&&this._transmuxer.pause()},n._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,r=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();r=n.totalVideoFrames,i=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(r=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=r,e.droppedFrames=i),e},n._onmseUpdateEnd=function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,r=0,i=0;i<e.length;i++){var n=e.start(i),a=e.end(i);if(n<=t&&t<a){n,r=a;break}}r>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(l.a.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},n._onmseUpdatePlayInfo=function(){if(this._transmuxer){var e=0,t=0;this._isEncodedH265&&this._mediaDataSource.url.includes(".m3u8")&&((e=this._transmuxer._getCurrentPlayTime())<0&&(e=0),t=this._transmuxer._getTotalDuration(),this._updateDuration({currentTime:e,duration:t}));var r=this._transmuxer._controller._ioctl.currentSpeed,i=this._transmuxer._controller._ioctl.averageKBps;this._updateKbps({currentSpeed:r,averageKBps:i})}},n._onmseBufferFull=function(){l.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},n._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},n._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,r=!1,i=0;i<t.length;i++){var n=t.start(i),a=t.end(i);if(e>=n&&e<a){e>=a-this._config.lazyLoadRecoverDuration&&(r=!0);break}}r&&(window.clearInterval(this._progressChecker),this._progressChecker=null,r&&(l.a.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},n._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,r=0;r<t.length;r++){var i=t.start(r),n=t.end(r);if(e>=i&&e<n)return!0}return!1},n._internalSeek=function(e){var t=this._isTimepointBuffered(e),r=!1,i=0;if(e<1&&this._mediaElement.buffered.length>0){var n=this._mediaElement.buffered.start(0);(n<1&&e<n||f.a.safari)&&(r=!0,i=f.a.safari?.1:n)}if(r)this._requestSetTime=!0,this._mediaElement.currentTime=i;else if(t){if(this._alwaysSeekKeyframe){var a=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=a?a.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},n._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},n._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var r=t.buffered;r.length>0&&t.currentTime<r.start(0)&&(l.a.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+r.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=r.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},n._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},n._onvSeeking=function(e){var t=this._mediaElement.currentTime,r=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&r.length>0){var i=r.start(0);if(i<1&&t<i||f.a.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=f.a.safari?.1:i)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var n=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=n&&(this._requestSetTime=!0,this._mediaElement.currentTime=n.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},n._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},n._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},n._onvProgress=function(e){this._checkAndResumeStuckPlayback()},n.seek=function(e,t){if(this._isEncodedH265&&this._transmuxer&&this._mediaDataSource.url.includes(".m3u8")){var r=Math.floor(e/100*this._transmuxer._getTotalDuration());if(this._msectl&&this._msectl.getCurrentPlayTime()===r)return!0;this._transmuxer._seekToSecs(e,t)}},n._render265VideoTools=function(){var e=this,t=document.createElement("span");t.style="width:100%;height:30px;position:absolute;bottom:0;left:0;background-color:rgba(43, 51, 63, 0.7);;z-index: 10;opacity:0;display: flex;flex-direction: row;justify-content: space-between;",t.classList="video-tools",this.videoTools=t;var r=document.createElement("div");r.style="display: flex;flex-direction: row;",this.playBtnEle=document.createElement("span"),this.playBtnEle.style="font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center",this.playBtnEle.classList="iconfont "+(this.playing?"icon-zanting":"icon-bofang"),this.audioBtnEle=document.createElement("span"),this.audioBtnEle.style="font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center",this.audioBtnEle.classList="iconfont "+(this._muted?"icon-jingyin":"icon-shengyin1")+" icon-wasm-audio",this._mediaDataSource.url.includes(".m3u8")&&(this.progressBarEle=document.createElement("div"),this.progressBarEle.style="display:flex;flex:1;opacity: 0",this.timeTrackEle=document.createElement("input"),this.timeTrackEle.classList="timeTrack",this.timeTrackEle.id="timeTrack",this.timeTrackEle.type="range",this.timeTrackEle.style="width:100%;-webkit-appearance: none;height:3px;border-radius:3px;cursor:pointer;margin:auto;display:block;color: #FFF",this.timeTrackEle.value=0,this.timeTrackEle.oninput=function(){e.seekToPercent(e.timeTrackEle.value,1)},this.progressBarEle.appendChild(this.timeTrackEle),this.progressBarLabelEle=document.createElement("label"),this.progressBarLabelEle.style="color: #fff;padding-left: 10px;line-height:30px;font-size: 12px;min-width: 125px",this.progressBarLabelEle.innerHTML="00:00:00/00:00:00",this.progressBarEle.appendChild(this.progressBarLabelEle)),this.playBtnEle.onclick=function(){return e._switchPlay()},this.audioBtnEle.onclick=function(){return e._switchAudio()};var i=document.createElement("div");i.style="display: flex;flex-direction: row;",this.kbpsEle=document.createElement("div"),this.kbpsEle.style="font-size:12px;min-width:60px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;padding-right: 10px;",this.luXiangEle=document.createElement("span"),this.luXiangEle.title="录像",this.luXiangEle.style="font-size:16px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;",this.luXiangEle.classList="iconfont icon-luxiang2",this.luXiangEle.onclick=function(){return e._recordSwitch()};var n=document.createElement("span");n.title="快照",n.style="font-size:16px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;",n.classList="iconfont icon-xiangji",n.onclick=function(){return e._saveLocalSnapshot()},this._fullScreenBtnEle=document.createElement("span"),this._fullScreenBtnEle.title="全屏",this._fullScreenBtnEle.style="font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center",this._fullScreenBtnEle.classList="iconfont "+(this.isFullScreen?"icon-xiaoping":"icon-quanping1"),this._fullScreenBtnEle.onclick=function(){return e._requestFullScreen()},this._mediaElement.parentNode.onmousemove=function(){e.videoToolsTimer&&clearTimeout(e.videoToolsTimer),e.videoTools.style.opacity="1",e.videoToolsTimer=setTimeout((function(){e.videoTools.style.opacity="0"}),1e4)},this._mediaElement.parentNode.onmouseout=function(){e.videoTools.style.opacity="0",e.videoToolsTimer&&clearTimeout(e.videoToolsTimer),e.videoToolsTimer=null},r.appendChild(this.playBtnEle),r.appendChild(this.audioBtnEle),i.appendChild(this.kbpsEle),this.isiOS||(i.appendChild(this.luXiangEle),i.appendChild(n)),i.appendChild(this._fullScreenBtnEle),t.appendChild(r),this.progressBarEle&&!this._mobile&&t.appendChild(this.progressBarEle),t.appendChild(i),this._mediaElement.parentNode.appendChild(t),window.onresize=function(){!document.fullscreenElement&&e.isFullScreen&&(e.isFullScreen=!1,e._fullScreenBtnEle.classList="iconfont "+(e.isFullScreen?"icon-xiaoping":"icon-quanping1"))}},n._recordingUIChange=function(){this._recording=!this._recording,this.luXiangEle.title=this._recording?"关闭录像":"录像",this.luXiangEle.style.color=this._recording?"red":"white"},n._requestFullScreen=function(){this.isFullScreen=!this.isFullScreen,this._fullScreenBtnEle.title=this.isFullScreen?"退出全屏":"全屏",this._fullScreenBtnEle.classList="iconfont "+(this.isFullScreen?"icon-xiaoping":"icon-quanping1"),this._emitter.emit("changeFullScreen",this.isFullScreen)},n._updateDuration=function(e){var t=e.currentTime,r=e.duration;if(!r)return this.progressBarEle.style.opacity=0;"0"===this.progressBarEle.style.opacity&&(this.progressBarEle.style.opacity=1);var i=parseInt((t+1)/r*100);i!==parseInt(this.timeTrackEle.value)&&(this.timeTrackEle.value=i),this.progressBarLabelEle&&(t<1?t=0:t>r&&(t=r),this.progressBarLabelEle.innerHTML=this._formatTime(t)+" / "+this._formatTime(r)),this._emitter.emit("timeupdate",t)},n._updateKbps=function(e){e.currentSpeed;var t=e.averageKBps;this.kbpsEle&&(this.kbpsEle.innerText=8*t>=1024?(8*t/1024).toFixed(2)+" Mb/s":parseInt(8*t+"")+" Kb/s")},n._saveLocalSnapshot=function(){this._transmuxer.saveLocalSnapshot(this._recordFileName)},n._saveImageDateURL=function(){return this._transmuxer.saveImageDateURL()},n._formatTime=function(e){return(Math.floor(e/3600)<10?"0"+Math.floor(e/3600):Math.floor(e/3600))+":"+(Math.floor(e/60%60)<10?"0"+Math.floor(e/60%60):Math.floor(e/60%60))+":"+(Math.floor(e%60)<10?"0"+Math.floor(e%60):Math.floor(e%60))},n._onAudioError=function(){this._msectl&&this._msectl._removerAudioSourceBuffer()},n.getClass=function(e){return 0===e?"blue":1===e?"black":2===e?"white":3===e?"green":4===e?"red":5===e?"yellow":"red"},n.seekToPercent=function(e){this.seek(e,1)},n.startWebVideoRecord=function(e,t,r,i){var n;this._transmuxer&&(n=t?t.includes(".mp4")?t.replace(".mp4","")+"-"+this.dateFormat(new Date,"YYYYMMDDhhmmss")+".mp4":t+"-"+this.dateFormat(new Date,"YYYYMMDDhhmmss")+".mp4":this.dateFormat(new Date,"YYYYMMDDhhmmss")+".mp4",this._mediaDataSource.url.includes(".flv")&&this._transmuxer.videoRecording(n,r||this._recordMaxFileSize,e,i),this._webRecording.enable=e)},n._isMobile=function(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}},n._recordSwitch=function(){var e=this;this._recordingUIChange(),this.startWebVideoRecord(this._recording?1:0,this._recordFileName,"",(function(){e._emitter.emit(w.RECORDING_END)}))},n._switchAudio=function(){this._muted=!this._muted,this.audioBtnEle.title=this._muted?"取消静音":"静音",this.audioBtnEle.classList="iconfont "+(this._muted?"icon-jingyin":"icon-shengyin1")+" ",this._mediaElement.muted=this._muted,this._transmuxer&&(this._transmuxer._wasmInitAudioPlayer?this._muted?this._transmuxer._wasmAudioPlayer.pause():this._transmuxer._wasmAudioPlayer.resume():this._muted||this._transmuxer._openWasmAudio())},n._switchPlay=function(){this.playing?this.pause():this.resume(),this.playing=!this.playing,this.playBtnEle.title=this.playing?"暂停":"播放",this.playBtnEle.classList="iconfont "+(this.playing?"icon-zanting":"icon-bofang"),this.playing||(this.kbpsEle.innerText="")},t=e,(r=[{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e}},{key:"mediaInfo",get:function(){return Object.assign({},this._mediaInfo)}},{key:"statisticsInfo",get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}}])&&P(t.prototype,r),i&&P(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();function L(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var B=function(){function e(e,t){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new h.a,this._config=o(),"object"==typeof t&&Object.assign(this._config,t),"flv"===e.type.toLowerCase())throw new I.b("NativePlayer does't support flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new I.b("NativePlayer("+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}var t,r,i,n=e.prototype;return n.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},n.on=function(e,t){var r=this;e===c.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){r._emitter.emit(c.MEDIA_INFO,r.mediaInfo)})):e===c.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){r._emitter.emit(c.STATISTICS_INFO,r.statisticsInfo)})),this._emitter.addListener(e,t)},n.off=function(e,t){this._emitter.removeListener(e,t)},n.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){}},n.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)},n.load=function(){if(!this._mediaElement)throw new I.a("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.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)},n.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},n.play=function(){return this._mediaElement.play()},n.pause=function(){this._mediaElement.pause()},n._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(c.MEDIA_INFO,this.mediaInfo)},n._reportStatisticsInfo=function(){this._emitter.emit(c.STATISTICS_INFO,this.statisticsInfo)},t=e,(r=[{key:"type",get:function(){return this._type}},{key:"buffered",get:function(){return this._mediaElement.buffered}},{key:"duration",get:function(){return this._mediaElement.duration}},{key:"volume",get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e}},{key:"muted",get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e}},{key:"currentTime",get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e}},{key:"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}},{key:"statisticsInfo",get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,r=0,i=0;if(this._mediaElement.getVideoPlaybackQuality){var n=this._mediaElement.getVideoPlaybackQuality();r=n.totalVideoFrames,i=n.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(r=this._mediaElement.webkitDecodedFrameCount,i=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=r,e.droppedFrames=i),e}}])&&L(t.prototype,r),i&&L(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();i.a.install();var F={createPlayer:function(e,t){var r=e;if(null==r||"object"!=typeof r)throw new I.b("MediaDataSource must be an javascript object!");return new N(r,t)},isSupported:function(){return s.supportMSEH264Playback()},getFeatureList:function(){return s.getFeatureList()}};F.BaseLoader=u.a,F.LoaderStatus=u.c,F.LoaderErrors=u.b,F.Events=c,F.ErrorTypes=x,F.ErrorDetails=C,F.FlvPlayer=N,F.NativePlayer=B,F.LoggingControl=g.a,Object.defineProperty(F,"version",{enumerable:!0,get:function(){return __VERSION__}});var U=F;t.default=U},function(e,t,r){"use strict";r.r(t);var i=r(30),n=r.n(i),a=r(123),o=r.n(a);function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,r;function i(){var t;return(t=e.call(this)||this).buffer="",t}return r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,s(t,r),i.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},i}(n.a);function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){for(var t,r=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),i={},n=r.length;n--;)""!==r[n]&&((t=/([^=]*)=(.*)/.exec(r[n]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),i[t[0]]=t[1]);return i},l=function(e){var t,r;function i(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,d(t,r);var n=i.prototype;return n.push=function(e){var t,r,i=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,r){var i=r(e);return i===e?t:t.concat([i])}),[e]).forEach((function(e){for(var n=0;n<i.customParsers.length;n++)if(i.customParsers[n].call(i,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))i.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return r={type:"tag",tagType:"inf"},t[1]&&(r.duration=parseFloat(t[1])),t[2]&&(r.title=t[2]),void i.trigger("data",r);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return r={type:"tag",tagType:"targetduration"},t[1]&&(r.duration=parseInt(t[1],10)),void i.trigger("data",r);if(t=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e))return r={type:"tag",tagType:"totalduration"},t[1]&&(r.duration=parseInt(t[1],10)),void i.trigger("data",r);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return r={type:"tag",tagType:"version"},t[1]&&(r.version=parseInt(t[1],10)),void i.trigger("data",r);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return r={type:"tag",tagType:"media-sequence"},t[1]&&(r.number=parseInt(t[1],10)),void i.trigger("data",r);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return r={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(r.number=parseInt(t[1],10)),void i.trigger("data",r);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return r={type:"tag",tagType:"playlist-type"},t[1]&&(r.playlistType=t[1]),void i.trigger("data",r);if(t=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e))return r={type:"tag",tagType:"byterange"},t[1]&&(r.length=parseInt(t[1],10)),t[2]&&(r.offset=parseInt(t[2],10)),void i.trigger("data",r);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return r={type:"tag",tagType:"allow-cache"},t[1]&&(r.allowed=!/NO/.test(t[1])),void i.trigger("data",r);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(r={type:"tag",tagType:"map"},t[1]){var a=h(t[1]);if(a.URI&&(r.uri=a.URI),a.BYTERANGE){var o=a.BYTERANGE.split("@"),s=o[0],u=o[1];r.byterange={},s&&(r.byterange.length=parseInt(s,10)),u&&(r.byterange.offset=parseInt(u,10))}}i.trigger("data",r)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(r={type:"tag",tagType:"stream-inf"},t[1]){if(r.attributes=h(t[1]),r.attributes.RESOLUTION){var d=r.attributes.RESOLUTION.split("x"),l={};d[0]&&(l.width=parseInt(d[0],10)),d[1]&&(l.height=parseInt(d[1],10)),r.attributes.RESOLUTION=l}r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["PROGRAM-ID"]&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10))}i.trigger("data",r)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return r={type:"tag",tagType:"media"},t[1]&&(r.attributes=h(t[1])),void i.trigger("data",r);if(t=/^#EXT-X-ENDLIST/.exec(e))i.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))i.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return r={type:"tag",tagType:"program-date-time"},t[1]&&(r.dateTimeString=t[1],r.dateTimeObject=new Date(t[1])),void i.trigger("data",r);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return r={type:"tag",tagType:"key"},t[1]&&(r.attributes=h(t[1]),r.attributes.IV&&("0x"===r.attributes.IV.substring(0,2).toLowerCase()&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=parseInt(r.attributes.IV[3],16),r.attributes.IV=new Uint32Array(r.attributes.IV))),void i.trigger("data",r);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return r={type:"tag",tagType:"start"},t[1]&&(r.attributes=h(t[1]),r.attributes["TIME-OFFSET"]=parseFloat(r.attributes["TIME-OFFSET"]),r.attributes.PRECISE=/YES/.test(r.attributes.PRECISE)),void i.trigger("data",r);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return r={type:"tag",tagType:"cue-out-cont"},t[1]?r.data=t[1]:r.data="",void i.trigger("data",r);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return r={type:"tag",tagType:"cue-out"},t[1]?r.data=t[1]:r.data="",void i.trigger("data",r);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return r={type:"tag",tagType:"cue-in"},t[1]?r.data=t[1]:r.data="",void i.trigger("data",r);i.trigger("data",{type:"tag",data:e.slice(4)})}}}else i.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},n.addParser=function(e){var t=this,r=e.expression,i=e.customType,n=e.dataParser,a=e.segment;"function"!=typeof n&&(n=function(e){return e}),this.customParsers.push((function(e){if(r.exec(e))return t.trigger("data",{type:"custom",data:n(e),customType:i,segment:a}),!0}))},n.addTagMapper=function(e){var t=e.expression,r=e.map;this.tagMappers.push((function(e){return t.test(e)?r(e):e}))},i}(n.a);function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){var t,r;function i(){var t;(t=e.call(this)||this).lineStream=new u,t.parseStream=new l,t.lineStream.pipe(t.parseStream);var r,i,n=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t),a=[],s={},d=function(){},h={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},f=0;return t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},t.parseStream.on("data",(function(e){var t,u;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(s.byterange=t,t.length=e.length,"offset"in e||(this.trigger("info",{message:"defaulting offset to zero"}),e.offset=0)),"offset"in e&&(s.byterange=t,t.offset=e.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?void(this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:o()(e.attributes.URI.split(",")[1])}}):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),i={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(i.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else i=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,f=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){r={},e.uri&&(r.uri=e.uri),e.byterange&&(r.byterange=e.byterange)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||h,e.attributes?(s.attributes||(s.attributes={}),Object.assign(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var r=this.manifest.mediaGroups[e.attributes.TYPE];r[e.attributes["GROUP-ID"]]=r[e.attributes["GROUP-ID"]]||{},t=r[e.attributes["GROUP-ID"]],(u={default:/yes/i.test(e.attributes.DEFAULT)}).default?u.autoselect=!0:u.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(u.language=e.attributes.LANGUAGE),e.attributes.URI&&(u.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(u.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(u.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(u.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=u}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){f+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):this.manifest.targetDuration=e.duration},totalduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+e.duration}):this.manifest.totalDuration=e.duration},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data}}[e.tagType]||d).call(n)},uri:function(){s.uri=e.uri,a.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),i&&(s.key=i),s.timeline=f,r&&(s.map=r),s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(n)})),t}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,f(t,r);var n=i.prototype;return n.push=function(e){this.lineStream.push(e)},n.end=function(){this.lineStream.push("\n")},n.addParser=function(e){this.parseStream.addParser(e)},n.addTagMapper=function(e){this.parseStream.addTagMapper(e)},i}(n.a),p=r(1);function m(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}var _=new WebAssembly.Memory({initial:256,maximum:256});new WebAssembly.Table({initial:0,maximum:0,element:"anyfunc"}),_.buffer.byteLength,t.default=function(e){e.url="",e.canvas=null,e.webGLPlayer=null,e.videoSampleQueue=[],e.audioSampleQueue=[],e.videoInterval=40,e.lastRenderTime=0,e.intervalVal=0,e.renderFrameCount=0,e.requestAbort=!1,e.pause=!1,e.cbStreamData=!0,e.reConnect=!0,e.isLiveStream=!0,e.seekTime=0,e.totalDuration=0,e.playDuration=0,e.startVideoPts=0,e.startAudioPts=0,e.tsFileList=[],e.getFileIndex=0,e.lastTsFile="",e.isFirstFile=!0,e.lastTsFileSequence=0,e.sequenceExceptNum=0,e.hlsTsPlaybackFileNo=-1,e.hlsTsFirstPlayFileNo=0,e.tsDemuxer=null,e.getFileCount=100,e.intervalHandle=-1,e.intervalValue=40,e.startDownloadTimeSecs=0;var t=function(e,t){var r=function(e){var t=RegExp("^(?:([^/?#]+))?//(?:([^:]*)(?::?(.*))@)?(?:([^/?#:]*):?([0-9]+)?)?([^?#]*)(\\?(?:[^#]*))?(#(?:.*))?"),r=e.match(t)||[];return{protocol:r[1],username:r[2],password:r[3],hostname:r[4],port:r[5],pathname:r[6],search:r[7],hash:r[8]}}(t),i=r.protocol+"//"+r.hostname+":"+r.port;if(e.indexOf("http")>=0)return e;if(e.indexOf("/")>=0)for(var n,a=m(e.split("/"));!(n=a()).done;){var o=n.value;if(t.indexOf(o)>=0)return i+e}i=t;for(var s=0,u=0;u>=0;)(u=i.indexOf("/"))>=0?(i=i.substring(u+1),s+=u+1):i=t.substring(0,s);return""!==e?i+e:i},r=function(){var t={cmd:p.l,workerId:p.b};e.postMessage(t),e.getFileIndex=0,e.hlsTsPlaybackFileNo=-1},i=function i(n,a){if(e.url=n,1!=e._requestAbort){if(!e.pause&&(!(e.totalDuration>0)||e.isLiveStream)){var o=new XMLHttpRequest;o.open("get",n,!0),o.responseType="text",o.onreadystatechange=function(){if(4!=o.readyState||200!=o.status&&304!=o.status)4===o.readyState&&404===o.status&&e.postMessage({cmd:404});else{for(var r=new c,s=o.response.split("\n"),u="",d=0;d<s.length;d++)s[d].includes(".m3u8")&&(u=s[d]);if(u=t(u,n),o.response.includes(".m3u8"))return i(u,a);r.push(o.responseText),r.end();var h=r.manifest;if("undefined"!==r.manifest.endList&&1==r.manifest.endList?e.isLiveStream=!1:e.isLiveStream=!0,h.segments.length<1){var l=e;return void p.j(3e3).then((function(){i(l.url,1)}))}var f=0,m=0;if(e.isLiveStream)if(""==e.lastTsFile){for(f=0;f<h.segments.length;f++){v={filename:y=t(h.segments[f].uri,e.url),duration:h.segments[f].duration};e.tsFileList.push(v)}var g=0;h.segments.length>2&&(g=h.segments.length-1-1),e.getFileIndex=g,e.lastTsFile=h.segments[g].uri}else{g=-1;var _=!1;for(f=0;f<h.segments.length;f++){y=t(h.segments[f].uri,e.url);if(h.segments[f].uri!==e.lastTsFile)if(g>=0){v={filename:y,duration:h.segments[f].duration};e.totalDuration+=h.segments[f].duration,e.tsFileList.push(v),_||(e.lastTsFile=h.segments[f].uri,_=!0)}else;else g=f,e.tsFileList.length=0,e.tsFileList=[],e.getFileIndex=0}if(g<0)for(e.tsFileList.length=0,e.tsFileList=[],e.getFileIndex=0,f=0;f<h.segments.length;f++){v={filename:y=t(h.segments[f].uri,e.url),duration:h.segments[f].duration};e.totalDuration+=h.segments[f].duration,e.tsFileList.push(v),e.lastTsFile=h.segments[f].uri}if(1===a)return}else{for(e.seekTime>0&&(e.getFileIndex=-1),f=0;f<h.segments.length;f++){var y=t(h.segments[f].uri,e.url),b=0;for(m=0;m<e.tsFileList.length;m++)if(e.tsFileList[m].filename===y){b=1;break}if(0==b){e.seekTime>0&&e.totalDuration>=e.seekTime&&e.getFileIndex<0&&(e.getFileIndex=f);var v={filename:y,duration:h.segments[f].duration};e.totalDuration+=h.segments[f].duration,e.tsFileList.push(v)}}e.getFileIndex<0&&(e.getFileIndex=0);var w={cmd:p.u,duration:e.totalDuration,live:e.isLiveStream,workerId:p.b};e.postMessage(w)}if(e.tsFileList.length>0&&1==a){w={cmd:p.w,workerId:p.b};e.postMessage(w)}}},o.send()}}else r()},n=function t(){if(!(e.getFileCount++<1)){var n=!1;if(!e.pause)if(1!=e._requestAbort){if(e.isLiveStream){if(e.getFileCount=0,e.getFileIndex>=e.tsFileList.length||3==e.getFileCount)return void i(e.url,1);n=!0}else if(e.getFileIndex>e.tsFileList.length){var a={cmd:p.r,workerId:p.b};return void e.postMessage(a)}var o;if(0==e.hlsTsFirstPlayFileNo&&1==e.getFileIndex)e.getFileIndex=0,e.hlsTsPlaybackFileNo=-1,e.hlsTsFirstPlayFileNo=-1,o=e.tsFileList[e.getFileIndex].filename;else{if(!e.tsFileList[e.getFileIndex])return;o=e.tsFileList[e.getFileIndex].filename}if(e.isLiveStream){var s=function(e){var t=e.split("-"),r=t.length;if(r>0){var i=t[r-1].split(".");if(i.length>0)return i[0]}return""}(o),u=parseInt(s);if(u>0&&u>e.lastTsFileSequence+1){e.sequenceExceptNum++;a={cmd:p.z,workerId:p.b,fileSequence:e.sequenceExceptNum};e.postMessage(a)}e.lastTsFileSequence=u}var d=new XMLHttpRequest;d.open("get",o,!0),d.responseType="arraybuffer",d.onreadystatechange=function(){if(404==d.status)return p.e("current file not found. refresh list..."),void i(e.url,1);if(4==d.readyState&&(200==d.status||304==d.status)){var r=new Uint8Array(d.response),a=0;for(a=0;a<e.getFileIndex;a++)e.tsFileList[a].duration;var o={cmd:p.q,workerId:p.b,mediaType:1,codecId:27,flag:0,pts:0,playTimeSec:0,dat:r};if(e.postMessage(o,[o.dat.buffer]),e.intervalHandle>=0&&(clearInterval(e.intervalHandle),e.intervalHandle=-1),!e.pause){var s=e.getFileIndex;s>=0&&s<e.tsFileList.length?e.intervalValue=1e3*e.tsFileList[s].duration-600:e.intervalValue=2e3,e.isFirstFile&&(e.isFirstFile=!1,e.intervalValue>900&&(e.intervalValue-=900)),e.intervalValue=1e3*e.tsFileList[s].duration/2,e.intervalHandle=setInterval(t,e.intervalValue)}e.getFileCount=100,e.getFileIndex++,e.getFileIndex>=0&&(e.getFileIndex,e.tsFileList.length);o={cmd:p.t,workerId:p.b};if(e.postMessage(o),n)return i(e.url,0)}},d.send(),e.hlsTsPlaybackFileNo=e.getFileIndex}else r()}};e.addEventListener("message",(function(t){var a=t.data;switch(a.cmd){case p.w:e.url=a.url,e.seekTime=a.time,i(a.url,1);break;case p.s:0==a.t&&n();break;case p.y:i(e.url,1);break;case p.B:var o=a.time;1==a.type&&(o=a.time/100*e.totalDuration);var s=!1,u=0,d=0;for(d=0;d<e.tsFileList.length;d++)if((u+=e.tsFileList[d].duration)>o){e.getFileIndex=d,n();var h={cmd:p.B,type:a.type,time:o};e.postMessage(h),s=!0;break}if(!s){h={cmd:p.B,type:a.type,time:o};e.postMessage(h)}break;case p.x:e.pause=!0;break;case p.A:e.pause=!1,i(e.url,1);break;case p.l:e._requestAbort=!0,e.seekTime=0,r()}}))}}]).default}));
- !function t(e){var r,i;r=this,i=function(){"use strict";function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function i(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){s(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,v(i.key),i)}}function a(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=v(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},o.apply(this,arguments)}function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,h(t,e)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function d(t,e,r){return d=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&h(n,r.prototype),n},d.apply(null,arguments)}function c(t){var e="function"==typeof Map?new Map:void 0;return c=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return d(t,arguments,u(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),h(i,t)},c(t)}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function g(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function m(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var p={exports:{}};!function(t,e){var r,i,n,a,s;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var n=s.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return n.path=s.normalizePath(n.path),s.buildURLFromParts(n)}var a=s.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):e;var o=s.parseURL(t);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=i.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var h=o.path,d=h.substring(0,h.lastIndexOf("/")+1)+a.path;u.path=s.normalizePath(d)}else u.path=o.path,a.params||(u.params=o.params,a.query||(u.query=o.query));return null===u.path&&(u.path=r.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(u)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(n,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=s}(p);var y=p.exports,T=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},E=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.RECORDING="recording",t}({}),S=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),L=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown",t}({}),R=function(){},A={trace:R,debug:R,log:R,warn:R,info:R,error:R},k=A;function b(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];r.forEach((function(e){k[e]=t[e]?t[e].bind(t):function(t){var e=self.console[t];return e?e.bind(self.console,"["+t+"] >"):R}(e)}))}function D(t,e){if(self.console&&!0===t||"object"==typeof t){b(t,"debug","log","info","warn","error");try{k.log('Debug logs enabled for "'+e+'" in hls.js version '+void 0)}catch(t){k=A}}else k=A}var I=k,w=/^(\d+)x(\d+)$/,C=/(.+?)=(".*?"|.*?)(?:,|$)/g,_=function(){function t(e){for(var r in"string"==typeof e&&(e=t.parseAttrList(e)),e)e.hasOwnProperty(r)&&("X-"===r.substring(0,2)&&(this.clientAttrs=this.clientAttrs||[],this.clientAttrs.push(r)),this[r]=e[r])}var e=t.prototype;return e.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var r=new Uint8Array(e.length/2),i=0;i<e.length/2;i++)r[i]=parseInt(e.slice(2*i,2*i+2),16);return r}return null},e.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.decimalFloatingPoint=function(t){return parseFloat(this[t])},e.optionalFloat=function(t,e){var r=this[t];return r?parseFloat(r):e},e.enumeratedString=function(t){return this[t]},e.bool=function(t){return"YES"===this[t]},e.decimalResolution=function(t){var e=w.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,r={};for(C.lastIndex=0;null!==(e=C.exec(t));){var i=e[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[e[1].trim()]=i}return r},t}();function P(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t}var x=function(){function t(t,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){var r=e.attr;for(var i in r)if(Object.prototype.hasOwnProperty.call(t,i)&&t[i]!==r[i]){I.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+t.ID+'"'),this._badValueForSameId=i;break}t=o(new _({}),r,t)}if(this.attr=t,this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){var n=new Date(this.attr["END-DATE"]);T(n.getTime())&&(this._endDate=n)}}return a(t,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var t=this.duration;return null!==t?new Date(this._startDate.getTime()+1e3*t):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var t=this.attr.decimalFloatingPoint("DURATION");if(T(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&T(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),t}(),F=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},O="audio",M="video",N="audiovideo",U=function(){function t(t){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[O]=null,e[M]=null,e[N]=null,e),this.baseurl=t}return t.prototype.setByteRange=function(t,e){var r=t.split("@",2),i=[];1===r.length?i[0]=e?e.byteRangeEndOffset:0:i[0]=parseInt(r[1]),i[1]=parseInt(r[0])+i[0],this._byteRange=i},a(t,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=y.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(t){this._url=t}}]),t}(),B=function(t){function e(e,r){var i;return(i=t.call(this,r)||this)._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new F,i.urlId=0,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.type=e,i}l(e,t);var r=e.prototype;return r.setKeyFormat=function(t){if(this.levelkeys){var e=this.levelkeys[t];e&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))}},r.abortRequests=function(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()},r.setElementaryStreamInfo=function(t,e,r,i,n,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,n)):s[t]={startPTS:e,endPTS:r,startDTS:i,endDTS:n,partial:a}},r.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[O]=null,t[M]=null,t[N]=null},a(e,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{var e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!T(this.programDateTime))return null;var t=T(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){var e=Object.keys(this.levelkeys),r=e.length;if(r>1||1===r&&this.levelkeys[e[0]].encrypted)return!0}return!1}}]),e}(U),G=function(t){function e(e,r,i,n,a){var s;(s=t.call(this,i)||this).fragOffset=0,s.duration=0,s.gap=!1,s.independent=!1,s.relurl=void 0,s.fragment=void 0,s.index=void 0,s.stats=new F,s.duration=e.decimalFloatingPoint("DURATION"),s.gap=e.bool("GAP"),s.independent=e.bool("INDEPENDENT"),s.relurl=e.enumeratedString("URI"),s.fragment=r,s.index=n;var o=e.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return l(e,t),a(e,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var t=this.elementaryStreams;return!!(t.audio||t.video||t.audiovideo)}}]),e}(U),K=function(){function t(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}return t.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-t.lastPartSn,r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e,this.advanced=this.endSN>t.endSN||e>0||0===e&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},a(t,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&T(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return null!=(t=this.fragments)&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),t}();function H(t){return Uint8Array.from(atob(t),(function(t){return t.charCodeAt(0)}))}function V(t){var e,r,i=t.split(":"),n=null;if("data"===i[0]&&2===i.length){var a=i[1].split(";"),s=a[a.length-1].split(",");if(2===s.length){var o="base64"===s[0],l=s[1];o?(a.splice(-1,1),n=H(l)):(e=Y(l).subarray(0,16),(r=new Uint8Array(16)).set(e,16-e.length),n=r)}}return n}function Y(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(function(t){return t.charCodeAt(0)}))}var W={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},j="org.w3.clearkey",q="com.apple.streamingkeydelivery",X="com.microsoft.playready",z="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Q(t){switch(t){case q:return W.FAIRPLAY;case X:return W.PLAYREADY;case z:return W.WIDEVINE;case j:return W.CLEARKEY}}var $="edef8ba979d64acea3c827dcd51d21ed";function J(t){switch(t){case W.FAIRPLAY:return q;case W.PLAYREADY:return X;case W.WIDEVINE:return z;case W.CLEARKEY:return j}}function Z(t){var e=t.drmSystems,r=t.widevineLicenseUrl,i=e?[W.FAIRPLAY,W.WIDEVINE,W.PLAYREADY,W.CLEARKEY].filter((function(t){return!!e[t]})):[];return!i[W.WIDEVINE]&&r&&i.push(W.WIDEVINE),i}var tt="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function et(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}var rt,it=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},nt=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},at=function(t,e){for(var r=e,i=0;it(t,e);)i+=10,i+=st(t,e+6),nt(t,e+10)&&(i+=10),e+=i;if(i>0)return t.subarray(r,r+i)},st=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},ot=function(t,e){return it(t,e)&&st(t,e+6)+10<=t.length-e},lt=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},ut=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=st(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},ht=function(t){for(var e=0,r=[];it(t,e);){for(var i=st(t,e+6),n=(e+=10)+i;e+8<n;){var a=ut(t.subarray(e)),s=dt(a);s&&r.push(s),e+=a.size+10}nt(t,e)&&(e+=10)}return r},dt=function(t){return"PRIV"===t.type?ct(t):"W"===t.type[0]?gt(t):ft(t)},ct=function(t){if(!(t.size<2)){var e=mt(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}}},ft=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,r=mt(t.data.subarray(e),!0);e+=r.length+1;var i=mt(t.data.subarray(e));return{key:t.type,info:r,data:i}}var n=mt(t.data.subarray(1));return{key:t.type,data:n}}},gt=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,r=mt(t.data.subarray(e),!0);e+=r.length+1;var i=mt(t.data.subarray(e));return{key:t.type,info:r,data:i}}var n=mt(t.data);return{key:t.type,data:n}},vt=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},mt=function(t,e){void 0===e&&(e=!1);var r=pt();if(r){var i=r.decode(t);if(e){var n=i.indexOf("\0");return-1!==n?i.substring(0,n):i}return i.replace(/\0/g,"")}for(var a,s,o,l=t.length,u="",h=0;h<l;){if(0===(a=t[h++])&&e)return u;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(a);break;case 12:case 13:s=t[h++],u+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=t[h++],o=t[h++],u+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return u};function pt(){return rt||void 0===self.TextDecoder||(rt=new self.TextDecoder("utf-8")),rt}var yt=function(t){for(var e="",r=0;r<t.length;r++){var i=t[r].toString(16);i.length<2&&(i="0"+i),e+=i}return e},Tt=Math.pow(2,32)-1,Et=[].push,St={video:1,audio:2,id3:3,text:4};function Lt(t){return String.fromCharCode.apply(null,t)}function Rt(t,e){var r=t[e]<<8|t[e+1];return r<0?65536+r:r}function At(t,e){var r=kt(t,e);return r<0?4294967296+r:r}function kt(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function bt(t,e,r){t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r}function Dt(t,e){var r=[];if(!e.length)return r;for(var i=t.byteLength,n=0;n<i;){var a=At(t,n),s=a>1?n+a:i;if(Lt(t.subarray(n+4,n+8))===e[0])if(1===e.length)r.push(t.subarray(n+8,s));else{var o=Dt(t.subarray(n+8,s),e.slice(1));o.length&&Et.apply(r,o)}n=s}return r}function It(t){var e=[],r=t[0],i=8,n=At(t,i);i+=4,i+=0===r?8:16,i+=2;var a=t.length+0,s=Rt(t,i);i+=2;for(var o=0;o<s;o++){var l=i,u=At(t,l);l+=4;var h=2147483647&u;if(1==(2147483648&u)>>>31)return I.warn("SIDX has hierarchical references (not supported)"),null;var d=At(t,l);l+=4,e.push({referenceSize:h,subsegmentDuration:d,info:{duration:d/n,start:a,end:a+h-1}}),a+=h,i=l+=4}return{earliestPresentationTime:0,timescale:n,version:r,referencesCount:s,references:e}}function wt(t){for(var e=[],r=Dt(t,["moov","trak"]),i=0;i<r.length;i++){var n=r[i],a=Dt(n,["tkhd"])[0];if(a){var s=a[0],o=0===s?12:20,l=At(a,o),u=Dt(n,["mdia","mdhd"])[0];if(u){var h=At(u,o=0===(s=u[0])?12:20),d=Dt(n,["mdia","hdlr"])[0];if(d){var c=Lt(d.subarray(8,12)),f={soun:O,vide:M}[c];if(f){var g=Dt(n,["mdia","minf","stbl","stsd"])[0],v=void 0;g&&(v=Lt(g.subarray(12,16))),e[l]={timescale:h,type:f},e[f]={timescale:h,id:l,codec:v}}}}}}return Dt(t,["moov","mvex","trex"]).forEach((function(t){var r=At(t,4),i=e[r];i&&(i.default={duration:At(t,12),flags:At(t,20)})})),e}function Ct(t){var e=Dt(t,["schm"])[0];if(e){var r=Lt(e.subarray(4,8));if("cbcs"===r||"cenc"===r)return Dt(t,["schi","tenc"])[0]}return I.error("[eme] missing 'schm' box"),null}function _t(t){var e=At(t,0),r=8;1&e&&(r+=4),4&e&&(r+=4);for(var i=0,n=At(t,4),a=0;a<n;a++)256&e&&(i+=At(t,r),r+=4),512&e&&(r+=4),1024&e&&(r+=4),2048&e&&(r+=4);return i}function Pt(t,e){var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function xt(t,e){var r=[],i=e.samples,n=e.timescale,a=e.id,s=!1;return Dt(i,["moof"]).map((function(o){var l=o.byteOffset-8;Dt(o,["traf"]).map((function(o){var u=Dt(o,["tfdt"]).map((function(t){var e=t[0],r=At(t,4);return 1===e&&(r*=Math.pow(2,32),r+=At(t,8)),r/n}))[0];return void 0!==u&&(t=u),Dt(o,["tfhd"]).map((function(u){var h=At(u,4),d=16777215&At(u,0),c=0,f=0!=(16&d),g=0,v=0!=(32&d),m=8;h===a&&(0!=(1&d)&&(m+=8),0!=(2&d)&&(m+=4),0!=(8&d)&&(c=At(u,m),m+=4),f&&(g=At(u,m),m+=4),v&&(m+=4),"video"===e.type&&(s=function(t){if(!t)return!1;var e=t.indexOf("."),r=e<0?t:t.substring(0,e);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(e.codec)),Dt(o,["trun"]).map((function(a){var o=a[0],u=16777215&At(a,0),h=0!=(1&u),d=0,f=0!=(4&u),v=0!=(256&u),m=0,p=0!=(512&u),y=0,T=0!=(1024&u),E=0!=(2048&u),S=0,L=At(a,4),R=8;h&&(d=At(a,R),R+=4),f&&(R+=4);for(var A=d+l,k=0;k<L;k++){if(v?(m=At(a,R),R+=4):m=c,p?(y=At(a,R),R+=4):y=g,T&&(R+=4),E&&(S=0===o?At(a,R):kt(a,R),R+=4),e.type===M)for(var b=0;b<y;){var D=At(i,A);Ft(s,i[A+=4])&&Ot(i.subarray(A,A+D),s?2:1,t+S/n,r),A+=D,b+=D+4}t+=m/n}})))}))}))})),r}function Ft(t,e){if(t){var r=e>>1&63;return 39===r||40===r}return 6==(31&e)}function Ot(t,e,r,i){var n=Mt(t),a=0;a+=e;for(var s=0,o=0,l=!1,u=0;a<n.length;){s=0;do{if(a>=n.length)break;s+=u=n[a++]}while(255===u);o=0;do{if(a>=n.length)break;o+=u=n[a++]}while(255===u);var h=n.length-a;if(!l&&4===s&&a<n.length){if(l=!0,181===n[a++]){var d=Rt(n,a);if(a+=2,49===d){var c=At(n,a);if(a+=4,1195456820===c){var f=n[a++];if(3===f){var g=n[a++],v=64&g,m=v?2+3*(31&g):0,p=new Uint8Array(m);if(v){p[0]=g;for(var y=1;y<m;y++)p[y]=n[a++]}i.push({type:f,payloadType:s,pts:r,bytes:p})}}}}}else if(5===s&&o<h){if(l=!0,o>16){for(var T=[],E=0;E<16;E++){var S=n[a++].toString(16);T.push(1==S.length?"0"+S:S),3!==E&&5!==E&&7!==E&&9!==E||T.push("-")}for(var L=o-16,R=new Uint8Array(L),A=0;A<L;A++)R[A]=n[a++];i.push({payloadType:s,pts:r,uuid:T.join(""),userData:mt(R),userDataBytes:R})}}else if(o<h)a+=o;else if(o>h)break}}function Mt(t){for(var e=t.byteLength,r=[],i=1;i<e-2;)0===t[i]&&0===t[i+1]&&3===t[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return t;var n=e-r.length,a=new Uint8Array(n),s=0;for(i=0;i<n;s++,i++)s===r[0]&&(s++,r.shift()),a[i]=t[s];return a}function Nt(t,e,r){if(16!==t.byteLength)throw new RangeError("Invalid system id");var i,n,a;if(e){i=1,n=new Uint8Array(16*e.length);for(var s=0;s<e.length;s++){var o=e[s];if(16!==o.byteLength)throw new RangeError("Invalid key");n.set(o,16*s)}}else i=0,n=new Uint8Array;i>0?(a=new Uint8Array(4),e.length>0&&new DataView(a.buffer).setUint32(0,e.length,!1)):a=new Uint8Array;var l=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(l.buffer).setUint32(0,r.byteLength,!1),function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];for(var n=r.length,a=8,s=n;s--;)a+=r[s].byteLength;var o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,o.set(t,4),s=0,a=8;s<n;s++)o.set(r[s],a),a+=r[s].byteLength;return o}([112,115,115,104],new Uint8Array([i,0,0,0]),t,a,n,l,r||new Uint8Array)}var Ut={},Bt=function(){function t(t,e,r,i,n){void 0===i&&(i=[1]),void 0===n&&(n=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=e,this.keyFormat=r,this.keyFormatVersions=i,this.iv=n,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&"AES-128"!==t}t.clearKeyUriToKeyIdMap=function(){Ut={}};var e=t.prototype;return e.isSupported=function(){if(this.method){if("AES-128"===this.method||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case q:case z:case X:case j:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1},e.getDecryptData=function(e){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof e&&("AES-128"!==this.method||this.iv||I.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),e=0);var r=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e}(e);return new t(this.method,this.uri,"identity",this.keyFormatVersions,r)}var i=V(this.uri);if(i)switch(this.keyFormat){case z:this.pssh=i,i.length>=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case X:var n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Nt(n,null,i);var a=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),s=String.fromCharCode.apply(null,Array.from(a)),o=s.substring(s.indexOf("<"),s.length),l=(new DOMParser).parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){var u=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(u){var h=H(u).subarray(0,16);!function(t){var e=function(t,e,r){var i=t[e];t[e]=t[r],t[r]=i};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}(h),this.keyId=h}}break;default:var d=i.subarray(0,16);if(16!==d.length){var c=new Uint8Array(16);c.set(d,16-d.length),d=c}this.keyId=d}if(!this.keyId||16!==this.keyId.byteLength){var f=Ut[this.uri];if(!f){var g=Object.keys(Ut).length%Number.MAX_SAFE_INTEGER;f=new Uint8Array(16),new DataView(f.buffer,12,4).setUint32(0,g),Ut[this.uri]=f}this.keyId=f}return this},t}(),Gt=/\{\$([a-zA-Z0-9-_]+)\}/g;function Kt(t){return Gt.test(t)}function Ht(t,e,r){if(null!==t.variableList||t.hasVariableRefs)for(var i=r.length;i--;){var n=r[i],a=e[n];a&&(e[n]=Vt(t,a))}}function Vt(t,e){if(null!==t.variableList||t.hasVariableRefs){var r=t.variableList;return e.replace(Gt,(function(e){var i=e.substring(2,e.length-1),n=null==r?void 0:r[i];return void 0===n?(t.playlistParsingError||(t.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),e):n}))}return e}function Yt(t,e,r){var i,n,a=t.variableList;if(a||(t.variableList=a={}),"QUERYPARAM"in e){i=e.QUERYPARAM;try{var s=new self.URL(r).searchParams;if(!s.has(i))throw new Error('"'+i+'" does not match any query parameter in URI: "'+r+'"');n=s.get(i)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+e.message))}}else i=e.NAME,n=e.VALUE;i in a?t.playlistParsingError||(t.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+i+'"')):a[i]=n||""}function Wt(t,e,r){var i=e.IMPORT;if(r&&i in r){var n=t.variableList;n||(t.variableList=n={}),n[i]=r[i]}else t.playlistParsingError||(t.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+i+'"'))}function jt(){if("undefined"!=typeof self)return self.MediaSource||self.WebKitMediaSource}var qt={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dva1:!0,dvav:!0,dvh1:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}},Xt=jt();function zt(t,e){var r;return null!=(r=null==Xt?void 0:Xt.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"'))&&r}var Qt=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,$t=/#EXT-X-MEDIA:(.*)/g,Jt=/^#EXT(?:INF|-X-TARGETDURATION):/m,Zt=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),te=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),ee=function(){function t(){}return t.findGroup=function(t,e){for(var r=0;r<t.length;r++){var i=t[r];if(i.id===e)return i}},t.convertAVC1ToAVCOTI=function(t){var e=t.split(".");if(e.length>2){var r=e.shift()+".";return r+=parseInt(e.shift()).toString(16),r+=("000"+parseInt(e.shift()).toString(16)).slice(-4)}return t},t.resolve=function(t,e){return y.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.isMediaPlaylist=function(t){return Jt.test(t)},t.parseMasterPlaylist=function(e,r){var i,n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Kt(e)},a=[];for(Qt.lastIndex=0;null!=(i=Qt.exec(e));)if(i[1]){var s,o=new _(i[1]);Ht(n,o,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var l=Vt(n,i[2]),u={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:t.resolve(l,r)},h=o.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),ne((o.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),u),u.videoCodec&&-1!==u.videoCodec.indexOf("avc1")&&(u.videoCodec=t.convertAVC1ToAVCOTI(u.videoCodec)),null!=(s=u.unknownCodecs)&&s.length||a.push(u),n.levels.push(u)}else if(i[3]){var d=i[3],c=i[4];switch(d){case"SESSION-DATA":var f=new _(c);Ht(n,f,["DATA-ID","LANGUAGE","VALUE","URI"]);var g=f["DATA-ID"];g&&(null===n.sessionData&&(n.sessionData={}),n.sessionData[g]=f);break;case"SESSION-KEY":var v=re(c,r,n);v.encrypted&&v.isSupported()?(null===n.sessionKeys&&(n.sessionKeys=[]),n.sessionKeys.push(v)):I.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+c+'"');break;case"DEFINE":var m=new _(c);Ht(n,m,["NAME","VALUE","QUERYPARAM"]),Yt(n,m,r);break;case"CONTENT-STEERING":var p=new _(c);Ht(n,p,["SERVER-URI","PATHWAY-ID"]),n.contentSteering={uri:t.resolve(p["SERVER-URI"],r),pathwayId:p["PATHWAY-ID"]||"."};break;case"START":n.startTimeOffset=ie(c)}}var y=a.length>0&&a.length<n.levels.length;return n.levels=y?a:n.levels,0===n.levels.length&&(n.playlistParsingError=new Error("no levels found in manifest")),n},t.parseMasterPlaylistMedia=function(e,r,i){var n,a={},s=i.levels,o={AUDIO:s.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),SUBTITLES:s.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for($t.lastIndex=0;null!==(n=$t.exec(e));){var u=new _(n[1]),h=u.TYPE;if(h){var d=o[h],c=a[h]||[];a[h]=c,Ht(i,u,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var f={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",instreamId:u["INSTREAM-ID"],name:u.NAME||u.LANGUAGE||"",type:h,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:u.LANGUAGE,url:u.URI?t.resolve(u.URI,r):""};if(null!=d&&d.length){var g=t.findGroup(d,f.groupId)||d[0];ae(f,g,"audioCodec"),ae(f,g,"textCodec")}c.push(f)}}return a},t.parseLevelPlaylist=function(t,e,r,i,n,a){var s,l,u,h=new K(e),d=h.fragments,c=null,f=0,g=0,v=0,m=0,p=null,y=new B(i,e),E=-1,S=!1;for(Zt.lastIndex=0,h.m3u8=t,h.hasVariableRefs=Kt(t);null!==(s=Zt.exec(t));){S&&(S=!1,(y=new B(i,e)).start=v,y.sn=f,y.cc=m,y.level=r,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null));var L=s[1];if(L){y.duration=parseFloat(L);var R=(" "+s[2]).slice(1);y.title=R||null,y.tagList.push(R?["INF",L,R]:["INF",L])}else if(s[3]){if(T(y.duration)){y.start=v,u&&le(y,u,h),y.sn=f,y.level=r,y.cc=m,y.urlId=n,d.push(y);var A=(" "+s[3]).slice(1);y.relurl=Vt(h,A),se(y,p),p=y,v+=y.duration,f++,g=0,S=!0}}else if(s[4]){var k=(" "+s[4]).slice(1);p?y.setByteRange(k,p):y.setByteRange(k)}else if(s[5])y.rawProgramDateTime=(" "+s[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===E&&(E=d.length);else{if(!(s=s[0].match(te))){I.warn("No matches on slow regex match for level playlist!");continue}for(l=1;l<s.length&&void 0===s[l];l++);var b=(" "+s[l]).slice(1),D=(" "+s[l+1]).slice(1),w=s[l+2]?(" "+s[l+2]).slice(1):"";switch(b){case"PLAYLIST-TYPE":h.type=D.toUpperCase();break;case"MEDIA-SEQUENCE":f=h.startSN=parseInt(D);break;case"SKIP":var C=new _(D);Ht(h,C,["RECENTLY-REMOVED-DATERANGES"]);var P=C.decimalInteger("SKIPPED-SEGMENTS");if(T(P)){h.skippedSegments=P;for(var F=P;F--;)d.unshift(null);f+=P}var O=C.enumeratedString("RECENTLY-REMOVED-DATERANGES");O&&(h.recentlyRemovedDateranges=O.split("\t"));break;case"TARGETDURATION":h.targetduration=Math.max(parseInt(D),1);break;case"VERSION":h.version=parseInt(D);break;case"EXTM3U":break;case"ENDLIST":h.live=!1;break;case"#":(D||w)&&y.tagList.push(w?[D,w]:[D]);break;case"DISCONTINUITY":m++,y.tagList.push(["DIS"]);break;case"GAP":y.gap=!0,y.tagList.push([b]);break;case"BITRATE":y.tagList.push([b,D]);break;case"DATERANGE":var M=new _(D);Ht(h,M,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Ht(h,M,M.clientAttrs);var N=new x(M,h.dateRanges[M.ID]);N.isValid||h.skippedSegments?h.dateRanges[N.id]=N:I.warn('Ignoring invalid DATERANGE tag: "'+D+'"'),y.tagList.push(["EXT-X-DATERANGE",D]);break;case"DEFINE":var U=new _(D);Ht(h,U,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in U?Wt(h,U,a):Yt(h,U,e);break;case"DISCONTINUITY-SEQUENCE":m=parseInt(D);break;case"KEY":var H=re(D,e,h);if(H.isSupported()){if("NONE"===H.method){u=void 0;break}u||(u={}),u[H.keyFormat]&&(u=o({},u)),u[H.keyFormat]=H}else I.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+D+'"');break;case"START":h.startTimeOffset=ie(D);break;case"MAP":var V=new _(D);if(Ht(h,V,["BYTERANGE","URI"]),y.duration){var Y=new B(i,e);oe(Y,V,r,u),c=Y,y.initSegment=c,c.rawProgramDateTime&&!y.rawProgramDateTime&&(y.rawProgramDateTime=c.rawProgramDateTime)}else oe(y,V,r,u),c=y,S=!0;break;case"SERVER-CONTROL":var W=new _(D);h.canBlockReload=W.bool("CAN-BLOCK-RELOAD"),h.canSkipUntil=W.optionalFloat("CAN-SKIP-UNTIL",0),h.canSkipDateRanges=h.canSkipUntil>0&&W.bool("CAN-SKIP-DATERANGES"),h.partHoldBack=W.optionalFloat("PART-HOLD-BACK",0),h.holdBack=W.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var j=new _(D);h.partTarget=j.decimalFloatingPoint("PART-TARGET");break;case"PART":var q=h.partList;q||(q=h.partList=[]);var X=g>0?q[q.length-1]:void 0,z=g++,Q=new _(D);Ht(h,Q,["BYTERANGE","URI"]);var $=new G(Q,y,e,z,X);q.push($),y.duration+=$.duration;break;case"PRELOAD-HINT":var J=new _(D);Ht(h,J,["URI"]),h.preloadHint=J;break;case"RENDITION-REPORT":var Z=new _(D);Ht(h,Z,["URI"]),h.renditionReports=h.renditionReports||[],h.renditionReports.push(Z);break;default:I.warn("line parsed but not handled: "+s)}}}p&&!p.relurl?(d.pop(),v-=p.duration,h.partList&&(h.fragmentHint=p)):h.partList&&(se(y,p),y.cc=m,h.fragmentHint=y,u&&le(y,u,h));var tt=d.length,et=d[0],rt=d[tt-1];if((v+=h.skippedSegments*h.targetduration)>0&&tt&&rt){h.averagetargetduration=v/tt;var it=rt.sn;h.endSN="initSegment"!==it?it:0,h.live||(rt.endList=!0),et&&(h.startCC=et.cc)}else h.endSN=0,h.startCC=0;return h.fragmentHint&&(v+=h.fragmentHint.duration),h.totalduration=v,h.endCC=m,E>0&&function(t,e){for(var r=t[e],i=e;i--;){var n=t[i];if(!n)return;n.programDateTime=r.programDateTime-1e3*n.duration,r=n}}(d,E),h},t}();function re(t,e,r){var i,n,a=new _(t);Ht(r,a,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var s=null!=(i=a.METHOD)?i:"",o=a.URI,l=a.hexadecimalInteger("IV"),u=a.KEYFORMATVERSIONS,h=null!=(n=a.KEYFORMAT)?n:"identity";o&&a.IV&&!l&&I.error("Invalid IV: "+a.IV);var d=o?ee.resolve(o,e):"",c=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Bt(s,d,h,c,l)}function ie(t){var e=new _(t).decimalFloatingPoint("TIME-OFFSET");return T(e)?e:null}function ne(t,e){["video","audio","text"].forEach((function(r){var i=t.filter((function(t){return function(t,e){var r=qt[e];return!!r&&!0===r[t.slice(0,4)]}(t,r)}));if(i.length){var n=i.filter((function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)}));e[r+"Codec"]=n.length>0?n[0]:i[0],t=t.filter((function(t){return-1===i.indexOf(t)}))}})),e.unknownCodecs=t}function ae(t,e,r){var i=e[r];i&&(t[r]=i)}function se(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),T(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function oe(t,e,r,i){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=r,t.sn="initSegment",i&&(t.levelkeys=i),t.initSegment=null}function le(t,e,r){t.levelkeys=e;var i=r.encryptedFragments;i.length&&i[i.length-1].levelkeys===e||!Object.keys(e).some((function(t){return e[t].isCommonEncryption}))||i.push(t)}var ue="manifest",he="level",de="audioTrack",ce="subtitleTrack",fe="main",ge="audio",ve="subtitle";function me(t){switch(t.type){case de:return ge;case ce:return ve;default:return fe}}function pe(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r}var ye=function(){function t(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=t,this.registerListeners()}var e=t.prototype;return e.startLoad=function(t){},e.stopLoad=function(){this.destroyInternalLoaders()},e.registerListeners=function(){var t=this.hls;t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.LEVEL_LOADING,this.onLevelLoading,this),t.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.LEVEL_LOADING,this.onLevelLoading,this),t.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,i=e.loader,n=new(r||i)(e);return this.loaders[t.type]=n,n},e.getInternalLoader=function(t){return this.loaders[t.type]},e.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},e.onManifestLoading=function(t,e){var r=e.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ue,url:r,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var r=e.id,i=e.level,n=e.url,a=e.deliveryDirectives;this.load({id:r,level:i,responseType:"text",type:he,url:n,deliveryDirectives:a})},e.onAudioTrackLoading=function(t,e){var r=e.id,i=e.groupId,n=e.url,a=e.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:de,url:n,deliveryDirectives:a})},e.onSubtitleTrackLoading=function(t,e){var r=e.id,i=e.groupId,n=e.url,a=e.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:ce,url:n,deliveryDirectives:a})},e.load=function(t){var e,r,i,n=this,a=this.hls.config,s=this.getInternalLoader(t);if(s){var l=s.context;if(l&&l.url===t.url)return void I.trace("[playlist-loader]: playlist request ongoing");I.log("[playlist-loader]: aborting previous loader for type: "+t.type),s.abort()}if(r=t.type===ue?a.manifestLoadPolicy.default:o({},a.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(t),null!=(e=t.deliveryDirectives)&&e.part&&(t.type===he&&null!==t.level?i=this.hls.levels[t.level].details:t.type===de&&null!==t.id?i=this.hls.audioTracks[t.id].details:t.type===ce&&null!==t.id&&(i=this.hls.subtitleTracks[t.id].details),i)){var u=i.partTarget,h=i.targetduration;if(u&&h){var d=1e3*Math.max(3*u,.8*h);r=o({},r,{maxTimeToFirstByteMs:Math.min(d,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(d,r.maxTimeToFirstByteMs)})}}var c=r.errorRetry||r.timeoutRetry||{},f={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:c.maxNumRetry||0,retryDelay:c.retryDelayMs||0,maxRetryDelay:c.maxRetryDelayMs||0},g={onSuccess:function(t,e,r,i){var a=n.getInternalLoader(r);n.resetInternalLoader(r.type);var s=t.data;0===s.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),ee.isMediaPlaylist(s)?n.handleTrackOrLevelPlaylist(t,e,r,i||null,a):n.handleMasterPlaylist(t,e,r,i)):n.handleManifestParsingError(t,r,new Error("no EXTM3U delimiter"),i||null,e)},onError:function(t,e,r,i){n.handleNetworkError(e,r,!1,t,i)},onTimeout:function(t,e,r){n.handleNetworkError(e,r,!0,void 0,t)}};s.load(t,f,g)},e.handleMasterPlaylist=function(t,e,r,i){var n=this.hls,a=t.data,s=pe(t,r),o=ee.parseMasterPlaylist(a,s);if(o.playlistParsingError)this.handleManifestParsingError(t,r,o.playlistParsingError,i,e);else{var l=o.contentSteering,u=o.levels,h=o.sessionData,d=o.sessionKeys,c=o.startTimeOffset,f=o.variableList;this.variableList=f;var g=ee.parseMasterPlaylistMedia(a,s,o),v=g.AUDIO,m=void 0===v?[]:v,p=g.SUBTITLES,y=g["CLOSED-CAPTIONS"];m.length&&(m.some((function(t){return!t.url}))||!u[0].audioCodec||u[0].attrs.AUDIO||(I.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new _({}),bitrate:0,url:""}))),n.trigger(E.MANIFEST_LOADED,{levels:u,audioTracks:m,subtitles:p,captions:y,contentSteering:l,url:s,stats:e,networkDetails:i,sessionData:h,sessionKeys:d,startTimeOffset:c,variableList:f})}},e.handleTrackOrLevelPlaylist=function(t,e,r,i,n){var a=this.hls,s=r.id,o=r.level,l=r.type,u=pe(t,r),h=T(s)?s:0,d=T(o)?o:h,c=me(r),f=ee.parseLevelPlaylist(t.data,u,d,c,h,this.variableList);if(l===ue){var g={attrs:new _({}),bitrate:0,details:f,name:"",url:u};a.trigger(E.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:u,stats:e,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),r.levelDetails=f,this.handlePlaylistLoaded(f,t,e,r,i,n)},e.handleManifestParsingError=function(t,e,r,i,n){this.hls.trigger(E.ERROR,{type:S.NETWORK_ERROR,details:L.MANIFEST_PARSING_ERROR,fatal:e.type===ue,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:i,stats:n})},e.handleNetworkError=function(t,e,r,n,a){void 0===r&&(r=!1);var s="A network "+(r?"timeout":"error"+(n?" (status "+n.code+")":""))+" occurred while loading "+t.type;t.type===he?s+=": "+t.level+" id: "+t.id:t.type!==de&&t.type!==ce||(s+=" id: "+t.id+' group-id: "'+t.groupId+'"');var o=new Error(s);I.warn("[playlist-loader]: "+s);var l=L.UNKNOWN,u=!1,h=this.getInternalLoader(t);switch(t.type){case ue:l=r?L.MANIFEST_LOAD_TIMEOUT:L.MANIFEST_LOAD_ERROR,u=!0;break;case he:l=r?L.LEVEL_LOAD_TIMEOUT:L.LEVEL_LOAD_ERROR,u=!1;break;case de:l=r?L.AUDIO_TRACK_LOAD_TIMEOUT:L.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ce:l=r?L.SUBTITLE_TRACK_LOAD_TIMEOUT:L.SUBTITLE_LOAD_ERROR,u=!1}h&&this.resetInternalLoader(t.type);var d={type:S.NETWORK_ERROR,details:l,fatal:u,url:t.url,loader:h,context:t,error:o,networkDetails:e,stats:a};if(n){var c=(null==e?void 0:e.url)||t.url;d.response=i({url:c,data:void 0},n)}this.hls.trigger(E.ERROR,d)},e.handlePlaylistLoaded=function(t,e,r,i,n,a){var s=this.hls,o=i.type,l=i.level,u=i.id,h=i.groupId,d=i.deliveryDirectives,c=pe(e,i),f=me(i),g="number"==typeof i.level&&f===fe?l:void 0;if(t.fragments.length){t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));var v=t.playlistParsingError;if(v)s.trigger(E.ERROR,{type:S.NETWORK_ERROR,details:L.LEVEL_PARSING_ERROR,fatal:!1,url:c,error:v,reason:v.message,response:e,context:i,level:g,parent:f,networkDetails:n,stats:r});else switch(t.live&&a&&(a.getCacheAge&&(t.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),o){case ue:case he:s.trigger(E.LEVEL_LOADED,{details:t,level:g||0,id:u||0,stats:r,networkDetails:n,deliveryDirectives:d});break;case de:s.trigger(E.AUDIO_TRACK_LOADED,{details:t,id:u||0,groupId:h||"",stats:r,networkDetails:n,deliveryDirectives:d});break;case ce:s.trigger(E.SUBTITLE_TRACK_LOADED,{details:t,id:u||0,groupId:h||"",stats:r,networkDetails:n,deliveryDirectives:d})}}else{var m=new Error("No Segments found in Playlist");s.trigger(E.ERROR,{type:S.NETWORK_ERROR,details:L.LEVEL_EMPTY_ERROR,fatal:!1,url:c,error:m,reason:m.message,response:e,context:i,level:g,parent:f,networkDetails:n,stats:r})}},t}();function Te(t,e){var r;try{r=new Event("addtrack")}catch(t){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function Ee(t,e){var r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(r){I.debug("[texttrack-utils]: "+r);var i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,t.addCue(i)}"disabled"===r&&(t.mode=r)}function Se(t){var e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(var r=t.cues.length;r--;)t.removeCue(t.cues[r]);"disabled"===e&&(t.mode=e)}function Le(t,e,r,i){var n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues&&t.cues.length>0)for(var a=function(t,e,r){var i=[],n=function(t,e){if(e<t[0].startTime)return 0;var r=t.length-1;if(e>t[r].endTime)return-1;for(var i=0,n=r;i<=n;){var a=Math.floor((n+i)/2);if(e<t[a].startTime)n=a-1;else{if(!(e>t[a].startTime&&i<r))return a;i=a+1}}return t[i].startTime-e<e-t[n].startTime?i:n}(t,e);if(n>-1)for(var a=n,s=t.length;a<s;a++){var o=t[a];if(o.startTime>=e&&o.endTime<=r)i.push(o);else if(o.startTime>r)return i}return i}(t.cues,e,r),s=0;s<a.length;s++)i&&!i(a[s])||t.removeCue(a[s]);"disabled"===n&&(t.mode=n)}var Re="org.id3",Ae="com.apple.quicktime.HLS",ke="https://aomedia.org/emsg/ID3";function be(){if("undefined"!=typeof self)return self.WebKitDataCue||self.VTTCue||self.TextTrackCue}var De=function(){var t=be();try{new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Ie(t,e){return t.getTime()/1e3-e}var we=function(){function t(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=t,this._registerListeners()}var e=t.prototype;return e.destroy=function(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null},e._registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)},e._unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)},e.onMediaAttached=function(t,e){this.media=e.media},e.onMediaDetaching=function(){this.id3Track&&(Se(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})},e.onManifestLoading=function(){this.dateRangeCuesAppended={}},e.createTrack=function(t){var e=this.getID3Track(t.textTracks);return e.mode="hidden",e},e.getID3Track=function(t){if(this.media){for(var e=0;e<t.length;e++){var r=t[e];if("metadata"===r.kind&&"id3"===r.label)return Te(r,this.media),r}return this.media.addTextTrack("metadata","id3")}},e.onFragParsingMetadata=function(t,e){if(this.media){var r=this.hls.config,i=r.enableEmsgMetadataCues,n=r.enableID3MetadataCues;if(i||n){var a=e.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));for(var s=be(),o=0;o<a.length;o++){var l=a[o].type;if((l!==ke||i)&&n){var u=ht(a[o].data);if(u){var h=a[o].pts,d=h+a[o].duration;d>De&&(d=De),d-h<=0&&(d=h+.25);for(var c=0;c<u.length;c++){var f=u[c];if(!lt(f)){this.updateId3CueEnds(h);var g=new s(h,d,"");g.value=f,l&&(g.type=l),this.id3Track.addCue(g)}}}}}}}},e.updateId3CueEnds=function(t){var e,r=null==(e=this.id3Track)?void 0:e.cues;if(r)for(var i=r.length;i--;){var n=r[i];n.startTime<t&&n.endTime===De&&(n.endTime=t)}},e.onBufferFlushing=function(t,e){var r=e.startOffset,i=e.endOffset,n=e.type,a=this.id3Track,s=this.hls;if(s){var o=s.config,l=o.enableEmsgMetadataCues,u=o.enableID3MetadataCues;a&&(l||u)&&Le(a,r,i,"audio"===n?function(t){return t.type===Re&&u}:"video"===n?function(t){return t.type===ke&&l}:function(t){return t.type===Re&&u||t.type===ke&&l})}},e.onLevelUpdated=function(t,e){var r=this,i=e.details;if(this.media&&i.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var n=this.dateRangeCuesAppended,a=this.id3Track,s=i.dateRanges,o=Object.keys(s);if(a)for(var l=Object.keys(n).filter((function(t){return!o.includes(t)})),u=function(){var t=l[h];Object.keys(n[t].cues).forEach((function(e){a.removeCue(n[t].cues[e])})),delete n[t]},h=l.length;h--;)u();var d=i.fragments[i.fragments.length-1];if(0!==o.length&&T(null==d?void 0:d.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var c=d.programDateTime/1e3-d.start,f=be(),g=function(){var t=o[v],e=s[t],i=n[t],a=(null==i?void 0:i.cues)||{},l=(null==i?void 0:i.durationKnown)||!1,u=Ie(e.startDate,c),h=De,d=e.endDate;if(d)h=Ie(d,c),l=!0;else if(e.endOnNext&&!l){var g=o.reduce((function(t,r){var i=s[r];return i.class===e.class&&i.id!==r&&i.startDate>e.startDate&&t.push(i),t}),[]).sort((function(t,e){return t.startDate.getTime()-e.startDate.getTime()}))[0];g&&(h=Ie(g.startDate,c),l=!0)}for(var m,p,y=Object.keys(e.attr),T=0;T<y.length;T++){var E=y[T];if("ID"!==(p=E)&&"CLASS"!==p&&"START-DATE"!==p&&"DURATION"!==p&&"END-DATE"!==p&&"END-ON-NEXT"!==p){var S=a[E];if(S)l&&!i.durationKnown&&(S.endTime=h);else{var L=e.attr[E];S=new f(u,h,""),P(E)&&(m=L,L=Uint8Array.from(m.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),S.value={key:E,data:L},S.type=Ae,S.id=t,r.id3Track.addCue(S),a[E]=S}}}n[t]={cues:a,dateRange:e,durationKnown:l}},v=0;v<o.length;v++)g()}}},t}(),Ce=function(){function t(t){var e=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return e.timeupdate()},this.hls=t,this.config=t.config,this.registerListeners()}var e=t.prototype;return e.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},e.registerListeners=function(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)},e.unregisterListeners=function(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)},e.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},e.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},e.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},e.onLevelUpdated=function(t,e){var r=e.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},e.onError=function(t,e){var r;e.details===L.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(r=this.levelDetails)&&r.live&&I.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},e.timeupdate=function(){var t=this.media,e=this.levelDetails;if(t&&e){this.currentTime=t.currentTime;var r=this.computeLatency();if(null!==r){this._latency=r;var i=this.config,n=i.lowLatencyMode,a=i.maxLiveSyncPlaybackRate;if(n&&1!==a){var s=this.targetLatency;if(null!==s){var o=r-s,l=o<Math.min(this.maxLatency,s+e.targetduration);if(e.live&&l&&o>.05&&this.forwardBufferLength>1){var u=Math.min(2,Math.max(1,a)),h=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;t.playbackRate=Math.min(u,Math.max(1,h))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}}}}},e.estimateLiveEdge=function(){var t=this.levelDetails;return null===t?null:t.edge+t.age},e.computeLatency=function(){var t=this.estimateLiveEdge();return null===t?null:t-this.currentTime},a(t,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config,e=this.levelDetails;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(null===t)return null;var e=t.holdBack,r=t.partHoldBack,i=t.targetduration,n=this.config,a=n.liveSyncDuration,s=n.liveSyncDurationCount,o=n.lowLatencyMode,l=this.hls.userConfig,u=o&&r||e;(l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==a?a:s*i);var h=i;return u+Math.min(1*this.stallCount,h)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,r=this.levelDetails;if(null===t||null===e||null===r)return null;var i=r.edge,n=t-e-this.edgeStalled,a=i-r.totalduration,s=i-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,n),s)}},{key:"drift",get:function(){var t=this.levelDetails;return null===t?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(null===t)return 0;var e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var r=t.buffered.length;return(r?t.buffered.end(r-1):e.edge)-this.currentTime}}]),t}(),_e=["NONE","TYPE-0","TYPE-1",null],Pe="",xe="YES",Fe="v2",Oe=function(){function t(t,e,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=r}return t.prototype.addDirectives=function(t){var e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href},t}(),Me=function(){function t(t){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return t})).join(",").replace(/\.[^.,]+/g,"")}return t.prototype.addFallback=function(t){this.url.push(t.url),this._attrs.push(t.attrs)},a(t,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"attrs",get:function(){return this._attrs[this._urlId]}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(t){var e=t%this.url.length;this._urlId!==e&&(this.fragmentError=0,this.loadError=0,this.details=void 0,this._urlId=e)}},{key:"audioGroupId",get:function(){var t;return null==(t=this.audioGroupIds)?void 0:t[this.urlId]}},{key:"textGroupId",get:function(){var t;return null==(t=this.textGroupIds)?void 0:t[this.urlId]}}]),t}();function Ne(t,e){var r=e.startPTS;if(T(r)){var i,n=0;e.sn>t.sn?(n=r-t.start,i=t):(n=t.start-r,i=e),i.duration!==n&&(i.duration=n)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration:e.start=Math.max(t.start-e.duration,0)}function Ue(t,e,r,i,n,a){i-r<=0&&(I.warn("Fragment should have a positive duration",e),i=r+e.duration,a=n+e.duration);var s=r,o=i,l=e.startPTS,u=e.endPTS;if(T(l)){var h=Math.abs(l-r);T(e.deltaPTS)?e.deltaPTS=Math.max(h,e.deltaPTS):e.deltaPTS=h,s=Math.max(r,l),r=Math.min(r,l),n=Math.min(n,e.startDTS),o=Math.min(i,u),i=Math.max(i,u),a=Math.max(a,e.endDTS)}var d=r-e.start;0!==e.start&&(e.start=r),e.duration=i-e.start,e.startPTS=r,e.maxStartPTS=s,e.startDTS=n,e.endPTS=i,e.minEndPTS=o,e.endDTS=a;var c,f=e.sn;if(!t||f<t.startSN||f>t.endSN)return 0;var g=f-t.startSN,v=t.fragments;for(v[g]=e,c=g;c>0;c--)Ne(v[c],v[c-1]);for(c=g;c<v.length-1;c++)Ne(v[c],v[c+1]);return t.fragmentHint&&Ne(v[v.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,d}function Be(t,e){for(var r=null,i=t.fragments,n=i.length-1;n>=0;n--){var a=i[n].initSegment;if(a){r=a;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var s,l,u,h,d,c=0;if(function(t,e,r){for(var i=e.skippedSegments,n=Math.max(t.startSN,e.startSN)-e.startSN,a=(t.fragmentHint?1:0)+(i?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,s=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,u=n;u<=a;u++){var h=l[s+u],d=o[u];i&&!d&&u<i&&(d=e.fragments[u]=h),h&&d&&r(h,d)}}(t,e,(function(t,i){t.relurl&&(c=t.cc-i.cc),T(t.startPTS)&&T(t.endPTS)&&(i.start=i.startPTS=t.startPTS,i.startDTS=t.startDTS,i.maxStartPTS=t.maxStartPTS,i.endPTS=t.endPTS,i.endDTS=t.endDTS,i.minEndPTS=t.minEndPTS,i.duration=t.endPTS-t.startPTS,i.duration&&(s=i),e.PTSKnown=e.alignedSliding=!0),i.elementaryStreams=t.elementaryStreams,i.loader=t.loader,i.stats=t.stats,i.urlId=t.urlId,t.initSegment&&(i.initSegment=t.initSegment,r=t.initSegment)})),r&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((function(t){var e;t.initSegment&&t.initSegment.relurl!==(null==(e=r)?void 0:e.relurl)||(t.initSegment=r)})),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some((function(t){return!t})),e.deltaUpdateFailed){I.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var f=e.skippedSegments;f--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=(l=t.dateRanges,u=e.dateRanges,h=e.recentlyRemovedDateranges,d=o({},l),h&&h.forEach((function(t){delete d[t]})),Object.keys(u).forEach((function(t){var e=new x(u[t].attr,d[t]);e.isValid?d[t]=e:I.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(u[t].attr)+'"')})),d));var g=e.fragments;if(c){I.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<g.length;v++)g[v].cc+=c}e.skippedSegments&&(e.startCC=e.fragments[0].cc),function(t,e,r){if(t&&e)for(var i=0,n=0,a=t.length;n<=a;n++){var s=t[n],o=e[n+i];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):i--}}(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),s?Ue(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):Ge(t,e),g.length&&(e.totalduration=e.edge-g[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var m=e.advancedDateTime;if(e.advanced&&m){var p=e.edge;e.driftStart||(e.driftStartTime=m,e.driftStart=p),e.driftEndTime=m,e.driftEnd=p}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function Ge(t,e){var r=e.startSN+e.skippedSegments-t.startSN,i=t.fragments;r<0||r>=i.length||Ke(e,i[r].start)}function Ke(t,e){if(e){for(var r=t.fragments,i=t.skippedSegments;i<r.length;i++)r[i].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function He(t,e,r){var i;return null!=t&&t.details?Ve(null==(i=t.details)?void 0:i.partList,e,r):null}function Ve(t,e,r){if(t)for(var i=t.length;i--;){var n=t[i];if(n.index===r&&n.fragment.sn===e)return n}return null}function Ye(t){switch(t.details){case L.FRAG_LOAD_TIMEOUT:case L.KEY_LOAD_TIMEOUT:case L.LEVEL_LOAD_TIMEOUT:case L.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function We(t,e){var r=Ye(e);return t.default[(r?"timeout":"error")+"Retry"]}function je(t,e){var r="linear"===t.backoff?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function qe(t){return i(i({},t),{errorRetry:null,timeoutRetry:null})}function Xe(t,e,r,i){return!!t&&e<t.maxNumRetry&&(function(t){return 0===t&&!1===navigator.onLine||!!t&&(t<400||t>499)}(i)||!!r)}var ze={search:function(t,e){for(var r=0,i=t.length-1,n=null,a=null;r<=i;){var s=e(a=t[n=(r+i)/2|0]);if(s>0)r=n+1;else{if(!(s<0))return a;i=n-1}}return null}};function Qe(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=null;if(t?n=e[t.sn-e[0].sn+1]||null:0===r&&0===e[0].start&&(n=e[0]),n&&0===$e(r,i,n))return n;var a=ze.search(e,$e.bind(null,r,i));return!a||a===t&&n?n:a}function $e(t,e,r){if(void 0===t&&(t=0),void 0===e&&(e=0),r.start<=t&&r.start+r.duration>t)return 0;var i=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-i<=t?1:r.start-i>t&&r.start?-1:0}function Je(t,e,r){var i=1e3*Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-i>t}var Ze,tr=3e5,er=0,rr=2,ir=5,nr=0,ar=1,sr=2,or=function(){function t(t){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=t,this.log=I.log.bind(I,"[info]:"),this.warn=I.warn.bind(I,"[warning]:"),this.error=I.error.bind(I,"[error]:"),this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(E.ERROR,this.onError,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this)},e.unregisterListeners=function(){var t=this.hls;t&&(t.off(E.ERROR,this.onError,this),t.off(E.ERROR,this.onErrorOut,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this))},e.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},e.startLoad=function(t){this.playlistError=0},e.stopLoad=function(){},e.getVariantLevelIndex=function(t){return(null==t?void 0:t.type)===fe?t.level:this.hls.loadLevel},e.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},e.onError=function(t,e){var r;if(!e.fatal){var i=this.hls,n=e.context;switch(e.details){case L.FRAG_LOAD_ERROR:case L.FRAG_LOAD_TIMEOUT:case L.KEY_LOAD_ERROR:case L.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case L.FRAG_GAP:case L.FRAG_PARSING_ERROR:case L.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=rr);case L.LEVEL_EMPTY_ERROR:case L.LEVEL_PARSING_ERROR:var a,s,o=e.parent===fe?e.level:i.loadLevel;return void(e.details===L.LEVEL_EMPTY_ERROR&&null!=(a=e.context)&&null!=(s=a.levelDetails)&&s.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,o):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,o)));case L.LEVEL_LOAD_ERROR:case L.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,n.level)));case L.AUDIO_TRACK_LOAD_ERROR:case L.AUDIO_TRACK_LOAD_TIMEOUT:case L.SUBTITLE_LOAD_ERROR:case L.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var l=i.levels[i.loadLevel];if(l&&(n.type===de&&n.groupId===l.audioGroupId||n.type===ce&&n.groupId===l.textGroupId))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,i.loadLevel),e.errorAction.action=rr,void(e.errorAction.flags=ar)}return;case L.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var u=i.levels[i.loadLevel],h=null==u?void 0:u.attrs["HDCP-LEVEL"];return void(h&&(e.errorAction={action:rr,flags:sr,hdcpLevel:h}));case L.BUFFER_ADD_CODEC_ERROR:case L.REMUX_ALLOC_ERROR:return void(e.errorAction=this.getLevelSwitchAction(e,null!=(r=e.level)?r:i.loadLevel));case L.INTERNAL_EXCEPTION:case L.BUFFER_APPENDING_ERROR:case L.BUFFER_APPEND_ERROR:case L.BUFFER_FULL_ERROR:case L.LEVEL_SWITCH_ERROR:case L.BUFFER_STALLED_ERROR:case L.BUFFER_SEEK_OVER_HOLE:case L.BUFFER_NUDGE_ON_STALL:return void(e.errorAction={action:er,flags:nr})}if(e.type===S.KEY_SYSTEM_ERROR){var d=this.getVariantLevelIndex(e.frag);return e.levelRetry=!1,void(e.errorAction=this.getLevelSwitchAction(e,d))}}},e.getPlaylistRetryOrSwitchAction=function(t,e){var r,i=We(this.hls.config.playlistLoadPolicy,t),n=this.playlistError++,a=null==(r=t.response)?void 0:r.code;if(Xe(i,n,Ye(t),a))return{action:ir,flags:nr,retryConfig:i,retryCount:n};var s=this.getLevelSwitchAction(t,e);return i&&(s.retryConfig=i,s.retryCount=n),s},e.getFragRetryOrSwitchAction=function(t){var e=this.hls,r=this.getVariantLevelIndex(t.frag),i=e.levels[r],n=e.config,a=n.fragLoadPolicy,s=n.keyLoadPolicy,o=We(t.details.startsWith("key")?s:a,t),l=e.levels.reduce((function(t,e){return t+e.fragmentError}),0);if(i){var u;t.details!==L.FRAG_GAP&&i.fragmentError++;var h=null==(u=t.response)?void 0:u.code;if(Xe(o,l,Ye(t),h))return{action:ir,flags:nr,retryConfig:o,retryCount:l}}var d=this.getLevelSwitchAction(t,r);return o&&(d.retryConfig=o,d.retryCount=l),d},e.getLevelSwitchAction=function(t,e){var r=this.hls;null==e&&(e=r.loadLevel);var i=this.hls.levels[e];if(i&&(i.loadError++,r.autoLevelEnabled)){for(var n,a,s=-1,o=r.levels,l=null==(n=t.frag)?void 0:n.type,u=null!=(a=t.context)?a:{},h=u.type,d=u.groupId,c=o.length;c--;){var f=(c+r.loadLevel)%o.length;if(f!==r.loadLevel&&0===o[f].loadError){var g=o[f];if(t.details===L.FRAG_GAP&&t.frag){var v=o[f].details;if(v){var m=Qe(t.frag,v.fragments,t.frag.start);if(null!=m&&m.gap)continue}}else{if(h===de&&d===g.audioGroupId||h===ce&&d===g.textGroupId)continue;if(l===ge&&i.audioGroupId===g.audioGroupId||l===ve&&i.textGroupId===g.textGroupId)continue}s=f;break}}if(s>-1&&r.loadLevel!==s)return t.levelRetry=!0,{action:rr,flags:nr,nextAutoLevel:s}}return{action:rr,flags:ar}},e.onErrorOut=function(t,e){var r;switch(null==(r=e.errorAction)?void 0:r.action){case er:break;case rr:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===L.FRAG_GAP||(e.fatal=!0)}e.fatal&&this.hls.stopLoad()},e.sendAlternateToPenaltyBox=function(t){var e=this.hls,r=t.errorAction;if(r){var i=r.flags,n=r.hdcpLevel,a=r.nextAutoLevel;switch(i){case nr:this.switchLevel(t,a);break;case ar:r.resolved||(r.resolved=this.redundantFailover(t));break;case sr:n&&(e.maxHdcpLevel=_e[_e.indexOf(n)-1],r.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+e.maxHdcpLevel+'" or lower')}r.resolved||this.switchLevel(t,a)}},e.switchLevel=function(t,e){void 0!==e&&t.errorAction&&(this.warn("switching to level "+e+" after "+t.details),this.hls.nextAutoLevel=e,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},e.redundantFailover=function(t){var e=this,r=this.hls,i=this.penalizedRenditions,n=t.parent===fe?t.level:r.loadLevel,a=r.levels[n],s=a.url.length,o=t.frag?t.frag.urlId:a.urlId;a.urlId!==o||t.frag&&!a.details||this.penalizeRendition(a,t);for(var l=function(){var l=(o+u)%s,h=i[l];if(!h||function(t,e,r){if(performance.now()-t.lastErrorPerfMs>tr)return!0;var i=t.details;if(e.details===L.FRAG_GAP&&i&&e.frag){var n=e.frag.start,a=Qe(null,i.fragments,n);if(a&&!a.gap)return!0}if(r&&t.errors.length<r.errors.length){var s=t.errors[t.errors.length-1];if(i&&s.frag&&e.frag&&Math.abs(s.frag.start-e.frag.start)>3*i.targetduration)return!0}return!1}(h,t,i[o]))return e.warn("Switching to Redundant Stream "+(l+1)+"/"+s+': "'+a.url[l]+'" after '+t.details),e.playlistError=0,r.levels.forEach((function(t){t.urlId=l})),r.nextLoadLevel=n,{v:!0}},u=1;u<s;u++){var h=l();if("object"==typeof h)return h.v}return!1},e.penalizeRendition=function(t,e){var r=this.penalizedRenditions,i=r[t.urlId]||{lastErrorPerfMs:0,errors:[],details:void 0};i.lastErrorPerfMs=performance.now(),i.errors.push(e),i.details=t.details,r[t.urlId]=i},t}(),lr=function(){function t(t,e){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=I.log.bind(I,e+":"),this.warn=I.warn.bind(I,e+":"),this.hls=t}var e=t.prototype;return e.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},e.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},e.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},e.stopLoad=function(){this.canLoad=!1,this.clearTimer()},e.switchParams=function(t,e){var r=null==e?void 0:e.renditionReports;if(r){for(var i=-1,n=0;n<r.length;n++){var a=r[n],s=void 0;try{s=new self.URL(a.URI,e.url).href}catch(t){I.warn("Could not construct new URL for Rendition Report: "+t),s=a.URI||""}if(s===t){i=n;break}s===t.substring(0,s.length)&&(i=n)}if(-1!==i){var o=r[i],l=parseInt(o["LAST-MSN"])||(null==e?void 0:e.lastPartSn),u=parseInt(o["LAST-PART"])||(null==e?void 0:e.lastPartIndex);if(this.hls.config.lowLatencyMode){var h=Math.min(e.age-e.partTarget,e.targetduration);u>=0&&h>e.partTarget&&(u+=1)}return new Oe(l,u>=0?u:void 0,Pe)}}},e.loadPlaylist=function(t){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())},e.shouldLoadPlaylist=function(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)},e.shouldReloadPlaylist=function(t){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(t)},e.playlistLoaded=function(t,e,r){var i=this,n=e.details,a=e.stats,s=self.performance.now(),o=a.loading.first?Math.max(0,s-a.loading.first):0;if(n.advancedDateTime=Date.now()-o,n.live||null!=r&&r.live){if(n.reloaded(r),r&&this.log("live playlist "+t+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),r&&n.fragments.length>0&&Be(r,n),!this.canLoad||!n.live)return;var l,u=void 0,h=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var d=this.hls.config.lowLatencyMode,c=n.lastPartSn,f=n.endSN,g=n.lastPartIndex,v=c===f;-1!==g?(u=v?f+1:c,h=v?d?0:g:g+1):u=f+1;var m=n.age,p=m+n.ageHeader,y=Math.min(p-n.partTarget,1.5*n.targetduration);if(y>0){if(r&&y>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+y+" with playlist age: "+n.age),y=0;else{var T=Math.floor(y/n.targetduration);u+=T,void 0!==h&&(h+=Math.round(y%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+y+" skip sn "+T+" to part "+h)}n.tuneInGoal=y}if(l=this.getDeliveryDirectives(n,e.deliveryDirectives,u,h),d||!v)return void this.loadPlaylist(l)}else n.canBlockReload&&(l=this.getDeliveryDirectives(n,e.deliveryDirectives,u,h));var E=this.hls.mainForwardBufferInfo,S=E?E.end-E.len:0,L=function(t,e){void 0===e&&(e=1/0);var r=1e3*t.targetduration;if(t.updated){var i=t.fragments;if(i.length&&4*r>e){var n=1e3*i[i.length-1].duration;n<r&&(r=n)}}else r/=2;return Math.round(r)}(n,1e3*(n.edge-S));n.updated&&s>this.requestScheduled+L&&(this.requestScheduled=a.loading.start),void 0!==u&&n.canBlockReload?this.requestScheduled=a.loading.first+L-(1e3*n.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+L<s?this.requestScheduled=s:this.requestScheduled-s<=0&&(this.requestScheduled+=L);var R=this.requestScheduled-s;R=Math.max(0,R),this.log("reload live playlist "+t+" in "+Math.round(R)+" ms"),this.timer=self.setTimeout((function(){return i.loadPlaylist(l)}),R)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,r,i){var n=function(t,e){var r=t.canSkipUntil,i=t.canSkipDateRanges,n=t.endSN;return r&&(void 0!==e?e-n:0)<r?i?Fe:xe:Pe}(t,r);return null!=e&&e.skip&&t.deltaUpdateFailed&&(r=e.msn,i=e.part,n=Pe),new Oe(r,i,n)},e.checkRetry=function(t){var e=this,r=t.details,i=Ye(t),n=t.errorAction,a=n||{},s=a.action,o=a.retryCount,l=void 0===o?0:o,u=a.retryConfig,h=!!n&&!!u&&(s===ir||!n.resolved&&s===rr);if(h){var d;if(this.requestScheduled=-1,i&&null!=(d=t.context)&&d.deliveryDirectives)this.warn("Retrying playlist loading "+(l+1)+"/"+u.maxNumRetry+' after "'+r+'" without delivery-directives'),this.loadPlaylist();else{var c=je(u,l);this.timer=self.setTimeout((function(){return e.loadPlaylist()}),c),this.warn("Retrying playlist loading "+(l+1)+"/"+u.maxNumRetry+' after "'+r+'" in '+c+"ms")}t.levelRetry=!0,n.resolved=!0}return h},t}(),ur=function(t){function e(e,r){var i;return(i=t.call(this,e,"[level-controller]")||this)._levels=[],i._firstLevel=-1,i._startLevel=void 0,i.currentLevel=null,i.currentLevelIndex=-1,i.manualLevelIndex=-1,i.steering=void 0,i.onParsedComplete=void 0,i.steering=r,i._registerListeners(),i}l(e,t);var r=e.prototype;return r._registerListeners=function(){var t=this.hls;t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(E.LEVEL_LOADED,this.onLevelLoaded,this),t.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(E.FRAG_LOADED,this.onFragLoaded,this),t.on(E.ERROR,this.onError,this)},r._unregisterListeners=function(){var t=this.hls;t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(E.LEVEL_LOADED,this.onLevelLoaded,this),t.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(E.FRAG_LOADED,this.onFragLoaded,this),t.off(E.ERROR,this.onError,this)},r.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),t.prototype.destroy.call(this)},r.startLoad=function(){this._levels.forEach((function(t){t.loadError=0,t.fragmentError=0})),t.prototype.startLoad.call(this)},r.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[]},r.onManifestLoading=function(t,e){this.resetLevels()},r.onManifestLoaded=function(t,e){var r,i=[],n={};e.levels.forEach((function(t){var e,a=t.attrs;-1!==(null==(e=t.audioCodec)?void 0:e.indexOf("mp4a.40.34"))&&(Ze||(Ze=/chrome|firefox/i.test(navigator.userAgent)),Ze&&(t.audioCodec=void 0));var s=a.AUDIO,o=a.CODECS,l=a["FRAME-RATE"],u=a["PATHWAY-ID"],h=a.RESOLUTION,d=a.SUBTITLES,c=(u||".")+"-"+t.bitrate+"-"+h+"-"+l+"-"+o;(r=n[c])?r.addFallback(t):(r=new Me(t),n[c]=r,i.push(r)),hr(r,"audio",s),hr(r,"text",d)})),this.filterAndSortMediaOptions(i,e)},r.filterAndSortMediaOptions=function(t,e){var r=this,i=[],n=[],a=!1,s=!1,o=!1,l=t.filter((function(t){var e=t.audioCodec,r=t.videoCodec,i=t.width,n=t.height,l=t.unknownCodecs;return a||(a=!(!i||!n)),s||(s=!!r),o||(o=!!e),!(null!=l&&l.length)&&(!e||zt(e,"audio"))&&(!r||zt(r,"video"))}));if((a||s)&&o&&(l=l.filter((function(t){var e=t.videoCodec,r=t.width,i=t.height;return!!e||!(!r||!i)}))),0!==l.length){e.audioTracks&&dr(i=e.audioTracks.filter((function(t){return!t.audioCodec||zt(t.audioCodec,"audio")}))),e.subtitles&&dr(n=e.subtitles);var u=l.slice(0);l.sort((function(t,e){return t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"]?(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1:t.bitrate!==e.bitrate?t.bitrate-e.bitrate:t.attrs["FRAME-RATE"]!==e.attrs["FRAME-RATE"]?t.attrs.decimalFloatingPoint("FRAME-RATE")-e.attrs.decimalFloatingPoint("FRAME-RATE"):t.attrs.SCORE!==e.attrs.SCORE?t.attrs.decimalFloatingPoint("SCORE")-e.attrs.decimalFloatingPoint("SCORE"):a&&t.height!==e.height?t.height-e.height:0}));var h=u[0];if(this.steering&&(l=this.steering.filterParsedLevels(l)).length!==u.length)for(var d=0;d<u.length;d++)if(u[d].pathwayId===l[0].pathwayId){h=u[d];break}this._levels=l;for(var c=0;c<l.length;c++)if(l[c]===h){this._firstLevel=c,this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+h.bitrate);break}var f=o&&!s,g={levels:l,audioTracks:i,subtitleTracks:n,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:o,video:s,altAudio:!f&&i.some((function(t){return!!t.url}))};this.hls.trigger(E.MANIFEST_PARSED,g),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then((function(){if(r.hls){var t=new Error("no level with compatible codecs found in manifest");r.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,error:t,reason:t.message})}}))},r.onError=function(t,e){!e.fatal&&e.context&&e.context.type===he&&e.context.level===this.level&&this.checkRetry(e)},r.onFragLoaded=function(t,e){var r=e.frag;if(void 0!==r&&r.type===fe){var i=this._levels[r.level];void 0!==i&&(i.loadError=0)}},r.onLevelLoaded=function(t,e){var r,i,n=e.level,a=e.details,s=this._levels[n];if(!s)return this.warn("Invalid level index "+n),void(null!=(i=e.deliveryDirectives)&&i.skip&&(a.deltaUpdateFailed=!0));n===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0),this.playlistLoaded(n,e,s.details)):null!=(r=e.deliveryDirectives)&&r.skip&&(a.deltaUpdateFailed=!0)},r.onAudioTrackSwitched=function(t,e){var r=this.currentLevel;if(r){var i=this.hls.audioTracks[e.id].groupId;if(r.audioGroupIds&&r.audioGroupId!==i){for(var n=-1,a=0;a<r.audioGroupIds.length;a++)if(r.audioGroupIds[a]===i){n=a;break}-1!==n&&n!==r.urlId&&(r.urlId=n,this.canLoad&&this.startLoad())}}},r.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){var n=i.urlId,a=i.uri;if(e)try{a=e.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}var s=i.attrs["PATHWAY-ID"];this.log("Loading level index "+r+(void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:"")+" with"+(s?" Pathway "+s:"")+" URI "+(n+1)+"/"+i.url.length+" "+a),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:a,level:r,id:n,deliveryDirectives:e||null})}},r.removeLevel=function(t,e){var r=this,i=function(t,r){return r!==e},n=this._levels.filter((function(n,a){return a!==t||(n.url.length>1&&void 0!==e?(n.url=n.url.filter(i),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(i)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(i)),n.urlId=0,!0):(r.steering&&r.steering.removeLevel(n),!1))}));this.hls.trigger(E.LEVELS_UPDATED,{levels:n})},r.onLevelsUpdated=function(t,e){var r=e.levels;r.forEach((function(t,e){var r=t.details;null!=r&&r.fragments&&r.fragments.forEach((function(t){t.level=e}))})),this._levels=r},a(e,[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e=this._levels;if(0!==e.length){if(t<0||t>=e.length){var r=new Error("invalid level idx"),i=t<0;if(this.hls.trigger(E.ERROR,{type:S.OTHER_ERROR,details:L.LEVEL_SWITCH_ERROR,level:t,fatal:i,error:r,reason:r.message}),i)return;t=Math.min(t,e.length-1)}var n=this.currentLevelIndex,a=this.currentLevel,s=a?a.attrs["PATHWAY-ID"]:void 0,l=e[t],u=l.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=l,n!==t||!l.details||!a||s!==u){this.log("Switching to level "+t+(u?" with Pathway "+u:"")+" from level "+n+(s?" with Pathway "+s:""));var h=o({},l,{level:t,maxBitrate:l.maxBitrate,attrs:l.attrs,uri:l.uri,urlId:l.urlId});delete h._attrs,delete h._urlId,this.hls.trigger(E.LEVEL_SWITCHING,h);var d=l.details;if(!d||d.live){var c=this.switchParams(l.uri,null==a?void 0:a.details);this.loadPlaylist(c)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}]),e}(lr);function hr(t,e,r){r&&("audio"===e?(t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds[t.url.length-1]=r):"text"===e&&(t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds[t.url.length-1]=r))}function dr(t){var e={};t.forEach((function(t){var r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++}))}var cr="NOT_LOADED",fr="APPENDING",gr="PARTIAL",vr="OK",mr=function(){function t(t){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){var t=this.hls;t.on(E.BUFFER_APPENDED,this.onBufferAppended,this),t.on(E.FRAG_BUFFERED,this.onFragBuffered,this),t.on(E.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(E.BUFFER_APPENDED,this.onBufferAppended,this),t.off(E.FRAG_BUFFERED,this.onFragBuffered,this),t.off(E.FRAG_LOADED,this.onFragLoaded,this)},e.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},e.getAppendedFrag=function(t,e){var r=this.activePartLists[e];if(r)for(var i=r.length;i--;){var n=r[i];if(!n)break;var a=n.end;if(n.start<=t&&null!==a&&t<=a)return n}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var r=this.fragments,i=Object.keys(r),n=i.length;n--;){var a=r[i[n]];if((null==a?void 0:a.body.type)===e&&a.buffered){var s=a.body;if(s.start<=t&&t<=s.end)return s}}return null},e.detectEvictedFragments=function(t,e,r,i){var n=this;this.timeRanges&&(this.timeRanges[t]=e);var a=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((function(i){var s=n.fragments[i];if(s&&!(a>=s.body.sn))if(s.buffered||s.loaded){var o=s.range[t];o&&o.time.some((function(t){var r=!n.isTimeBuffered(t.startPTS,t.endPTS,e);return r&&n.removeFragment(s.body),r}))}else s.body.type===r&&n.removeFragment(s.body)}))},e.detectPartialFragments=function(t){var e=this,r=this.timeRanges,i=t.frag,n=t.part;if(r&&"initSegment"!==i.sn){var a=yr(i),s=this.fragments[a];if(s){var o=!i.relurl;Object.keys(r).forEach((function(t){var a=i.elementaryStreams[t];if(a){var l=r[t],u=o||!0===a.partial;s.range[t]=e.getBufferedTimes(i,n,u,l)}})),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,s.body.endList&&(this.endListFragments[s.body.type]=s),pr(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}}},e.removeParts=function(t,e){var r=this.activePartLists[e];r&&(this.activePartLists[e]=r.filter((function(e){return e.fragment.sn>=t})))},e.fragBuffered=function(t,e){var r=yr(t),i=this.fragments[r];!i&&e&&(i=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)},e.getBufferedTimes=function(t,e,r,i){for(var n={time:[],partial:r},a=t.start,s=t.end,o=t.minEndPTS||s,l=t.maxStartPTS||a,u=0;u<i.length;u++){var h=i.start(u)-this.bufferPadding,d=i.end(u)+this.bufferPadding;if(l>=h&&o<=d){n.time.push({startPTS:Math.max(a,i.start(u)),endPTS:Math.min(s,i.end(u))});break}if(a<d&&s>h)n.partial=!0,n.time.push({startPTS:Math.max(a,i.start(u)),endPTS:Math.min(s,i.end(u))});else if(s<=h)break}return n},e.getPartialFragment=function(t){var e,r,i,n=null,a=0,s=this.bufferPadding,o=this.fragments;return Object.keys(o).forEach((function(l){var u=o[l];u&&pr(u)&&(r=u.body.start-s,i=u.body.end+s,t>=r&&t<=i&&(e=Math.min(t-r,i-t),a<=e&&(n=u.body,a=e)))})),n},e.isEndListAppended=function(t){var e=this.endListFragments[t];return void 0!==e&&(e.buffered||pr(e))},e.getState=function(t){var e=yr(t),r=this.fragments[e];return r?r.buffered?pr(r)?gr:vr:fr:cr},e.isTimeBuffered=function(t,e,r){for(var i,n,a=0;a<r.length;a++){if(i=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,t>=i&&e<=n)return!0;if(e<=i)return!1}return!1},e.onFragLoaded=function(t,e){var r=e.frag,i=e.part;if("initSegment"!==r.sn&&!r.bitrateTest){var n=i?null:e,a=yr(r);this.fragments[a]={body:r,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var r=this,i=e.frag,n=e.part,a=e.timeRanges;if("initSegment"!==i.sn){var s=i.type;if(n){var o=this.activePartLists[s];o||(this.activePartLists[s]=o=[]),o.push(n)}this.timeRanges=a,Object.keys(a).forEach((function(t){var e=a[t];r.detectEvictedFragments(t,e,s,n)}))}},e.onFragBuffered=function(t,e){this.detectPartialFragments(e)},e.hasFragment=function(t){var e=yr(t);return!!this.fragments[e]},e.hasParts=function(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)},e.removeFragmentsInRange=function(t,e,r,i,n){var a=this;i&&!this.hasGaps||Object.keys(this.fragments).forEach((function(s){var o=a.fragments[s];if(o){var l=o.body;l.type!==r||i&&!l.gap||l.start<e&&l.end>t&&(o.buffered||n)&&a.removeFragment(l)}}))},e.removeFragment=function(t){var e=yr(t);t.stats.loaded=0,t.clearElementaryStreamInfo();var r=this.activePartLists[t.type];if(r){var i=t.sn;this.activePartLists[t.type]=r.filter((function(t){return t.fragment.sn!==i}))}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]},e.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},t}();function pr(t){var e,r,i;return t.buffered&&(t.body.gap||(null==(e=t.range.video)?void 0:e.partial)||(null==(r=t.range.audio)?void 0:r.partial)||(null==(i=t.range.audiovideo)?void 0:i.partial))}function yr(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn}var Tr=Math.pow(2,17),Er=function(){function t(t,e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.hls=void 0,this.config=t,this.hls=e}var e=t.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(t,e){var r=this,n=t.url;if(!n)return Promise.reject(new Rr({type:S.NETWORK_ERROR,details:L.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(n?"part list":"url")),networkDetails:null}));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(l,u){if(r.loader&&r.loader.destroy(),t.gap)u(Lr(t));else{var h=r.loader=t.loader=s?new s(a):new o(a),d=Sr(t),c=qe(a.fragLoadPolicy.default),f={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:Tr};t.stats=h.stats,h.load(d,f,{onSuccess:function(e,i,n,a){r.resetLoader(t,h);var s=e.data;n.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),r.hls.trigger(E.RECORDING,{data:e.data}),l({frag:t,part:null,payload:s,networkDetails:a})},onError:function(e,a,s,o){r.resetLoader(t,h),u(new Rr({type:S.NETWORK_ERROR,details:L.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:i({url:n,data:void 0},e),error:new Error("HTTP Error "+e.code+" "+e.text),networkDetails:s,stats:o}))},onAbort:function(e,i,n){r.resetLoader(t,h),u(new Rr({type:S.NETWORK_ERROR,details:L.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:n,stats:e}))},onTimeout:function(e,i,n){r.resetLoader(t,h),u(new Rr({type:S.NETWORK_ERROR,details:L.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error("Timeout after "+f.timeout+"ms"),networkDetails:n,stats:e}))},onProgress:function(r,i,n,a){e&&e({frag:t,part:null,payload:n,networkDetails:a})}})}}))},e.loadPart=function(t,e,r){var n=this;this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(l,u){if(n.loader&&n.loader.destroy(),t.gap||e.gap)u(Lr(t,e));else{var h=n.loader=t.loader=s?new s(a):new o(a),d=Sr(t,e),c=qe(a.fragLoadPolicy.default),f={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Tr};e.stats=h.stats,h.load(d,f,{onSuccess:function(i,a,s,o){n.resetLoader(t,h),n.updateStatsFromPart(t,e);var u={frag:t,part:e,payload:i.data,networkDetails:o};r(u),l(u)},onError:function(r,a,s,o){n.resetLoader(t,h),u(new Rr({type:S.NETWORK_ERROR,details:L.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:i({url:d.url,data:void 0},r),error:new Error("HTTP Error "+r.code+" "+r.text),networkDetails:s,stats:o}))},onAbort:function(r,i,a){t.stats.aborted=e.stats.aborted,n.resetLoader(t,h),u(new Rr({type:S.NETWORK_ERROR,details:L.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:a,stats:r}))},onTimeout:function(r,i,a){n.resetLoader(t,h),u(new Rr({type:S.NETWORK_ERROR,details:L.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error("Timeout after "+f.timeout+"ms"),networkDetails:a,stats:r}))}})}}))},e.updateStatsFromPart=function(t,e){var r=t.stats,i=e.stats,n=i.total;if(r.loaded+=i.loaded,n){var a=Math.round(t.duration/e.duration),s=Math.min(Math.round(r.loaded/n),a),o=(a-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,u=i.loading;l.start?l.first+=u.first-u.start:(l.start=u.start,l.first=u.first),l.end=u.end},e.resetLoader=function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},t}();function Sr(t,e){void 0===e&&(e=null);var r=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},n=r.byteRangeStartOffset,a=r.byteRangeEndOffset;if(T(n)&&T(a)){var s,o=n,l=a;if("initSegment"===t.sn&&"AES-128"===(null==(s=t.decryptdata)?void 0:s.method)){var u=a-n;u%16&&(l=a+(16-u%16)),0!==n&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=l}return i}function Lr(t,e){var r=new Error("GAP "+(t.gap?"tag":"attribute")+" found"),i={type:S.MEDIA_ERROR,details:L.FRAG_GAP,fatal:!1,frag:t,error:r,networkDetails:null};return e&&(i.part=e),(e||t).stats.aborted=!0,new Rr(i)}var Rr=function(t){function e(e){var r;return(r=t.call(this,e.error.message)||this).data=void 0,r.data=e,r}return l(e,t),e}(c(Error)),Ar=function(){function t(t){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}var e=t.prototype;return e.abort=function(t){for(var e in this.keyUriToKeyInfo){var r=this.keyUriToKeyInfo[e].loader;if(r){if(t&&t!==r.context.frag.type)return;r.abort()}}},e.detach=function(){for(var t in this.keyUriToKeyInfo){var e=this.keyUriToKeyInfo[t];(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[t]}},e.destroy=function(){for(var t in this.detach(),this.keyUriToKeyInfo){var e=this.keyUriToKeyInfo[t].loader;e&&e.destroy()}this.keyUriToKeyInfo={}},e.createKeyLoadError=function(t,e,r,i,n){return void 0===e&&(e=L.KEY_LOAD_ERROR),new Rr({type:S.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:n,error:r,networkDetails:i})},e.loadClear=function(t,e){var r=this;if(this.emeController&&this.config.emeEnabled)for(var i=t.sn,n=t.cc,a=function(){var t=e[s];if(n<=t.cc&&("initSegment"===i||"initSegment"===t.sn||i<t.sn))return r.emeController.selectKeySystemFormat(t).then((function(e){t.setKeyFormat(e)})),"break"},s=0;s<e.length&&"break"!==a();s++);},e.load=function(t){var e=this;return!t.decryptdata&&t.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(t).then((function(r){return e.loadInternal(t,r)})):this.loadInternal(t)},e.loadInternal=function(t,e){var r,i;e&&t.setKeyFormat(e);var n=t.decryptdata;if(!n){var a=new Error(e?"Expected frag.decryptdata to be defined after setting format "+e:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(t,L.KEY_LOAD_ERROR,a))}var s=n.uri;if(!s)return Promise.reject(this.createKeyLoadError(t,L.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+s+'"')));var o,l=this.keyUriToKeyInfo[s];if(null!=(r=l)&&r.decryptdata.key)return n.key=l.decryptdata.key,Promise.resolve({frag:t,keyInfo:l});if(null!=(i=l)&&i.keyLoadPromise)switch(null==(o=l.mediaKeySessionContext)?void 0:o.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return l.keyLoadPromise.then((function(e){return n.key=e.keyInfo.decryptdata.key,{frag:t,keyInfo:l}}))}switch(l=this.keyUriToKeyInfo[s]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===n.keyFormat?this.loadKeyHTTP(l,t):this.loadKeyEME(l,t);case"AES-128":return this.loadKeyHTTP(l,t);default:return Promise.reject(this.createKeyLoadError(t,L.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+n.method+'"')))}},e.loadKeyEME=function(t,e){var r={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){var i=this.emeController.loadKey(r);if(i)return(t.keyLoadPromise=i.then((function(e){return t.mediaKeySessionContext=e,r}))).catch((function(e){throw t.keyLoadPromise=null,e}))}return Promise.resolve(r)},e.loadKeyHTTP=function(t,e){var r=this,n=this.config,a=new(0,n.loader)(n);return e.keyLoader=t.loader=a,t.keyLoadPromise=new Promise((function(s,o){var l={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},u=n.keyLoadPolicy.default,h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:function(t,e,i,n){var a=i.frag,l=i.keyInfo,u=i.url;if(!a.decryptdata||l!==r.keyUriToKeyInfo[u])return o(r.createKeyLoadError(a,L.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));l.decryptdata.key=a.decryptdata.key=new Uint8Array(t.data),a.keyLoader=null,l.loader=null,s({frag:a,keyInfo:l})},onError:function(t,n,a,s){r.resetLoader(n),o(r.createKeyLoadError(e,L.KEY_LOAD_ERROR,new Error("HTTP Error "+t.code+" loading key "+t.text),a,i({url:l.url,data:void 0},t)))},onTimeout:function(t,i,n){r.resetLoader(i),o(r.createKeyLoadError(e,L.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:function(t,i,n){r.resetLoader(i),o(r.createKeyLoadError(e,L.INTERNAL_ABORTED,new Error("key loading aborted"),n))}};a.load(l,h,d)}))},e.resetLoader=function(t){var e=t.frag,r=t.keyInfo,i=t.url,n=r.loader;e.keyLoader===n&&(e.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[i],n&&n.destroy()},t}(),kr=function(){function t(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var e=t.prototype;return e.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},e.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.onHandlerDestroyed=function(){},e.hasInterval=function(){return!!this._tickInterval},e.hasNextTick=function(){return!!this._tickTimer},e.setInterval=function(t){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)},e.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},e.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},e.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},e.doTick=function(){},t}(),br={length:0,start:function(){return 0},end:function(){return 0}},Dr=function(){function t(){}return t.isBuffered=function(e,r){try{if(e)for(var i=t.getBuffered(e),n=0;n<i.length;n++)if(r>=i.start(n)&&r<=i.end(n))return!0}catch(t){}return!1},t.bufferInfo=function(e,r,i){try{if(e){var n,a=t.getBuffered(e),s=[];for(n=0;n<a.length;n++)s.push({start:a.start(n),end:a.end(n)});return this.bufferedInfo(s,r,i)}}catch(t){}return{len:0,start:r,end:r,nextStart:void 0}},t.bufferedInfo=function(t,e,r){e=Math.max(0,e),t.sort((function(t,e){var r=t.start-e.start;return r||e.end-t.end}));var i=[];if(r)for(var n=0;n<t.length;n++){var a=i.length;if(a){var s=i[a-1].end;t[n].start-s<r?t[n].end>s&&(i[a-1].end=t[n].end):i.push(t[n])}else i.push(t[n])}else i=t;for(var o,l=0,u=e,h=e,d=0;d<i.length;d++){var c=i[d].start,f=i[d].end;if(e+r>=c&&e<f)u=c,l=(h=f)-e;else if(e+r<c){o=c;break}}return{len:l,start:u||0,end:h||0,nextStart:o}},t.getBuffered=function(t){try{return t.buffered}catch(t){return I.log("failed to get media.buffered",t),br}},t}(),Ir=function(t,e,r,i,n,a){void 0===i&&(i=0),void 0===n&&(n=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=r,this.size=i,this.part=n,this.partial=a};function wr(t,e){for(var r=null,i=0,n=t.length;i<n;i++){var a=t[i];if(a&&a.cc===e){r=a;break}}return r}function Cr(t,e){if(t){var r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function _r(t,e){for(var r=e.fragments,i=0,n=r.length;i<n;i++)Cr(r[i],t);e.fragmentHint&&Cr(e.fragmentHint,t),e.alignedSliding=!0}function Pr(t,e,r){e&&(function(t,e,r){if(function(t,e,r){return!(!e.details||!(r.endCC>r.startCC||t&&t.cc<r.startCC))}(t,r,e)){var i=function(t,e,r){var i=t.fragments,n=e.fragments;if(n.length&&i.length){var a=wr(i,n[0].cc);if(a&&(!a||a.startPTS))return a;I.log("No frag in previous level to align on")}else I.log("No fragments to align")}(r.details,e);i&&T(i.start)&&(I.log("Adjusting PTS using last level due to CC increase within current level "+e.url),_r(i.start,e))}}(t,r,e),!r.alignedSliding&&e.details&&function(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var r=e.fragments[0].programDateTime,i=t.fragments[0].programDateTime,n=(i-r)/1e3+e.fragments[0].start;n&&T(n)&&(I.log("Adjusting PTS using programDateTime delta "+(i-r)+"ms, sliding:"+n.toFixed(3)+" "+t.url+" "),_r(n,t))}}(r,e.details),r.alignedSliding||!e.details||r.skippedSegments||Ge(e.details,r))}function xr(t,e){if(t.hasProgramDateTime&&e.hasProgramDateTime){var r=t.fragments,i=e.fragments;if(r.length&&i.length){var n=i[Math.round(i.length/2)-1],a=wr(r,n.cc)||r[Math.round(r.length/2)-1],s=n.programDateTime,o=a.programDateTime;null!==s&&null!==o&&_r((o-s)/1e3-(a.start-n.start),t)}}}var Fr=function(){function t(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}(),Or=function(){function t(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}(),Mr=function(){function t(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var e=t.prototype;return e.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),i=0;i<4;i++)r[i]=e.getUint32(4*i);return r},e.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,i=r[0],n=r[1],a=r[2],s=r[3],o=this.invSubMix,l=o[0],u=o[1],h=o[2],d=o[3],c=new Uint32Array(256),f=0,g=0,v=0;for(v=0;v<256;v++)c[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var m=g^g<<1^g<<2^g<<3^g<<4;m=m>>>8^255&m^99,t[f]=m,e[m]=f;var p=c[f],y=c[p],T=c[y],E=257*c[m]^16843008*m;i[f]=E<<24|E>>>8,n[f]=E<<16|E>>>16,a[f]=E<<8|E>>>24,s[f]=E,E=16843009*T^65537*y^257*p^16843008*f,l[m]=E<<24|E>>>8,u[m]=E<<16|E>>>16,h[m]=E<<8|E>>>24,d[m]=E,f?(f=p^c[c[c[T^p]]],g^=c[c[g]]):f=g=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,i=0;i<e.length&&r;)r=e[i]===this.key[i],i++;if(!r){this.key=e;var n=this.keySize=e.length;if(4!==n&&6!==n&&8!==n)throw new Error("Invalid aes key size="+n);var a,s,o,l,u=this.ksRows=4*(n+6+1),h=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),c=this.sBox,f=this.rcon,g=this.invSubMix,v=g[0],m=g[1],p=g[2],y=g[3];for(a=0;a<u;a++)a<n?o=h[a]=e[a]:(l=o,a%n==0?(l=c[(l=l<<8|l>>>24)>>>24]<<24|c[l>>>16&255]<<16|c[l>>>8&255]<<8|c[255&l],l^=f[a/n|0]<<24):n>6&&a%n==4&&(l=c[l>>>24]<<24|c[l>>>16&255]<<16|c[l>>>8&255]<<8|c[255&l]),h[a]=o=(h[a-n]^l)>>>0);for(s=0;s<u;s++)a=u-s,l=3&s?h[a]:h[a-4],d[s]=s<4||a<=4?l:v[c[l>>>24]]^m[c[l>>>16&255]]^p[c[l>>>8&255]]^y[c[255&l]],d[s]=d[s]>>>0}},e.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},e.decrypt=function(t,e,r){for(var i,n,a,s,o,l,u,h,d,c,f,g,v,m,p=this.keySize+6,y=this.invKeySchedule,T=this.invSBox,E=this.invSubMix,S=E[0],L=E[1],R=E[2],A=E[3],k=this.uint8ArrayToUint32Array_(r),b=k[0],D=k[1],I=k[2],w=k[3],C=new Int32Array(t),_=new Int32Array(C.length),P=this.networkToHostOrderSwap;e<C.length;){for(d=P(C[e]),c=P(C[e+1]),f=P(C[e+2]),g=P(C[e+3]),o=d^y[0],l=g^y[1],u=f^y[2],h=c^y[3],v=4,m=1;m<p;m++)i=S[o>>>24]^L[l>>16&255]^R[u>>8&255]^A[255&h]^y[v],n=S[l>>>24]^L[u>>16&255]^R[h>>8&255]^A[255&o]^y[v+1],a=S[u>>>24]^L[h>>16&255]^R[o>>8&255]^A[255&l]^y[v+2],s=S[h>>>24]^L[o>>16&255]^R[l>>8&255]^A[255&u]^y[v+3],o=i,l=n,u=a,h=s,v+=4;i=T[o>>>24]<<24^T[l>>16&255]<<16^T[u>>8&255]<<8^T[255&h]^y[v],n=T[l>>>24]<<24^T[u>>16&255]<<16^T[h>>8&255]<<8^T[255&o]^y[v+1],a=T[u>>>24]<<24^T[h>>16&255]<<16^T[o>>8&255]<<8^T[255&l]^y[v+2],s=T[h>>>24]<<24^T[o>>16&255]<<16^T[l>>8&255]<<8^T[255&u]^y[v+3],_[e]=P(i^b),_[e+1]=P(s^D),_[e+2]=P(a^I),_[e+3]=P(n^w),b=d,D=c,I=f,w=g,e+=4}return _.buffer},t}(),Nr=function(){function t(t,e){var r=(void 0===e?{}:e).removePKCS7Padding,i=void 0===r||r;if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=t.enableSoftwareAES,this.removePKCS7Padding=i,i)try{var n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(t){}null===this.subtle&&(this.useSoftware=!0)}var e=t.prototype;return e.destroy=function(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null},e.isSync=function(){return this.useSoftware},e.flush=function(){var t=this.currentResult,e=this.remainderData;if(!t||e)return this.reset(),null;var r,i,n,a=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?(i=(r=a).byteLength,(n=i&&new DataView(r.buffer).getUint8(i-1))?et(r,0,i-n):r):a},e.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},e.decrypt=function(t,e,r){var i=this;return this.useSoftware?new Promise((function(n,a){i.softwareDecrypt(new Uint8Array(t),e,r);var s=i.flush();s?n(s.buffer):a(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(t),e,r)},e.softwareDecrypt=function(t,e,r){var i=this.currentIV,n=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(t=Pt(a,t),this.remainderData=null);var s=this.getValidChunk(t);if(!s.length)return null;i&&(r=i);var o=this.softwareDecrypter;o||(o=this.softwareDecrypter=new Mr),o.expandKey(e);var l=n;return this.currentResult=o.decrypt(s.buffer,0,r),this.currentIV=et(s,-16).buffer,l||null},e.webCryptoDecrypt=function(t,e,r){var i=this,n=this.subtle;return this.key===e&&this.fastAesKey||(this.key=e,this.fastAesKey=new Or(n,e)),this.fastAesKey.expandKey().then((function(e){return n?(i.logOnce("WebCrypto AES decrypt"),new Fr(n,new Uint8Array(r)).decrypt(t.buffer,e)):Promise.reject(new Error("web crypto not initialized"))})).catch((function(n){return I.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+n.name+": "+n.message),i.onWebCryptoError(t,e,r)}))},e.onWebCryptoError=function(t,e,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,r);var i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")},e.getValidChunk=function(t){var e=t,r=t.length-t.length%16;return r!==t.length&&(e=et(t,0,r),this.remainderData=et(t,r)),e},e.logOnce=function(t){this.logEnabled&&(I.log("[decrypter]: "+t),this.logEnabled=!1)},t}(),Ur=function(t){for(var e="",r=t.length,i=0;i<r;i++)e+="["+t.start(i).toFixed(3)+"-"+t.end(i).toFixed(3)+"]";return e},Br="STOPPED",Gr="IDLE",Kr="KEY_LOADING",Hr="FRAG_LOADING",Vr="FRAG_LOADING_WAITING_RETRY",Yr="WAITING_TRACK",Wr="PARSING",jr="PARSED",qr="ENDED",Xr="ERROR",zr="WAITING_INIT_PTS",Qr="WAITING_LEVEL",$r=function(t){function e(e,r,i,n,a){var s;return(s=t.call(this)||this).hls=void 0,s.fragPrevious=null,s.fragCurrent=null,s.fragmentTracker=void 0,s.transmuxer=null,s._state=Br,s.playlistType=void 0,s.media=null,s.mediaBuffer=null,s.config=void 0,s.bitrateTest=!1,s.lastCurrentTime=0,s.nextLoadPosition=0,s.startPosition=0,s.startTimeOffset=null,s.loadedmetadata=!1,s.retryDate=0,s.levels=null,s.fragmentLoader=void 0,s.keyLoader=void 0,s.levelLastLoaded=null,s.startFragRequested=!1,s.decrypter=void 0,s.initPTS=[],s.onvseeking=null,s.onvended=null,s.logPrefix="",s.log=void 0,s.warn=void 0,s.playlistType=a,s.logPrefix=n,s.log=I.log.bind(I,n+":"),s.warn=I.warn.bind(I,n+":"),s.hls=e,s.fragmentLoader=new Er(e.config,s.hls),s.keyLoader=i,s.fragmentTracker=r,s.config=e.config,s.decrypter=new Nr(e.config),e.on(E.MANIFEST_LOADED,s.onManifestLoaded,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(s)),s}l(e,t);var r=e.prototype;return r.doTick=function(){this.onTickEnd()},r.onTickEnd=function(){},r.startLoad=function(t){},r.stopLoad=function(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);var t=this.fragCurrent;null!=t&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Br},r._streamEnded=function(t,e){if(e.live||t.nextStart||!t.end||!this.media)return!1;var r=e.partList;if(null!=r&&r.length){var i=r[r.length-1];return Dr.isBuffered(this.media,i.start+i.duration/2)}var n=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(n)},r.getLevelDetails=function(){var t;if(this.levels&&null!==this.levelLastLoaded)return null==(t=this.levels[this.levelLastLoaded])?void 0:t.details},r.onMediaAttached=function(t,e){var r=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var i=this.config;this.levels&&i.autoStartLoad&&this.state===Br&&this.startLoad(i.startPosition)},r.onMediaDetaching=function(){var t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},r.onMediaSeeking=function(){var t=this.config,e=this.fragCurrent,r=this.media,i=this.mediaBuffer,n=this.state,a=r?r.currentTime:0,s=Dr.bufferInfo(i||r,a,t.maxBufferHole);if(this.log("media seeking to "+(T(a)?a.toFixed(3):a)+", state: "+n),this.state===qr)this.resetLoadingState();else if(e){var o=t.maxFragLookUpTolerance,l=e.start-o,u=e.start+e.duration+o;if(!s.len||u<s.start||l>s.end){var h=a>u;(a<l||h)&&(h&&e.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),e.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}r&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),this.lastCurrentTime=a),this.loadedmetadata||s.len||(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()},r.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},r.onManifestLoaded=function(t,e){this.startTimeOffset=e.startTimeOffset,this.initPTS=[]},r.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},r.onHandlerDestroyed=function(){this.state=Br,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,t.prototype.onHandlerDestroyed.call(this)},r.loadFragment=function(t,e,r){this._loadFragForPlayback(t,e,r)},r._loadFragForPlayback=function(t,e,r){var i=this;this._doFragLoad(t,e,r,(function(e){if(i.fragContextChanged(t))return i.warn("Fragment "+t.sn+(e.part?" p: "+e.part.index:"")+" of level "+t.level+" was dropped during download."),void i.fragmentTracker.removeFragment(t);t.stats.chunkCount++,i._handleFragmentLoadProgress(e)})).then((function(e){if(e){var r=i.state;i.fragContextChanged(t)?(r===Hr||!i.fragCurrent&&r===Wr)&&(i.fragmentTracker.removeFragment(t),i.state=Gr):("payload"in e&&(i.log("Loaded fragment "+t.sn+" of level "+t.level),i.hls.trigger(E.FRAG_LOADED,e)),i._handleFragmentLoadComplete(e))}})).catch((function(e){i.state!==Br&&i.state!==Xr&&(i.warn(e),i.resetFragmentLoading(t))}))},r.clearTrackerIfNeeded=function(t){var e,r=this.fragmentTracker;if(r.getState(t)===fr){var i=t.type,n=this.getFwdBufferInfo(this.mediaBuffer,i),a=Math.max(t.duration,n?n.len:this.config.maxBufferLength);this.reduceMaxBufferLength(a)&&r.removeFragment(t)}else 0===(null==(e=this.mediaBuffer)?void 0:e.buffered.length)?r.removeAllFragments():r.hasParts(t.type)&&(r.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),r.getState(t)===gr&&r.removeFragment(t))},r.flushMainBuffer=function(t,e,r){if(void 0===r&&(r=null),t-e){var i={startOffset:t,endOffset:e,type:r};this.hls.trigger(E.BUFFER_FLUSHING,i)}},r._loadInitSegment=function(t,e){var r=this;this._doFragLoad(t,e).then((function(e){if(!e||r.fragContextChanged(t)||!r.levels)throw new Error("init load aborted");return e})).then((function(e){var i=r.hls,n=e.payload,a=t.decryptdata;if(n&&n.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return r.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer).catch((function(e){throw i.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((function(r){var n=self.performance.now();return i.trigger(E.FRAG_DECRYPTED,{frag:t,payload:r,stats:{tstart:s,tdecrypt:n}}),e.payload=r,e}))}return e})).then((function(i){var n=r.fragCurrent,a=r.hls;if(!r.levels)throw new Error("init load aborted, missing levels");var s=t.stats;r.state=Gr,e.fragmentError=0,t.data=new Uint8Array(i.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),i.frag===n&&a.trigger(E.FRAG_BUFFERED,{stats:s,frag:n,part:null,id:t.type}),r.tick()})).catch((function(e){r.state!==Br&&r.state!==Xr&&(r.warn(e),r.resetFragmentLoading(t))}))},r.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId},r.fragBufferedComplete=function(t,e){var r,i,n,a,s=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+(this.playlistType===fe?"level":"track")+" "+t.level+" (frag:["+(null!=(r=t.startPTS)?r:NaN).toFixed(3)+"-"+(null!=(i=t.endPTS)?i:NaN).toFixed(3)+"] > buffer:"+(s?Ur(Dr.getBuffered(s)):"(detached)")+")"),this.state=Gr,s&&(!this.loadedmetadata&&t.type==fe&&s.buffered.length&&(null==(n=this.fragCurrent)?void 0:n.sn)===(null==(a=this.fragPrevious)?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},r.seekToStartPos=function(){},r._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(e){var r=t.frag,i=t.part,n=t.partsLoaded,a=!n||0===n.length||n.some((function(t){return!t})),s=new Ir(r.level,r.sn,r.stats.chunkCount+1,0,i?i.index:-1,!a);e.flush(s)}},r._handleFragmentLoadProgress=function(t){},r._doFragLoad=function(t,e,r,i){var n,a=this;void 0===r&&(r=null);var s=null==e?void 0:e.details;if(!this.levels||!s)throw new Error("frag load aborted, missing level"+(s?"":" detail")+"s");var o=null;if(!t.encrypted||null!=(n=t.decryptdata)&&n.key?!t.encrypted&&s.encryptedFragments.length&&this.keyLoader.loadClear(t,s.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+s.startSN+"-"+s.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level),this.state=Kr,this.fragCurrent=t,o=this.keyLoader.load(t).then((function(t){if(!a.fragContextChanged(t.frag))return a.hls.trigger(E.KEY_LOADED,t),a.state===Kr&&(a.state=Gr),t})),this.hls.trigger(E.KEY_LOADING,{frag:t}),null===this.fragCurrent&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),r=Math.max(t.start,r||0),this.config.lowLatencyMode&&"initSegment"!==t.sn){var l=s.partList;if(l&&i){r>t.end&&s.fragmentHint&&(t=s.fragmentHint);var u=this.getNextPart(l,t,r);if(u>-1){var h,d=l[u];return this.log("Loading part sn: "+t.sn+" p: "+d.index+" cc: "+t.cc+" of playlist ["+s.startSN+"-"+s.endSN+"] parts [0-"+u+"-"+(l.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=d.start+d.duration,this.state=Hr,h=o?o.then((function(r){return!r||a.fragContextChanged(r.frag)?null:a.doFragPartsLoad(t,d,e,i)})).catch((function(t){return a.handleFragLoadError(t)})):this.doFragPartsLoad(t,d,e,i).catch((function(t){return a.handleFragLoadError(t)})),this.hls.trigger(E.FRAG_LOADING,{frag:t,part:d,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):h}if(!t.url||this.loadedEndOfParts(l,r))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(s?"of ["+s.startSN+"-"+s.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),T(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Hr;var c,f=this.config.progressive;return c=f&&o?o.then((function(e){return!e||a.fragContextChanged(null==e?void 0:e.frag)?null:a.fragmentLoader.load(t,i)})).catch((function(t){return a.handleFragLoadError(t)})):Promise.all([this.fragmentLoader.load(t,f?i:void 0),o]).then((function(t){var e=t[0];return!f&&e&&i&&i(e),e})).catch((function(t){return a.handleFragLoadError(t)})),this.hls.trigger(E.FRAG_LOADING,{frag:t,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c},r.doFragPartsLoad=function(t,e,r,i){var n=this;return new Promise((function(a,s){var o,l=[],u=null==(o=r.details)?void 0:o.partList;!function e(o){n.fragmentLoader.loadPart(t,o,i).then((function(i){l[o.index]=i;var s=i.part;n.hls.trigger(E.FRAG_LOADED,i);var h=He(r,t.sn,o.index+1)||Ve(u,t.sn,o.index+1);if(!h)return a({frag:t,part:s,partsLoaded:l});e(h)})).catch(s)}(e)}))},r.handleFragLoadError=function(t){if("data"in t){var e=t.data;t.data&&e.details===L.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(E.ERROR,e)}else this.hls.trigger(E.ERROR,{type:S.OTHER_ERROR,details:L.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null},r._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===Wr){var r=e.frag,i=e.part,n=e.level,a=self.performance.now();r.stats.parsing.end=a,i&&(i.stats.parsing.end=a),this.updateLevelTiming(r,i,n,t.partial)}else this.fragCurrent||this.state===Br||this.state===Xr||(this.state=Gr)},r.getCurrentContext=function(t){var e=this.levels,r=this.fragCurrent,i=t.level,n=t.sn,a=t.part;if(null==e||!e[i])return this.warn("Levels object was unset while buffering fragment "+n+" of level "+i+". The current chunk will not be buffered."),null;var s=e[i],o=a>-1?He(s,n,a):null,l=o?o.fragment:function(t,e,r){if(null==t||!t.details)return null;var i=t.details,n=i.fragments[e-i.startSN];return n||((n=i.fragmentHint)&&n.sn===e?n:e<i.startSN&&r&&r.sn===e?r:null)}(s,n,r);return l?(r&&r!==l&&(l.stats=r.stats),{frag:l,part:o,level:s}):null},r.bufferFragmentData=function(t,e,r,i){var n;if(t&&this.state===Wr){var a=t.data1,s=t.data2,o=a;if(a&&s&&(o=Pt(a,s)),null!=(n=o)&&n.length){var l={type:t.type,frag:e,part:r,chunkMeta:i,parent:e.type,data:o};this.hls.trigger(E.BUFFER_APPENDING,l),t.dropped&&t.independent&&!r&&this.flushBufferGap(e)}}},r.flushBufferGap=function(t){var e=this.media;if(e)if(Dr.isBuffered(e,e.currentTime)){var r=e.currentTime,i=Dr.bufferInfo(e,r,0),n=t.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),s=Math.max(Math.min(t.start-a,i.end-a),r+a);t.start-s>a&&this.flushMainBuffer(s,t.start)}else this.flushMainBuffer(0,t.start)},r.getFwdBufferInfo=function(t,e){var r=this.getLoadPosition();return T(r)?this.getFwdBufferInfoAtPos(t,r,e):null},r.getFwdBufferInfoAtPos=function(t,e,r){var i=this.config.maxBufferHole,n=Dr.bufferInfo(t,e,i);if(0===n.len&&void 0!==n.nextStart){var a=this.fragmentTracker.getBufferedFrag(e,r);if(a&&n.nextStart<a.end)return Dr.bufferInfo(t,e,Math.max(n.nextStart,i))}return n},r.getMaxBufferLength=function(t){var e,r=this.config;return e=t?Math.max(8*r.maxBufferSize/t,r.maxBufferLength):r.maxBufferLength,Math.min(e,r.maxMaxBufferLength)},r.reduceMaxBufferLength=function(t){var e=this.config,r=t||e.maxBufferLength;return e.maxMaxBufferLength>=r&&(e.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},r.getAppendedFrag=function(t,e){var r=this.fragmentTracker.getAppendedFrag(t,fe);return r&&"fragment"in r?r.fragment:r},r.getNextFragment=function(t,e){var r=e.fragments,i=r.length;if(!i)return null;var n,a=this.config,s=r[0].start;if(e.live){var o=a.initialLiveManifestSize;if(i<o)return this.warn("Not enough fragments to start playback (have: "+i+", need: "+o+")"),null;e.PTSKnown||this.startFragRequested||-1!==this.startPosition||(n=this.getInitialLiveFragment(e,r),this.startPosition=n?this.hls.liveSyncPosition||n.start:t)}else t<=s&&(n=r[0]);if(!n){var l=a.lowLatencyMode?e.partEnd:e.fragmentEnd;n=this.getFragmentAtPosition(t,l,e)}return this.mapToInitFragWhenRequired(n)},r.isLoopLoading=function(t,e){var r=this.fragmentTracker.getState(t);return(r===vr||r===gr&&!!t.gap)&&this.nextLoadPosition>e},r.getNextFragmentLoopLoading=function(t,e,r,i,n){var a=t.gap,s=this.getNextFragment(this.nextLoadPosition,e);if(null===s)return s;if(t=s,a&&t&&!t.gap&&r.nextStart){var o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,i);if(null!==o&&r.len+o.len>=n)return this.log('buffer full after gaps in "'+i+'" playlist starting at sn: '+t.sn),null}return t},r.mapToInitFragWhenRequired=function(t){return null==t||!t.initSegment||null!=t&&t.initSegment.data||this.bitrateTest?t:t.initSegment},r.getNextPart=function(t,e,r){for(var i=-1,n=!1,a=!0,s=0,o=t.length;s<o;s++){var l=t[s];if(a=a&&!l.independent,i>-1&&r<l.start)break;var u=l.loaded;u?i=-1:(n||l.independent||a)&&l.fragment===e&&(i=s),n=u}return i},r.loadedEndOfParts=function(t,e){var r=t[t.length-1];return r&&e>r.start&&r.loaded},r.getInitialLiveFragment=function(t,e){var r=this.fragPrevious,i=null;if(r){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),i=function(t,e,r){if(null===e||!Array.isArray(t)||!t.length||!T(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;i<t.length;++i){var n=t[i];if(Je(e,r,n))return n}return null}(e,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){var n=r.sn+1;if(n>=t.startSN&&n<=t.endSN){var a=e[n-t.startSN];r.cc===a.cc&&(i=a,this.log("Live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=function(t,e){return ze.search(t,(function(t){return t.cc<e?1:t.cc>e?-1:0}))}(e,r.cc),i&&this.log("Live playlist, switching playlist, load frag with same CC: "+i.sn))}}else{var s=this.hls.liveSyncPosition;null!==s&&(i=this.getFragmentAtPosition(s,this.bitrateTest?t.fragmentEnd:t.edge,t))}return i},r.getFragmentAtPosition=function(t,e,r){var i,n=this.config,a=this.fragPrevious,s=r.fragments,o=r.endSN,l=r.fragmentHint,u=n.maxFragLookUpTolerance,h=r.partList,d=!!(n.lowLatencyMode&&null!=h&&h.length&&l);if(d&&l&&!this.bitrateTest&&(s=s.concat(l),o=l.sn),i=t<e?Qe(a,s,t,t>e-u?0:u):s[s.length-1]){var c=i.sn-r.startSN,f=this.fragmentTracker.getState(i);if((f===vr||f===gr&&i.gap)&&(a=i),a&&i.sn===a.sn&&(!d||h[0].fragment.sn>i.sn)&&a&&i.level===a.level){var g=s[c+1];i=i.sn<o&&this.fragmentTracker.getState(g)!==vr?g:null}}return i},r.synchronizeToLiveEdge=function(t){var e=this.config,r=this.media;if(r){var i=this.hls.liveSyncPosition,n=r.currentTime,a=t.fragments[0].start,s=t.edge,o=n>=a-e.maxFragLookUpTolerance&&n<=s;if(null!==i&&r.duration>i&&(n<i||!o)){var l=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!o&&r.readyState<4||n<s-l)&&(this.loadedmetadata||(this.nextLoadPosition=i),r.readyState&&(this.warn("Playback: "+n.toFixed(3)+" is located too far from the end of live sliding playlist: "+s+", reset currentTime to : "+i.toFixed(3)),r.currentTime=i))}}},r.alignPlaylists=function(t,e){var r=this.levels,i=this.levelLastLoaded,n=this.fragPrevious,a=null!==i?r[i]:null,s=t.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;var o=t.fragments[0].start,l=!e,u=t.alignedSliding&&T(o);if(l||!u&&!o){Pr(n,a,t);var h=t.fragments[0].start;return this.log("Live playlist sliding: "+h.toFixed(2)+" start-sn: "+(e?e.startSN:"na")+"->"+t.startSN+" prev-sn: "+(n?n.sn:"na")+" fragments: "+s),h}return o},r.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},r.setStartPosition=function(t,e){var r=this.startPosition;if(r<e&&(r=-1),-1===r||-1===this.lastCurrentTime){var i=null!==this.startTimeOffset,n=i?this.startTimeOffset:t.startTimeOffset;null!==n&&T(n)?(r=e+n,n<0&&(r+=t.totalduration),r=Math.min(Math.max(e,r),e+t.totalduration),this.log("Start time offset "+n+" found in "+(i?"multivariant":"media")+" playlist, adjust startPosition to "+r),this.startPosition=r):t.live?r=this.hls.liveSyncPosition||e:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},r.getLoadPosition=function(){var t=this.media,e=0;return this.loadedmetadata&&t?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e},r.handleFragLoadAborted=function(t,e){this.transmuxer&&"initSegment"!==t.sn&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},r.resetFragmentLoading=function(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Vr)||(this.state=Gr)},r.onFragmentOrKeyLoadError=function(t,e){if(e.chunkMeta&&!e.frag){var r=this.getCurrentContext(e.chunkMeta);r&&(e.frag=r.frag)}var i=e.frag;if(i&&i.type===t&&this.levels)if(this.fragContextChanged(i)){var n;this.warn("Frag load error must match current frag to retry "+i.url+" > "+(null==(n=this.fragCurrent)?void 0:n.url))}else{var a=e.details===L.FRAG_GAP;a&&this.fragmentTracker.fragBuffered(i,!0);var s=e.errorAction,o=s||{},l=o.action,u=o.retryCount,h=void 0===u?0:u,d=o.retryConfig;if(s&&l===ir&&d){this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition);var c=je(d,h);this.warn("Fragment "+i.sn+" of "+t+" "+i.level+" errored with "+e.details+", retrying loading "+(h+1)+"/"+d.maxNumRetry+" in "+c+"ms"),s.resolved=!0,this.retryDate=self.performance.now()+c,this.state=Vr}else d&&s?(this.resetFragmentErrors(t),h<d.maxNumRetry?a||(s.resolved=!0):I.warn(e.details+" reached or exceeded max retry ("+h+")")):this.state=Xr;this.tickImmediate()}},r.reduceLengthAndFlushBuffer=function(t){if(this.state===Wr||this.state===jr){var e=t.parent,r=this.getFwdBufferInfo(this.mediaBuffer,e),i=r&&r.len>.5;i&&this.reduceMaxBufferLength(r.len);var n=!i;return n&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+e+" buffer"),t.frag&&(this.fragmentTracker.removeFragment(t.frag),this.nextLoadPosition=t.frag.start),this.resetLoadingState(),n}return!1},r.resetFragmentErrors=function(t){t===ge&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Br&&(this.state=Gr)},r.afterBufferFlushed=function(t,e,r){if(t){var i=Dr.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,i,r),this.state===qr&&this.resetLoadingState()}},r.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Gr},r.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var e=this.levels?this.levels[t].details:null;null!=e&&e.live?(this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},r.resetWhenMissingContext=function(t){this.warn("The loading context changed while buffering fragment "+t.sn+" of level "+t.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(t.level),this.resetLoadingState()},r.removeUnbufferedFrags=function(t){void 0===t&&(t=0),this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)},r.updateLevelTiming=function(t,e,r,i){var n,a=this,s=r.details;if(s){if(Object.keys(t.elementaryStreams).reduce((function(e,n){var o=t.elementaryStreams[n];if(o){var l=o.endPTS-o.startPTS;if(l<=0)return a.warn("Could not parse fragment "+t.sn+" "+n+" duration reliably ("+l+")"),e||!1;var u=i?0:Ue(s,t,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return a.hls.trigger(E.LEVEL_PTS_UPDATED,{details:s,level:r,drift:u,type:n,frag:t,start:o.startPTS,end:o.endPTS}),!0}return e}),!1))r.fragmentError=0;else if(null===(null==(n=this.transmuxer)?void 0:n.error)){var o=new Error("Found no media in fragment "+t.sn+" of level "+r.id+" resetting transmuxer to fallback to playlist timing");if(this.warn(o.message),this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,fatal:!1,error:o,frag:t,reason:"Found no media in msn "+t.sn+' of level "'+r.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=jr,this.hls.trigger(E.FRAG_PARSED,{frag:t,part:e})}else this.warn("level.details undefined")},r.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},r.recoverWorkerError=function(t){"demuxerWorker"===t.event&&(this.resetTransmuxer(),this.resetLoadingState())},a(e,[{key:"state",get:function(){return this._state},set:function(t){var e=this._state;e!==t&&(this._state=t,this.log(e+"->"+t))}}]),e}(kr);function Jr(){return self.SourceBuffer||self.WebKitSourceBuffer}function Zr(t,e){return void 0===t&&(t=""),void 0===e&&(e=9e4),{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}var ti=function(){function t(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}var e=t.prototype;return e.resetInitSegment=function(t,e,r,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},e.resetTimeStamp=function(t){this.initPTS=t,this.resetContiguity()},e.resetContiguity=function(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0},e.canParse=function(t,e){return!1},e.appendFrame=function(t,e,r){},e.demux=function(t,e){this.cachedData&&(t=Pt(this.cachedData,t),this.cachedData=null);var r,i=at(t,0),n=i?i.length:0,a=this._audioTrack,s=this._id3Track,o=i?function(t){for(var e=ht(t),r=0;r<e.length;r++){var i=e[r];if(lt(i))return vt(i)}}(i):void 0,l=t.length;for((null===this.basePTS||0===this.frameIndex&&T(o))&&(this.basePTS=ei(o,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Re,duration:Number.POSITIVE_INFINITY});n<l;){if(this.canParse(t,n)){var u=this.appendFrame(a,t,n);u?(this.frameIndex++,this.lastPTS=u.sample.pts,r=n+=u.length):n=l}else ot(t,n)?(i=at(t,n),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Re,duration:Number.POSITIVE_INFINITY}),r=n+=i.length):n++;if(n===l&&r!==l){var h=et(t,r);this.cachedData?this.cachedData=Pt(this.cachedData,h):this.cachedData=h}}return{audioTrack:a,videoTrack:Zr(),id3Track:s,textTrack:Zr()}},e.demuxSampleAes=function(t,e,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},e.flush=function(t){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:Zr(),id3Track:this._id3Track,textTrack:Zr()}},e.destroy=function(){},t}(),ei=function(t,e,r){return T(t)?90*t:9e4*e+(r?9e4*r.baseTime/r.timescale:0)};function ri(t,e){return 255===t[e]&&240==(246&t[e+1])}function ii(t,e){return 1&t[e+1]?7:9}function ni(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function ai(t,e){return e+1<t.length&&ri(t,e)}function si(t,e){if(ai(t,e)){var r=ii(t,e);if(e+r>=t.length)return!1;var i=ni(t,e);if(i<=r)return!1;var n=e+i;return n===t.length||ai(t,n)}return!1}function oi(t,e,r,i,n){if(!t.samplerate){var a=function(t,e,r,i){var n,a,s,o,l=navigator.userAgent.toLowerCase(),u=i,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];n=1+((192&e[r+2])>>>6);var d=(60&e[r+2])>>>2;if(!(d>h.length-1))return s=(1&e[r+2])<<2,s|=(192&e[r+3])>>>6,I.log("manifest codec:"+i+", ADTS type:"+n+", samplingIndex:"+d),/firefox/i.test(l)?d>=6?(n=5,o=new Array(4),a=d-3):(n=2,o=new Array(2),a=d):-1!==l.indexOf("android")?(n=2,o=new Array(2),a=d):(n=5,o=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&d>=6?a=d-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(d>=6&&1===s||/vivaldi/i.test(l))||!i&&1===s)&&(n=2,o=new Array(2)),a=d)),o[0]=n<<3,o[0]|=(14&d)>>1,o[1]|=(1&d)<<7,o[1]|=s<<3,5===n&&(o[1]|=(14&a)>>1,o[2]=(1&a)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:h[d],channelCount:s,codec:"mp4a.40."+n,manifestCodec:u};t.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+d})}(e,r,i,n);if(!a)return;t.config=a.config,t.samplerate=a.samplerate,t.channelCount=a.channelCount,t.codec=a.codec,t.manifestCodec=a.manifestCodec,I.log("parsed codec:"+t.codec+", rate:"+a.samplerate+", channels:"+a.channelCount)}}function li(t){return 9216e4/t}function ui(t,e,r,i,n){var a,s=i+n*li(t.samplerate),o=function(t,e){var r=ii(t,e);if(e+r<=t.length){var i=ni(t,e)-r;if(i>0)return{headerLength:r,frameLength:i}}}(e,r);if(o){var l=o.frameLength,u=o.headerLength,h=u+l,d=Math.max(0,r+h-e.length);d?(a=new Uint8Array(h-u)).set(e.subarray(r+u,e.length),0):a=e.subarray(r+u,r+h);var c={unit:a,pts:s};return d||t.samples.push(c),{sample:c,length:h,missing:d}}var f=e.length-r;return(a=new Uint8Array(f)).set(e.subarray(r,e.length),0),{sample:{unit:a,pts:s},length:f,missing:-1}}var hi=function(t){function e(e,r){var i;return(i=t.call(this)||this).observer=void 0,i.config=void 0,i.observer=e,i.config=r,i}l(e,t);var r=e.prototype;return r.resetInitSegment=function(e,r,i,n){t.prototype.resetInitSegment.call(this,e,r,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},e.probe=function(t){if(!t)return!1;for(var e=(at(t,0)||[]).length,r=t.length;e<r;e++)if(si(t,e))return I.log("ADTS sync word found !"),!0;return!1},r.canParse=function(t,e){return function(t,e){return function(t,e){return e+5<t.length}(t,e)&&ri(t,e)&&ni(t,e)<=t.length-e}(t,e)},r.appendFrame=function(t,e,r){oi(t,this.observer,e,r,t.manifestCodec);var i=ui(t,e,r,this.basePTS,this.frameIndex);if(i&&0===i.missing)return i},e}(ti),di=/\/emsg[-/]ID3/i,ci=function(){function t(t,e){this.remainderData=null,this.Demuxer=void 0,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=e}var e=t.prototype;return e.resetTimeStamp=function(){},e.resetInitSegment=function(t,e,r,i){var n=this.videoTrack=Zr("video",1),a=this.audioTrack=Zr("audio",1),s=this.txtTrack=Zr("text",1);if(this.id3Track=Zr("id3",1),this.timeOffset=0,null!=t&&t.byteLength){var o=wt(t);if(o.video){var l=o.video,u=l.id,h=l.timescale,d=l.codec;n.id=u,n.timescale=s.timescale=h,n.codec=d}if(o.audio){var c=o.audio,f=c.id,g=c.timescale,v=c.codec;a.id=f,a.timescale=g,a.codec=v}s.id=St.text,n.sampleDuration=0,n.duration=a.duration=i}},e.resetContiguity=function(){this.remainderData=null},t.probe=function(t){return Dt(t=t.length>16384?t.subarray(0,16384):t,["moof"]).length>0},e.demux=function(t,e){this.timeOffset=e;var r=t,i=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Pt(this.remainderData,t));var a=function(t){var e={valid:null,remainder:null},r=Dt(t,["moof"]);if(!r)return e;if(r.length<2)return e.remainder=t,e;var i=r[r.length-1];return e.valid=et(t,0,i.byteOffset-8),e.remainder=et(t,i.byteOffset-8),e}(r);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=r;var s=this.extractID3Track(i,e);return n.samples=xt(e,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}},e.flush=function(){var t=this.timeOffset,e=this.videoTrack,r=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;var i=this.extractID3Track(e,this.timeOffset);return r.samples=xt(t,e),{videoTrack:e,audioTrack:Zr(),id3Track:i,textTrack:Zr()}},e.extractID3Track=function(t,e){var r=this.id3Track;if(t.samples.length){var i=Dt(t.samples,["emsg"]);i&&i.forEach((function(t){var i=function(t){var e=t[0],r="",i="",n=0,a=0,s=0,o=0,l=0,u=0;if(0===e){for(;"\0"!==Lt(t.subarray(u,u+1));)r+=Lt(t.subarray(u,u+1)),u+=1;for(r+=Lt(t.subarray(u,u+1)),u+=1;"\0"!==Lt(t.subarray(u,u+1));)i+=Lt(t.subarray(u,u+1)),u+=1;i+=Lt(t.subarray(u,u+1)),u+=1,n=At(t,12),a=At(t,16),o=At(t,20),l=At(t,24),u=28}else if(1===e){n=At(t,u+=4);var h=At(t,u+=4),d=At(t,u+=4);for(u+=4,s=Math.pow(2,32)*h+d,Number.isSafeInteger(s)||(s=Number.MAX_SAFE_INTEGER,I.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=At(t,u),l=At(t,u+=4),u+=4;"\0"!==Lt(t.subarray(u,u+1));)r+=Lt(t.subarray(u,u+1)),u+=1;for(r+=Lt(t.subarray(u,u+1)),u+=1;"\0"!==Lt(t.subarray(u,u+1));)i+=Lt(t.subarray(u,u+1)),u+=1;i+=Lt(t.subarray(u,u+1)),u+=1}return{schemeIdUri:r,value:i,timeScale:n,presentationTime:s,presentationTimeDelta:a,eventDuration:o,id:l,payload:t.subarray(u,t.byteLength)}}(t);if(di.test(i.schemeIdUri)){var n=T(i.presentationTime)?i.presentationTime/i.timeScale:e+i.presentationTimeDelta/i.timeScale,a=4294967295===i.eventDuration?Number.POSITIVE_INFINITY:i.eventDuration/i.timeScale;a<=.001&&(a=Number.POSITIVE_INFINITY);var s=i.payload;r.samples.push({data:s,len:s.byteLength,dts:n,pts:n,type:ke,duration:a})}}))}return r},e.demuxSampleAes=function(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},e.destroy=function(){},t}(),fi=null,gi=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],vi=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],mi=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],pi=[0,1,1,4];function yi(t,e,r,i,n){if(!(r+24>e.length)){var a=Ti(e,r);if(a&&r+a.frameLength<=e.length){var s=i+n*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:e.subarray(r,r+a.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=a.channelCount,t.samplerate=a.sampleRate,t.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function Ti(t,e){var r=t[e+1]>>3&3,i=t[e+1]>>1&3,n=t[e+2]>>4&15,a=t[e+2]>>2&3;if(1!==r&&0!==n&&15!==n&&3!==a){var s=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*gi[14*(3===r?3-i:3===i?3:4)+n-1],u=vi[3*(3===r?0:2===r?1:2)+a],h=3===o?1:2,d=mi[r][i],c=pi[i],f=8*d*c,g=Math.floor(d*l/u+s)*c;if(null===fi){var v=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);fi=v?parseInt(v[1]):0}return!!fi&&fi<=87&&2===i&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:u,channelCount:h,frameLength:g,samplesPerFrame:f}}}function Ei(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function Si(t,e){return e+1<t.length&&Ei(t,e)}function Li(t,e){if(e+1<t.length&&Ei(t,e)){var r=Ti(t,e),i=4;null!=r&&r.frameLength&&(i=r.frameLength);var n=e+i;return n===t.length||Si(t,n)}return!1}var Ri=function(){function t(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}var e=t.prototype;return e.loadWord=function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,i=new Uint8Array(4),n=Math.min(4,e);if(0===n)throw new Error("no bytes available");i.set(t.subarray(r,r+n)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n},e.skipBits=function(t){var e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,t-=(e=t>>3)<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},e.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;if(t>32&&I.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(e=t-e)>0&&this.bitsAvailable?r<<e|this.readBits(e):r},e.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.skipEG=function(){this.skipBits(1+this.skipLZ())},e.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.readBoolean=function(){return 1===this.readBits(1)},e.readUByte=function(){return this.readBits(8)},e.readUShort=function(){return this.readBits(16)},e.readUInt=function(){return this.readBits(32)},e.skipScalingList=function(t){for(var e=8,r=8,i=0;i<t;i++)0!==r&&(r=(e+this.readEG()+256)%256),e=0===r?e:r},e.readSPS=function(){var t,e,r,i=0,n=0,a=0,s=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),u=this.readUEG.bind(this),h=this.readBoolean.bind(this),d=this.skipBits.bind(this),c=this.skipEG.bind(this),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);o();var v=o();if(l(5),d(3),o(),f(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){var m=u();if(3===m&&d(1),f(),f(),d(1),h())for(e=3!==m?8:12,r=0;r<e;r++)h()&&g(r<6?16:64)}f();var p=u();if(0===p)u();else if(1===p)for(d(1),c(),c(),t=u(),r=0;r<t;r++)c();f(),d(1);var y=u(),T=u(),E=l(1);0===E&&d(1),d(1),h()&&(i=u(),n=u(),a=u(),s=u());var S=[1,1];if(h()&&h())switch(o()){case 1:S=[1,1];break;case 2:S=[12,11];break;case 3:S=[10,11];break;case 4:S=[16,11];break;case 5:S=[40,33];break;case 6:S=[24,11];break;case 7:S=[20,11];break;case 8:S=[32,11];break;case 9:S=[80,33];break;case 10:S=[18,11];break;case 11:S=[15,11];break;case 12:S=[64,33];break;case 13:S=[160,99];break;case 14:S=[4,3];break;case 15:S=[3,2];break;case 16:S=[2,1];break;case 255:S=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*i-2*n),height:(2-E)*(T+1)*16-(E?2:4)*(a+s),pixelRatio:S}},e.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}(),Ai=function(){function t(t,e,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new Nr(e,{removePKCS7Padding:!1})}var e=t.prototype;return e.decryptBuffer=function(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer)},e.decryptAacSample=function(t,e,r){var i=this,n=t[e].unit;if(!(n.length<=16)){var a=n.subarray(16,n.length-n.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length);this.decryptBuffer(s).then((function(a){var s=new Uint8Array(a);n.set(s,16),i.decrypter.isSync()||i.decryptAacSamples(t,e+1,r)}))}},e.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32||(this.decryptAacSample(t,e,r),this.decrypter.isSync())))return}},e.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),i=0,n=32;n<t.length-16;n+=160,i+=16)r.set(t.subarray(n,n+16),i);return r},e.getAvcDecryptedUnit=function(t,e){for(var r=new Uint8Array(e),i=0,n=32;n<t.length-16;n+=160,i+=16)t.set(r.subarray(i,i+16),n);return t},e.decryptAvcSample=function(t,e,r,i,n){var a=this,s=Mt(n.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then((function(o){n.data=a.getAvcDecryptedUnit(s,o),a.decrypter.isSync()||a.decryptAvcSamples(t,e,r+1,i)}))},e.decryptAvcSamples=function(t,e,r,i){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length)return void i();for(var n=t[e].units;!(r>=n.length);r++){var a=n[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(t,e,r,i,a),this.decrypter.isSync())))return}}},t}(),ki=188,bi=function(){function t(t,e,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=t,this.config=e,this.typeSupported=r}t.probe=function(e){var r=t.syncOffset(e);return r>0&&I.warn("MPEG2-TS detected but first sync word found @ offset "+r),-1!==r},t.syncOffset=function(t){for(var e=t.length,r=Math.min(940,t.length-ki)+1,i=0;i<r;){for(var n=!1,a=i;a<e&&71===t[a];a+=ki)if(n||0!==Ii(t,a)||(n=!0),n&&a+ki>r)return i;i++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:St[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}};var e=t.prototype;return e.resetInitSegment=function(e,r,i,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video"),this._audioTrack=t.createTrack("audio",n),this._id3Track=t.createTrack("id3"),this._txtTrack=t.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=i,this._duration=n},e.resetTimeStamp=function(){},e.resetContiguity=function(){var t=this._audioTrack,e=this._avcTrack,r=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.avcSample=null,this.remainderData=null},e.demux=function(e,r,i,n){var a;void 0===i&&(i=!1),void 0===n&&(n=!1),i||(this.sampleAes=null);var s=this._avcTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack,h=s.pid,d=s.pesData,c=o.pid,f=l.pid,g=o.pesData,v=l.pesData,m=null,p=this.pmtParsed,y=this._pmtId,T=e.length;if(this.remainderData&&(T=(e=Pt(this.remainderData,e)).length,this.remainderData=null),T<ki&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};var R=Math.max(0,t.syncOffset(e));(T-=(T-R)%ki)<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,T,e.buffer.byteLength-T));for(var A=0,k=R;k<T;k+=ki)if(71===e[k]){var b=!!(64&e[k+1]),D=Ii(e,k),w=void 0;if((48&e[k+3])>>4>1){if((w=k+5+e[k+4])===k+ki)continue}else w=k+4;switch(D){case h:b&&(d&&(a=_i(d))&&this.parseAVCPES(s,u,a,!1),d={data:[],size:0}),d&&(d.data.push(e.subarray(w,k+ki)),d.size+=k+ki-w);break;case c:if(b){if(g&&(a=_i(g)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,a);break;case"mp3":this.parseMPEGPES(o,a)}g={data:[],size:0}}g&&(g.data.push(e.subarray(w,k+ki)),g.size+=k+ki-w);break;case f:b&&(v&&(a=_i(v))&&this.parseID3PES(l,a),v={data:[],size:0}),v&&(v.data.push(e.subarray(w,k+ki)),v.size+=k+ki-w);break;case 0:b&&(w+=e[w]+1),y=this._pmtId=wi(e,w);break;case y:b&&(w+=e[w]+1);var C=Ci(e,w,this.typeSupported,i,this.observer);(h=C.avc)>0&&(s.pid=h),(c=C.audio)>0&&(o.pid=c,o.segmentCodec=C.segmentCodec),(f=C.id3)>0&&(l.pid=f),null===m||p||(I.warn("MPEG-TS PMT found at "+k+" after unknown PID '"+m+"'. Backtracking to sync byte @"+R+" to parse all TS packets."),m=null,k=R-188),p=this.pmtParsed=!0;break;case 17:case 8191:break;default:m=D}}else A++;if(A>0){var _=new Error("Found "+A+" TS packet/s that do not start with 0x47");this.observer.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,fatal:!1,error:_,reason:_.message})}s.pesData=d,o.pesData=g,l.pesData=v;var P={audioTrack:o,videoTrack:s,id3Track:l,textTrack:u};return n&&this.extractRemainingSamples(P),P},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t},e.extractRemainingSamples=function(t){var e,r=t.audioTrack,i=t.videoTrack,n=t.id3Track,a=t.textTrack,s=i.pesData,o=r.pesData,l=n.pesData;if(s&&(e=_i(s))?(this.parseAVCPES(i,a,e,!0),i.pesData=null):i.pesData=s,o&&(e=_i(o))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,e);break;case"mp3":this.parseMPEGPES(r,e)}r.pesData=null}else null!=o&&o.size&&I.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=o;l&&(e=_i(l))?(this.parseID3PES(n,e),n.pesData=null):n.pesData=l},e.demuxSampleAes=function(t,e,r){var i=this.demux(t,r,!0,!this.config.progressive),n=this.sampleAes=new Ai(this.observer,this.config,e);return this.decrypt(i,n)},e.decrypt=function(t,e){return new Promise((function(r){var i=t.audioTrack,n=t.videoTrack;i.samples&&"aac"===i.segmentCodec?e.decryptAacSamples(i.samples,0,(function(){n.samples?e.decryptAvcSamples(n.samples,0,0,(function(){r(t)})):r(t)})):n.samples&&e.decryptAvcSamples(n.samples,0,0,(function(){r(t)}))}))},e.destroy=function(){this._duration=0},e.parseAVCPES=function(t,e,r,i){var n,a=this,s=this.parseAVCNALu(t,r.data),o=this.avcSample,l=!1;r.data=null,o&&s.length&&!t.audFound&&(Pi(o,t),o=this.avcSample=Di(!1,r.pts,r.dts,"")),s.forEach((function(i){switch(i.type){case 1:n=!0,o||(o=a.avcSample=Di(!0,r.pts,r.dts,"")),o.frame=!0;var s=i.data;if(l&&s.length>4){var u=new Ri(s).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(o.key=!0)}break;case 5:n=!0,o||(o=a.avcSample=Di(!0,r.pts,r.dts,"")),o.key=!0,o.frame=!0;break;case 6:n=!0,Ot(i.data,1,r.pts,e.samples);break;case 7:if(n=!0,l=!0,!t.sps){var h=i.data,d=new Ri(h).readSPS();t.width=d.width,t.height=d.height,t.pixelRatio=d.pixelRatio,t.sps=[h],t.duration=a._duration;for(var c=h.subarray(1,4),f="avc1.",g=0;g<3;g++){var v=c[g].toString(16);v.length<2&&(v="0"+v),f+=v}t.codec=f}break;case 8:n=!0,t.pps||(t.pps=[i.data]);break;case 9:n=!1,t.audFound=!0,o&&Pi(o,t),o=a.avcSample=Di(!1,r.pts,r.dts,"");break;case 12:n=!0;break;default:n=!1,o&&(o.debug+="unknown NAL "+i.type+" ")}o&&n&&o.units.push(i)})),i&&o&&(Pi(o,t),this.avcSample=null)},e.getLastNalUnit=function(t){var e,r,i=this.avcSample;if(i&&0!==i.units.length||(i=t[t.length-1]),null!=(e=i)&&e.units){var n=i.units;r=n[n.length-1]}return r},e.parseAVCNALu=function(t,e){var r,i,n=e.byteLength,a=t.naluState||0,s=a,o=[],l=0,u=-1,h=0;for(-1===a&&(u=0,h=31&e[0],a=0,l=1);l<n;)if(r=e[l++],a)if(1!==a)if(r)if(1===r){if(u>=0){var d={data:e.subarray(u,l-a-1),type:h};o.push(d)}else{var c=this.getLastNalUnit(t.samples);if(c&&(s&&l<=4-s&&c.state&&(c.data=c.data.subarray(0,c.data.byteLength-s)),(i=l-a-1)>0)){var f=new Uint8Array(c.data.byteLength+i);f.set(c.data,0),f.set(e.subarray(0,i),c.data.byteLength),c.data=f,c.state=0}}l<n?(u=l,h=31&e[l],a=0):a=-1}else a=0;else a=3;else a=r?0:2;else a=r?0:1;if(u>=0&&a>=0){var g={data:e.subarray(u,n),type:h,state:a};o.push(g)}if(0===o.length){var v=this.getLastNalUnit(t.samples);if(v){var m=new Uint8Array(v.data.byteLength+e.byteLength);m.set(v.data,0),m.set(e,v.data.byteLength),v.data=m}}return t.naluState=a,o},e.parseAACPES=function(t,e){var r,i,n,a=0,s=this.aacOverFlow,o=e.data;if(s){this.aacOverFlow=null;var l=s.missing,u=s.sample.unit.byteLength;if(-1===l){var h=new Uint8Array(u+o.byteLength);h.set(s.sample.unit,0),h.set(o,u),o=h}else{var d=u-l;s.sample.unit.set(o.subarray(0,l),d),t.samples.push(s.sample),a=s.missing}}for(r=a,i=o.length;r<i-1&&!ai(o,r);r++);if(r!==a){var c,f=r<i-1;c=f?"AAC PES did not start with ADTS header,offset:"+r:"No ADTS header found in AAC PES";var g=new Error(c);if(I.warn("parsing error: "+c),this.observer.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,fatal:!1,levelRetry:f,error:g,reason:c}),!f)return}if(oi(t,this.observer,o,r,this.audioCodec),void 0!==e.pts)n=e.pts;else{if(!s)return void I.warn("[tsdemuxer]: AAC PES unknown PTS");var v=li(t.samplerate);n=s.sample.pts+v}for(var m,p=0;r<i;){if(r+=(m=ui(t,o,r,n,p)).length,m.missing){this.aacOverFlow=m;break}for(p++;r<i-1&&!ai(o,r);r++);}},e.parseMPEGPES=function(t,e){var r=e.data,i=r.length,n=0,a=0,s=e.pts;if(void 0!==s)for(;a<i;)if(Si(r,a)){var o=yi(t,r,a,s,n);if(!o)break;a+=o.length,n++}else a++;else I.warn("[tsdemuxer]: MPEG PES unknown PTS")},e.parseID3PES=function(t,e){if(void 0!==e.pts){var r=o({},e,{type:this._avcTrack?ke:Re,duration:Number.POSITIVE_INFINITY});t.samples.push(r)}else I.warn("[tsdemuxer]: ID3 PES unknown PTS")},t}();function Di(t,e,r,i){return{key:t,frame:!1,pts:e,dts:r,units:[],debug:i,length:0}}function Ii(t,e){return((31&t[e+1])<<8)+t[e+2]}function wi(t,e){return(31&t[e+10])<<8|t[e+11]}function Ci(t,e,r,i,n){var a={audio:-1,avc:-1,id3:-1,segmentCodec:"aac"},s=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<s;){var o=Ii(t,e);switch(t[e]){case 207:if(!i){I.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===a.audio&&(a.audio=o);break;case 21:-1===a.id3&&(a.id3=o);break;case 219:if(!i){I.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===a.avc&&(a.avc=o);break;case 3:case 4:!0!==r.mpeg&&!0!==r.mp3?I.log("MPEG audio found, not supported in this browser"):-1===a.audio&&(a.audio=o,a.segmentCodec="mp3");break;case 36:n.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:L.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!1,reason:"Unsupported HEVC stream type found 0x24"}),I.warn("Unsupported HEVC stream type found")}e+=5+((15&t[e+3])<<8|t[e+4])}return a}function _i(t){var e,r,i,n,a,s=0,o=t.data;if(!t||0===t.size)return null;for(;o[0].length<19&&o.length>1;){var l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]),l.set(o[1],o[0].length),o[0]=l,o.splice(1,1)}if(1===((e=o[0])[0]<<16)+(e[1]<<8)+e[2]){if((r=(e[4]<<8)+e[5])&&r>t.size-6)return null;var u=e[7];192&u&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&u?n-(a=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(I.warn(Math.round((n-a)/9e4)+"s delta between PTS and DTS, align them"),n=a):a=n);var h=(i=e[8])+9;if(t.size<=h)return null;t.size-=h;for(var d=new Uint8Array(t.size),c=0,f=o.length;c<f;c++){var g=(e=o[c]).byteLength;if(h){if(h>g){h-=g;continue}e=e.subarray(h),g-=h,h=0}d.set(e,s),s+=g}return r&&(r-=i+3),{data:d,pts:n,dts:a,len:r}}return null}function Pi(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var r=e.samples,i=r.length;if(!i)return void e.dropped++;var n=r[i-1];t.pts=n.pts,t.dts=n.dts}e.samples.push(t)}t.debug.length&&I.log(t.pts+"/"+t.dts+":"+t.debug)}var xi=function(t){function e(){return t.apply(this,arguments)||this}l(e,t);var r=e.prototype;return r.resetInitSegment=function(e,r,i,n){t.prototype.resetInitSegment.call(this,e,r,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:n,inputTimeScale:9e4,dropped:0}},e.probe=function(t){if(!t)return!1;for(var e=(at(t,0)||[]).length,r=t.length;e<r;e++)if(Li(t,e))return I.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(t,e){return function(t,e){return Ei(t,e)&&4<=t.length-e}(t,e)},r.appendFrame=function(t,e,r){if(null!==this.basePTS)return yi(t,e,r,this.basePTS,this.frameIndex)},e}(ti),Fi=function(){function t(){}return t.getSilentFrame=function(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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===e)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===e)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===e)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===e)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])}},t}(),Oi=Math.pow(2,32)-1,Mi=function(){function t(){}return t.init=function(){var e;for(e in t.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);t.HDLR_TYPES={video:r,audio:i};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=a,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,s,l,s,o),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,n))},t.box=function(t){for(var e=8,r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(var a=i.length,s=a;a--;)e+=i[a].byteLength;var o=new Uint8Array(e);for(o[0]=e>>24&255,o[1]=e>>16&255,o[2]=e>>8&255,o[3]=255&e,o.set(t,4),a=0,e=8;a<s;a++)o.set(i[a],e),e+=i[a].byteLength;return o},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,r){r*=e;var i=Math.floor(r/(Oi+1)),n=Math.floor(r%(Oi+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,i){return t.box(t.types.moof,t.mfhd(e),t.traf(i,r))},t.moov=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,i=[];r--;)i[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(i))},t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(Oi+1)),n=Math.floor(r%(Oi+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,n>>24,n>>16&255,n>>8&255,255&n,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,a)},t.sdtp=function(e){var r,i,n=e.samples||[],a=new Uint8Array(4+n.length);for(r=0;r<n.length;r++)i=n[r].flags,a[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t.box(t.types.sdtp,a)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var r,i,n,a=[],s=[];for(r=0;r<e.sps.length;r++)n=(i=e.sps[r]).byteLength,a.push(n>>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(i));for(r=0;r<e.pps.length;r++)n=(i=e.pps[r]).byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));var o=t.box(t.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(s))),l=e.width,u=e.height,h=e.pixelRatio[0],d=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,255&h,d>>24,d>>16&255,d>>8&255,255&d])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,i=e.duration*e.timescale,n=e.width,a=e.height,s=Math.floor(i/(Oi+1)),o=Math.floor(i%(Oi+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,a>>8&255,255&a,0,0]))},t.traf=function(e,r){var i=t.sdtp(e),n=e.id,a=Math.floor(r/(Oi+1)),s=Math.floor(r%(Oi+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,r){var i,n,a,s,o,l,u=e.samples||[],h=u.length,d=12+16*h,c=new Uint8Array(d);for(r+=8+d,c.set(["video"===e.type?1:0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,255&h,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),i=0;i<h;i++)a=(n=u[i]).duration,s=n.size,o=n.flags,l=n.cts,c.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*i);return t.box(t.types.trun,c)},t.initSegment=function(e){t.types||t.init();var r=t.moov(e),i=new Uint8Array(t.FTYP.byteLength+r.byteLength);return i.set(t.FTYP),i.set(r,t.FTYP.byteLength),i},t}();Mi.types=void 0,Mi.HDLR_TYPES=void 0,Mi.STTS=void 0,Mi.STSC=void 0,Mi.STCO=void 0,Mi.STSZ=void 0,Mi.VMHD=void 0,Mi.SMHD=void 0,Mi.STSD=void 0,Mi.FTYP=void 0,Mi.DINF=void 0;var Ni=9e4;function Ui(t,e,r,i){void 0===r&&(r=1),void 0===i&&(i=!1);var n=t*e*r;return i?Math.round(n):n}function Bi(t,e){return void 0===e&&(e=!1),Ui(t,1e3,1/Ni,e)}var Gi=null,Ki=null,Hi=function(){function t(t,e,r,i){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.gLastPTS=0,this.observer=t,this.config=e,this.typeSupported=r,this.ISGenerated=!1,null===Gi){var n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Gi=n?parseInt(n[1]):0}if(null===Ki){var a=navigator.userAgent.match(/Safari\/(\d+)/i);Ki=a?parseInt(a[1]):0}}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){I.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){I.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){I.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},e.getVideoStartPts=function(t){var e=!1,r=t.reduce((function(t,r){var i=r.pts-t;return i<-4294967296?(e=!0,Vi(t,r.pts)):i>0?t:r.pts}),t[0].pts);return e&&I.debug("PTS rollover detected"),r},e.remux=function(t,e,r,i,n,a,s,o,l){var u,h,d,c,f,g,v=this,m=n,p=n,y=t.pid>-1,T=e.pid>-1,E=e.samples.length,S=t.samples.length>0,L=s&&E>0||E>1,R=(!y||S)&&(!T||L)||this.ISGenerated||s;if(this.gLastPTS=l*(e.samples.length-1)*3600,t.samples.forEach((function(t,e){return t.pts=3600*e+v.gLastPTS})),e.samples.forEach((function(t,e){t.pts=3600*e+v.gLastPTS,t.dts=3600*e+v.gLastPTS})),R){this.ISGenerated||(d=this.generateIS(t,e,n,a));var A,k=this.isVideoContiguous,b=-1;if(L&&(b=function(t){for(var e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!k&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,b>0){I.warn("[mp4-remuxer]: Dropped "+b+" out of "+E+" video samples due to a missing keyframe");var D=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(b),e.dropped+=b,A=p+=(e.samples[0].pts-D)/e.inputTimeScale}else-1===b&&(I.warn("[mp4-remuxer]: No keyframe found out of "+E+" video samples"),g=!1);if(this.ISGenerated){if(S&&L){var w=this.getVideoStartPts(e.samples),C=(Vi(t.samples[0].pts,w)-w)/e.inputTimeScale;m+=Math.max(0,C),p+=Math.max(0,-C)}if(S){if(t.samplerate||(I.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(t,e,n,a)),h=this.remuxAudio(t,m,this.isAudioContiguous,a,T||L||o===ge?p:void 0),L){var _=h?h.endPTS-h.startPTS:0;e.inputTimeScale||(I.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(t,e,n,a)),u=this.remuxVideo(e,p,k,_)}}else L&&(u=this.remuxVideo(e,p,k,0));u&&(u.firstKeyFrame=b,u.independent=-1!==b,u.firstKeyFramePTS=A)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(f=Yi(r,n,this._initPTS,this._initDTS)),i.samples.length&&(c=Wi(i,n,this._initPTS))),{audio:h,video:u,initSegment:d,independent:g,text:c,id3:f}},e.generateIS=function(t,e,r,i){var n,a,s,o=t.samples,l=e.samples,u=this.typeSupported,h={},d=this._initPTS,c=!d||i,f="audio/mp4";if(c&&(n=a=1/0),t.config&&o.length&&(t.timescale=t.samplerate,"mp3"===t.segmentCodec&&(u.mpeg?(f="audio/mpeg",t.codec=""):u.mp3&&(t.codec="mp3")),h.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&u.mpeg?new Uint8Array(0):Mi.initSegment([t]),metadata:{channelCount:t.channelCount}},c&&(s=t.inputTimeScale,d&&s===d.timescale?c=!1:n=a=o[0].pts-Math.round(s*r))),e.sps&&e.pps&&l.length&&(e.timescale=e.inputTimeScale,h.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:Mi.initSegment([e]),metadata:{width:e.width,height:e.height}},c))if(s=e.inputTimeScale,d&&s===d.timescale)c=!1;else{var g=this.getVideoStartPts(l),v=Math.round(s*r);a=Math.min(a,Vi(l[0].dts,g)-v),n=Math.min(n,g-v)}if(Object.keys(h).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:n,timescale:s},this._initDTS={baseTime:a,timescale:s}):n=s=void 0,{tracks:h,initPTS:n,timescale:s}},e.remuxVideo=function(t,e,r,i){var n,a,s=t.inputTimeScale,l=t.samples,u=[],h=l.length,d=this._initPTS,c=this.nextAvcDts,f=8,g=this.videoSampleDuration,v=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,p=!1;r&&null!==c||(c=e*s-(l[0].pts-Vi(l[0].dts,l[0].pts)));for(var y=d.baseTime*s/d.timescale,T=0;T<h;T++){var R=l[T];R.pts=Vi(R.pts-y,c),R.dts=Vi(R.dts-y,c),R.dts<l[T>0?T-1:T].dts&&(p=!0)}p&&l.sort((function(t,e){var r=t.dts-e.dts,i=t.pts-e.pts;return r||i})),n=l[0].dts;var A=(a=l[l.length-1].dts)-n,k=A?Math.round(A/(h-1)):g||t.inputTimeScale/30;if(r){var b=n-c,D=b>k,w=b<-1;if((D||w)&&(D?I.warn("AVC: "+Bi(b,!0)+" ms ("+b+"dts) hole between fragments detected, filling it"):I.warn("AVC: "+Bi(-b,!0)+" ms ("+b+"dts) overlapping between fragments detected"),!w||c>l[0].pts)){n=c;var C=l[0].pts-b;l[0].dts=n,l[0].pts=C,I.log("Video: First PTS/DTS adjusted: "+Bi(C,!0)+"/"+Bi(n,!0)+", delta: "+Bi(b,!0)+" ms")}}n=Math.max(0,n);for(var _=0,P=0,x=0;x<h;x++){for(var F=l[x],O=F.units,M=O.length,N=0,U=0;U<M;U++)N+=O[U].data.length;P+=N,_+=M,F.length=N,F.dts=Math.max(F.dts,n),v=Math.min(F.pts,v),m=Math.max(F.pts,m)}a=l[h-1].dts;var B,G=P+4*_+8;try{B=new Uint8Array(G)}catch(t){return void this.observer.emit(E.ERROR,E.ERROR,{type:S.MUX_ERROR,details:L.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:G,reason:"fail allocating video mdat "+G})}var K=new DataView(B.buffer);K.setUint32(0,G),B.set(Mi.types.mdat,4);for(var H=!1,V=Number.POSITIVE_INFINITY,Y=Number.POSITIVE_INFINITY,W=Number.NEGATIVE_INFINITY,j=Number.NEGATIVE_INFINITY,q=0;q<h;q++){for(var X=l[q],z=X.units,Q=0,$=0,J=z.length;$<J;$++){var Z=z[$],tt=Z.data,et=Z.data.byteLength;K.setUint32(f,et),f+=4,B.set(tt,f),f+=et,Q+=4+et}var rt=void 0;if(q<h-1)g=l[q+1].dts-X.dts,rt=l[q+1].pts-X.pts;else{var it=this.config,nt=q>0?X.dts-l[q-1].dts:k;if(rt=q>0?X.pts-l[q-1].pts:k,it.stretchShortVideoTrack&&null!==this.nextAudioPts){var at=Math.floor(it.maxBufferHole*s),st=(i?v+i*s:this.nextAudioPts)-X.pts;st>at?((g=st-nt)<0?g=nt:H=!0,I.log("[mp4-remuxer]: It is approximately "+st/90+" ms to the next segment; using duration "+g/90+" ms for the last video frame.")):g=nt}else g=nt}var ot=Math.round(X.pts-X.dts);V=Math.min(V,g),W=Math.max(W,g),Y=Math.min(Y,rt),j=Math.max(j,rt),u.push(new qi(X.key,g,Q,ot))}if(u.length)if(Gi){if(Gi<70){var lt=u[0].flags;lt.dependsOn=2,lt.isNonSync=0}}else if(Ki&&j-Y<W-V&&k/W<.025&&0===u[0].cts){I.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var ut=n,ht=0,dt=u.length;ht<dt;ht++){var ct=ut+u[ht].duration,ft=ut+u[ht].cts;if(ht<dt-1){var gt=ct+u[ht+1].cts;u[ht].duration=gt-ft}else u[ht].duration=ht?u[ht-1].duration:k;u[ht].cts=0,ut=ct}}g=H||!g?k:g,this.nextAvcDts=c=a+g,this.videoSampleDuration=g,this.isVideoContiguous=!0;var vt={data1:Mi.moof(t.sequenceNumber++,n,o({},t,{samples:u})),data2:B,startPTS:v/s,endPTS:(m+g)/s,startDTS:n/s,endDTS:c/s,type:"video",hasAudio:!1,hasVideo:!0,nb:u.length,dropped:t.dropped};return t.samples=[],t.dropped=0,vt},e.remuxAudio=function(t,e,r,i,n){var a=t.inputTimeScale,s=a/(t.samplerate?t.samplerate:a),l="aac"===t.segmentCodec?1024:1152,u=l*s,h=this._initPTS,d="mp3"===t.segmentCodec&&this.typeSupported.mpeg,c=[],f=void 0!==n,g=t.samples,v=d?0:8,m=this.nextAudioPts||-1,p=e*a,y=h.baseTime*a/h.timescale;if(this.isAudioContiguous=r=r||g.length&&m>0&&(i&&Math.abs(p-m)<9e3||Math.abs(Vi(g[0].pts-y,p)-m)<20*u),g.forEach((function(t){t.pts=Vi(t.pts-y,p)})),!r||m<0){if(g=g.filter((function(t){return t.pts>=0})),!g.length)return;m=0===n?0:i&&!f?Math.max(0,p):g[0].pts}if("aac"===t.segmentCodec)for(var T=this.config.maxAudioFramesDrift,R=0,A=m;R<g.length;R++){var k=g[R],b=k.pts,D=b-A,w=Math.abs(1e3*D/a);if(D<=-T*u&&f)0===R&&(I.warn("Audio frame @ "+(b/a).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*D/a)+" ms."),this.nextAudioPts=m=A=b);else if(D>=T*u&&w<1e4&&f){var C=Math.round(D/u);(A=b-C*u)<0&&(C--,A+=u),0===R&&(this.nextAudioPts=m=A),I.warn("[mp4-remuxer]: Injecting "+C+" audio frame @ "+(A/a).toFixed(3)+"s due to "+Math.round(1e3*D/a)+" ms gap.");for(var _=0;_<C;_++){var P=Math.max(A,0),x=Fi.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);x||(I.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),x=k.unit.subarray()),g.splice(R,0,{unit:x,pts:P}),A+=u,R++}}k.pts=A,A+=u}for(var F,O=null,M=null,N=0,U=g.length;U--;)N+=g[U].unit.byteLength;for(var B=0,G=g.length;B<G;B++){var K=g[B],H=K.unit,V=K.pts;if(null!==M)c[B-1].duration=Math.round((V-M)/s);else{if(r&&"aac"===t.segmentCodec&&(V=m),O=V,!(N>0))return;N+=v;try{F=new Uint8Array(N)}catch(t){return void this.observer.emit(E.ERROR,E.ERROR,{type:S.MUX_ERROR,details:L.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:N,reason:"fail allocating audio mdat "+N})}d||(new DataView(F.buffer).setUint32(0,N),F.set(Mi.types.mdat,4))}F.set(H,v);var Y=H.byteLength;v+=Y,c.push(new qi(!0,l,Y,0)),M=V}var W=c.length;if(W){var j=c[c.length-1];this.nextAudioPts=m=M+s*j.duration;var q=d?new Uint8Array(0):Mi.moof(t.sequenceNumber++,O/s,o({},t,{samples:c}));t.samples=[];var X=O/a,z=m/a,Q={data1:q,data2:F,startPTS:X,endPTS:z,startDTS:X,endDTS:z,type:"audio",hasAudio:!0,hasVideo:!1,nb:W};return this.isAudioContiguous=!0,Q}},e.remuxEmptyAudio=function(t,e,r,i){var n=t.inputTimeScale,a=n/(t.samplerate?t.samplerate:n),s=this.nextAudioPts,o=this._initDTS,l=9e4*o.baseTime/o.timescale,u=(null!==s?s:i.startDTS*n)+l,h=i.endDTS*n+l,d=1024*a,c=Math.ceil((h-u)/d),f=Fi.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(I.warn("[mp4-remuxer]: remux empty Audio"),f){for(var g=[],v=0;v<c;v++){var m=u+v*d;g.push({unit:f,pts:m,dts:m})}return t.samples=g,this.remuxAudio(t,e,r,!1)}I.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t}();function Vi(t,e){var r;if(null===e)return t;for(r=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=r;return t}function Yi(t,e,r,i){var n=t.samples.length;if(n){for(var a=t.inputTimeScale,s=0;s<n;s++){var o=t.samples[s];o.pts=Vi(o.pts-9e4*r.baseTime/r.timescale,e*a)/a,o.dts=Vi(o.dts-9e4*i.baseTime/i.timescale,e*a)/a}var l=t.samples;return t.samples=[],{samples:l}}}function Wi(t,e,r){var i=t.samples.length;if(i){for(var n=t.inputTimeScale,a=0;a<i;a++){var s=t.samples[a];s.pts=Vi(s.pts-9e4*r.baseTime/r.timescale,e*n)/n}t.samples.sort((function(t,e){return t.pts-e.pts}));var o=t.samples;return t.samples=[],{samples:o}}}var ji,qi=function(t,e,r,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=r,this.cts=i,this.flags=new Xi(t)},Xi=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?0:1},zi=function(){function t(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){this.initPTS=t,this.lastEndTime=null},e.resetNextTimestamp=function(){this.lastEndTime=null},e.resetInitSegment=function(t,e,r,i){this.audioCodec=e,this.videoCodec=r,this.generateInitSegment(function(t,e){if(!t||!e)return t;var r=e.keyId;return r&&e.isCommonEncryption&&Dt(t,["moov","trak"]).forEach((function(t){var e=Dt(t,["mdia","minf","stbl","stsd"])[0].subarray(8),i=Dt(e,["enca"]),n=i.length>0;n||(i=Dt(e,["encv"])),i.forEach((function(t){Dt(n?t.subarray(28):t.subarray(78),["sinf"]).forEach((function(t){var e=Ct(t);if(e){var i=e.subarray(8,24);i.some((function(t){return 0!==t}))||(I.log("[eme] Patching keyId in 'enc"+(n?"a":"v")+">sinf>>tenc' box: "+yt(i)+" -> "+yt(r)),e.set(r,8))}}))}))})),t}(t,i)),this.emitInitSegment=!0},e.generateInitSegment=function(t){var e=this.audioCodec,r=this.videoCodec;if(null==t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var i=this.initData=wt(t);e||(e=Qi(i.audio,O)),r||(r=Qi(i.video,M));var n={};i.audio&&i.video?n.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:t,id:"main"}:i.audio?n.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:i.video?n.video={container:"video/mp4",codec:r,initSegment:t,id:"main"}:I.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n},e.remux=function(t,e,r,i,n,a){var s,o,l=this.initPTS,u=this.lastEndTime,h={audio:void 0,video:void 0,text:i,id3:r,initSegment:void 0};T(u)||(u=this.lastEndTime=n||0);var d=e.samples;if(null==d||!d.length)return h;var c={initPTS:void 0,timescale:1},f=this.initData;if(null!=(s=f)&&s.length||(this.generateInitSegment(d),f=this.initData),null==(o=f)||!o.length)return I.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(c.tracks=this.initTracks,this.emitInitSegment=!1);var g=function(t,e){for(var r=0,i=0,n=0,a=Dt(t,["moof","traf"]),s=0;s<a.length;s++){var o=a[s],l=Dt(o,["tfhd"])[0],u=e[At(l,4)];if(u){var h=u.default,d=At(l,0)|(null==h?void 0:h.flags),c=null==h?void 0:h.duration;8&d&&(c=At(l,2&d?12:8));for(var f=u.timescale||9e4,g=Dt(o,["trun"]),v=0;v<g.length;v++)!(r=_t(g[v]))&&c&&(r=c*At(g[v],4)),u.type===M?i+=r/f:u.type===O&&(n+=r/f)}}if(0===i&&0===n){for(var m=0,p=Dt(t,["sidx"]),y=0;y<p.length;y++){var T=It(p[y]);null!=T&&T.references&&(m+=T.references.reduce((function(t,e){return t+e.info.duration||0}),0))}return m}return i||n}(d,f),v=function(t,e){return Dt(e,["moof","traf"]).reduce((function(e,r){var i=Dt(r,["tfdt"])[0],n=i[0],a=Dt(r,["tfhd"]).reduce((function(e,r){var a=At(r,4),s=t[a];if(s){var o=At(i,4);if(1===n){if(o===Tt)return I.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;o*=Tt+1,o+=At(i,8)}var l=o/(s.timescale||9e4);if(isFinite(l)&&(null===e||l<e))return l}return e}),null);return null!==a&&isFinite(a)&&(null===e||a<e)?a:e}),null)}(f,d),m=null===v?n:v;(function(t,e,r,i){if(null===t)return!0;var n=Math.max(i,1),a=e-t.baseTime/t.timescale;return Math.abs(a-r)>n}(l,m,n,g)||c.timescale!==l.timescale&&a)&&(c.initPTS=m-n,l&&1===l.timescale&&I.warn("Adjusting initPTS by "+(c.initPTS-l.baseTime)),this.initPTS=l={baseTime:c.initPTS,timescale:1});var p=t?m-l.baseTime/l.timescale:u,y=p+g;!function(t,e,r){Dt(e,["moof","traf"]).forEach((function(e){Dt(e,["tfhd"]).forEach((function(i){var n=At(i,4),a=t[n];if(a){var s=a.timescale||9e4;Dt(e,["tfdt"]).forEach((function(t){var e=t[0],i=At(t,4);if(0===e)i-=r*s,bt(t,4,i=Math.max(i,0));else{i*=Math.pow(2,32),i+=At(t,8),i-=r*s,i=Math.max(i,0);var n=Math.floor(i/(Tt+1)),a=Math.floor(i%(Tt+1));bt(t,4,n),bt(t,8,a)}}))}}))}))}(f,d,l.baseTime/l.timescale),g>0?this.lastEndTime=y:(I.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var E=!!f.audio,S=!!f.video,L="";E&&(L+="audio"),S&&(L+="video");var R={data1:d,startPTS:p,startDTS:p,endPTS:y,endDTS:y,type:L,hasAudio:E,hasVideo:S,nb:1,dropped:0};return h.audio="audio"===R.type?R:void 0,h.video="audio"!==R.type?R:void 0,h.initSegment=c,h.id3=Yi(r,n,l,l),i.samples.length&&(h.text=Wi(i,n,l)),h},t}();function Qi(t,e){var r=null==t?void 0:t.codec;return r&&r.length>4?r:"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1"===r||e===M?"avc1.42e01e":"mp4a.40.5"}try{ji=self.performance.now.bind(self.performance)}catch(t){I.debug("Unable to use Performance API on this environment"),ji="undefined"!=typeof self&&self.Date.now}var $i=[{demux:ci,remux:zi},{demux:bi,remux:Hi},{demux:hi,remux:Hi},{demux:xi,remux:Hi}],Ji=function(){function t(t,e,r,i,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=t,this.typeSupported=e,this.config=r,this.vendor=i,this.id=n}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,r,i){var n=this,a=r.transmuxing;a.executeStart=ji();var s=new Uint8Array(t),o=this.currentTransmuxState,l=this.transmuxConfig;i&&(this.currentTransmuxState=i);var u=i||o,h=u.contiguous,d=u.discontinuity,c=u.trackSwitch,f=u.accurateTimeOffset,g=u.timeOffset,v=u.initSegmentChange,m=l.audioCodec,p=l.videoCodec,y=l.defaultInitPts,T=l.duration,R=l.initSegmentData,A=function(t,e){var r=null;return t.byteLength>0&&null!=e&&null!=e.key&&null!==e.iv&&null!=e.method&&(r=e),r}(s,e);if(A&&"AES-128"===A.method){var k=this.getDecrypter();if(!k.isSync())return this.decryptionPromise=k.webCryptoDecrypt(s,A.key.buffer,A.iv.buffer).then((function(t){var e=n.push(t,null,r);return n.decryptionPromise=null,e})),this.decryptionPromise;var b=k.softwareDecrypt(s,A.key.buffer,A.iv.buffer);if(r.part>-1&&(b=k.flush()),!b)return a.executeEnd=ji(),Zi(r);s=new Uint8Array(b)}var D=this.needsProbing(d,c);if(D){var w=this.configureTransmuxer(s);if(w)return I.warn("[transmuxer] "+w.message),this.observer.emit(E.ERROR,E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,fatal:!1,error:w,reason:w.message}),a.executeEnd=ji(),Zi(r)}(d||c||v||D)&&this.resetInitSegment(R,m,p,T,e),(d||v||D)&&this.resetInitialTimestamp(y),h||this.resetContiguity();var C=this.transmux(s,A,g,f,r),_=this.currentTransmuxState;return _.contiguous=!0,_.discontinuity=!1,_.trackSwitch=!1,a.executeEnd=ji(),C},e.flush=function(t){var e=this,r=t.transmuxing;r.executeStart=ji();var i=this.decrypter,n=this.currentTransmuxState,a=this.decryptionPromise;if(a)return a.then((function(){return e.flush(t)}));var s=[],o=n.timeOffset;if(i){var l=i.flush();l&&s.push(this.push(l,null,t))}var u=this.demuxer,h=this.remuxer;if(!u||!h)return r.executeEnd=ji(),[Zi(t)];var d=u.flush(o);return tn(d)?d.then((function(r){return e.flushRemux(s,r,t),s})):(this.flushRemux(s,d,t),s)},e.flushRemux=function(t,e,r){var i=e.audioTrack,n=e.videoTrack,a=e.id3Track,s=e.textTrack,o=this.currentTransmuxState,l=o.accurateTimeOffset,u=o.timeOffset;I.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var h=this.remuxer.remux(i,n,a,s,u,l,!0,this.id,r.sn);t.push({remuxResult:h,chunkMeta:r}),r.transmuxing.executeEnd=ji()},e.resetInitialTimestamp=function(t){var e=this.demuxer,r=this.remuxer;e&&r&&(e.resetTimeStamp(t),r.resetTimeStamp(t))},e.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())},e.resetInitSegment=function(t,e,r,i,n){var a=this.demuxer,s=this.remuxer;a&&s&&(a.resetInitSegment(t,e,r,i),s.resetInitSegment(t,e,r,n))},e.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},e.transmux=function(t,e,r,i,n){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,r,i,n):this.transmuxUnencrypted(t,r,i,n)},e.transmuxUnencrypted=function(t,e,r,i){var n=this.demuxer.demux(t,e,!1,!this.config.progressive),a=n.audioTrack,s=n.videoTrack,o=n.id3Track,l=n.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,e,r,!1,this.id,i.sn),chunkMeta:i}},e.transmuxSampleAes=function(t,e,r,i,n){var a=this;return this.demuxer.demuxSampleAes(t,e,r).then((function(t){return{remuxResult:a.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,r,i,!1,a.id,n.sn),chunkMeta:n}}))},e.configureTransmuxer=function(t){for(var e,r=this.config,i=this.observer,n=this.typeSupported,a=this.vendor,s=0,o=$i.length;s<o;s++)if($i[s].demux.probe(t)){e=$i[s];break}if(!e)return new Error("Failed to find demuxer by probing fragment data");var l=this.demuxer,u=this.remuxer,h=e.remux,d=e.demux;u&&u instanceof h||(this.remuxer=new h(i,r,n,a)),l&&l instanceof d||(this.demuxer=new d(i,r,n),this.probe=d.probe)},e.needsProbing=function(t,e){return!this.demuxer||!this.remuxer||t||e},e.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new Nr(this.config)),t},t}(),Zi=function(t){return{remuxResult:{},chunkMeta:t}};function tn(t){return"then"in t&&t.then instanceof Function}var en=function(t,e,r,i,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=r,this.duration=i,this.defaultInitPts=n||null},rn=function(t,e,r,i,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=t,this.contiguous=e,this.accurateTimeOffset=r,this.trackSwitch=i,this.timeOffset=n,this.initSegmentChange=a},nn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function a(t,e,i,a,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,a||t,s),l=r?r+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),o.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,s=new Array(a);n<a;n++)s[n]=i[n].fn;return s},o.prototype.listenerCount=function(t){var e=r?r+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,n,a,s){var o=r?r+t:t;if(!this._events[o])return!1;var l,u,h=this._events[o],d=arguments.length;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),d){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,i),!0;case 4:return h.fn.call(h.context,e,i,n),!0;case 5:return h.fn.call(h.context,e,i,n,a),!0;case 6:return h.fn.call(h.context,e,i,n,a,s),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];h.fn.apply(h.context,l)}else{var c,f=h.length;for(u=0;u<f;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),d){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,i);break;case 4:h[u].fn.call(h[u].context,e,i,n);break;default:if(!l)for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];h[u].fn.apply(h[u].context,l)}}return!0},o.prototype.on=function(t,e,r){return a(this,t,e,r,!1)},o.prototype.once=function(t,e,r){return a(this,t,e,r,!0)},o.prototype.removeListener=function(t,e,i,n){var a=r?r+t:t;if(!this._events[a])return this;if(!e)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==e||n&&!o.once||i&&o.context!==i||s(this,a);else{for(var l=0,u=[],h=o.length;l<h;l++)(o[l].fn!==e||n&&!o[l].once||i&&o[l].context!==i)&&u.push(o[l]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,t.exports=o}(nn);var an=m(nn.exports);function sn(t,e){if(!((r=e.remuxResult).audio||r.video||r.text||r.id3||r.initSegment))return!1;var r,i=[],n=e.remuxResult,a=n.audio,s=n.video;return a&&on(i,a),s&&on(i,s),t.postMessage({event:"transmuxComplete",data:e},i),!0}function on(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function ln(t,e,r){e.reduce((function(e,r){return sn(t,r)||e}),!1)||t.postMessage({event:"transmuxComplete",data:e[0]}),t.postMessage({event:"flush",data:r})}void 0!==e&&e&&function(t){var e=new an,r=function(e,r){t.postMessage({event:e,data:r})};e.on(E.FRAG_DECRYPTED,r),e.on(E.ERROR,r);var i=function(){var t=function(t){var e=function(e){r("workerLog",{logType:t,message:e})};I[t]=e};for(var e in I)t(e)};t.addEventListener("message",(function(n){var a=n.data;switch(a.cmd){case"init":var s=JSON.parse(a.config);t.transmuxer=new Ji(e,a.typeSupported,s,a.vendor,a.id),D(s.debug,a.id),i(),r("init",null);break;case"configure":t.transmuxer.configure(a.config);break;case"demux":var o=t.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);tn(o)?(t.transmuxer.async=!0,o.then((function(e){sn(t,e)})).catch((function(t){r(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:t,err:t,reason:"transmuxer-worker push error"})}))):(t.transmuxer.async=!1,sn(t,o));break;case"flush":var l=a.chunkMeta,u=t.transmuxer.flush(l);tn(u)||t.transmuxer.async?(tn(u)||(u=Promise.resolve(u)),u.then((function(e){ln(t,e,l)})).catch((function(t){r(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,chunkMeta:a.chunkMeta,fatal:!1,error:t,err:t,reason:"transmuxer-worker flush error"})}))):ln(t,u,l)}}))}(self);var un=jt()||{isTypeSupported:function(){return!1}},hn=function(){function e(e,r,i,n){var a=this;this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;var s=e.config;this.hls=e,this.id=r,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;var o=function(t,e){(e=e||{}).frag=a.frag,e.id=a.id,t===E.ERROR&&(a.error=e.error),a.hls.trigger(t,e)};this.observer=new an,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);var l,u,h,d,c={mp4:un.isTypeSupported("video/mp4"),mpeg:un.isTypeSupported("audio/mpeg"),mp3:un.isTypeSupported('audio/mp4; codecs="mp3"')},f=navigator.vendor;if(!this.useWorker||"undefined"==typeof Worker||(s.workerPath,0))this.transmuxer=new Ji(this.observer,c,s,f,r);else try{s.workerPath?(I.log("loading Web Worker "+s.workerPath+' for "'+r+'"'),this.workerContext=(h=s.workerPath,d=new self.URL(h,self.location.href).href,{worker:new self.Worker(d),scriptURL:d})):(I.log('injecting Web Worker for "'+r+'"'),this.workerContext=(l=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;("+t.toString()+")(true);"],{type:"text/javascript"}),u=self.URL.createObjectURL(l),{worker:new self.Worker(u),objectURL:u})),this.onwmsg=function(t){return a.onWorkerMessage(t)};var g=this.workerContext.worker;g.addEventListener("message",this.onwmsg),g.onerror=function(t){var e=new Error(t.message+" ("+t.filename+":"+t.lineno+")");s.enableWorker=!1,I.warn('Error in "'+r+'" Web Worker, fallback to inline'),a.hls.trigger(E.ERROR,{type:S.OTHER_ERROR,details:L.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:e})},g.postMessage({cmd:"init",typeSupported:c,vendor:f,id:r,config:JSON.stringify(s)})}catch(t){I.warn('Error setting up "'+r+'" Web Worker, fallback to inline',t),this.resetWorker(),this.error=null,this.transmuxer=new Ji(this.observer,c,s,f,r)}}var r=e.prototype;return r.resetWorker=function(){if(this.workerContext){var t=this.workerContext,e=t.worker,r=t.objectURL;r&&self.URL.revokeObjectURL(r),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}},r.destroy=function(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},r.push=function(t,e,r,i,n,a,s,o,l,u){var h,d,c=this;l.transmuxing.start=self.performance.now();var f=this.transmuxer,g=a?a.start:n.start,v=n.decryptdata,m=this.frag,p=!(m&&n.cc===m.cc),y=!(m&&l.level===m.level),T=m?l.sn-m.sn:-1,E=this.part?l.part-this.part.index:-1,S=0===T&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),L=!y&&(1===T||0===T&&(1===E||S&&E<=0)),R=self.performance.now();(y||T||0===n.stats.parsing.start)&&(n.stats.parsing.start=R),!a||!E&&L||(a.stats.parsing.start=R);var A=!(m&&(null==(h=n.initSegment)?void 0:h.url)===(null==(d=m.initSegment)?void 0:d.url)),k=new rn(p,L,o,y,g,A);if(!L||p||A){I.log("[transmuxer-interface, "+n.type+"]: Starting new transmux session for sn: "+l.sn+" p: "+l.part+" level: "+l.level+" id: "+l.id+"\n discontinuity: "+p+"\n trackSwitch: "+y+"\n contiguous: "+L+"\n accurateTimeOffset: "+o+"\n timeOffset: "+g+"\n initSegmentChange: "+A);var b=new en(r,i,e,s,u);this.configureTransmuxer(b)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:t,decryptdata:v,chunkMeta:l,state:k},t instanceof ArrayBuffer?[t]:[]);else if(f){var D=f.push(t,v,l,k);tn(D)?(f.async=!0,D.then((function(t){c.handleTransmuxComplete(t)})).catch((function(t){c.transmuxerError(t,l,"transmuxer-interface push error")}))):(f.async=!1,this.handleTransmuxComplete(D))}},r.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var r=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:t});else if(r){var i=r.flush(t);tn(i)||r.async?(tn(i)||(i=Promise.resolve(i)),i.then((function(r){e.handleFlushResult(r,t)})).catch((function(r){e.transmuxerError(r,t,"transmuxer-interface flush error")}))):this.handleFlushResult(i,t)}},r.transmuxerError=function(t,e,r){this.hls&&(this.error=t,this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_PARSING_ERROR,chunkMeta:e,fatal:!1,error:t,err:t,reason:r}))},r.handleFlushResult=function(t,e){var r=this;t.forEach((function(t){r.handleTransmuxComplete(t)})),this.onFlush(e)},r.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":var i,n=null==(i=this.workerContext)?void 0:i.objectURL;n&&self.URL.revokeObjectURL(n);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":I[e.data.logType]&&I[e.data.logType](e.data.message);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}},r.configureTransmuxer=function(t){var e=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:t}):e&&e.configure(t)},r.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},e}(),dn=function(){function t(t,e,r,i){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=t,this.media=e,this.fragmentTracker=r,this.hls=i}var e=t.prototype;return e.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},e.poll=function(t,e){var r=this.config,i=this.media,n=this.stalled;if(null!==i){var a=i.currentTime,s=i.seeking,o=this.seeking&&!s,l=!this.seeking&&s;if(this.seeking=s,a===t){if(l||o)this.stalled=null;else if(!(i.paused&&!s||i.ended||0===i.playbackRate)&&Dr.getBuffered(i).length){var u=Dr.bufferInfo(i,a,0),h=u.len>0,d=u.nextStart||0;if(h||d){if(s){var c=u.len>2,f=!d||e&&e.start<=a||d-a>2&&!this.fragmentTracker.getPartialFragment(a);if(c||f)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var g,v=Math.max(d,u.start||0)-a,m=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,p=(null==m||null==(g=m.details)?void 0:g.live)?2*m.details.targetduration:2,y=this.fragmentTracker.getPartialFragment(a);if(v>0&&(v<=p||y))return void this._trySkipBufferHole(y)}var T=self.performance.now();if(null!==n){var E=T-n;if(s||!(E>=250)||(this._reportStall(u),this.media)){var S=Dr.bufferInfo(i,a,r.maxBufferHole);this._tryFixBufferStall(S,E)}}else this.stalled=T}}}else if(this.moved=!0,null!==n){if(this.stallReported){var L=self.performance.now()-n;I.warn("playback not stuck anymore @"+a+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},e._tryFixBufferStall=function(t,e){var r=this.config,i=this.fragmentTracker,n=this.media;if(null!==n){var a=n.currentTime,s=i.getPartialFragment(a);if(s&&(this._trySkipBufferHole(s)||!this.media))return;(t.len>r.maxBufferHole||t.nextStart&&t.nextStart-a<r.maxBufferHole)&&e>1e3*r.highBufferWatchdogPeriod&&(I.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},e._reportStall=function(t){var e=this.hls,r=this.media;if(!this.stallReported&&r){this.stallReported=!0;var i=new Error("Playback stalling at @"+r.currentTime+" due to low buffer ("+JSON.stringify(t)+")");I.warn(i.message),e.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:t.len})}},e._trySkipBufferHole=function(t){var e=this.config,r=this.hls,i=this.media;if(null===i)return 0;var n=i.currentTime,a=Dr.bufferInfo(i,n,0),s=n<a.start?a.start:a.nextStart;if(s){var o=a.len<=e.maxBufferHole,l=a.len>0&&a.len<1&&i.readyState<3,u=s-n;if(u>0&&(o||l)){if(u>e.maxBufferHole){var h=this.fragmentTracker,d=!1;if(0===n){var c=h.getAppendedFrag(0,fe);c&&s<c.end&&(d=!0)}if(!d){var f=t||h.getAppendedFrag(n,fe);if(f){for(var g=!1,v=f.end;v<s;){var m=h.getPartialFragment(v);if(!m){g=!0;break}v+=m.duration}if(g)return 0}}}var p=Math.max(s+.05,n+.1);if(I.warn("skipping hole, adjusting currentTime from "+n+" to "+p),this.moved=!0,this.stalled=null,i.currentTime=p,t&&!t.gap){var y=new Error("fragment loaded with buffer holes, seeking from "+n+" to "+p);r.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:t})}return p}}return 0},e._tryNudgeBuffer=function(){var t=this.config,e=this.hls,r=this.media,i=this.nudgeRetry;if(null!==r){var n=r.currentTime;if(this.nudgeRetry++,i<t.nudgeMaxRetry){var a=n+(i+1)*t.nudgeOffset,s=new Error("Nudging 'currentTime' from "+n+" to "+a);I.warn(s.message),r.currentTime=a,e.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_NUDGE_ON_STALL,error:s,fatal:!1})}else{var o=new Error("Playhead still not moving while enough data buffered @"+n+" after "+t.nudgeMaxRetry+" nudges");I.error(o.message),e.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}},t}(),cn=function(t){function e(e,r,i){var n;return(n=t.call(this,e,r,i,"[stream-controller]",fe)||this).audioCodecSwap=!1,n.gapController=null,n.level=-1,n._forceStartLoad=!1,n.altAudio=!1,n.audioOnly=!1,n.fragPlaying=null,n.onvplaying=null,n.onvseeked=null,n.fragLastKbps=0,n.couldBacktrack=!1,n.backtrackFragment=null,n.audioCodecSwitch=!1,n.videoBuffer=null,n._registerListeners(),n}l(e,t);var r=e.prototype;return r._registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_PARSED,this.onManifestParsed,this),t.on(E.LEVEL_LOADING,this.onLevelLoading,this),t.on(E.LEVEL_LOADED,this.onLevelLoaded,this),t.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(E.ERROR,this.onError,this),t.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(E.BUFFER_CREATED,this.onBufferCreated,this),t.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(E.FRAG_BUFFERED,this.onFragBuffered,this)},r._unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_PARSED,this.onManifestParsed,this),t.off(E.LEVEL_LOADED,this.onLevelLoaded,this),t.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(E.ERROR,this.onError,this),t.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(E.BUFFER_CREATED,this.onBufferCreated,this),t.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(E.FRAG_BUFFERED,this.onFragBuffered,this)},r.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},r.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){var i=r.startLevel;-1===i&&(r.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=r.nextAutoLevel),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=Gr,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Br},r.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},r.doTick=function(){switch(this.state){case Qr:var t,e=this.levels,r=this.level,i=null==e||null==(t=e[r])?void 0:t.details;if(i&&(!i.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(i))break;this.state=Gr;break}break;case Vr:var n,a=self.performance.now(),s=this.retryDate;(!s||a>=s||null!=(n=this.media)&&n.seeking)&&(this.resetStartWhenNotLoaded(this.level),this.state=Gr)}this.state===Gr&&this.doTickIdle(),this.onTickEnd()},r.onTickEnd=function(){t.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},r.doTickIdle=function(){var t=this.hls,e=this.levelLastLoaded,r=this.levels,i=this.media,n=t.config,a=t.nextLoadLevel;if(null!==e&&(i||!this.startFragRequested&&n.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&null!=r&&r[a]){var s=r[a],o=this.getMainFwdBufferInfo();if(null!==o){var l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){var u={};return this.altAudio&&(u.type="video"),this.hls.trigger(E.BUFFER_EOS,u),void(this.state=qr)}t.loadLevel!==a&&-1===t.manualLevel&&this.log("Adapting to level "+a+" from level "+this.level),this.level=t.nextLoadLevel=a;var h=s.details;if(!h||this.state===Qr||h.live&&this.levelLastLoaded!==a)return this.level=a,void(this.state=Qr);var d=o.len,c=this.getMaxBufferLength(s.maxBitrate);if(!(d>=c)){this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);var f=this.backtrackFragment?this.backtrackFragment.start:o.end,g=this.getNextFragment(f,h);if(this.couldBacktrack&&!this.fragPrevious&&g&&"initSegment"!==g.sn&&this.fragmentTracker.getState(g)!==vr){var v,m=(null!=(v=this.backtrackFragment)?v:g).sn-h.startSN,p=h.fragments[m-1];p&&g.cc===p.cc&&(g=p,this.fragmentTracker.removeFragment(p))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(g&&this.isLoopLoading(g,f)){if(!g.gap){var y=this.audioOnly&&!this.altAudio?O:M,T=(y===M?this.videoBuffer:this.mediaBuffer)||this.media;T&&this.afterBufferFlushed(T,y,fe)}g=this.getNextFragmentLoopLoading(g,h,o,fe,c)}g&&(!g.initSegment||g.initSegment.data||this.bitrateTest||(g=g.initSegment),this.loadFragment(g,s,f))}}}},r.loadFragment=function(e,r,i){var n=this.fragmentTracker.getState(e);this.fragCurrent=e,n===cr||n===gr?"initSegment"===e.sn?this._loadInitSegment(e,r):this.bitrateTest?(this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e,r)):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,i)):this.clearTrackerIfNeeded(e)},r.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,fe)},r.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},r.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},r.nextLevelSwitch=function(){var t=this.levels,e=this.media;if(null!=e&&e.readyState){var r,i=this.getAppendedFrag(e.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);var n=this.getLevelDetails();if(null!=n&&n.live){var a=this.getMainFwdBufferInfo();if(!a||a.len<2*n.targetduration)return}if(!e.paused&&t){var s=t[this.hls.nextLoadLevel],o=this.fragLastKbps;r=o&&this.fragCurrent?this.fragCurrent.duration*s.maxBitrate/(1e3*o)+1:0}else r=0;var l=this.getBufferedFrag(e.currentTime+r);if(l){var u=this.followingBufferedFrag(l);if(u){this.abortCurrentFrag();var h=u.maxStartPTS?u.maxStartPTS:u.start,d=u.duration,c=Math.max(l.end,h+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,.5*d),.75*d));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}},r.abortCurrentFrag=function(){var t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Kr:case Hr:case Vr:case Wr:case jr:this.state=Gr}this.nextLoadPosition=this.getLoadPosition()},r.flushMainBuffer=function(e,r){t.prototype.flushMainBuffer.call(this,e,r,this.altAudio?"video":null)},r.onMediaAttached=function(e,r){t.prototype.onMediaAttached.call(this,e,r);var i=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new dn(this.config,i,this.fragmentTracker,this.hls)},r.onMediaDetaching=function(){var e=this.media;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),t.prototype.onMediaDetaching.call(this)},r.onMediaPlaying=function(){this.tick()},r.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:null;T(e)&&this.log("Media seeked to "+e.toFixed(3));var r=this.getMainFwdBufferInfo();null!==r&&0!==r.len?this.tick():this.warn('Main forward buffer length on "seeked" event '+(r?r.len:"empty")+")")},r.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.levels=this.fragPlaying=this.backtrackFragment=null,this.altAudio=this.audioOnly=!1},r.onManifestParsed=function(t,e){var r,i,n,a=!1,s=!1;e.levels.forEach((function(t){(r=t.audioCodec)&&(-1!==r.indexOf("mp4a.40.2")&&(a=!0),-1!==r.indexOf("mp4a.40.5")&&(s=!0))})),this.audioCodecSwitch=a&&s&&!("function"==typeof(null==(n=Jr())||null==(i=n.prototype)?void 0:i.changeType)),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},r.onLevelLoading=function(t,e){var r=this.levels;if(r&&this.state===Gr){var i=r[e.level];(!i.details||i.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(i.details))&&(this.state=Qr)}},r.onLevelLoaded=function(t,e){var r,i=this.levels,n=e.level,a=e.details,s=a.totalduration;if(i){this.log("Level "+n+" loaded ["+a.startSN+","+a.endSN+"]"+(a.lastPartSn?"[part-"+a.lastPartSn+"-"+a.lastPartIndex+"]":"")+", cc ["+a.startCC+", "+a.endCC+"] duration:"+s);var o=i[n],l=this.fragCurrent;!l||this.state!==Hr&&this.state!==Vr||l.level===e.level&&l.urlId===o.urlId||!l.loader||this.abortCurrentFrag();var u=0;if(a.live||null!=(r=o.details)&&r.live){if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed)return;u=this.alignPlaylists(a,o.details)}if(o.details=a,this.levelLastLoaded=n,this.hls.trigger(E.LEVEL_UPDATED,{details:a,level:n}),this.state===Qr){if(this.waitForCdnTuneIn(a))return;this.state=Gr}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,u),this.tick()}else this.warn("Levels were reset while loading level "+n)},r._handleFragmentLoadProgress=function(t){var e,r=t.frag,i=t.part,n=t.payload,a=this.levels;if(a){var s=a[r.level],o=s.details;if(!o)return this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset"),void this.fragmentTracker.removeFragment(r);var l=s.videoCodec,u=o.PTSKnown||!o.live,h=null==(e=r.initSegment)?void 0:e.data,d=this._getAudioCodec(s),c=this.transmuxer=this.transmuxer||new hn(this.hls,fe,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=-1!==f,v=new Ir(r.level,r.sn,r.stats.chunkCount,n.byteLength,f,g),m=this.initPTS[r.cc];c.push(n,h,d,l,r,i,o.totalduration,u,v,m)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},r.onAudioTrackSwitching=function(t,e){var r=this.altAudio;if(!e.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i&&(this.log("Switching to main audio track, cancel main fragment load"),i.abortRequests(),this.fragmentTracker.removeFragment(i)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var n=this.hls;r&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,e)}},r.onAudioTrackSwitched=function(t,e){var r=e.id,i=!!this.hls.audioTracks[r].url;if(i){var n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i,this.tick()},r.onBufferCreated=function(t,e){var r,i,n=e.tracks,a=!1;for(var s in n){var o=n[s];if("main"===o.id){if(i=s,r=o,"video"===s){var l=n[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&r?(this.log("Alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},r.onFragBuffered=function(t,e){var r=e.frag,i=e.part;if(!r||r.type===fe){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(i?" p: "+i.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===jr&&(this.state=Gr));var n=i?i.stats:r.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,i)}},r.onError=function(t,e){var r;if(e.fatal)this.state=Xr;else switch(e.details){case L.FRAG_GAP:case L.FRAG_PARSING_ERROR:case L.FRAG_DECRYPT_ERROR:case L.FRAG_LOAD_ERROR:case L.FRAG_LOAD_TIMEOUT:case L.KEY_LOAD_ERROR:case L.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(fe,e);break;case L.LEVEL_LOAD_ERROR:case L.LEVEL_LOAD_TIMEOUT:case L.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Qr||(null==(r=e.context)?void 0:r.type)!==he||(this.state=Gr);break;case L.BUFFER_FULL_ERROR:if(!e.parent||"main"!==e.parent)return;this.reduceLengthAndFlushBuffer(e)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case L.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}},r.checkBuffer=function(){var t=this.media,e=this.gapController;if(t&&e&&t.readyState){if(this.loadedmetadata||!Dr.getBuffered(t).length){var r=this.state!==Gr?this.fragCurrent:null;e.poll(this.lastCurrentTime,r)}this.lastCurrentTime=t.currentTime}},r.onFragLoadEmergencyAborted=function(){this.state=Gr,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},r.onBufferFlushed=function(t,e){var r=e.type;if(r!==O||this.audioOnly&&!this.altAudio){var i=(r===M?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,r,fe)}},r.onLevelsUpdated=function(t,e){this.levels=e.levels},r.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},r.seekToStartPos=function(){var t=this.media;if(t){var e=t.currentTime,r=this.startPosition;if(r>=0&&e<r){if(t.seeking)return void this.log("could not seek to "+r+", already seeking at "+e);var i=Dr.getBuffered(t),n=(i.length?i.start(0):0)-r;n>0&&(n<this.config.maxBufferHole||n<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+n+" to match buffer start"),r+=n,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+e),t.currentTime=r}}},r._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},r._loadBitrateTestFrag=function(t,e){var r=this;t.bitrateTest=!0,this._doFragLoad(t,e).then((function(i){var n=r.hls;if(i&&!r.fragContextChanged(t)){e.fragmentError=0,r.state=Gr,r.startFragRequested=!1,r.bitrateTest=!1;var a=t.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger(E.FRAG_LOADED,i),t.bitrateTest=!1}}))},r._handleTransmuxComplete=function(t){var e,r="main",i=this.hls,n=t.remuxResult,a=t.chunkMeta,s=this.getCurrentContext(a);if(s){var o=s.frag,l=s.part,u=s.level,h=n.video,d=n.text,c=n.id3,f=n.initSegment,g=u.details,v=this.altAudio?void 0:n.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Wr,f){if(null!=f&&f.tracks){var m=o.initSegment||o;this._bufferInitSegment(u,f.tracks,m,a),i.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:m,id:r,tracks:f.tracks})}var p=f.initPTS,y=f.timescale;T(p)&&(this.initPTS[o.cc]={baseTime:p,timescale:y},i.trigger(E.INIT_PTS_FOUND,{frag:o,id:r,initPTS:p,timescale:y}))}if(h&&!1!==n.independent){if(g){var S=h.startPTS,L=h.endPTS,R=h.startDTS,A=h.endDTS;if(l)l.elementaryStreams[h.type]={startPTS:S,endPTS:L,startDTS:R,endDTS:A};else if(h.firstKeyFrame&&h.independent&&1===a.id&&(this.couldBacktrack=!0),h.dropped&&h.independent){var k=this.getMainFwdBufferInfo();if((k?k.end:this.getLoadPosition())+this.config.maxBufferHole<(h.firstKeyFramePTS?h.firstKeyFramePTS:S)-this.config.maxBufferHole)return void this.backtrack(o);o.setElementaryStreamInfo(h.type,o.start,L,o.start,A,!0)}o.setElementaryStreamInfo(h.type,S,L,R,A),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(h,o,l,a)}}else if(!1===n.independent)return void this.backtrack(o);if(v){var b=v.startPTS,D=v.endPTS,I=v.startDTS,w=v.endDTS;l&&(l.elementaryStreams[O]={startPTS:b,endPTS:D,startDTS:I,endDTS:w}),o.setElementaryStreamInfo(O,b,D,I,w),this.bufferFragmentData(v,o,l,a)}if(g&&null!=c&&null!=(e=c.samples)&&e.length){var C={id:r,frag:o,details:g,samples:c.samples};i.trigger(E.FRAG_PARSING_METADATA,C)}if(g&&d){var _={id:r,frag:o,details:g,samples:d.samples};i.trigger(E.FRAG_PARSING_USERDATA,_)}}}else this.resetWhenMissingContext(a)},r._bufferInitSegment=function(t,e,r,i){var n=this;if(this.state===Wr){this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var a=e.audio,s=e.video,o=e.audiovideo;if(a){var l=t.audioCodec,u=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(l&&(l=-1!==l.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==a.metadata.channelCount&&-1===u.indexOf("firefox")&&(l="mp4a.40.5")),-1!==u.indexOf("android")&&"audio/mpeg"!==a.container&&(l="mp4a.40.2",this.log("Android: force audio codec to "+l)),t.audioCodec&&t.audioCodec!==l&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+l+'"'),a.levelCodec=l,a.id="main",this.log("Init audio buffer, container:"+a.container+", codecs[selected/level/parsed]=["+(l||"")+"/"+(t.audioCodec||"")+"/"+a.codec+"]")}s&&(s.levelCodec=t.videoCodec,s.id="main",this.log("Init video buffer, container:"+s.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+s.codec+"]")),o&&this.log("Init audiovideo buffer, container:"+o.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+o.codec+"]"),this.hls.trigger(E.BUFFER_CODECS,e),Object.keys(e).forEach((function(t){var a=e[t].initSegment;null!=a&&a.byteLength&&n.hls.trigger(E.BUFFER_APPENDING,{type:t,data:a,frag:r,part:null,chunkMeta:i,parent:r.type})})),this.tick()}},r.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,fe)},r.backtrack=function(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=Gr},r.checkFragmentChanged=function(){var t=this.media,e=null;if(t&&t.readyState>1&&!1===t.seeking){var r=t.currentTime;if(Dr.isBuffered(t,r)?e=this.getAppendedFrag(r):Dr.isBuffered(t,r+.1)&&(e=this.getAppendedFrag(r+.1)),e){this.backtrackFragment=null;var i=this.fragPlaying,n=e.level;i&&e.sn===i.sn&&i.level===n&&e.urlId===i.urlId||(this.fragPlaying=e,this.hls.trigger(E.FRAG_CHANGED,{frag:e}),i&&i.level===n||this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}},a(e,[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentFrag",get:function(){var t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}},{key:"currentProgramDateTime",get:function(){var t=this.media;if(t){var e=t.currentTime,r=this.currentFrag;if(r&&T(e)&&T(r.programDateTime)){var i=r.programDateTime+1e3*(e-r.start);return new Date(i)}}return null}},{key:"currentLevel",get:function(){var t=this.currentFrag;return t?t.level:-1}},{key:"nextBufferedFrag",get:function(){var t=this.currentFrag;return t?this.followingBufferedFrag(t):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),e}($r),fn=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=r}var e=t.prototype;return e.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},e.getTotalWeight=function(){return this.totalWeight_},e.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_},t}(),gn=function(){function t(t,e,r,i){void 0===i&&(i=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new fn(t),this.fast_=new fn(e),this.defaultTTFB_=i,this.ttfb_=new fn(t)}var e=t.prototype;return e.update=function(t,e){var r=this.slow_,i=this.fast_,n=this.ttfb_;r.halfLife!==t&&(this.slow_=new fn(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.fast_=new fn(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.ttfb_=new fn(t,n.getEstimate(),n.getTotalWeight()))},e.sample=function(t,e){var r=(t=Math.max(t,this.minDelayMs_))/1e3,i=8*e/r;this.fast_.sample(r,i),this.slow_.sample(r,i)},e.sampleTTFB=function(t){var e=t/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(r,Math.max(t,5))},e.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},e.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},e.destroy=function(){},t}(),vn=function(){function t(t){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=-1,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=t;var e=t.config;this.bwEstimator=new gn(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(E.FRAG_LOADING,this.onFragLoading,this),t.on(E.FRAG_LOADED,this.onFragLoaded,this),t.on(E.FRAG_BUFFERED,this.onFragBuffered,this),t.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(E.LEVEL_LOADED,this.onLevelLoaded,this)},e.unregisterListeners=function(){var t=this.hls;t.off(E.FRAG_LOADING,this.onFragLoading,this),t.off(E.FRAG_LOADED,this.onFragLoaded,this),t.off(E.FRAG_BUFFERED,this.onFragBuffered,this),t.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(E.LEVEL_LOADED,this.onLevelLoaded,this)},e.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},e.onFragLoading=function(t,e){var r,i=e.frag;this.ignoreFragment(i)||(this.fragCurrent=i,this.partCurrent=null!=(r=e.part)?r:null,this.clearTimer(),this.timer=self.setInterval(this.onCheck,100))},e.onLevelSwitching=function(t,e){this.clearTimer()},e.getTimeToLoadFrag=function(t,e,r,i){return t+r/e+(i?this.lastLevelLoadSec:0)},e.onLevelLoaded=function(t,e){var r=this.hls.config,i=e.stats,n=i.total,a=i.bwEstimate;T(n)&&T(a)&&(this.lastLevelLoadSec=8*n/a),e.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},e._abandonRulesCheck=function(){var t=this.fragCurrent,e=this.partCurrent,r=this.hls,i=r.autoLevelEnabled,n=r.media;if(t&&n){var a=performance.now(),s=e?e.stats:t.stats,o=e?e.duration:t.duration,l=a-s.loading.start;if(s.aborted||s.loaded&&s.loaded===s.total||0===t.level)return this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!n.paused&&n.playbackRate&&n.readyState){var u=r.mainForwardBufferInfo;if(null!==u){var h=this.bwEstimator.getEstimateTTFB(),d=Math.abs(n.playbackRate);if(!(l<=Math.max(h,o/(2*d)*1e3))){var c=u.len/d;if(!(c>=2*o/d)){var f=s.loading.first?s.loading.first-s.loading.start:-1,g=s.loaded&&f>-1,v=this.bwEstimator.getEstimate(),m=r.levels,p=r.minAutoLevel,y=m[t.level],S=s.total||Math.max(s.loaded,Math.round(o*y.maxBitrate/8)),L=l-f;L<1&&g&&(L=Math.min(l,8*s.loaded/v));var R=g?1e3*s.loaded/L:0,A=R?(S-s.loaded)/R:8*S/v+h/1e3;if(!(A<=c)){var k,b=R?8*R:v,D=Number.POSITIVE_INFINITY;for(k=t.level-1;k>p;k--){var w=m[k].maxBitrate;if((D=this.getTimeToLoadFrag(h/1e3,b,o*w,!m[k].details))<c)break}D>=A||D>10*o||(r.nextLoadLevel=k,g?this.bwEstimator.sample(l-Math.min(h,f),s.loaded):this.bwEstimator.sampleTTFB(l),this.clearTimer(),I.warn("[abr] Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.level+" is loading too slowly;\n Time to underbuffer: "+c.toFixed(3)+" s\n Estimated load time for current fragment: "+A.toFixed(3)+" s\n Estimated load time for down switch fragment: "+D.toFixed(3)+" s\n TTFB estimate: "+f+"\n Current BW estimate: "+(T(v)?(v/1024).toFixed(3):"Unknown")+" Kb/s\n New BW estimate: "+(this.bwEstimator.getEstimate()/1024).toFixed(3)+" Kb/s\n Aborting and switching to level "+k),t.loader&&(this.fragCurrent=this.partCurrent=null,t.abortRequests()),r.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:s}))}}}}}}},e.onFragLoaded=function(t,e){var r=e.frag,i=e.part,n=i?i.stats:r.stats;if(r.type===fe&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),this.lastLoadedFragLevel=r.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var a=i?i.duration:r.duration,s=this.hls.levels[r.level],o=(s.loaded?s.loaded.bytes:0)+n.loaded,l=(s.loaded?s.loaded.duration:0)+a;s.loaded={bytes:o,duration:l},s.realBitrate=Math.round(8*o/l)}if(r.bitrateTest){var u={stats:n,frag:r,part:i,id:r.type};this.onFragBuffered(E.FRAG_BUFFERED,u),r.bitrateTest=!1}}},e.onFragBuffered=function(t,e){var r=e.frag,i=e.part,n=null!=i&&i.stats.loaded?i.stats:r.stats;if(!n.aborted&&!this.ignoreFragment(r)){var a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},e.ignoreFragment=function(t){return t.type!==fe||"initSegment"===t.sn},e.clearTimer=function(){self.clearInterval(this.timer)},e.getNextABRAutoLevel=function(){var t=this.fragCurrent,e=this.partCurrent,r=this.hls,i=r.maxAutoLevel,n=r.config,a=r.minAutoLevel,s=r.media,o=e?e.duration:t?t.duration:0,l=s&&0!==s.playbackRate?Math.abs(s.playbackRate):1,u=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,h=r.mainForwardBufferInfo,d=(h?h.len:0)/l,c=this.findBestLevel(u,a,i,d,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(c>=0)return c;I.trace("[abr] "+(d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var f=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay,g=n.abrBandWidthFactor,v=n.abrBandWidthUpFactor;if(!d){var m=this.bitrateTestDelay;m&&(f=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-m,I.trace("[abr] bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*f)+" ms"),g=v=1)}return c=this.findBestLevel(u,a,i,d+f,g,v),Math.max(c,0)},e.findBestLevel=function(t,e,r,i,n,a){for(var s,o=this.fragCurrent,l=this.partCurrent,u=this.lastLoadedFragLevel,h=this.hls.levels,d=h[u],c=!(null==d||null==(s=d.details)||!s.live),f=null==d?void 0:d.codecSet,g=l?l.duration:o?o.duration:0,v=this.bwEstimator.getEstimateTTFB()/1e3,m=e,p=-1,y=r;y>=e;y--){var E=h[y];if(!E||f&&E.codecSet!==f)E&&(m=Math.min(y,m),p=Math.max(y,p));else{-1!==p&&I.trace("[abr] Skipped level(s) "+m+"-"+p+' with CODECS:"'+h[p].attrs.CODECS+'"; not compatible with "'+d.attrs.CODECS+'"');var S=E.details,L=(l?null==S?void 0:S.partTarget:null==S?void 0:S.averagetargetduration)||g,R=void 0;R=y<=u?n*t:a*t;var A=h[y].maxBitrate,k=this.getTimeToLoadFrag(v,R,A*L,void 0===S);if(I.trace("[abr] level:"+y+" adjustedbw-bitrate:"+Math.round(R-A)+" avgDuration:"+L.toFixed(1)+" maxFetchDuration:"+i.toFixed(1)+" fetchDuration:"+k.toFixed(1)),R>A&&(0===k||!T(k)||c&&!this.bitrateTestDelay||k<i))return y}}return-1},a(t,[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this.bwEstimator;if(-1!==t&&!e.canEstimate())return t;var r=this.getNextABRAutoLevel();if(-1!==t){var i=this.hls.levels;if(i.length>Math.max(t,r)&&i[t].loadError<=i[r].loadError)return t}return-1!==t&&(r=Math.min(t,r)),r},set:function(t){this._nextAutoLevel=t}}]),t}(),mn=function(){function t(){this.chunks=[],this.dataLength=0}var e=t.prototype;return e.push=function(t){this.chunks.push(t),this.dataLength+=t.length},e.flush=function(){var t,e=this.chunks,r=this.dataLength;return e.length?(t=1===e.length?e[0]:function(t,e){for(var r=new Uint8Array(e),i=0,n=0;n<t.length;n++){var a=t[n];r.set(a,i),i+=a.length}return r}(e,r),this.reset(),t):new Uint8Array(0)},e.reset=function(){this.chunks.length=0,this.dataLength=0},t}(),pn=function(t){function e(e,r,i){var n;return(n=t.call(this,e,r,i,"[audio-stream-controller]",ge)||this).videoBuffer=null,n.videoTrackCC=-1,n.waitingVideoCC=-1,n.bufferedTrack=null,n.switchingTrack=null,n.trackId=-1,n.waitingData=null,n.mainDetails=null,n.bufferFlushed=!1,n.cachedTrackLoadedData=null,n._registerListeners(),n}l(e,t);var r=e.prototype;return r.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},r._registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.LEVEL_LOADED,this.onLevelLoaded,this),t.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(E.ERROR,this.onError,this),t.on(E.BUFFER_RESET,this.onBufferReset,this),t.on(E.BUFFER_CREATED,this.onBufferCreated,this),t.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(E.FRAG_BUFFERED,this.onFragBuffered,this)},r._unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.LEVEL_LOADED,this.onLevelLoaded,this),t.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(E.ERROR,this.onError,this),t.off(E.BUFFER_RESET,this.onBufferReset,this),t.off(E.BUFFER_CREATED,this.onBufferCreated,this),t.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(E.FRAG_BUFFERED,this.onFragBuffered,this)},r.onInitPtsFound=function(t,e){var r=e.frag,i=e.id,n=e.initPTS,a=e.timescale;if("main"===i){var s=r.cc;this.initPTS[r.cc]={baseTime:n,timescale:a},this.log("InitPTS for cc: "+s+" found from main: "+n),this.videoTrackCC=s,this.state===zr&&this.tick()}},r.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Br);var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),e>0&&-1===t?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e,this.state=Gr):(this.loadedmetadata=!1,this.state=Yr),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},r.doTick=function(){switch(this.state){case Gr:this.doTickIdle();break;case Yr:var e,r=this.levels,i=this.trackId,n=null==r||null==(e=r[i])?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=zr}break;case Vr:var a,s=performance.now(),o=this.retryDate;(!o||s>=o||null!=(a=this.media)&&a.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=Gr);break;case zr:var l=this.waitingData;if(l){var u=l.frag,h=l.part,d=l.cache,c=l.complete;if(void 0!==this.initPTS[u.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Hr;var f={frag:u,part:h,payload:d.flush(),networkDetails:null};this._handleFragmentLoadProgress(f),c&&t.prototype._handleFragmentLoadComplete.call(this,f)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+u.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var g=this.getLoadPosition(),v=Dr.bufferInfo(this.mediaBuffer,g,this.config.maxBufferHole);$e(v.end,this.config.maxFragLookUpTolerance,u)<0&&(this.log("Waiting fragment cc ("+u.cc+") @ "+u.start+" cancelled because another fragment at "+v.end+" is needed"),this.clearWaitingFragment())}}else this.state=Gr}this.onTickEnd()},r.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Gr)},r.resetLoadingState=function(){this.clearWaitingFragment(),t.prototype.resetLoadingState.call(this)},r.onTickEnd=function(){var t=this.media;null!=t&&t.readyState&&(this.lastCurrentTime=t.currentTime)},r.doTickIdle=function(){var t=this.hls,e=this.levels,r=this.media,i=this.trackId,n=t.config;if(null!=e&&e[i]&&(r||!this.startFragRequested&&n.startFragPrefetch)){var a=e[i],s=a.details;if(!s||s.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(s))this.state=Yr;else{var o=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&o&&(this.bufferFlushed=!1,this.afterBufferFlushed(o,O,ge));var l=this.getFwdBufferInfo(o,ge);if(null!==l){var u=this.bufferedTrack,h=this.switchingTrack;if(!h&&this._streamEnded(l,s))return t.trigger(E.BUFFER_EOS,{type:"audio"}),void(this.state=qr);var d=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,fe),c=l.len,f=this.getMaxBufferLength(null==d?void 0:d.len);if(!(c>=f)||h){var g=s.fragments[0].start,v=l.end;if(h&&r){var m=this.getLoadPosition();u&&h.attrs!==u.attrs&&(v=m),s.PTSKnown&&m<g&&(l.end>g||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=g+.05)}var p=this.getNextFragment(v,s),y=!1;if(p&&this.isLoopLoading(p,v)&&(y=!!p.gap,p=this.getNextFragmentLoopLoading(p,s,l,fe,f)),p){var T=d&&p.start>d.end+s.targetduration;if(T||(null==d||!d.len)&&l.len){var S=this.getAppendedFrag(p.start,fe);if(null===S)return;if(y||(y=!!S.gap||!!T&&0===d.len),T&&!y||y&&l.nextStart&&l.nextStart<S.end)return}this.loadFragment(p,a,v)}else this.bufferFlushed=!0}}}}},r.getMaxBufferLength=function(e){var r=t.prototype.getMaxBufferLength.call(this);return e?Math.min(Math.max(r,e),this.config.maxMaxBufferLength):r},r.onMediaDetaching=function(){this.videoBuffer=null,t.prototype.onMediaDetaching.call(this)},r.onAudioTracksUpdated=function(t,e){var r=e.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(t){return new Me(t)}))},r.onAudioTrackSwitching=function(t,e){var r=!!e.url;this.trackId=e.id;var i=this.fragCurrent;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=e,this.state=Gr):(this.switchingTrack=null,this.bufferedTrack=e,this.state=Br),this.tick()},r.onManifestLoading=function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1},r.onLevelLoaded=function(t,e){this.mainDetails=e.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},r.onAudioTrackLoaded=function(t,e){var r;if(null!=this.mainDetails){var i=this.levels,n=e.details,a=e.id;if(i){this.log("Track "+a+" loaded ["+n.startSN+","+n.endSN+"]"+(n.lastPartSn?"[part-"+n.lastPartSn+"-"+n.lastPartIndex+"]":"")+",duration:"+n.totalduration);var s=i[a],o=0;if(n.live||null!=(r=s.details)&&r.live){var l=this.mainDetails;if(n.fragments[0]||(n.deltaUpdateFailed=!0),n.deltaUpdateFailed||!l)return;!s.details&&n.hasProgramDateTime&&l.hasProgramDateTime?(xr(n,l),o=n.fragments[0].start):o=this.alignPlaylists(n,s.details)}s.details=n,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&n.live||this.setStartPosition(s.details,o),this.state!==Yr||this.waitForCdnTuneIn(n)||(this.state=Gr),this.tick()}else this.warn("Audio tracks were reset while loading level "+a)}else this.cachedTrackLoadedData=e},r._handleFragmentLoadProgress=function(t){var e,r=t.frag,i=t.part,n=t.payload,a=this.config,s=this.trackId,o=this.levels;if(o){var l=o[s];if(l){var u=l.details;if(!u)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);var h=a.defaultAudioCodec||l.audioCodec||"mp4a.40.2",d=this.transmuxer;d||(d=this.transmuxer=new hn(this.hls,ge,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var c=this.initPTS[r.cc],f=null==(e=r.initSegment)?void 0:e.data;if(void 0!==c){var g=i?i.index:-1,v=-1!==g,m=new Ir(r.level,r.sn,r.stats.chunkCount,n.byteLength,g,v);d.push(n,f,h,"",r,i,u.totalduration,!1,m,c)}else this.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+u.startSN+" ,"+u.endSN+"],track "+s),(this.waitingData=this.waitingData||{frag:r,part:i,cache:new mn,complete:!1}).cache.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=zr}else this.warn("Audio track is undefined on fragment load progress")}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},r._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:t.prototype._handleFragmentLoadComplete.call(this,e)},r.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},r.onBufferCreated=function(t,e){var r=e.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer||null)},r.onFragBuffered=function(t,e){var r,n=e.frag,a=e.part;if(n.type===ge)if(this.fragContextChanged(n))this.warn("Fragment "+n.sn+(a?" p: "+a.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if("initSegment"!==n.sn){this.fragPrevious=n;var s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,i({},s)))}this.fragBufferedComplete(n,a)}else this.loadedmetadata||n.type!==fe||null!=(r=this.videoBuffer||this.media)&&r.buffered.length&&(this.loadedmetadata=!0)},r.onError=function(e,r){var i;if(r.fatal)this.state=Xr;else switch(r.details){case L.FRAG_GAP:case L.FRAG_PARSING_ERROR:case L.FRAG_DECRYPT_ERROR:case L.FRAG_LOAD_ERROR:case L.FRAG_LOAD_TIMEOUT:case L.KEY_LOAD_ERROR:case L.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge,r);break;case L.AUDIO_TRACK_LOAD_ERROR:case L.AUDIO_TRACK_LOAD_TIMEOUT:case L.LEVEL_PARSING_ERROR:r.levelRetry||this.state!==Yr||(null==(i=r.context)?void 0:i.type)!==de||(this.state=Gr);break;case L.BUFFER_FULL_ERROR:if(!r.parent||"audio"!==r.parent)return;this.reduceLengthAndFlushBuffer(r)&&(this.bufferedTrack=null,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case L.INTERNAL_EXCEPTION:this.recoverWorkerError(r)}},r.onBufferFlushed=function(t,e){e.type===O&&(this.bufferFlushed=!0,this.state===qr&&(this.state=Gr))},r._handleTransmuxComplete=function(t){var e,r="audio",i=this.hls,n=t.remuxResult,a=t.chunkMeta,s=this.getCurrentContext(a);if(s){var l=s.frag,u=s.part,h=s.level.details,d=n.audio,c=n.text,f=n.id3,g=n.initSegment;if(!this.fragContextChanged(l)&&h){if(this.state=Wr,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){var v=l.initSegment||l;this._bufferInitSegment(g.tracks,v,a),i.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:g.tracks})}if(d){var m=d.startPTS,p=d.endPTS,y=d.startDTS,T=d.endDTS;u&&(u.elementaryStreams[O]={startPTS:m,endPTS:p,startDTS:y,endDTS:T}),l.setElementaryStreamInfo(O,m,p,y,T),this.bufferFragmentData(d,l,u,a)}if(null!=f&&null!=(e=f.samples)&&e.length){var S=o({id:r,frag:l,details:h},f);i.trigger(E.FRAG_PARSING_METADATA,S)}if(c){var L=o({id:r,frag:l,details:h},c);i.trigger(E.FRAG_PARSING_USERDATA,L)}}else this.fragmentTracker.removeFragment(l)}else this.resetWhenMissingContext(a)},r._bufferInitSegment=function(t,e,r){if(this.state===Wr){t.video&&delete t.video;var i=t.audio;if(i){i.levelCodec=i.codec,i.id="audio",this.log("Init audio buffer, container:"+i.container+", codecs[parsed]=["+i.codec+"]"),this.hls.trigger(E.BUFFER_CODECS,t);var n=i.initSegment;if(null!=n&&n.byteLength){var a={type:"audio",frag:e,part:null,chunkMeta:r,parent:e.type,data:n};this.hls.trigger(E.BUFFER_APPENDING,a)}this.tick()}}},r.loadFragment=function(e,r,i){var n,a=this.fragmentTracker.getState(e);this.fragCurrent=e,this.switchingTrack||a===cr||a===gr?"initSegment"===e.sn?this._loadInitSegment(e,r):null!=(n=r.details)&&n.live&&!this.initPTS[e.cc]?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=zr):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,i)):this.clearTrackerIfNeeded(e)},r.completeAudioSwitch=function(e){var r=this.hls,n=this.media,a=this.bufferedTrack,s=null==a?void 0:a.attrs,o=e.attrs;n&&s&&(s.CHANNELS!==o.CHANNELS||s.NAME!==o.NAME||s.LANGUAGE!==o.LANGUAGE)&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.bufferedTrack=e,this.switchingTrack=null,r.trigger(E.AUDIO_TRACK_SWITCHED,i({},e))},e}($r),yn=function(t){function e(e){var r;return(r=t.call(this,e,"[audio-track-controller]")||this).tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.currentTrack=null,r.selectDefaultTrack=!0,r.registerListeners(),r}l(e,t);var r=e.prototype;return r.registerListeners=function(){var t=this.hls;t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_PARSED,this.onManifestParsed,this),t.on(E.LEVEL_LOADING,this.onLevelLoading,this),t.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(E.ERROR,this.onError,this)},r.unregisterListeners=function(){var t=this.hls;t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_PARSED,this.onManifestParsed,this),t.off(E.LEVEL_LOADING,this.onLevelLoading,this),t.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(E.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,t.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},r.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]},r.onAudioTrackLoaded=function(t,e){var r=e.id,i=e.groupId,n=e.details,a=this.tracksInGroup[r];if(a&&a.groupId===i){var s=a.details;a.details=e.details,this.log("audio-track "+r+' "'+a.name+'" lang:'+a.lang+" group:"+i+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,e,s)}else this.warn("Track with id:"+r+" and group:"+i+" not found in active group "+a.groupId)},r.onLevelLoading=function(t,e){this.switchLevel(e.level)},r.onLevelSwitching=function(t,e){this.switchLevel(e.level)},r.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.audioGroupIds){var r=e.audioGroupIds[e.urlId];if(this.groupId!==r){this.groupId=r||null;var i=this.tracks.filter((function(t){return!r||t.groupId===r}));this.selectDefaultTrack&&!i.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var n={audioTracks:i};this.log("Updating audio tracks, "+i.length+" track(s) found in group:"+r),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,n),this.selectInitialTrack()}else this.shouldReloadPlaylist(this.currentTrack)&&this.setAudioTrack(this.trackId)}},r.onError=function(t,e){!e.fatal&&e.context&&e.context.type===de&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&(this.requestScheduled=-1,this.checkRetry(e))},r.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=this.currentTrack;e[this.trackId];var n=e[t],a=n.groupId,s=n.name;if(this.log("Switching to audio-track "+t+' "'+s+'" lang:'+n.lang+" group:"+a),this.trackId=t,this.currentTrack=n,this.selectDefaultTrack=!1,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,i({},n)),!n.details||n.details.live){var o=this.switchParams(n.url,null==r?void 0:r.details);this.loadPlaylist(o)}}},r.selectInitialTrack=function(){var t=this.tracksInGroup,e=this.findTrackId(this.currentTrack)|this.findTrackId(null);if(-1!==e)this.setAudioTrack(e);else{var r=new Error("No track found for running audio group-ID: "+this.groupId+" track count: "+t.length);this.warn(r.message),this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:r})}},r.findTrackId=function(t){for(var e=this.tracksInGroup,r=0;r<e.length;r++){var i=e[r];if(!this.selectDefaultTrack||i.default){if(!t||void 0!==t.attrs["STABLE-RENDITION-ID"]&&t.attrs["STABLE-RENDITION-ID"]===i.attrs["STABLE-RENDITION-ID"])return i.id;if(t.name===i.name&&t.lang===i.lang)return i.id}}return-1},r.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(r)){var i=r.id,n=r.groupId,a=r.url;if(e)try{a=e.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist "+i+' "'+r.name+'" lang:'+r.lang+" group:"+n),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:a,id:i,groupId:n,deliveryDirectives:e||null})}},a(e,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}]),e}(lr);function Tn(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!En(t[r].attrs,e[r].attrs))return!1;return!0}function En(t,e){var r=t["STABLE-RENDITION-ID"];return r?r===e["STABLE-RENDITION-ID"]:!["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED"].some((function(r){return t[r]!==e[r]}))}var Sn=function(t){function e(e,r,i){var n;return(n=t.call(this,e,r,i,"[subtitle-stream-controller]",ve)||this).levels=[],n.currentTrackId=-1,n.tracksBuffered=[],n.mainDetails=null,n._registerListeners(),n}l(e,t);var r=e.prototype;return r.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},r._registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.LEVEL_LOADED,this.onLevelLoaded,this),t.on(E.ERROR,this.onError,this),t.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(E.FRAG_BUFFERED,this.onFragBuffered,this)},r._unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.LEVEL_LOADED,this.onLevelLoaded,this),t.off(E.ERROR,this.onError,this),t.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(E.FRAG_BUFFERED,this.onFragBuffered,this)},r.startLoad=function(t){this.stopLoad(),this.state=Gr,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},r.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},r.onMediaDetaching=function(){this.tracksBuffered=[],t.prototype.onMediaDetaching.call(this)},r.onLevelLoaded=function(t,e){this.mainDetails=e.details},r.onSubtitleFragProcessed=function(t,e){var r=e.frag,i=e.success;if(this.fragPrevious=r,this.state=Gr,i){var n=this.tracksBuffered[this.currentTrackId];if(n){for(var a,s=r.start,o=0;o<n.length;o++)if(s>=n[o].start&&s<=n[o].end){a=n[o];break}var l=r.start+r.duration;a?a.end=l:(a={start:s,end:l},n.push(a)),this.fragmentTracker.fragBuffered(r)}}},r.onBufferFlushing=function(t,e){var r=e.startOffset,i=e.endOffset;if(0===r&&i!==Number.POSITIVE_INFINITY){var n=this.currentTrackId,a=this.levels;if(!a.length||!a[n]||!a[n].details)return;var s=i-a[n].details.targetduration;if(s<=0)return;e.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach((function(t){for(var e=0;e<t.length;)if(t[e].end<=s)t.shift();else{if(!(t[e].start<s))break;t[e].start=s,e++}})),this.fragmentTracker.removeFragmentsInRange(r,s,ve)}},r.onFragBuffered=function(t,e){var r;this.loadedmetadata||e.frag.type!==fe||null!=(r=this.media)&&r.buffered.length&&(this.loadedmetadata=!0)},r.onError=function(t,e){var r=e.frag;(null==r?void 0:r.type)===ve&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Br&&(this.state=Gr))},r.onSubtitleTracksUpdated=function(t,e){var r=this,i=e.subtitleTracks;Tn(this.levels,i)?this.levels=i.map((function(t){return new Me(t)})):(this.tracksBuffered=[],this.levels=i.map((function(t){var e=new Me(t);return r.tracksBuffered[e.id]=[],e})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ve),this.fragPrevious=null,this.mediaBuffer=null)},r.onSubtitleTrackSwitch=function(t,e){if(this.currentTrackId=e.id,this.levels.length&&-1!==this.currentTrackId){var r=this.levels[this.currentTrackId];null!=r&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(500)}else this.clearInterval()},r.onSubtitleTrackLoaded=function(t,e){var r,i=e.details,n=e.id,a=this.currentTrackId,s=this.levels;if(s.length){var o=s[a];if(!(n>=s.length||n!==a)&&o){this.mediaBuffer=this.mediaBufferTimeRanges;var l=0;if(i.live||null!=(r=o.details)&&r.live){var u=this.mainDetails;if(i.deltaUpdateFailed||!u)return;var h=u.fragments[0];o.details?0===(l=this.alignPlaylists(i,o.details))&&h&&Ke(i,l=h.start):i.hasProgramDateTime&&u.hasProgramDateTime?(xr(i,u),l=i.fragments[0].start):h&&Ke(i,l=h.start)}o.details=i,this.levelLastLoaded=n,this.startFragRequested||!this.mainDetails&&i.live||this.setStartPosition(o.details,l),this.tick(),i.live&&!this.fragCurrent&&this.media&&this.state===Gr&&(Qe(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0))}}},r._handleFragmentLoadComplete=function(t){var e=this,r=t.frag,i=t.payload,n=r.decryptdata,a=this.hls;if(!this.fragContextChanged(r)&&i&&i.byteLength>0&&n&&n.key&&n.iv&&"AES-128"===n.method){var s=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).catch((function(t){throw a.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:r}),t})).then((function(t){var e=performance.now();a.trigger(E.FRAG_DECRYPTED,{frag:r,payload:t,stats:{tstart:s,tdecrypt:e}})})).catch((function(t){e.warn(t.name+": "+t.message),e.state=Gr}))}},r.doTick=function(){if(this.media){if(this.state===Gr){var t=this.currentTrackId,e=this.levels,r=e[t];if(!e.length||!r||!r.details)return;var i=r.details,n=i.targetduration,a=this.config,s=this.getLoadPosition(),o=Dr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s-n,a.maxBufferHole),l=o.end,u=o.len,h=this.getFwdBufferInfo(this.media,fe);if(u>this.getMaxBufferLength(null==h?void 0:h.len)+n)return;var d=i.fragments,c=d.length,f=i.edge,g=null,v=this.fragPrevious;if(l<f){var m=a.maxFragLookUpTolerance;!(g=Qe(v,d,Math.max(d[0].start,l),m))&&v&&v.start<d[0].start&&(g=d[0])}else g=d[c-1];if(!g)return;g=this.mapToInitFragWhenRequired(g),this.fragmentTracker.getState(g)===cr&&this.loadFragment(g,r,l)}}else this.state=Gr},r.getMaxBufferLength=function(e){var r=t.prototype.getMaxBufferLength.call(this);return e?Math.max(r,e):r},r.loadFragment=function(e,r,i){this.fragCurrent=e,"initSegment"===e.sn?this._loadInitSegment(e,r):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,i))},a(e,[{key:"mediaBufferTimeRanges",get:function(){return new Ln(this.tracksBuffered[this.currentTrackId]||[])}}]),e}($r),Ln=function(t){this.buffered=void 0;var e=function(e,r,i){if((r>>>=0)>i-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+r+") is greater than the maximum bound ("+i+")");return t[r][e]};this.buffered={get length(){return t.length},end:function(r){return e("end",r,t.length)},start:function(r){return e("start",r,t.length)}}},Rn=function(t){function e(e){var r;return(r=t.call(this,e,"[subtitle-track-controller]")||this).media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r._subtitleDisplay=!0,r.registerListeners(),r}l(e,t);var r=e.prototype;return r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,t.prototype.destroy.call(this)},r.registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_PARSED,this.onManifestParsed,this),t.on(E.LEVEL_LOADING,this.onLevelLoading,this),t.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(E.ERROR,this.onError,this)},r.unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_PARSED,this.onManifestParsed,this),t.off(E.LEVEL_LOADING,this.onLevelLoading,this),t.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(E.ERROR,this.onError,this)},r.onMediaAttached=function(t,e){this.media=e.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},r.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},r.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),An(this.media.textTracks).forEach((function(t){Se(t)})),this.subtitleTrack=-1,this.media=null)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},r.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},r.onSubtitleTrackLoaded=function(t,e){var r=e.id,i=e.details,n=this.trackId,a=this.tracksInGroup[n];if(a){var s=a.details;a.details=e.details,this.log("subtitle track "+r+" loaded ["+i.startSN+"-"+i.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,e,s)}else this.warn("Invalid subtitle track id "+r)},r.onLevelLoading=function(t,e){this.switchLevel(e.level)},r.onLevelSwitching=function(t,e){this.switchLevel(e.level)},r.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.textGroupIds){var r=e.textGroupIds[e.urlId],i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;if(this.groupId!==r){var n=this.tracks.filter((function(t){return!r||t.groupId===r}));this.tracksInGroup=n;var a=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=r||null;var s={subtitleTracks:n};this.log("Updating subtitle tracks, "+n.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,s),-1!==a&&this.setSubtitleTrack(a,i)}else this.shouldReloadPlaylist(i)&&this.setSubtitleTrack(this.trackId,i)}},r.findTrackId=function(t){for(var e=this.tracksInGroup,r=0;r<e.length;r++){var i=e[r];if((!this.selectDefaultTrack||i.default)&&(!t||t===i.name))return i.id}return-1},r.onError=function(t,e){!e.fatal&&e.context&&e.context.type===ce&&e.context.id===this.trackId&&e.context.groupId===this.groupId&&this.checkRetry(e)},r.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.tracksInGroup[this.trackId];if(this.shouldLoadPlaylist(r)){var i=r.id,n=r.groupId,a=r.url;if(e)try{a=e.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:a,id:i,groupId:n,deliveryDirectives:e||null})}},r.toggleTrackModes=function(t){var e=this,r=this.media,i=this.trackId;if(r){var n=An(r.textTracks),a=n.filter((function(t){return t.groupId===e.groupId}));if(-1===t)[].slice.call(n).forEach((function(t){t.mode="disabled"}));else{var s=a[i];s&&(s.mode="disabled")}var o=a[t];o&&(o.mode=this.subtitleDisplay?"showing":"hidden")}},r.setSubtitleTrack=function(t,e){var r,i=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(-1===t||null!=(r=i[t])&&r.details)||t<-1||t>=i.length)){this.clearTimer();var n=i[t];if(this.log("Switching to subtitle-track "+t+(n?' "'+n.name+'" lang:'+n.lang+" group:"+n.groupId:"")),this.trackId=t,n){var a=n.id,s=n.groupId,o=void 0===s?"":s,l=n.name,u=n.type,h=n.url;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:u,url:h});var d=this.switchParams(n.url,null==e?void 0:e.details);this.loadPlaylist(d)}else this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},r.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,e=An(this.media.textTracks),r=0;r<e.length;r++)if("hidden"===e[r].mode)t=r;else if("showing"===e[r].mode){t=r;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},a(e,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,e)}}]),e}(lr);function An(t){for(var e=[],r=0;r<t.length;r++){var i=t[r];"subtitles"!==i.kind&&"captions"!==i.kind||!i.label||e.push(t[r])}return e}var kn=function(){function t(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}var e=t.prototype;return e.append=function(t,e){var r=this.queues[e];r.push(t),1===r.length&&this.buffers[e]&&this.executeNext(e)},e.insertAbort=function(t,e){this.queues[e].unshift(t),this.executeNext(e)},e.appendBlocker=function(t){var e,r=new Promise((function(t){e=t})),i={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(i,t),r},e.executeNext=function(t){var e=this.buffers,r=this.queues,i=e[t],n=r[t];if(n.length){var a=n[0];try{a.execute()}catch(e){I.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(e),null!=i&&i.updating||(n.shift(),this.executeNext(t))}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}(),bn=jt(),Dn=/([ha]vc.)(?:\.[^.,]+)+/,In=function(){function t(t){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var t=e.media,r=e.mediaSource;I.log("[buffer-controller]: Media source opened"),t&&(t.removeEventListener("emptied",e._onMediaEmptied),e.updateMediaElementDuration(),e.hls.trigger(E.MEDIA_ATTACHED,{media:t})),r&&r.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){I.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){I.log("[buffer-controller]: Media source ended")},this._onMediaEmptied=function(){var t=e.media,r=e._objectUrl;t&&t.src!==r&&I.error("Media element src was set while attaching MediaSource ("+r+" > "+t.src+")")},this.hls=t,this._initSourceBuffer(),this.registerListeners()}var e=t.prototype;return e.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},e.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null},e.registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_PARSED,this.onManifestParsed,this),t.on(E.BUFFER_RESET,this.onBufferReset,this),t.on(E.BUFFER_APPENDING,this.onBufferAppending,this),t.on(E.BUFFER_CODECS,this.onBufferCodecs,this),t.on(E.BUFFER_EOS,this.onBufferEos,this),t.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(E.FRAG_PARSED,this.onFragParsed,this),t.on(E.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_PARSED,this.onManifestParsed,this),t.off(E.BUFFER_RESET,this.onBufferReset,this),t.off(E.BUFFER_APPENDING,this.onBufferAppending,this),t.off(E.BUFFER_CODECS,this.onBufferCodecs,this),t.off(E.BUFFER_EOS,this.onBufferEos,this),t.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(E.FRAG_PARSED,this.onFragParsed,this),t.off(E.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new kn(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.lastMpegAudioChunk=null},e.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},e.onManifestParsed=function(t,e){var r=2;(e.audio&&!e.video||!e.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,I.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var r=this.media=e.media;if(r&&bn){var i=this.mediaSource=new bn;i.addEventListener("sourceopen",this._onMediaSourceOpen),i.addEventListener("sourceended",this._onMediaSourceEnded),i.addEventListener("sourceclose",this._onMediaSourceClose),r.src=self.URL.createObjectURL(i),this._objectUrl=r.src,r.addEventListener("emptied",this._onMediaEmptied)}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,r=this._objectUrl;if(e){if(I.log("[buffer-controller]: media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){I.warn("[buffer-controller]: onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(t.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),t.src===r?(t.removeAttribute("src"),t.load()):I.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)},e.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){var r=t.sourceBuffer[e];try{r&&(t.removeBufferListeners(e),t.mediaSource&&t.mediaSource.removeSourceBuffer(r),t.sourceBuffer[e]=void 0)}catch(t){I.warn("[buffer-controller]: Failed to reset the "+e+" buffer",t)}})),this._initSourceBuffer()},e.onBufferCodecs=function(t,e){var r=this,i=this.getSourceBufferTypes().length;Object.keys(e).forEach((function(t){if(i){var n=r.tracks[t];if(n&&"function"==typeof n.buffer.changeType){var a=e[t],s=a.id,o=a.codec,l=a.levelCodec,u=a.container,h=a.metadata,d=(n.levelCodec||n.codec).replace(Dn,"$1"),c=(l||o).replace(Dn,"$1");if(d!==c){var f=u+";codecs="+(l||o);r.appendChangeType(t,f),I.log("[buffer-controller]: switching codec "+d+" to "+c),r.tracks[t]={buffer:n.buffer,codec:o,container:u,levelCodec:l,metadata:h,id:s}}}}else r.pendingTracks[t]=e[t]})),i||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},e.appendChangeType=function(t,e){var r=this,i=this.operationQueue,n={execute:function(){var n=r.sourceBuffer[t];n&&(I.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+e),n.changeType(e)),i.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){I.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}};i.append(n,t)},e.onBufferAppending=function(t,e){var r=this,i=this.hls,n=this.operationQueue,a=this.tracks,s=e.data,o=e.type,l=e.frag,u=e.part,h=e.chunkMeta,d=h.buffering[o],c=self.performance.now();d.start=c;var f=l.stats.buffering,g=u?u.stats.buffering:null;0===f.start&&(f.start=c),g&&0===g.start&&(g.start=c);var v=a.audio,m=!1;"audio"===o&&"audio/mpeg"===(null==v?void 0:v.container)&&(m=!this.lastMpegAudioChunk||1===h.id||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h);var p=l.start,y={execute:function(){if(d.executeStart=self.performance.now(),m){var t=r.sourceBuffer[o];if(t){var e=p-t.timestampOffset;Math.abs(e)>=.1&&(I.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+p+" (delta: "+e+") sn: "+l.sn+")"),t.timestampOffset=p)}}r.appendExecutor(s,o)},onStart:function(){},onComplete:function(){var t=self.performance.now();d.executeEnd=d.end=t,0===f.first&&(f.first=t),g&&0===g.first&&(g.first=t);var e=r.sourceBuffer,i={};for(var n in e)i[n]=Dr.getBuffered(e[n]);r.appendError=0,r.hls.trigger(E.BUFFER_APPENDED,{type:o,frag:l,part:u,chunkMeta:h,parent:l.type,timeRanges:i})},onError:function(t){I.error("[buffer-controller]: Error encountered while trying to append to the "+o+" SourceBuffer",t);var e={type:S.MEDIA_ERROR,parent:l.type,details:L.BUFFER_APPEND_ERROR,frag:l,part:u,chunkMeta:h,error:t,err:t,fatal:!1};t.code===DOMException.QUOTA_EXCEEDED_ERR?e.details=L.BUFFER_FULL_ERROR:(r.appendError++,e.details=L.BUFFER_APPEND_ERROR,r.appendError>i.config.appendErrorMaxRetry&&(I.error("[buffer-controller]: Failed "+i.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),e.fatal=!0)),i.trigger(E.ERROR,e)}};n.append(y,o)},e.onBufferFlushing=function(t,e){var r=this,i=this.operationQueue,n=function(t){return{execute:r.removeExecutor.bind(r,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(E.BUFFER_FLUSHED,{type:t})},onError:function(e){I.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}};e.type?i.append(n(e.type),e.type):this.getSourceBufferTypes().forEach((function(t){i.append(n(t),t)}))},e.onFragParsed=function(t,e){var r=this,i=e.frag,n=e.part,a=[],s=n?n.elementaryStreams:i.elementaryStreams;s[N]?a.push("audiovideo"):(s[O]&&a.push("audio"),s[M]&&a.push("video")),0===a.length&&I.warn("Fragments must have at least one ElementaryStreamType set. type: "+i.type+" level: "+i.level+" sn: "+i.sn),this.blockBuffers((function(){var t=self.performance.now();i.stats.buffering.end=t,n&&(n.stats.buffering.end=t);var e=n?n.stats:i.stats;r.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:n,stats:e,id:i.type})}),a)},e.onFragChanged=function(t,e){this.flushBackBuffer()},e.onBufferEos=function(t,e){var r=this;this.getSourceBufferTypes().reduce((function(t,i){var n=r.sourceBuffer[i];return!n||e.type&&e.type!==i||(n.ending=!0,n.ended||(n.ended=!0,I.log("[buffer-controller]: "+i+" sourceBuffer now EOS"))),t&&!(n&&!n.ended)}),!0)&&(I.log("[buffer-controller]: Queueing mediaSource.endOfStream()"),this.blockBuffers((function(){r.getSourceBufferTypes().forEach((function(t){var e=r.sourceBuffer[t];e&&(e.ending=!1)}));var t=r.mediaSource;t&&"open"===t.readyState?(I.log("[buffer-controller]: Calling mediaSource.endOfStream()"),t.endOfStream()):t&&I.info("[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: "+t.readyState)})))},e.onLevelUpdated=function(t,e){var r=e.details;r.fragments.length&&(this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},e.flushBackBuffer=function(){var t=this.hls,e=this.details,r=this.media,i=this.sourceBuffer;if(r&&null!==e){var n=this.getSourceBufferTypes();if(n.length){var a=e.live&&null!==t.config.liveBackBufferLength?t.config.liveBackBufferLength:t.config.backBufferLength;if(T(a)&&!(a<0)){var s=r.currentTime,o=e.levelTargetDuration,l=Math.max(a,o),u=Math.floor(s/o)*o-l;n.forEach((function(r){var n=i[r];if(n){var a=Dr.getBuffered(n);if(a.length>0&&u>a.start(0)){if(t.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:u}),e.live)t.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:u});else if(n.ended&&a.end(a.length-1)-s<2*o)return void I.info("[buffer-controller]: Cannot flush "+r+" back buffer while SourceBuffer is in ended state");t.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:u,type:r})}}}))}}}},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,r=this.media,i=this.mediaSource,n=t.fragments[0].start+t.totalduration,a=r.duration,s=T(i.duration)?i.duration:0;t.live&&e.config.liveDurationInfinity?(I.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(t)):(n>s&&n>a||!T(a))&&(I.log("[buffer-controller]: Updating Media Source duration to "+n.toFixed(3)),i.duration=n)}},e.updateSeekableRange=function(t){var e=this.mediaSource,r=t.fragments;if(r.length&&t.live&&null!=e&&e.setLiveSeekableRange){var i=Math.max(0,r[0].start),n=Math.max(i,i+t.totalduration);e.setLiveSeekableRange(i,n)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,r=this.pendingTracks,i=Object.keys(r).length;if(i&&!t||2===i){this.createSourceBuffers(r),this.pendingTracks={};var n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach((function(t){e.executeNext(t)}));else{var a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}},e.createSourceBuffers=function(t){var e=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(var i in t)if(!e[i]){var n=t[i];if(!n)throw Error("source buffer exists for track "+i+", however track does not");var a=n.levelCodec||n.codec,s=n.container+";codecs="+a;I.log("[buffer-controller]: creating sourceBuffer("+s+")");try{var o=e[i]=r.addSourceBuffer(s),l=i;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.tracks[i]={buffer:o,codec:a,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(t){I.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:s})}}},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e=this.operationQueue;e.current(t).onComplete(),e.shiftAndExecuteNext(t)},e._onSBUpdateError=function(t,e){var r=new Error(t+" SourceBuffer error");I.error("[buffer-controller]: "+r,e),this.hls.trigger(E.ERROR,{type:S.MEDIA_ERROR,details:L.BUFFER_APPENDING_ERROR,error:r,fatal:!1});var i=this.operationQueue.current(t);i&&i.onError(e)},e.removeExecutor=function(t,e,r){var i=this.media,n=this.mediaSource,a=this.operationQueue,s=this.sourceBuffer[t];if(!i||!n||!s)return I.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void a.shiftAndExecuteNext(t);var o=T(i.duration)?i.duration:1/0,l=T(n.duration)?n.duration:1/0,u=Math.max(0,e),h=Math.min(r,o,l);h>u&&!s.ending?(s.ended=!1,I.log("[buffer-controller]: Removing ["+u+","+h+"] from the "+t+" SourceBuffer"),s.remove(u,h)):a.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var r=this.operationQueue,i=this.sourceBuffer[e];if(!i)return I.warn("[buffer-controller]: Attempting to append to the "+e+" SourceBuffer, but it does not exist"),void r.shiftAndExecuteNext(e);i.ended=!1,i.appendBuffer(t)},e.blockBuffers=function(t,e){var r=this;if(void 0===e&&(e=this.getSourceBufferTypes()),!e.length)return I.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(t);var i=this.operationQueue,n=e.map((function(t){return i.appendBlocker(t)}));Promise.all(n).then((function(){t(),e.forEach((function(t){var e=r.sourceBuffer[t];null!=e&&e.updating||i.shiftAndExecuteNext(t)}))}))},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,r){var i=this.sourceBuffer[t];if(i){var n=r.bind(this,t);this.listeners[t].push({event:e,listener:n}),i.addEventListener(e,n)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},t}(),wn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Cn=function(t){var e=t;return wn.hasOwnProperty(t)&&(e=wn[t]),String.fromCharCode(e)},_n=15,Pn=100,xn={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Fn={17:2,18:4,21:6,22:8,23:10,19:13,20:15},On={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Mn={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Nn=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],Un=function(){function t(){this.time=null,this.verboseLevel=0}return t.prototype.log=function(t,e){if(this.verboseLevel>=t){var r="function"==typeof e?e():e;I.log(this.time+" ["+t+"] "+r)}},t}(),Bn=function(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e},Gn=function(){function t(t,e,r,i,n){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=r||!1,this.background=i||"black",this.flash=n||!1}var e=t.prototype;return e.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},e.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],r=0;r<e.length;r++){var i=e[r];t.hasOwnProperty(i)&&(this[i]=t[i])}},e.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},e.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},e.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},e.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),Kn=function(){function t(t,e,r,i,n,a){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new Gn(e,r,i,n,a)}var e=t.prototype;return e.reset=function(){this.uchar=" ",this.penState.reset()},e.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},e.setPenState=function(t){this.penState.copy(t)},e.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},e.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},e.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},t}(),Hn=function(){function t(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<Pn;e++)this.chars.push(new Kn);this.logger=t,this.pos=0,this.currPenState=new Gn}var e=t.prototype;return e.equals=function(t){for(var e=!0,r=0;r<Pn;r++)if(!this.chars[r].equals(t.chars[r])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<Pn;e++)this.chars[e].copy(t.chars[e])},e.isEmpty=function(){for(var t=!0,e=0;e<Pn;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},e.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Pn&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Pn)},e.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)},e.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},e.insertChar=function(t){var e=this;t>=144&&this.backSpace();var r=Cn(t);this.pos>=Pn?this.logger.log(0,(function(){return"Cannot insert "+t.toString(16)+" ("+r+") at position "+e.pos+". Skipping it!"})):(this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1))},e.clearFromPos=function(t){var e;for(e=t;e<Pn;e++)this.chars[e].reset()},e.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},e.clearToEndOfRow=function(){this.clearFromPos(this.pos)},e.getTextString=function(){for(var t=[],e=!0,r=0;r<Pn;r++){var i=this.chars[r].uchar;" "!==i&&(e=!1),t.push(i)}return e?"":t.join("")},e.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),Vn=function(){function t(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<_n;e++)this.rows.push(new Hn(t));this.logger=t,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var e=t.prototype;return e.reset=function(){for(var t=0;t<_n;t++)this.rows[t].clear();this.currRow=14},e.equals=function(t){for(var e=!0,r=0;r<_n;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<_n;e++)this.rows[e].copy(t.rows[e])},e.isEmpty=function(){for(var t=!0,e=0;e<_n;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},e.backSpace=function(){this.rows[this.currRow].backSpace()},e.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},e.insertChar=function(t){this.rows[this.currRow].insertChar(t)},e.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},e.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},e.setCursor=function(t){this.logger.log(2,"setCursor: "+t),this.rows[this.currRow].setCursor(t)},e.setPAC=function(t){this.logger.log(2,(function(){return"pacData = "+JSON.stringify(t)}));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<_n;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,n=this.lastOutputScreen;if(n){var a=n.rows[i].cueStartTime,s=this.logger.time;if(a&&null!==s&&a<s)for(var o=0;o<this.nrRollUpRows;o++)this.rows[e-this.nrRollUpRows+o+1].copy(n.rows[i+o])}}this.currRow=e;var l=this.rows[this.currRow];if(null!==t.indent){var u=t.indent,h=Math.max(u-1,0);l.setCursor(t.indent),t.color=l.chars[h].penState.foreground}var d={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(d)},e.setBkgData=function(t){this.logger.log(2,(function(){return"bkgData = "+JSON.stringify(t)})),this.backSpace(),this.setPen(t),this.insertChar(32)},e.setRollUpRows=function(t){this.nrRollUpRows=t},e.rollUp=function(){var t=this;if(null!==this.nrRollUpRows){this.logger.log(1,(function(){return t.getDisplayText()}));var e=this.currRow+1-this.nrRollUpRows,r=this.rows.splice(e,1)[0];r.clear(),this.rows.splice(this.currRow,0,r),this.logger.log(2,"Rolling up")}else this.logger.log(3,"roll_up but nrRollUpRows not set yet")},e.getDisplayText=function(t){t=t||!1;for(var e=[],r="",i=-1,n=0;n<_n;n++){var a=this.rows[n].getTextString();a&&(i=n+1,t?e.push("Row "+i+": '"+a+"'"):e.push(a.trim()))}return e.length>0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},e.getTextAndFormat=function(){return this.rows},t}(),Yn=function(){function t(t,e,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new Vn(r),this.nonDisplayedMemory=new Vn(r),this.lastOutputScreen=new Vn(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var e=t.prototype;return e.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},e.getHandler=function(){return this.outputFilter},e.setHandler=function(t){this.outputFilter=t},e.setPAC=function(t){this.writeScreen.setPAC(t)},e.setBkgData=function(t){this.writeScreen.setBkgData(t)},e.setMode=function(t){t!==this.mode&&(this.mode=t,this.logger.log(2,(function(){return"MODE="+t})),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},e.insertChars=function(t){for(var e=this,r=0;r<t.length;r++)this.writeScreen.insertChar(t[r]);var i=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(function(){return i+": "+e.writeScreen.getDisplayText(!0)})),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(function(){return"DISPLAYED: "+e.displayedMemory.getDisplayText(!0)})),this.outputDataUpdate())},e.ccRCL=function(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},e.ccBS=function(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},e.ccAOF=function(){},e.ccAON=function(){},e.ccDER=function(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},e.ccRU=function(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},e.ccFON=function(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},e.ccRDC=function(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},e.ccTR=function(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")},e.ccRTD=function(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")},e.ccEDM=function(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},e.ccCR=function(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},e.ccENM=function(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},e.ccEOC=function(){var t=this;if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(function(){return"DISP: "+t.displayedMemory.getDisplayText()}))}this.outputDataUpdate(!0)},e.ccTO=function(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},e.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}this.logger.log(2,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},e.outputDataUpdate=function(t){void 0===t&&(t=!1);var e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},e.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),Wn=function(){function t(t,e,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var i=new Un;this.channels=[null,new Yn(t,e,i),new Yn(t+1,r,i)],this.cmdHistory={a:null,b:null},this.logger=i}var e=t.prototype;return e.getHandler=function(t){return this.channels[t].getHandler()},e.setHandler=function(t,e){this.channels[t].setHandler(e)},e.addData=function(t,e){var r,i,n,a=!1;this.logger.time=t;for(var s=0;s<e.length;s+=2)if(i=127&e[s],n=127&e[s+1],0!==i||0!==n){if(this.logger.log(3,"["+Bn([e[s],e[s+1]])+"] -> ("+Bn([i,n])+")"),(r=this.parseCmd(i,n))||(r=this.parseMidrow(i,n)),r||(r=this.parsePAC(i,n)),r||(r=this.parseBackgroundAttributes(i,n)),!r&&(a=this.parseChars(i,n))){var o=this.currentChannel;o&&o>0?this.channels[o].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}r||a||this.logger.log(2,"Couldn't parse cleaned data "+Bn([i,n])+" orig: "+Bn([e[s],e[s+1]]))}},e.parseCmd=function(t,e){var r=this.cmdHistory;if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;if(qn(t,e,r))return jn(null,null,r),this.logger.log(3,"Repeated command ("+Bn([t,e])+") is dropped"),!0;var i=20===t||21===t||23===t?1:2,n=this.channels[i];return 20===t||21===t||28===t||29===t?32===e?n.ccRCL():33===e?n.ccBS():34===e?n.ccAOF():35===e?n.ccAON():36===e?n.ccDER():37===e?n.ccRU(2):38===e?n.ccRU(3):39===e?n.ccRU(4):40===e?n.ccFON():41===e?n.ccRDC():42===e?n.ccTR():43===e?n.ccRTD():44===e?n.ccEDM():45===e?n.ccCR():46===e?n.ccENM():47===e&&n.ccEOC():n.ccTO(e-32),jn(t,e,r),this.currentChannel=i,!0},e.parseMidrow=function(t,e){var r=0;if((17===t||25===t)&&e>=32&&e<=47){if((r=17===t?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(e),this.logger.log(3,"MIDROW ("+Bn([t,e])+")"),!0)}return!1},e.parsePAC=function(t,e){var r,i=this.cmdHistory;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;if(qn(t,e,i))return jn(null,null,i),!0;var n=t<=23?1:2;r=e>=64&&e<=95?1===n?xn[t]:On[t]:1===n?Fn[t]:Mn[t];var a=this.channels[n];return!!a&&(a.setPAC(this.interpretPAC(r,e)),jn(t,e,i),this.currentChannel=n,!0)},e.interpretPAC=function(t,e){var r,i={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,i.underline=1==(1&r),r<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((r-16)/2),i},e.parseChars=function(t,e){var r,i,n=null,a=null;if(t>=25?(r=2,a=t-8):(r=1,a=t),a>=17&&a<=19?(i=17===a?e+80:18===a?e+112:e+144,this.logger.log(2,"Special char '"+Cn(i)+"' in channel "+r),n=[i]):t>=32&&t<=127&&(n=0===e?[t]:[t,e]),n){var s=Bn(n);this.logger.log(3,"Char codes = "+s.join(",")),jn(t,e,this.cmdHistory)}return n},e.parseBackgroundAttributes=function(t,e){var r;if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;var i={};16===t||24===t?(r=Math.floor((e-32)/2),i.background=Nn[r],e%2==1&&(i.background=i.background+"_semi")):45===e?i.background="transparent":(i.foreground="black",47===e&&(i.underline=!0));var n=t<=23?1:2;return this.channels[n].setBkgData(i),jn(t,e,this.cmdHistory),!0},e.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}this.cmdHistory={a:null,b:null}},e.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var r=this.channels[e];r&&r.cueSplitAtTime(t)}},t}();function jn(t,e,r){r.a=t,r.b=e}function qn(t,e,r){return r.a===t&&r.b===e}var Xn=function(){function t(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}var e=t.prototype;return e.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},e.newCue=function(t,e,r){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},e.reset=function(){this.cueRanges=[],this.startTime=null},t}(),zn=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var t=["","lr","rl"],e=["start","middle","end","left","right"];function r(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;var r=e.toLowerCase();return!!~t.indexOf(r)&&r}function i(t){return r(e,t)}function n(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var s in a)t[s]=a[s]}return t}function a(e,a,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",h=!1,d=e,c=a,f=s,g=null,v="",m=!0,p="auto",y="start",T=50,E="middle",S=50,L="middle";Object.defineProperty(o,"id",n({},l,{get:function(){return u},set:function(t){u=""+t}})),Object.defineProperty(o,"pauseOnExit",n({},l,{get:function(){return h},set:function(t){h=!!t}})),Object.defineProperty(o,"startTime",n({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",n({},l,{get:function(){return c},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");c=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",n({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",n({},l,{get:function(){return g},set:function(t){g=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",n({},l,{get:function(){return v},set:function(e){var i=function(e){return r(t,e)}(e);if(!1===i)throw new SyntaxError("An invalid or illegal string was specified.");v=i,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",n({},l,{get:function(){return m},set:function(t){m=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",n({},l,{get:function(){return p},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",n({},l,{get:function(){return y},set:function(t){var e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",n({},l,{get:function(){return T},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");T=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",n({},l,{get:function(){return E},set:function(t){var e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",n({},l,{get:function(){return S},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");S=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",n({},l,{get:function(){return L},set:function(t){var e=i(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");L=e,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}(),Qn=function(){function t(){}return t.prototype.decode=function(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))},t}();function $n(t){function e(t,e,r,i){return 3600*(0|t)+60*(0|e)+(0|r)+parseFloat(i||0)}var r=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?e(r[2],r[3],0,r[4]):e(r[1],r[2],r[3],r[4]):null}var Jn=function(){function t(){this.values=Object.create(null)}var e=t.prototype;return e.set=function(t,e){this.get(t)||""===e||(this.values[t]=e)},e.get=function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},e.has=function(t){return t in this.values},e.alt=function(t,e,r){for(var i=0;i<r.length;++i)if(e===r[i]){this.set(t,e);break}},e.integer=function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},e.percent=function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var r=parseFloat(e);if(r>=0&&r<=100)return this.set(t,r),!0}return!1},t}();function Zn(t,e,r,i){var n=i?t.split(i):[t];for(var a in n)if("string"==typeof n[a]){var s=n[a].split(r);2===s.length&&e(s[0],s[1])}}var ta=new zn(0,0,""),ea="middle"===ta.align?"middle":"center";function ra(t,e,r){var i=t;function n(){var e=$n(t);if(null===e)throw new Error("Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function a(){t=t.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);t=t.slice(3),a(),e.endTime=n(),a(),function(t,e){var i=new Jn;Zn(t,(function(t,e){var n;switch(t){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===e){i.set(t,r[a].region);break}break;case"vertical":i.alt(t,e,["rl","lr"]);break;case"line":n=e.split(","),i.integer(t,n[0]),i.percent(t,n[0])&&i.set("snapToLines",!1),i.alt(t,n[0],["auto"]),2===n.length&&i.alt("lineAlign",n[1],["start",ea,"end"]);break;case"position":n=e.split(","),i.percent(t,n[0]),2===n.length&&i.alt("positionAlign",n[1],["start",ea,"end","line-left","line-right","auto"]);break;case"size":i.percent(t,e);break;case"align":i.alt(t,e,["start",ea,"end","left","right"])}}),/:/,/\s/),e.region=i.get("region",null),e.vertical=i.get("vertical","");var n=i.get("line","auto");"auto"===n&&-1===ta.line&&(n=-1),e.line=n,e.lineAlign=i.get("lineAlign","start"),e.snapToLines=i.get("snapToLines",!0),e.size=i.get("size",100),e.align=i.get("align",ea);var a=i.get("position","auto");"auto"===a&&50===ta.position&&(a="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=a}(t,e)}function ia(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var na=function(){function t(){this.state="INITIAL",this.buffer="",this.decoder=new Qn,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var e=t.prototype;return e.parse=function(t){var e=this;function r(){var t=e.buffer,r=0;for(t=ia(t);r<t.length&&"\r"!==t[r]&&"\n"!==t[r];)++r;var i=t.slice(0,r);return"\r"===t[r]&&++r,"\n"===t[r]&&++r,e.buffer=t.slice(r),i}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{var i="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;var n=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var a=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(a?a=!1:i=r(),e.state){case"HEADER":/:/.test(i)?Zn(i,(function(t,e){}),/:/):i||(e.state="ID");continue;case"NOTE":i||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){e.state="NOTE";break}if(!i)continue;if(e.cue=new zn(0,0,""),e.state="CUE",-1===i.indexOf("--\x3e")){e.cue.id=i;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{ra(i,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var s=-1!==i.indexOf("--\x3e");if(!i||s&&(a=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=i;continue;case"BADCUE":i||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this},e.flush=function(){var t=this;try{if((t.cue||"HEADER"===t.state)&&(t.buffer+="\n\n",t.parse()),"INITIAL"===t.state||"BADWEBVTT"===t.state)throw new Error("Malformed WebVTT signature.")}catch(e){t.onparsingerror&&t.onparsingerror(e)}return t.onflush&&t.onflush(),this},t}(),aa=/\r\n|\n\r|\n|\r/g,sa=function(t,e,r){return void 0===r&&(r=0),t.slice(r,r+e.length)===e},oa=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()};function la(t,e,r){return oa(t.toString())+oa(e.toString())+oa(r)}function ua(t,e,r,i,n,a,s){var o,l,u,h=new na,d=mt(new Uint8Array(t)).trim().replace(aa,"\n").split("\n"),c=[],f=(o=e.baseTime,void 0===(l=e.timescale)&&(l=1),Ui(o,Ni,1/l)),g="00:00.000",v=0,m=0,p=!0;h.oncue=function(t){var e=r[i],a=r.ccOffset,s=(v-f)/9e4;null!=e&&e.new&&(void 0!==m?a=r.ccOffset=e.start:function(t,e,r){var i=t[e],n=t[i.prevCC];if(!n||!n.new&&i.new)return t.ccOffset=t.presentationOffset=i.start,void(i.new=!1);for(;null!=(a=n)&&a.new;){var a;t.ccOffset+=i.start-n.start,i.new=!1,n=t[(i=n).prevCC]}t.presentationOffset=r}(r,i,s)),s&&(a=s-r.presentationOffset);var o=t.endTime-t.startTime,l=Vi(9e4*(t.startTime+a-m),9e4*n)/9e4;t.startTime=Math.max(l,0),t.endTime=Math.max(l+o,0);var u=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(u)),t.id||(t.id=la(t.startTime,t.endTime,u)),t.endTime>0&&c.push(t)},h.onparsingerror=function(t){u=t},h.onflush=function(){u?s(u):a(c)},d.forEach((function(t){if(p){if(sa(t,"X-TIMESTAMP-MAP=")){p=!1,t.slice(16).split(",").forEach((function(t){sa(t,"LOCAL:")?g=t.slice(6):sa(t,"MPEGTS:")&&(v=parseInt(t.slice(7)))}));try{m=function(t){var e=parseInt(t.slice(-3)),r=parseInt(t.slice(-6,-4)),i=parseInt(t.slice(-9,-7)),n=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(T(e)&&T(r)&&T(i)&&T(n)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*r,(e+=6e4*i)+36e5*n}(g)/1e3}catch(t){u=t}return}""===t&&(p=!1)}h.parse(t+"\n")})),h.flush()}var ha="stpp.ttml.im1t",da=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ca=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,fa={left:"start",center:"center",right:"end",start:"start",end:"end"};function ga(t,e,r,i){var n=Dt(new Uint8Array(t),["mdat"]);if(0!==n.length){var a,s,l,u,h=n.map((function(t){return mt(t)})),d=(a=e.baseTime,s=1,void 0===(l=e.timescale)&&(l=1),void 0===u&&(u=!1),Ui(a,s,1/l,u));try{h.forEach((function(t){return r(function(t,e){var r=(new DOMParser).parseFromString(t,"text/xml"),i=r.getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((function(t,e){return t[e]=i.getAttribute("ttp:"+e)||n[e],t}),{}),s="preserve"!==i.getAttribute("xml:space"),l=ma(va(i,"styling","style")),u=ma(va(i,"layout","region")),h=va(i,"body","[begin]");return[].map.call(h,(function(t){var r=pa(t,s);if(!r||!t.hasAttribute("begin"))return null;var i=Ea(t.getAttribute("begin"),a),n=Ea(t.getAttribute("dur"),a),h=Ea(t.getAttribute("end"),a);if(null===i)throw Ta(t);if(null===h){if(null===n)throw Ta(t);h=i+n}var d=new zn(i-e,h-e,r);d.id=la(d.startTime,d.endTime,d.text);var c=function(t,e,r){var i="http://www.w3.org/ns/ttml#styling",n=null,a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],s=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;return s&&r.hasOwnProperty(s)&&(n=r[s]),a.reduce((function(r,a){var s=ya(e,i,a)||ya(t,i,a)||ya(n,i,a);return s&&(r[a]=s),r}),{})}(u[t.getAttribute("region")],l[t.getAttribute("style")],l),f=c.textAlign;if(f){var g=fa[f];g&&(d.lineAlign=g),d.align=f}return o(d,c),d})).filter((function(t){return null!==t}))}(t,d))}))}catch(t){i(t)}}else i(new Error("Could not parse IMSC1 mdat"))}function va(t,e,r){var i=t.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(r)):[]}function ma(t){return t.reduce((function(t,e){var r=e.getAttribute("xml:id");return r&&(t[r]=e),t}),{})}function pa(t,e){return[].slice.call(t.childNodes).reduce((function(t,r,i){var n;return"br"===r.nodeName&&i?t+"\n":null!=(n=r.childNodes)&&n.length?pa(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}function ya(t,e,r){return t&&t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function Ta(t){return new Error("Could not parse ttml timestamp "+t)}function Ea(t,e){if(!t)return null;var r=$n(t);return null===r&&(da.test(t)?r=function(t,e){var r=da.exec(t),i=(0|r[4])+(0|r[5])/e.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+i/e.frameRate}(t,e):ca.test(t)&&(r=function(t,e){var r=ca.exec(t),i=Number(r[1]);switch(r[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}(t,e))),r}var Sa=function(){function t(t){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var e=new Xn(this,"textTrack1"),r=new Xn(this,"textTrack2"),i=new Xn(this,"textTrack3"),n=new Xn(this,"textTrack4");this.cea608Parser1=new Wn(1,e,r),this.cea608Parser2=new Wn(3,i,n)}t.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(E.FRAG_LOADING,this.onFragLoading,this),t.on(E.FRAG_LOADED,this.onFragLoaded,this),t.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=t.prototype;return e.destroy=function(){var t=this.hls;t.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(E.FRAG_LOADING,this.onFragLoading,this),t.off(E.FRAG_LOADED,this.onFragLoaded,this),t.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(t,e,r,i,n){for(var a,s,o,l,u=!1,h=n.length;h--;){var d=n[h],c=(a=d[0],s=d[1],o=e,l=r,Math.min(s,l)-Math.max(a,o));if(c>=0&&(d[0]=Math.min(d[0],e),d[1]=Math.max(d[1],r),u=!0,c/(r-e)>.5))return}if(u||n.push([e,r]),this.config.renderTextTracksNatively){var f=this.captionsTracks[t];this.Cues.newCue(f,e,r,i)}else{var g=this.Cues.newCue(null,e,r,i);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:g,track:t})}},e.onInitPtsFound=function(t,e){var r=this,i=e.frag,n=e.id,a=e.initPTS,s=e.timescale,o=this.unparsedVttFrags;"main"===n&&(this.initPTS[i.cc]={baseTime:a,timescale:s}),o.length&&(this.unparsedVttFrags=[],o.forEach((function(t){r.onFragLoaded(E.FRAG_LOADED,t)})))},e.getExistingTrack=function(t){var e=this.media;if(e)for(var r=0;r<e.textTracks.length;r++){var i=e.textTracks[r];if(i[t])return i}return null},e.createCaptionsTrack=function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)},e.createNativeTrack=function(t){if(!this.captionsTracks[t]){var e=this.captionsProperties,r=this.captionsTracks,i=this.media,n=e[t],a=n.label,s=n.languageCode,o=this.getExistingTrack(t);if(o)r[t]=o,Se(r[t]),Te(r[t],i);else{var l=this.createTextTrack("captions",a,s);l&&(l[t]=!0,r[t]=l)}}},e.createNonNativeTrack=function(t){if(!this.nonNativeCaptionsTracks[t]){var e=this.captionsProperties[t];if(e){var r={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=r,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},e.createTextTrack=function(t,e,r){var i=this.media;if(i)return i.addTextTrack(t,e,r)},e.onMediaAttaching=function(t,e){this.media=e.media,this._cleanTracks()},e.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach((function(e){Se(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var r=0;r<e.length;r++)Se(e[r])}},e.onSubtitleTracksUpdated=function(t,e){var r=this,i=e.subtitleTracks||[],n=i.some((function(t){return t.textCodec===ha}));if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(Tn(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){var a=this.media?this.media.textTracks:null;this.tracks.forEach((function(t,e){var i;if(a&&e<a.length){for(var n=null,s=0;s<a.length;s++)if(La(a[s],t)){n=a[s];break}n&&(i=n)}if(i)Se(i);else{var o=r._captionsOrSubtitlesFromCharacteristics(t);(i=r.createTextTrack(o,t.name,t.lang))&&(i.mode="disabled")}i&&(i.groupId=t.groupId,r.textTracks.push(i))}))}else if(this.tracks.length){var s=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:s})}}},e._captionsOrSubtitlesFromCharacteristics=function(t){if(t.attrs.CHARACTERISTICS){var e=/transcribes-spoken-dialog/gi.test(t.attrs.CHARACTERISTICS),r=/describes-music-and-sound/gi.test(t.attrs.CHARACTERISTICS);if(e&&r)return"captions"}return"subtitles"},e.onManifestLoaded=function(t,e){var r=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(t){var e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(e){var i="textTrack"+e[1],n=r.captionsProperties[i];n&&(n.label=t.name,t.lang&&(n.languageCode=t.lang),n.media=t)}}))},e.closedCaptionsForLevel=function(t){var e=this.hls.levels[t.level];return null==e?void 0:e.attrs["CLOSED-CAPTIONS"]},e.onFragLoading=function(t,e){var r=this.cea608Parser1,i=this.cea608Parser2,n=this.lastSn,a=this.lastPartIndex;if(this.enabled&&r&&i&&e.frag.type===fe){var s,o,l=e.frag.sn,u=null!=(s=null==e||null==(o=e.part)?void 0:o.index)?s:-1;l===n+1||l===n&&u===a+1||(r.reset(),i.reset()),this.lastSn=l,this.lastPartIndex=u}},e.onFragLoaded=function(t,e){var r=e.frag,i=e.payload,n=this.initPTS,a=this.unparsedVttFrags;if(r.type===ve)if(i.byteLength){if(!n[r.cc])return a.push(e),void(n.length&&this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Missing initial subtitle PTS")}));var s=r.decryptdata,o="stats"in e;if(null==s||!s.encrypted||o){var l=this.tracks[r.level],u=this.vttCCs;u[r.cc]||(u[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),l&&l.textCodec===ha?this._parseIMSC1(r,i):this._parseVTTs(r,i,u)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(t,e){var r=this,i=this.hls;ga(e,this.initPTS[t.cc],(function(e){r._appendCues(e,t.level),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(e){I.log("Failed to parse IMSC1: "+e),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))},e._parseVTTs=function(t,e,r){var i,n=this,a=this.hls;ua(null!=(i=t.initSegment)&&i.data?Pt(t.initSegment.data,new Uint8Array(e)):e,this.initPTS[t.cc],r,t.cc,t.start,(function(e){n._appendCues(e,t.level),a.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(r){n._fallbackToIMSC1(t,e),I.log("Failed to parse VTT cue: "+r),a.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:r})}))},e._fallbackToIMSC1=function(t,e){var r=this,i=this.tracks[t.level];i.textCodec||ga(e,this.initPTS[t.cc],(function(){i.textCodec=ha,r._parseIMSC1(t,e)}),(function(){i.textCodec="wvtt"}))},e._appendCues=function(t,e){var r=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[e];if(!i||"disabled"===i.mode)return;t.forEach((function(t){return Ee(i,t)}))}else{var n=this.tracks[e];if(!n)return;var a=n.default?"default":"subtitles"+e;r.trigger(E.CUES_PARSED,{type:"subtitles",cues:t,track:a})}},e.onFragDecrypted=function(t,e){var r=e.frag;if(r.type===ve){if(!this.initPTS[r.cc])return void this.unparsedVttFrags.push(e);this.onFragLoaded(E.FRAG_LOADED,e)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(t,e){var r=this.cea608Parser1,i=this.cea608Parser2;if(this.enabled&&r&&i){var n=e.frag,a=e.samples;if(n.type!==fe||"NONE"!==this.closedCaptionsForLevel(n))for(var s=0;s<a.length;s++){var o=a[s].bytes;if(o){var l=this.extractCea608Data(o);r.addData(a[s].pts,l[0]),i.addData(a[s].pts,l[1])}}}},e.onBufferFlushing=function(t,e){var r=e.startOffset,i=e.endOffset,n=e.endOffsetSubtitles,a=e.type,s=this.media;if(s&&!(s.currentTime<i)){if(!a||"video"===a){var o=this.captionsTracks;Object.keys(o).forEach((function(t){return Le(o[t],r,i)}))}if(this.config.renderTextTracksNatively&&0===r&&void 0!==n){var l=this.textTracks;Object.keys(l).forEach((function(t){return Le(l[t],r,n)}))}}},e.extractCea608Data=function(t){for(var e=[[],[]],r=31&t[0],i=2,n=0;n<r;n++){var a=t[i++],s=127&t[i++],o=127&t[i++];if((0!==s||0!==o)&&0!=(4&a)){var l=3&a;0!==l&&1!==l||(e[l].push(s),e[l].push(o))}}return e},t}();function La(t,e){return!!t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}var Ra=function(){function t(t){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},e.registerListeners=function(){var t=this.hls;t.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(E.MANIFEST_PARSED,this.onManifestParsed,this),t.on(E.BUFFER_CODECS,this.onBufferCodecs,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)},e.unregisterListener=function(){var t=this.hls;t.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(E.MANIFEST_PARSED,this.onManifestParsed,this),t.off(E.BUFFER_CODECS,this.onBufferCodecs,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)},e.onFpsDropLevelCapping=function(t,e){var r=this.hls.levels[e.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})},e.onMediaAttaching=function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null},e.onManifestParsed=function(t,e){var r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()},e.onBufferCodecs=function(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},e.onMediaDetaching=function(){this.stopCapping()},e.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1),e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},e.getMaxLevel=function(e){var r=this,i=this.hls.levels;if(!i.length)return-1;var n=i.filter((function(t,i){return r.isLevelAllowed(t)&&i<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},e.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},e.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},e.getDimensions=function(){if(this.clientRect)return this.clientRect;var t=this.media,e={width:0,height:0};if(t){var r=t.getBoundingClientRect();e.width=r.width,e.height=r.height,e.width||e.height||(e.width=r.right-r.left||t.width||0,e.height=r.bottom-r.top||t.height||0)}return this.clientRect=e,e},e.isLevelAllowed=function(t){return!this.restrictedLevels.some((function(e){return t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height}))},t.getMaxLevelByMediaSize=function(t,e,r){if(null==t||!t.length)return-1;for(var i,n,a=t.length-1,s=0;s<t.length;s+=1){var o=t[s];if((o.width>=e||o.height>=r)&&(i=o,!(n=t[s+1])||i.width!==n.width||i.height!==n.height)){a=s;break}}return a},a(t,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(t){}return t}}]),t}(),Aa=function(){function t(t){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.registerListeners=function(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},e.onMediaAttaching=function(t,e){var r=this.hls.config;if(r.capLevelOnFPSDrop){var i=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}},e.checkFPS=function(t,e,r){var i=performance.now();if(e){if(this.lastTime){var n=i-this.lastTime,a=r-this.lastDroppedFrames,s=e-this.lastDecodedFrames,o=1e3*a/n,l=this.hls;if(l.trigger(E.FPS_DROP,{currentDropped:a,currentDecoded:s,totalDroppedFrames:r}),o>0&&a>l.config.fpsDroppedMonitoringThreshold*s){var u=l.currentLevel;I.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},e.checkFPSInterval=function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},t}(),ka="[eme]",ba=function(){function t(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=t.CDMCleanupPromise?[t.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=I.debug.bind(I,ka),this.log=I.log.bind(I,ka),this.warn=I.warn.bind(I,ka),this.error=I.error.bind(I,ka),this.hls=e,this.config=e.config,this.registerListeners()}var e=t.prototype;return e.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},e.registerListeners=function(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)},e.unregisterListeners=function(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)},e.getLicenseServerUrl=function(t){var e=this.config,r=e.drmSystems,i=e.widevineLicenseUrl,n=r[t];if(n)return n.licenseUrl;if(t===W.WIDEVINE&&i)return i;throw new Error('no license server URL configured for key-system "'+t+'"')},e.getServerCertificateUrl=function(t){var e=this.config.drmSystems[t];if(e)return e.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+t+'"]')},e.attemptKeySystemAccess=function(t){var e=this,r=this.hls.levels,i=function(t,e,r){return!!t&&r.indexOf(t)===e},n=r.map((function(t){return t.audioCodec})).filter(i),a=r.map((function(t){return t.videoCodec})).filter(i);return n.length+a.length===0&&a.push("avc1.42e01e"),new Promise((function(r,i){!function t(s){var o=s.shift();e.getMediaKeysPromise(o,n,a).then((function(t){return r({keySystem:o,mediaKeys:t})})).catch((function(e){s.length?t(s):i(e instanceof Da?e:new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))}))}(t)}))},e.requestMediaKeySystemAccess=function(t,e){var r=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof r){var i="Configured requestMediaKeySystemAccess is not a function "+r;return null===tt&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(i))}return r(t,e)},e.getMediaKeysPromise=function(t,e,r){var i=this,n=function(t,e,r,i){var n;switch(t){case W.FAIRPLAY:n=["cenc","sinf"];break;case W.WIDEVINE:case W.PLAYREADY:n=["cenc"];break;case W.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+t)}return function(t,e,r,i){return[{initDataTypes:t,persistentState:i.persistentState||"not-allowed",distinctiveIdentifier:i.distinctiveIdentifier||"not-allowed",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map((function(t){return{contentType:'audio/mp4; codecs="'+t+'"',robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}})),videoCapabilities:r.map((function(t){return{contentType:'video/mp4; codecs="'+t+'"',robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}}))}]}(n,e,r,i)}(t,e,r,this.config.drmSystemOptions),a=this.keySystemAccessPromises[t],s=null==a?void 0:a.keySystemAccess;if(!s){this.log('Requesting encrypted media "'+t+'" key-system access with config: '+JSON.stringify(n)),s=this.requestMediaKeySystemAccess(t,n);var o=this.keySystemAccessPromises[t]={keySystemAccess:s};return s.catch((function(e){i.log('Failed to obtain access to key-system "'+t+'": '+e)})),s.then((function(e){i.log('Access for key-system "'+e.keySystem+'" obtained');var r=i.fetchServerCertificate(t);return i.log('Create media-keys for "'+t+'"'),o.mediaKeys=e.createMediaKeys().then((function(e){return i.log('Media-keys created for "'+t+'"'),r.then((function(r){return r?i.setMediaKeysServerCertificate(e,t,r):e}))})),o.mediaKeys.catch((function(e){i.error('Failed to create media-keys for "'+t+'"}: '+e)})),o.mediaKeys}))}return s.then((function(){return a.mediaKeys}))},e.createMediaKeySessionContext=function(t){var e=t.decryptdata,r=t.keySystem,i=t.mediaKeys;this.log('Creating key-system session "'+r+'" keyId: '+yt(e.keyId||[]));var n=i.createSession(),a={decryptdata:e,keySystem:r,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(a),a},e.renewKeySession=function(t){var e=t.decryptdata;if(e.pssh){var r=this.createMediaKeySessionContext(t),i=this.getKeyIdString(e);this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(r,"cenc",e.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)},e.getKeyIdString=function(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(null===t.keyId)throw new Error("keyId is null");return yt(t.keyId)},e.updateKeySession=function(t,e){var r,i=t.mediaKeysSession;return this.log('Updating key-session "'+i.sessionId+'" for keyID '+yt((null==(r=t.decryptdata)?void 0:r.keyId)||[])+"\n } (data length: "+(e?e.byteLength:e)+")"),i.update(e)},e.selectKeySystemFormat=function(t){var e=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+t.sn+" "+t.type+": "+t.level+") key formats "+e.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(e)),this.keyFormatPromise},e.getKeyFormatPromise=function(t){var e=this;return new Promise((function(r,i){var n=Z(e.config),a=t.map(Q).filter((function(t){return!!t&&-1!==n.indexOf(t)}));return e.getKeySystemSelectionPromise(a).then((function(t){var e=t.keySystem,n=J(e);n?r(n):i(new Error('Unable to find format for key-system "'+e+'"'))})).catch(i)}))},e.loadKey=function(t){var e=this,r=t.keyInfo.decryptdata,i=this.getKeyIdString(r),n="(keyId: "+i+' format: "'+r.keyFormat+'" method: '+r.method+" uri: "+r.uri+")";this.log("Starting session for key "+n);var a=this.keyIdToKeySessionPromise[i];return a||(a=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(r).then((function(i){var a=i.keySystem,s=i.mediaKeys;return e.throwIfDestroyed(),e.log("Handle encrypted media sn: "+t.frag.sn+" "+t.frag.type+": "+t.frag.level+" using key "+n),e.attemptSetMediaKeys(a,s).then((function(){e.throwIfDestroyed();var t=e.createMediaKeySessionContext({keySystem:a,mediaKeys:s,decryptdata:r});return e.generateRequestWithPreferredKeySession(t,"cenc",r.pssh,"playlist-key")}))}))).catch((function(t){return e.handleError(t)})),a},e.throwIfDestroyed=function(t){if(!this.hls)throw new Error("invalid state")},e.handleError=function(t){this.hls&&(this.error(t.message),t instanceof Da?this.hls.trigger(E.ERROR,t.data):this.hls.trigger(E.ERROR,{type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))},e.getKeySystemForKeyPromise=function(t){var e=this.getKeyIdString(t),r=this.keyIdToKeySessionPromise[e];if(!r){var i=Q(t.keyFormat),n=i?[i]:Z(this.config);return this.attemptKeySystemAccess(n)}return r},e.getKeySystemSelectionPromise=function(t){if(t.length||(t=Z(this.config)),0===t.length)throw new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(t)},e._onMediaEncrypted=function(t){var e=this,r=t.initDataType,i=t.initData;if(this.debug('"'+t.type+'" event: init data type: "'+r+'"'),null!==i){var n,a;if("sinf"===r&&this.config.drmSystems[W.FAIRPLAY]){var s=Lt(new Uint8Array(i));try{var o=H(JSON.parse(s).sinf),l=Ct(new Uint8Array(o));if(!l)return;n=l.subarray(8,24),a=W.FAIRPLAY}catch(t){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var u=function(t){if(!(t instanceof ArrayBuffer)||t.byteLength<32)return null;var e={version:0,systemId:"",kids:null,data:null},r=new DataView(t),i=r.getUint32(0);if(t.byteLength!==i&&i>44)return null;if(1886614376!==r.getUint32(4))return null;if(e.version=r.getUint32(8)>>>24,e.version>1)return null;e.systemId=yt(new Uint8Array(t,12,16));var n=r.getUint32(28);if(0===e.version){if(i-32<n)return null;e.data=new Uint8Array(t,32,n)}else if(1===e.version){e.kids=[];for(var a=0;a<n;a++)e.kids.push(new Uint8Array(t,32+16*a,16))}return e}(i);if(null===u)return;0===u.version&&u.systemId===$&&u.data&&(n=u.data.subarray(8,24)),a=function(t){if(t===$)return W.WIDEVINE}(u.systemId)}if(a&&n){for(var h=yt(n),d=this.keyIdToKeySessionPromise,c=this.mediaKeySessions,f=d[h],g=function(){var t=c[v],a=t.decryptdata;if(a.pssh||!a.keyId)return"continue";var s=yt(a.keyId);return h===s||-1!==a.uri.replace(/-/g,"").indexOf(h)?(f=d[s],delete d[s],a.pssh=new Uint8Array(i),a.keyId=n,f=d[h]=f.then((function(){return e.generateRequestWithPreferredKeySession(t,r,i,"encrypted-event-key-match")})),"break"):void 0},v=0;v<c.length;v++){var m=g();if("continue"!==m&&"break"===m)break}f||(f=d[h]=this.getKeySystemSelectionPromise([a]).then((function(t){var a,s=t.keySystem,o=t.mediaKeys;e.throwIfDestroyed();var l=new Bt("ISO-23001-7",h,null!=(a=J(s))?a:"");return l.pssh=new Uint8Array(i),l.keyId=n,e.attemptSetMediaKeys(s,o).then((function(){e.throwIfDestroyed();var t=e.createMediaKeySessionContext({decryptdata:l,keySystem:s,mediaKeys:o});return e.generateRequestWithPreferredKeySession(t,r,i,"encrypted-event-no-match")}))}))),f.catch((function(t){return e.handleError(t)}))}}},e._onWaitingForKey=function(t){this.log('"'+t.type+'" event')},e.attemptSetMediaKeys=function(t,e){var r=this,i=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+t+'"');var n=Promise.all(i).then((function(){if(!r.media)throw new Error("Attempted to set mediaKeys without media element attached");return r.media.setMediaKeys(e)}));return this.setMediaKeysQueue.push(n),n.then((function(){r.log('Media-keys set for "'+t+'"'),i.push(n),r.setMediaKeysQueue=r.setMediaKeysQueue.filter((function(t){return-1===i.indexOf(t)}))}))},e.generateRequestWithPreferredKeySession=function(t,e,r,i){var n,a,s=this,o=null==(n=this.config.drmSystems)||null==(a=n[t.keySystem])?void 0:a.generateRequest;if(o)try{var l=o.call(this.hls,e,r,t);if(!l)throw new Error("Invalid response from configured generateRequest filter");e=l.initDataType,r=t.decryptdata.pssh=l.initData?new Uint8Array(l.initData):null}catch(t){var u;if(this.warn(t.message),null!=(u=this.hls)&&u.config.debug)throw t}if(null===r)return this.log('Skipping key-session request for "'+i+'" (no initData)'),Promise.resolve(t);var h=this.getKeyIdString(t.decryptdata);this.log('Generating key-session request for "'+i+'": '+h+" (init data type: "+e+" length: "+(r?r.byteLength:null)+")");var d=new an;t.mediaKeysSession.onmessage=function(e){var r=t.mediaKeysSession;if(r){var i=e.messageType,n=e.message;s.log('"'+i+'" message event for session "'+r.sessionId+'" message size: '+n.byteLength),"license-request"===i||"license-renewal"===i?s.renewLicense(t,n).catch((function(t){s.handleError(t),d.emit("error",t)})):"license-release"===i?t.keySystem===W.FAIRPLAY&&(s.updateKeySession(t,Y("acknowledged")),s.removeSession(t)):s.warn('unhandled media key message type "'+i+'"')}else d.emit("error",new Error("invalid state"))},t.mediaKeysSession.onkeystatuseschange=function(e){if(t.mediaKeysSession){s.onKeyStatusChange(t);var r=t.keyStatus;d.emit("keyStatus",r),"expired"===r&&(s.warn(t.keySystem+" expired for key "+h),s.renewKeySession(t))}else d.emit("error",new Error("invalid state"))};var c=new Promise((function(t,e){d.on("error",e),d.on("keyStatus",(function(r){r.startsWith("usable")?t():"output-restricted"===r?e(new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?e(new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+r+'"')):"expired"===r?e(new Error("key expired while generating request")):s.warn('unhandled key status change "'+r+'"')}))}));return t.mediaKeysSession.generateRequest(e,r).then((function(){var e;s.log('Request generated for key-session "'+(null==(e=t.mediaKeysSession)?void 0:e.sessionId)+'" keyId: '+h)})).catch((function(t){throw new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_NO_SESSION,error:t,fatal:!1},"Error generating key-session request: "+t)})).then((function(){return c})).catch((function(e){throw d.removeAllListeners(),s.removeSession(t),e})).then((function(){return d.removeAllListeners(),t}))},e.onKeyStatusChange=function(t){var e=this;t.mediaKeysSession.keyStatuses.forEach((function(r,i){e.log('key status change "'+r+'" for keyStatuses keyId: '+yt("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))+" session keyId: "+yt(new Uint8Array(t.decryptdata.keyId||[]))+" uri: "+t.decryptdata.uri),t.keyStatus=r}))},e.fetchServerCertificate=function(t){var e=this.config,r=new(0,e.loader)(e),n=this.getServerCertificateUrl(t);return n?(this.log('Fetching serverCertificate for "'+t+'"'),new Promise((function(a,s){var o={responseType:"arraybuffer",url:n},l=e.certLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:function(t,e,r,i){a(t.data)},onError:function(e,r,a,l){s(new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:i({url:o.url,data:void 0},e)},'"'+t+'" certificate request failed ('+n+"). Status: "+e.code+" ("+e.text+")"))},onTimeout:function(e,r,i){s(new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:i,response:{url:o.url,data:void 0}},'"'+t+'" certificate request timed out ('+n+")"))},onAbort:function(t,e,r){s(new Error("aborted"))}};r.load(o,u,h)}))):Promise.resolve()},e.setMediaKeysServerCertificate=function(t,e,r){var i=this;return new Promise((function(n,a){t.setServerCertificate(r).then((function(a){i.log("setServerCertificate "+(a?"success":"not supported by CDM")+" ("+(null==r?void 0:r.byteLength)+') on "'+e+'"'),n(t)})).catch((function(t){a(new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:!0},t.message))}))}))},e.renewLicense=function(t,e){var r=this;return this.requestLicense(t,new Uint8Array(e)).then((function(e){return r.updateKeySession(t,new Uint8Array(e)).catch((function(t){throw new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:t,fatal:!0},t.message)}))}))},e.setupLicenseXHR=function(t,e,r,i){var n=this,a=this.config.licenseXhrSetup;return a?Promise.resolve().then((function(){if(!r.decryptdata)throw new Error("Key removed");return a.call(n.hls,t,e,r,i)})).catch((function(s){if(!r.decryptdata)throw s;return t.open("POST",e,!0),a.call(n.hls,t,e,r,i)})).then((function(r){return t.readyState||t.open("POST",e,!0),{xhr:t,licenseChallenge:r||i}})):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:i}))},e.requestLicense=function(t,e){var r=this,i=this.config.keyLoadPolicy.default;return new Promise((function(n,a){var s=r.getLicenseServerUrl(t.keySystem);r.log("Sending license request to URL: "+s);var o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=function(){if(!r.hls||!t.mediaKeysSession)return a(new Error("invalid state"));if(4===o.readyState)if(200===o.status){r._requestLicenseFailureCount=0;var l=o.response;r.log("License received "+(l instanceof ArrayBuffer?l.byteLength:l));var u=r.config.licenseResponseCallback;if(u)try{l=u.call(r.hls,o,s,t)}catch(t){r.error(t)}n(l)}else{var h=i.errorRetry,d=h?h.maxNumRetry:0;if(r._requestLicenseFailureCount++,r._requestLicenseFailureCount>d||o.status>=400&&o.status<500)a(new Da({type:S.KEY_SYSTEM_ERROR,details:L.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},"License Request XHR failed ("+s+"). Status: "+o.status+" ("+o.statusText+")"));else{var c=d-r._requestLicenseFailureCount+1;r.warn("Retrying license request, "+c+" attempts left"),r.requestLicense(t,e).then(n,a)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=o,r.setupLicenseXHR(o,s,t,e).then((function(t){var e=t.xhr,r=t.licenseChallenge;e.send(r)}))}))},e.onMediaAttached=function(t,e){if(this.config.emeEnabled){var r=e.media;this.media=r,r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}},e.onMediaDetached=function(){var e=this,r=this.media,i=this.mediaKeySessions;r&&(r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Bt.clearKeyUriToKeyIdMap();var n=i.length;t.CDMCleanupPromise=Promise.all(i.map((function(t){return e.removeSession(t)})).concat(null==r?void 0:r.setMediaKeys(null).catch((function(t){e.log("Could not clear media keys: "+t+". media.src: "+(null==r?void 0:r.src))})))).then((function(){n&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)})).catch((function(t){e.log("Could not close sessions and clear media keys: "+t+". media.src: "+(null==r?void 0:r.src))}))},e.onManifestLoading=function(){this.keyFormatPromise=null},e.onManifestLoaded=function(t,e){var r=e.sessionKeys;if(r&&this.config.emeEnabled&&!this.keyFormatPromise){var i=r.reduce((function(t,e){return-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t}),[]);this.log("Selecting key-system from session-keys "+i.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(i)}},e.removeSession=function(t){var e=this,r=t.mediaKeysSession,i=t.licenseXhr;if(r){this.log("Remove licenses and keys and close session "+r.sessionId),r.onmessage=null,r.onkeystatuseschange=null,i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;var n=this.mediaKeySessions.indexOf(t);return n>-1&&this.mediaKeySessions.splice(n,1),r.remove().catch((function(t){e.log("Could not remove session: "+t)})).then((function(){return r.close()})).catch((function(t){e.log("Could not close session: "+t)}))}},t}();ba.CDMCleanupPromise=void 0;var Da=function(t){function e(e,r){var i;return(i=t.call(this,r)||this).data=void 0,e.error||(e.error=new Error(r)),i.data=e,e.err=e.error,i}return l(e,t),e}(c(Error)),Ia="m",wa="a",Ca="v",_a="av",Pa="i",xa="tt",Fa=function(){function t(e){var r=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(t){try{r.apply(t,{ot:Ia,su:!r.initialized})}catch(t){I.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(t){try{var e=t.frag,i=r.hls.levels[e.level],n=r.getObjectType(e),a={d:1e3*e.duration,ot:n};n!==Ca&&n!==wa&&n!=_a||(a.br=i.bitrate/1e3,a.tb=r.getTopBandwidth(n)/1e3,a.bl=r.getBufferLength(n)),r.apply(t,a)}catch(t){I.warn("Could not generate segment CMCD data.",t)}},this.hls=e;var i=this.config=e.config,n=i.cmcd;null!=n&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||t.uuid(),this.cid=n.contentId,this.useHeaders=!0===n.useHeaders,this.registerListeners())}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHED,this.onMediaDetached,this),t.on(E.BUFFER_CREATED,this.onBufferCreated,this)},e.unregisterListeners=function(){var t=this.hls;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHED,this.onMediaDetached,this),t.off(E.BUFFER_CREATED,this.onBufferCreated,this)},e.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},e.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},e.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},e.onBufferCreated=function(t,e){var r,i;this.audioBuffer=null==(r=e.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(i=e.tracks.video)?void 0:i.buffer},e.createData=function(){var t;return{v:1,sf:"h",sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},e.apply=function(e,r){void 0===r&&(r={}),o(r,this.createData());var i=r.ot===Pa||r.ot===Ca||r.ot===_a;if(this.starved&&i&&(r.bs=!0,r.su=!0,this.starved=!1),null==r.su&&(r.su=this.buffering),this.useHeaders){var n=t.toHeaders(r);if(!Object.keys(n).length)return;e.headers||(e.headers={}),o(e.headers,n)}else{var a=t.toQuery(r);if(!a)return;e.url=t.appendQueryToUri(e.url,a)}},e.getObjectType=function(t){var e=t.type;return"subtitle"===e?xa:"initSegment"===t.sn?Pa:"audio"===e?wa:"main"===e?this.hls.audioTracks.length?Ca:_a:void 0},e.getTopBandwidth=function(t){var e,r=0,i=this.hls;if(t===wa)e=i.audioTracks;else{var n=i.maxAutoLevel,a=n>-1?n+1:i.levels.length;e=i.levels.slice(0,a)}for(var s,o=g(e);!(s=o()).done;){var l=s.value;l.bitrate>r&&(r=l.bitrate)}return r>0?r:NaN},e.getBufferLength=function(t){var e=this.hls.media,r=t===wa?this.audioBuffer:this.videoBuffer;return r&&e?1e3*Dr.bufferInfo(r,e.currentTime,this.config.maxBufferHole).len:NaN},e.createPlaylistLoader=function(){var t=this.config.pLoader,e=this.applyPlaylistData,r=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new r(t)}var i=t.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(t,r,i){e(t),this.loader.load(t,r,i)},a(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},e.createFragmentLoader=function(){var t=this.config.fLoader,e=this.applyFragmentData,r=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new r(t)}var i=t.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(t,r,i){e(t),this.loader.load(t,r,i)},a(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},t.uuid=function(){var t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)},t.serialize=function(t){for(var e,r=[],i=function(t){return!Number.isNaN(t)&&null!=t&&""!==t&&!1!==t},n=function(t){return Math.round(t)},a=function(t){return 100*n(t/100)},s={br:n,d:n,bl:a,dl:a,mtp:a,nor:function(t){return encodeURIComponent(t)},rtp:a,tb:n},o=g(Object.keys(t||{}).sort());!(e=o()).done;){var l=e.value,u=t[l];if(i(u)&&!("v"===l&&1===u||"pr"==l&&1===u)){var h=s[l];h&&(u=h(u));var d=typeof u,c=void 0;c="ot"===l||"sf"===l||"st"===l?l+"="+u:"boolean"===d?l:"number"===d?l+"="+u:l+"="+JSON.stringify(u),r.push(c)}}return r.join(",")},t.toHeaders=function(e){for(var r={},i=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},s=0,o=Object.keys(e);s<o.length;s++){var l=o[s];n[null!=a[l]?a[l]:1][l]=e[l]}for(var u=0;u<n.length;u++){var h=t.serialize(n[u]);h&&(r["CMCD-"+i[u]]=h)}return r},t.toQuery=function(e){return"CMCD="+encodeURIComponent(t.serialize(e))},t.appendQueryToUri=function(t,e){if(!e)return t;var r=t.includes("?")?"&":"?";return""+t+r+e},t}(),Oa=function(){function t(t){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=t,this.log=I.log.bind(I,"[content-steering]:"),this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(E.MANIFEST_PARSED,this.onManifestParsed,this),t.on(E.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t&&(t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(E.MANIFEST_PARSED,this.onManifestParsed,this),t.off(E.ERROR,this.onError,this))},e.startLoad=function(){if(this.started=!0,self.clearTimeout(this.reloadTimer),this.enabled&&this.uri)if(this.updated){var t=Math.max(1e3*this.timeToLoad-(performance.now()-this.updated),0);this.scheduleRefresh(this.uri,t)}else this.loadSteeringManifest(this.uri)},e.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),self.clearTimeout(this.reloadTimer)},e.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},e.removeLevel=function(t){var e=this.levels;e&&(this.levels=e.filter((function(e){return e!==t})))},e.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},e.onManifestLoaded=function(t,e){var r=e.contentSteering;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())},e.onManifestParsed=function(t,e){this.audioTracks=e.audioTracks,this.subtitleTracks=e.subtitleTracks},e.onError=function(t,e){var r=e.errorAction;if((null==r?void 0:r.action)===rr&&r.flags===ar){var i=this.pathwayPriority,n=this.pathwayId;this.penalizedPathways[n]||(this.penalizedPathways[n]=performance.now()),!i&&this.levels&&(i=this.levels.reduce((function(t,e){return-1===t.indexOf(e.pathwayId)&&t.push(e.pathwayId),t}),[])),i&&i.length>1&&(this.updatePathwayPriority(i),r.resolved=this.pathwayId!==n)}},e.filterParsedLevels=function(t){this.levels=t;var e=this.getLevelsForPathway(this.pathwayId);if(0===e.length){var r=t[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+r+'"'),e=this.getLevelsForPathway(r),this.pathwayId=r}return e.length!==t.length?(this.log("Found "+e.length+"/"+t.length+' levels in Pathway "'+this.pathwayId+'"'),e):t},e.getLevelsForPathway=function(t){return null===this.levels?[]:this.levels.filter((function(e){return t===e.pathwayId}))},e.updatePathwayPriority=function(t){var e;this.pathwayPriority=t;var r=this.penalizedPathways,i=performance.now();Object.keys(r).forEach((function(t){i-r[t]>3e5&&delete r[t]}));for(var n=0;n<t.length;n++){var a=t[n];if(!r[a]){if(a===this.pathwayId)return;var s=this.hls.nextLoadLevel,o=this.hls.levels[s];if((e=this.getLevelsForPathway(a)).length>0){this.log('Setting Pathway to "'+a+'"'),this.pathwayId=a,this.hls.trigger(E.LEVELS_UPDATED,{levels:e});var l=this.hls.levels[s];o&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==o.bitrate&&this.log("Unstable Pathways change from bitrate "+o.bitrate+" to "+l.bitrate),this.hls.nextLoadLevel=s);break}}}},e.clonePathways=function(t){var e=this,r=this.levels;if(r){var i={},n={};t.forEach((function(t){var a=t.ID,s=t["BASE-ID"],l=t["URI-REPLACEMENT"];if(!r.some((function(t){return t.pathwayId===a}))){var u=e.getLevelsForPathway(s).map((function(t){var e=o({},t);e.details=void 0,e.url=Na(t.uri,t.attrs["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l);var r=new _(t.attrs);r["PATHWAY-ID"]=a;var s=r.AUDIO&&r.AUDIO+"_clone_"+a,u=r.SUBTITLES&&r.SUBTITLES+"_clone_"+a;s&&(i[r.AUDIO]=s,r.AUDIO=s),u&&(n[r.SUBTITLES]=u,r.SUBTITLES=u),e.attrs=r;var h=new Me(e);return hr(h,"audio",s),hr(h,"text",u),h}));r.push.apply(r,u),Ma(e.audioTracks,i,l,a),Ma(e.subtitleTracks,n,l,a)}}))}},e.loadSteeringManifest=function(t){var e,r=this,i=this.hls.config,n=i.loader;this.loader&&this.loader.destroy(),this.loader=new n(i);try{e=new self.URL(t)}catch(e){return this.enabled=!1,void this.log("Failed to parse Steering Manifest URI: "+t)}if("data:"!==e.protocol){var a=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);e.searchParams.set("_HLS_pathway",this.pathwayId),e.searchParams.set("_HLS_throughput",""+a)}var s={responseType:"json",url:e.href},o=i.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},u={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},h={onSuccess:function(t,i,n,a){r.log('Loaded steering manifest: "'+e+'"');var s=t.data;if(1===s.VERSION){r.updated=performance.now(),r.timeToLoad=s.TTL;var o=s["RELOAD-URI"],l=s["PATHWAY-CLONES"],u=s["PATHWAY-PRIORITY"];if(o)try{r.uri=new self.URL(o,e).href}catch(t){return r.enabled=!1,void r.log("Failed to parse Steering Manifest RELOAD-URI: "+o)}r.scheduleRefresh(r.uri||n.url),l&&r.clonePathways(l),u&&r.updatePathwayPriority(u)}else r.log("Steering VERSION "+s.VERSION+" not supported!")},onError:function(t,e,i,n){if(r.log("Error loading steering manifest: "+t.code+" "+t.text+" ("+e.url+")"),r.stopLoad(),410===t.code)return r.enabled=!1,void r.log("Steering manifest "+e.url+" no longer available");var a=1e3*r.timeToLoad;if(429!==t.code)r.scheduleRefresh(r.uri||e.url,a);else{var s=r.loader;if("function"==typeof(null==s?void 0:s.getResponseHeader)){var o=s.getResponseHeader("Retry-After");o&&(a=1e3*parseFloat(o))}r.log("Steering manifest "+e.url+" rate limited")}},onTimeout:function(t,e,i){r.log("Timeout loading steering manifest ("+e.url+")"),r.scheduleRefresh(r.uri||e.url)}};this.log("Requesting steering manifest: "+e),this.loader.load(s,u,h)},e.scheduleRefresh=function(t,e){var r=this;void 0===e&&(e=1e3*this.timeToLoad),self.clearTimeout(this.reloadTimer),this.reloadTimer=self.setTimeout((function(){r.loadSteeringManifest(t)}),e)},t}();function Ma(t,e,r,i){t&&Object.keys(e).forEach((function(n){var a=t.filter((function(t){return t.groupId===n})).map((function(t){var a=o({},t);return a.details=void 0,a.attrs=new _(a.attrs),a.url=a.attrs.URI=Na(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),a.groupId=a.attrs["GROUP-ID"]=e[n],a.attrs["PATHWAY-ID"]=i,a}));t.push.apply(t,a)}))}function Na(t,e,r,i){var n,a=i.HOST,s=i.PARAMS,o=i[r];e&&(n=null==o?void 0:o[e])&&(t=n);var l=new self.URL(t);return a&&!n&&(l.host=a),s&&Object.keys(s).sort().forEach((function(t){t&&l.searchParams.set(t,s[t])})),l.href}var Ua=/^age:\s*[\d.]+\s*$/im,Ba=function(){function t(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new F,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.loadInternal()},e.loadInternal=function(){var t=this,e=this.config,r=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var a=this.xhrSetup;a?Promise.resolve().then((function(){if(!t.stats.aborted)return a(i,r.url)})).catch((function(t){return i.open("GET",r.url,!0),a(i,r.url)})).then((function(){t.stats.aborted||t.openAndSendXhr(i,r,e)})).catch((function(e){t.callbacks.onError({code:i.status,text:e.message},r,i,n)})):this.openAndSendXhr(i,r,e)}},e.openAndSendXhr=function(t,e,r){t.readyState||t.open("GET",e.url,!0);var i=this.context.headers,n=r.loadPolicy,a=n.maxTimeToFirstByteMs,s=n.maxLoadTimeMs;if(i)for(var o in i)t.setRequestHeader(o,i[o]);e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=e.responseType,self.clearTimeout(this.requestTimeout),r.timeout=a&&T(a)?a:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),t.send()},e.readystatechange=function(){var t=this.context,e=this.loader,r=this.stats;if(t&&e){var i=e.readyState,n=this.config;if(!r.aborted&&i>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;var a=e.status,s="text"!==e.responseType;if(a>=200&&a<300&&(s&&e.response||null!==e.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);var o=s?e.response:e.responseText,l="arraybuffer"===e.responseType?o.byteLength:o.length;if(r.loaded=r.total=l,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first),!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(r,t,o,e),!this.callbacks)return;var h={url:e.responseURL,data:o,code:a};this.callbacks.onSuccess(h,r,t,e)}else{var d=n.loadPolicy.errorRetry;Xe(d,r.retry,!1,a)?this.retry(d):(I.error(a+" while loading "+t.url),this.callbacks.onError({code:a,text:e.statusText},t,e,r))}}}},e.loadtimeout=function(){var t,e=null==(t=this.config)?void 0:t.loadPolicy.timeoutRetry;if(Xe(e,this.stats.retry,!0))this.retry(e);else{I.warn("timeout while loading "+this.context.url);var r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}},e.retry=function(t){var e=this.context,r=this.stats;this.retryDelay=je(t,r.retry),r.retry++,I.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+e.url+", retrying "+r.retry+"/"+t.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&Ua.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},e.getResponseHeader=function(t){return this.loader&&new RegExp("^"+t+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null},t}(),Ga=/(\d+)-(\d+)\/(\d+)/,Ka=function(){function t(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||Ha,this.controller=new self.AbortController,this.stats=new F}var e=t.prototype;return e.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},e.abortInternal=function(){var t=this.response;null!=t&&t.ok||(this.stats.aborted=!0,this.controller.abort())},e.abort=function(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},e.load=function(t,e,r){var i=this,n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();var a=function(t,e){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(o({},t.headers))};return t.rangeEnd&&r.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),r}(t,this.controller.signal),s=r.onProgress,l="arraybuffer"===t.responseType,u=l?"byteLength":"length",h=e.loadPolicy,d=h.maxTimeToFirstByteMs,c=h.maxLoadTimeMs;this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,a),self.clearTimeout(this.requestTimeout),e.timeout=d&&T(d)?d:c,this.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(n,t,i.response)}),e.timeout),self.fetch(this.request).then((function(a){i.response=i.loader=a;var o=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(i.requestTimeout),e.timeout=c,i.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(n,t,i.response)}),c-(o-n.loading.start)),!a.ok){var u=a.status,h=a.statusText;throw new Va(h||"fetch, bad network response",u,a)}return n.loading.first=o,n.total=function(t){var e=t.get("Content-Range");if(e){var r=function(t){var e=Ga.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(T(r))return r}var i=t.get("Content-Length");if(i)return parseInt(i)}(a.headers)||n.total,s&&T(e.highWaterMark)?i.loadProgressively(a,n,t,e.highWaterMark,s):l?a.arrayBuffer():"json"===t.responseType?a.json():a.text()})).then((function(a){var o=i.response;self.clearTimeout(i.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);var l=a[u];l&&(n.loaded=n.total=l);var h={url:o.url,data:a,code:o.status};s&&!T(e.highWaterMark)&&s(n,t,a,o),r.onSuccess(h,n,t,o)})).catch((function(e){if(self.clearTimeout(i.requestTimeout),!n.aborted){var a=e&&e.code||0,s=e?e.message:null;r.onError({code:a,text:s},t,e?e.details:null,n)}}))},e.getCacheAge=function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t},e.getResponseHeader=function(t){return this.response?this.response.headers.get(t):null},e.loadProgressively=function(t,e,r,i,n){void 0===i&&(i=0);var a=new mn,s=t.body.getReader();return function o(){return s.read().then((function(s){if(s.done)return a.dataLength&&n(e,r,a.flush(),t),Promise.resolve(new ArrayBuffer(0));var l=s.value,u=l.length;return e.loaded+=u,u<i||a.dataLength?(a.push(l),a.dataLength>=i&&n(e,r,a.flush(),t)):n(e,r,l,t),o()})).catch((function(){return Promise.reject()}))}()},t}();function Ha(t,e){return new self.Request(t.url,e)}var Va=function(t){function e(e,r,i){var n;return(n=t.call(this,e)||this).code=void 0,n.details=void 0,n.code=r,n.details=i,n}return l(e,t),e}(c(Error)),Ya=/\s/,Wa=i(i({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ba,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:vn,bufferController:In,capLevelController:Ra,errorController:or,fpsController:Aa,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:tt,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(t,e,r,i){for(var n,a,s,o,l,u=[],h=self.VTTCue||self.TextTrackCue,d=0;d<i.rows.length;d++)if(s=!0,o=0,l="",!(n=i.rows[d]).isEmpty()){for(var c,f=0;f<n.chars.length;f++)Ya.test(n.chars[f].uchar)&&s?o++:(l+=n.chars[f].uchar,s=!1);n.cueStartTime=e,e===r&&(r+=1e-4),o>=16?o--:o++;var g=ia(l.trim()),v=la(e,r,g);null!=t&&null!=(c=t.cues)&&c.getCueById(v)||((a=new h(e,r,g)).id=v,a.line=d+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*o/32)),u.push(a))}return t&&u.length&&(u.sort((function(t,e){return"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line})),u.forEach((function(e){return Ee(t,e)}))),u}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:Sn,subtitleTrackController:Rn,timelineController:Sa,audioStreamController:pn,audioTrackController:yn,emeController:ba,cmcdController:Fa,contentSteeringController:Oa});function ja(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(ja):Object.keys(t).reduce((function(e,r){return e[r]=ja(t[r]),e}),{}):t}function qa(t){var e=t.loader;e!==Ka&&e!==Ba?(I.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1}()&&(t.loader=Ka,t.progressive=!0,t.enableSoftwareAES=!0,I.log("[config]: Progressive streaming enabled, using FetchLoader"))}var Xa=function(){function t(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new an,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,D(e.debug||!1,"Hls instance");var r=this.config=function(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var r=ja(t),n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((function(t){var i=("level"===t?"playlist":t)+"LoadPolicy",a=void 0===e[i],s=[];n.forEach((function(n){var o=t+"Loading"+n,l=e[o];if(void 0!==l&&a){s.push(o);var u=r[i].default;switch(e[i]={default:u},n){case"TimeOut":u.maxLoadTimeMs=l,u.maxTimeToFirstByteMs=l;break;case"MaxRetry":u.errorRetry.maxNumRetry=l,u.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":u.errorRetry.retryDelayMs=l,u.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=l,u.timeoutRetry.maxRetryDelayMs=l}}})),s.length&&I.warn('hls.js config: "'+s.join('", "')+'" setting(s) are deprecated, use "'+i+'": '+JSON.stringify(e[i]))})),i(i({},r),e)}(t.DefaultConfig,e);this.userConfig=e,this._autoLevelCapping=-1,r.progressive&&qa(r);var n=r.abrController,a=r.bufferController,s=r.capLevelController,o=r.errorController,l=r.fpsController,u=new o(this),h=this.abrController=new n(this),d=this.bufferController=new a(this),c=this.capLevelController=new s(this),f=new l(this),g=new ye(this),v=new we(this),m=r.contentSteeringController,p=m?new m(this):null,y=this.levelController=new ur(this,p),T=new mr(this),S=new Ar(this.config),L=this.streamController=new cn(this,T,S);c.setStreamController(L),f.setStreamController(L);var R=[g,y,L];p&&R.splice(1,0,p),this.networkControllers=R;var A=[h,d,c,f,v,T];this.audioTrackController=this.createController(r.audioTrackController,R);var k=r.audioStreamController;k&&R.push(new k(this,T,S)),this.subtitleTrackController=this.createController(r.subtitleTrackController,R);var b=r.subtitleStreamController;b&&R.push(new b(this,T,S)),this.createController(r.timelineController,A),S.emeController=this.emeController=this.createController(r.emeController,A),this.cmcdController=this.createController(r.cmcdController,A),this.latencyController=this.createController(Ce,A),this.coreComponents=A,R.push(u);var w=u.onErrorOut;"function"==typeof w&&this.on(E.ERROR,w,u)}t.isSupported=function(){return function(){var t=jt();if(!t)return!1;var e=Jr(),r=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!r&&!!i}()};var e=t.prototype;return e.createController=function(t,e){if(t){var r=new t(this);return e&&e.push(r),r}return null},e.on=function(t,e,r){void 0===r&&(r=this),this._emitter.on(t,e,r)},e.once=function(t,e,r){void 0===r&&(r=this),this._emitter.once(t,e,r)},e.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},e.off=function(t,e,r,i){void 0===r&&(r=this),this._emitter.off(t,e,r,i)},e.listeners=function(t){return this._emitter.listeners(t)},e.emit=function(t,e,r){return this._emitter.emit(t,e,r)},e.trigger=function(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){I.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(E.ERROR,{type:S.OTHER_ERROR,details:L.INTERNAL_EXCEPTION,fatal:!1,event:t,error:e})}return!1},e.listenerCount=function(t){return this._emitter.listenerCount(t)},e.destroy=function(){I.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(t){return t.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(t){return t.destroy()})),this.coreComponents.length=0;var t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null},e.attachMedia=function(t){I.log("attachMedia"),this._media=t,this.trigger(E.MEDIA_ATTACHING,{media:t})},e.detachMedia=function(){I.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null},e.loadSource=function(t){this.stopLoad();var e=this.media,r=this.url,i=this.url=y.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});I.log("loadSource:"+i),e&&r&&(r!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(E.MANIFEST_LOADING,{url:t})},e.startLoad=function(t){void 0===t&&(t=-1),I.log("startLoad("+t+")"),this.networkControllers.forEach((function(e){e.startLoad(t)}))},e.stopLoad=function(){I.log("stopLoad"),this.networkControllers.forEach((function(t){t.stopLoad()}))},e.swapAudioCodec=function(){I.log("swapAudioCodec"),this.streamController.swapAudioCodec()},e.recoverMediaError=function(){I.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},e.removeLevel=function(t,e){void 0===e&&(e=0),this.levelController.removeLevel(t,e)},a(t,[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){I.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){I.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){I.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){I.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){I.log("set startLevel:"+t),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(I.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"ttfbEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(t){_e.indexOf(t)>-1&&(this._maxHdcpLevel=t)}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var r=t.length,i=0;i<r;i++)if(t[i].maxBitrate>=e)return i;return 0}},{key:"maxAutoLevel",get:function(){var t,e=this.levels,r=this.autoLevelCapping,i=this.maxHdcpLevel;if(t=-1===r&&e&&e.length?e.length-1:r,i)for(var n=t;n--;){var a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=i)return n}return t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){}},{key:"Events",get:function(){return E}},{key:"ErrorTypes",get:function(){return S}},{key:"ErrorDetails",get:function(){return L}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:Wa},set:function(e){t.defaultConfig=e}}]),t}();return Xa.defaultConfig=void 0,Xa},"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(r="undefined"!=typeof globalThis?globalThis:r||self).Hls=i()}(!1);
- //# sourceMappingURL=hls.min.js.map
- /**
- * @file plugin.js
- */
- let flvjs = window.flvjs
- let flv265 = window.flv265
- let videojs = window.videojs
- let Html5 = videojs.getTech('Html5');
- let mergeOptions = videojs.mergeOptions || videojs.util.mergeOptions;
- let defaults = {
- mediaDataSource: {},
- config: {}
- };
- class Flvjs extends Html5 {
- /**
- * Create an instance of this Tech.
- *
- * @param {Object} [options]
- * The key/value store of player options.
- *
- * @param {Component~ReadyCallback} ready
- * Callback function to call when the `Flvjs` Tech is ready.
- */
- constructor(options, ready) {
- options = mergeOptions(defaults, options);
- super(options, ready);
- }
- /**
- * A getter/setter for the `Flvjs` Tech's source object.
- *
- * @param {Tech~SourceObject} [src]
- * The source object you want to set on the `Flvjs` techs.
- *
- * @return {Tech~SourceObject|undefined}
- * - The current source object when a source is not passed in.
- * - undefined when setting
- */
- setSrc(src) {
- if (this.flvPlayer) {
- // Is this necessary to change source?
- this.flvPlayer.detachMediaElement();
- this.flvPlayer.destroy();
- }
- const mediaDataSource = this.options_.mediaDataSource;
- const config = this.options_.config;
- mediaDataSource.type = mediaDataSource.type === undefined ? 'flv' : mediaDataSource.type;
- mediaDataSource.url = src;
- // const features = flv265.getFeatureList()
- // console.log("features = ", features.nativeMP4H265Playback)
- // if (features.nativeMP4H265Playback) this.flvPlayer = flv265.createPlayer(mediaDataSource, config);
- // else this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
- this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
- this.flvPlayer.attachMediaElement(this.el_);
- this.flvPlayer.load();
- }
- /**
- * Dispose of flvjs.
- */
- dispose() {
- if (this.flvPlayer) {
- this.flvPlayer.detachMediaElement();
- this.flvPlayer.destroy();
- }
- super.dispose();
- }
- }
- /**
- * Check if the Flvjs tech is currently supported.
- *
- * @return {boolean}
- * - True if the Flvjs tech is supported.
- * - False otherwise.
- */
- Flvjs.isSupported = function () {
- return flvjs && flvjs.isSupported();
- };
- /**
- * Flvjs supported mime types.
- *
- * @constant {Object}
- */
- Flvjs.formats = {
- 'video/flv': 'FLV',
- 'video/x-flv': 'FLV'
- };
- /**
- * Check if the tech can support the given type
- *
- * @param {string} type
- * The mimetype to check
- * @return {string} 'probably', 'maybe', or '' (empty string)
- */
- Flvjs.canPlayType = function (type) {
- if (Flvjs.isSupported() && type in Flvjs.formats) {
- return 'maybe';
- }
- return '';
- };
- /**
- * Check if the tech can support the given source
- * @param {Object} srcObj
- * The source object
- * @param {Object} options
- * The options passed to the tech
- * @return {string} 'probably', 'maybe', or '' (empty string)
- */
- Flvjs.canPlaySource = function (srcObj, options) {
- return Flvjs.canPlayType(srcObj.type);
- };
- // Include the version number.
- Flvjs.VERSION = '__VERSION__';
- videojs.registerTech('Flvjs', Flvjs);
- /**
- * @file plugin.js
- */
- const Hls = window.Hls
- class Hlsjs extends Html5 {
- /**
- * Create an instance of this Tech.
- *
- * @param {Object} [options]
- * The key/value store of player options.
- *
- * @param {Component~ReadyCallback} ready
- * Callback function to call when the `Hlsjs` Tech is ready.
- */
- constructor(options, ready) {
- options = videojs.obj.merge(defaults, options);
- super(options, ready);
- }
- /**
- * A getter/setter for the `Hlsjs` Tech's source object.
- *
- * @param {Tech~SourceObject} [src]
- * The source object you want to set on the `Hlsjs` techs.
- *
- * @return {Tech~SourceObject|undefined}
- * - The current source object when a source is not passed in.
- * - undefined when setting
- */
- setSrc(src) {
- if (this.hlsPlayer) {
- this.hlsPlayer.detachMedia();
- this.hlsPlayer.destroy();
- }
- this.src_ = src
- this.hlsPlayer = new Hls();
- this.hlsPlayer.attachMedia(this.el_);
- this.hlsPlayer.loadSource(this.src_);
- this.hlsPlayer.once(Hls.Events.LEVEL_PTS_UPDATED, (event, data) => this.isLive_ = data.details.live) // 设置直播状态
- }
- autoplay() {
- return this.options_.autoplay;
- }
- currentSrc() {
- if (this.hlsPlayer) return this.hlsPlayer.url;
- return this.el_.currentSrc;
- }
- setCurrentTime(seconds) {
- this.el_.currentTime = seconds;
- }
- play() {
- this.el_.play();
- }
- duration() {
- if (this.isLive_) return Infinity
- else return this.el_.duration
- }
- /**
- * Dispose of Hlsjs.
- */
- dispose() {
- if (this.hlsPlayer) {
- this.hlsPlayer.detachMedia();
- this.hlsPlayer.destroy();
- }
- super.dispose();
- }
- }
- /**
- * Check if the Hlsjs tech is currently supported.
- *
- * @return {boolean}
- * - True if the Hlsjs tech is supported.
- * - False otherwise.
- */
- Hlsjs.isSupported = function () {
- return Hls && Hls.isSupported();
- };
- /**
- * Check if the tech can support the given source
- * @param {Object} srcObj
- * The source object
- * @param {Object} options
- * The options passed to the tech
- * @return {string} 'probably', 'maybe', or '' (empty string)
- */
- // Hlsjs.canPlaySource = function (srcObj, options) {
- // return Hlsjs.canPlayType(srcObj.type);
- // };
- // Include the version number.
- Hlsjs.VERSION = '1.0.0';
- videojs.registerTech('Hlsjs', Hlsjs);
- /*! videojs-resolution-switcher - 2015-7-26
- * Copyright (c) 2016 Kasper Moskwiak
- * Modified by Pierre Kraft
- * Licensed under the Apache-2.0 license. */
- (function() {
- /* jshint eqnull: true*/
- /* global require */
- 'use strict';
- var videojs = null;
- if(typeof window.videojs === 'undefined' && typeof require === 'function') {
- videojs = require('video.js');
- } else {
- videojs = window.videojs;
- }
- (function(window, videojs) {
- var defaults = {},
- videoJsResolutionSwitcher,
- currentResolution = {}, // stores current resolution
- menuItemsHolder = {}; // stores menuItems
- function setSourcesSanitized(player, sources, label, customSourcePicker) {
- currentResolution = {
- label: label,
- sources: sources
- };
- if(typeof customSourcePicker === 'function'){
- return customSourcePicker(player, sources, label);
- }
- return player.src(sources.map(function(src) {
- return {src: src.src, type: src.type, res: src.res};
- }));
- }
- /*
- * Resolution menu item
- */
- var MenuItem = videojs.getComponent('MenuItem');
- // const Component = videojs.getComponent('Component');
- class ResolutionMenuItem extends MenuItem {
- constructor(player, options, onClickListener, label){
- super(player, options, onClickListener, label)
- this.onClickListener = onClickListener;
- this.label = label;
- // Sets this.player_, this.options_ and initializes the component
- MenuItem.call(this, player, options);
- this.src = options.src;
- this.on('click', this.onClick);
- this.on('touchstart', this.onClick);
- if (options.initialySelected) {
- this.showAsLabel();
- this.selected(true);
- this.addClass('vjs-selected');
- }
- }
- showAsLabel() {
- // Change menu button label to the label of this item if the menu button label is provided
- if(this.label) {
- this.label.innerHTML = this.options_.label;
- }
- }
- onClick(customSourcePicker){
- this.onClickListener(this);
- // Remember player state
- var currentTime = this.player_.currentTime();
- var isPaused = this.player_.paused();
- this.showAsLabel();
- // add .current class
- this.addClass('vjs-selected');
- // Hide bigPlayButton
- if(!isPaused){
- this.player_.bigPlayButton.hide();
- }
- if(typeof customSourcePicker !== 'function' &&
- typeof this.options_.customSourcePicker === 'function'){
- customSourcePicker = this.options_.customSourcePicker;
- }
- // Change player source and wait for loadeddata event, then play video
- // loadedmetadata doesn't work right now for flash.
- // Probably because of https://github.com/videojs/video-js-swf/issues/124
- // If player preload is 'none' and then loadeddata not fired. So, we need timeupdate event for seek handle (timeupdate doesn't work properly with flash)
- var handleSeekEvent = 'loadeddata';
- if(this.player_.techName_ !== 'Youtube' && this.player_.preload() === 'none' && this.player_.techName_ !== 'Flash') {
- handleSeekEvent = 'timeupdate';
- }
- setSourcesSanitized(this.player_, this.src, this.options_.label, customSourcePicker)
- this.player_.one(handleSeekEvent, function() {
- this.player_.currentTime(currentTime);
- this.player_.handleTechSeeked_();
- this.player_.trigger('resolutionchange');
- });
- }
- }
- videojs.registerComponent('ResolutionMenuItem', ResolutionMenuItem);
- // var ResolutionMenuItem = videojs.extend(MenuItem, {
- // constructor: function(player, options, onClickListener, label){
- // this.onClickListener = onClickListener;
- // this.label = label;
- // // Sets this.player_, this.options_ and initializes the component
- // MenuItem.call(this, player, options);
- // this.src = options.src;
- //
- // this.on('click', this.onClick);
- // this.on('touchstart', this.onClick);
- //
- // if (options.initialySelected) {
- // this.showAsLabel();
- // this.selected(true);
- //
- // this.addClass('vjs-selected');
- // }
- // },
- // showAsLabel: function() {
- // // Change menu button label to the label of this item if the menu button label is provided
- // if(this.label) {
- // this.label.innerHTML = this.options_.label;
- // }
- // },
- // onClick: function(customSourcePicker){
- // this.onClickListener(this);
- // // Remember player state
- // var currentTime = this.player_.currentTime();
- // var isPaused = this.player_.paused();
- // this.showAsLabel();
- //
- // // add .current class
- // this.addClass('vjs-selected');
- //
- // // Hide bigPlayButton
- // if(!isPaused){
- // this.player_.bigPlayButton.hide();
- // }
- // if(typeof customSourcePicker !== 'function' &&
- // typeof this.options_.customSourcePicker === 'function'){
- // customSourcePicker = this.options_.customSourcePicker;
- // }
- // // Change player source and wait for loadeddata event, then play video
- // // loadedmetadata doesn't work right now for flash.
- // // Probably because of https://github.com/videojs/video-js-swf/issues/124
- // // If player preload is 'none' and then loadeddata not fired. So, we need timeupdate event for seek handle (timeupdate doesn't work properly with flash)
- // var handleSeekEvent = 'loadeddata';
- // if(this.player_.techName_ !== 'Youtube' && this.player_.preload() === 'none' && this.player_.techName_ !== 'Flash') {
- // handleSeekEvent = 'timeupdate';
- // }
- // setSourcesSanitized(this.player_, this.src, this.options_.label, customSourcePicker)
- // this.player_.one(handleSeekEvent, function() {
- // this.player_.currentTime(currentTime);
- // this.player_.handleTechSeeked_();
- // this.player_.trigger('resolutionchange');
- // });
- // }
- // });
- /*
- * Resolution menu button
- */
- var MenuButton = videojs.getComponent('MenuButton');
- class ResolutionMenuButton extends MenuButton {
- constructor(player, options, settings, label){
- super(player, options, settings, label)
- this.sources = options.sources;
- this.label = label;
- this.label.innerHTML = options.initialySelectedLabel;
- // Sets this.player_, this.options_ and initializes the component
- MenuButton.call(this, player, options, settings);
- this.controlText('Quality');
- if(settings.dynamicLabel){
- this.el().appendChild(label);
- }else{
- var staticLabel = document.createElement('span');
- videojs.dom.addClass(staticLabel, 'vjs-resolution-button-staticlabel');
- this.el().appendChild(staticLabel);
- }
- }
- createItems(){
- var menuItems = [];
- var labels = (this.sources && this.sources.label) || {};
- var onClickUnselectOthers = function(clickedItem) {
- menuItems.map(function(item) {
- item.selected(item === clickedItem);
- item.removeClass('vjs-selected');
- });
- };
- for (var key in labels) {
- if (labels.hasOwnProperty(key)) {
- menuItems.push(new ResolutionMenuItem(
- this.player_,
- {
- label: key,
- src: labels[key],
- initialySelected: key === this.options_.initialySelectedLabel,
- customSourcePicker: this.options_.customSourcePicker
- },
- onClickUnselectOthers,
- this.label));
- // Store menu item for API calls
- menuItemsHolder[key] = menuItems[menuItems.length - 1];
- }
- }
- return menuItems;
- }
- }
- videojs.registerComponent('ResolutionMenuButton', ResolutionMenuButton);
- // var ResolutionMenuButton = videojs.extend(MenuButton, {
- // constructor: function(player, options, settings, label){
- // this.sources = options.sources;
- // this.label = label;
- // this.label.innerHTML = options.initialySelectedLabel;
- // // Sets this.player_, this.options_ and initializes the component
- // MenuButton.call(this, player, options, settings);
- // this.controlText('Quality');
- //
- // if(settings.dynamicLabel){
- // this.el().appendChild(label);
- // }else{
- // var staticLabel = document.createElement('span');
- // videojs.dom.addClass(staticLabel, 'vjs-resolution-button-staticlabel');
- // this.el().appendChild(staticLabel);
- // }
- // },
- // createItems: function(){
- // var menuItems = [];
- // var labels = (this.sources && this.sources.label) || {};
- // var onClickUnselectOthers = function(clickedItem) {
- // menuItems.map(function(item) {
- // item.selected(item === clickedItem);
- // item.removeClass('vjs-selected');
- // });
- // };
- //
- // for (var key in labels) {
- // if (labels.hasOwnProperty(key)) {
- // menuItems.push(new ResolutionMenuItem(
- // this.player_,
- // {
- // label: key,
- // src: labels[key],
- // initialySelected: key === this.options_.initialySelectedLabel,
- // customSourcePicker: this.options_.customSourcePicker
- // },
- // onClickUnselectOthers,
- // this.label));
- // // Store menu item for API calls
- // menuItemsHolder[key] = menuItems[menuItems.length - 1];
- // }
- // }
- // return menuItems;
- // }
- // });
- /**
- * Initialize the plugin.
- * @param {object} [options] configuration for the plugin
- */
- videoJsResolutionSwitcher = function(options) {
- var settings = videojs.mergeOptions(defaults, options),
- player = this,
- label = document.createElement('span'),
- groupedSrc = {};
- videojs.dom.addClass(label, 'vjs-resolution-button-label');
- /**
- * Updates player sources or returns current source URL
- * @param {Array} [src] array of sources [{src: '', type: '', label: '', res: ''}]
- * @returns {Object|String|Array} videojs player object if used as setter or current source URL, object, or array of sources
- */
- player.updateSrc = function(src){
- //Return current src if src is not given
- if(!src){ return player.src(); }
- // Dispose old resolution menu button before adding new sources
- if(player.controlBar.resolutionSwitcher){
- player.controlBar.resolutionSwitcher.dispose();
- delete player.controlBar.resolutionSwitcher;
- }
- //Sort sources
- src = src.sort(compareResolutions);
- groupedSrc = bucketSources(src);
- var choosen = chooseSrc(groupedSrc, src);
- var menuButton = new ResolutionMenuButton(player, { sources: groupedSrc, initialySelectedLabel: choosen.label , initialySelectedRes: choosen.res , customSourcePicker: settings.customSourcePicker}, settings, label);
- videojs.dom.addClass(menuButton.el(), 'vjs-resolution-button');
- player.controlBar.resolutionSwitcher = player.controlBar.el_.insertBefore(menuButton.el_, player.controlBar.getChild('fullscreenToggle').el_);
- player.controlBar.resolutionSwitcher.dispose = function(){
- this.parentNode.removeChild(this);
- };
- return setSourcesSanitized(player, choosen.sources, choosen.label);
- };
- /**
- * Returns current resolution or sets one when label is specified
- * @param {String} [label] label name
- * @param {Function} [customSourcePicker] custom function to choose source. Takes 3 arguments: player, sources, label. Must return player object.
- * @returns {Object} current resolution object {label: '', sources: []} if used as getter or player object if used as setter
- */
- player.currentResolution = function(label, customSourcePicker){
- if(label == null) { return currentResolution; }
- if(menuItemsHolder[label] != null){
- menuItemsHolder[label].onClick(customSourcePicker);
- }
- return player;
- };
- /**
- * Returns grouped sources by label, resolution and type
- * @returns {Object} grouped sources: { label: { key: [] }, res: { key: [] }, type: { key: [] } }
- */
- player.getGroupedSrc = function(){
- return groupedSrc;
- };
- /**
- * Method used for sorting list of sources
- * @param {Object} a - source object with res property
- * @param {Object} b - source object with res property
- * @returns {Number} result of comparation
- */
- function compareResolutions(a, b){
- if(!a.res || !b.res){ return 0; }
- return (+b.res)-(+a.res);
- }
- /**
- * Group sources by label, resolution and type
- * @param {Array} src Array of sources
- * @returns {Object} grouped sources: { label: { key: [] }, res: { key: [] }, type: { key: [] } }
- */
- function bucketSources(src){
- var resolutions = {
- label: {},
- res: {},
- type: {}
- };
- src.map(function(source) {
- initResolutionKey(resolutions, 'label', source);
- initResolutionKey(resolutions, 'res', source);
- initResolutionKey(resolutions, 'type', source);
- appendSourceToKey(resolutions, 'label', source);
- appendSourceToKey(resolutions, 'res', source);
- appendSourceToKey(resolutions, 'type', source);
- });
- return resolutions;
- }
- function initResolutionKey(resolutions, key, source) {
- if(resolutions[key][source[key]] == null) {
- resolutions[key][source[key]] = [];
- }
- }
- function appendSourceToKey(resolutions, key, source) {
- resolutions[key][source[key]].push(source);
- }
- /**
- * Choose src if option.default is specified
- * @param {Object} groupedSrc {res: { key: [] }}
- * @param {Array} src Array of sources sorted by resolution used to find high and low res
- * @returns {Object} {res: string, sources: []}
- */
- function chooseSrc(groupedSrc, src){
- var selectedRes = settings['default']; // use array access as default is a reserved keyword
- var selectedLabel = '';
- if (selectedRes === 'high') {
- selectedRes = src[0].res;
- selectedLabel = src[0].label;
- } else if (selectedRes === 'low' || selectedRes == null || !groupedSrc.res[selectedRes]) {
- // Select low-res if default is low or not set
- selectedRes = src[src.length - 1].res;
- selectedLabel = src[src.length -1].label;
- } else if (groupedSrc.res[selectedRes]) {
- selectedLabel = groupedSrc.res[selectedRes][0].label;
- }
- return {res: selectedRes, label: selectedLabel, sources: groupedSrc.res[selectedRes]};
- }
- function initResolutionForYt(player){
- // Init resolution
- player.tech_.ytPlayer.setPlaybackQuality('default');
- // Capture events
- player.tech_.ytPlayer.addEventListener('onPlaybackQualityChange', function(){
- player.trigger('resolutionchange');
- });
- // We must wait for play event
- player.one('play', function(){
- var qualities = player.tech_.ytPlayer.getAvailableQualityLevels();
- // Map youtube qualities names
- var _yts = {
- highres: {res: 1080, label: '1080', yt: 'highres'},
- hd1080: {res: 1080, label: '1080', yt: 'hd1080'},
- hd720: {res: 720, label: '720', yt: 'hd720'},
- large: {res: 480, label: '480', yt: 'large'},
- medium: {res: 360, label: '360', yt: 'medium'},
- small: {res: 240, label: '240', yt: 'small'},
- tiny: {res: 144, label: '144', yt: 'tiny'},
- auto: {res: 0, label: 'auto', yt: 'default'}
- };
- var _sources = [];
- qualities.map(function(q){
- _sources.push({
- src: player.src().src,
- type: player.src().type,
- label: _yts[q].label,
- res: _yts[q].res,
- _yt: _yts[q].yt
- });
- });
- groupedSrc = bucketSources(_sources);
- // Overwrite defualt sourcePicer function
- var _customSourcePicker = function(_player, _sources, _label){
- player.tech_.ytPlayer.setPlaybackQuality(_sources[0]._yt);
- return player;
- };
- var choosen = {label: 'auto', res: 0, sources: groupedSrc.label.auto};
- var menuButton = new ResolutionMenuButton(player, {
- sources: groupedSrc,
- initialySelectedLabel: choosen.label,
- initialySelectedRes: choosen.res,
- customSourcePicker: _customSourcePicker
- }, settings, label);
- menuButton.el().classList.add('vjs-resolution-button');
- player.controlBar.resolutionSwitcher = player.controlBar.addChild(menuButton);
- });
- }
- player.ready(function(){
- if(player.options_.sources.length > 1){
- // tech: Html5 and Flash
- // Create resolution switcher for videos form <source> tag inside <video>
- player.updateSrc(player.options_.sources);
- }
- if(player.techName_ === 'Youtube'){
- // tech: YouTube
- initResolutionForYt(player);
- }
- });
- };
- // register the plugin
- videojs.registerPlugin('videoJsResolutionSwitcher', videoJsResolutionSwitcher);
- })(window, videojs);
- })();
|